|
From: <xer...@us...> - 2026-07-17 20:05:22
|
Revision: 1670
http://sourceforge.net/p/seq/svn/1670
Author: xerxes00
Date: 2026-07-17 20:05:20 +0000 (Fri, 17 Jul 2026)
Log Message:
-----------
Handle permanent buffs in the spell list
Permanent profile buffs (duration -1) were computed as a small negative
duration, so timeout() expired them one tick after load and dropped them
from the spell list. Track a permanent flag on SpellItem: buffLoad marks
duration -1 as permanent, durationStr shows "Permanent", timeout() skips
them, and the list renders them green instead of expiry-red.
Modified Paths:
--------------
showeq/branches/xerxes-trunk-dev/src/spelllist.cpp
showeq/branches/xerxes-trunk-dev/src/spellshell.cpp
showeq/branches/xerxes-trunk-dev/src/spellshell.h
Modified: showeq/branches/xerxes-trunk-dev/src/spelllist.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spelllist.cpp 2026-07-17 20:00:59 UTC (rev 1669)
+++ showeq/branches/xerxes-trunk-dev/src/spelllist.cpp 2026-07-17 20:05:20 UTC (rev 1670)
@@ -74,7 +74,11 @@
//color change by Worried
//change spell colors according to time remaining
- if (m_item->duration() > 120)
+ // permanent buffs (no timer) are not "about to expire" - show them green
+ // rather than the red the <=12s bucket would otherwise give.
+ if (m_item->permanent())
+ this->setTextColor(QColor(0, 140, 0));
+ else if (m_item->duration() > 120)
this->setTextColor(Qt::black);
else if (m_item->duration() <= 120 and m_item->duration() > 60)
this->setTextColor(QColor(128,54,193));
Modified: showeq/branches/xerxes-trunk-dev/src/spellshell.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spellshell.cpp 2026-07-17 20:00:59 UTC (rev 1669)
+++ showeq/branches/xerxes-trunk-dev/src/spellshell.cpp 2026-07-17 20:05:20 UTC (rev 1670)
@@ -36,6 +36,7 @@
SpellItem::SpellItem()
: m_duration(0),
+ m_permanent(false),
m_spellId(0),
m_casterId(0),
m_targetId(0)
@@ -69,6 +70,8 @@
QString SpellItem::durationStr() const
{
+ if (m_permanent)
+ return "Permanent";
QString text;
int d = m_duration;
if (d < 0)
@@ -269,19 +272,25 @@
#endif // DIAG_SPELLSHELL
const Spell* spell = m_spells->spell(c->spellid);
- int duration = c->duration * 6;
+ // A profile buff with duration -1 is permanent (no timer); it must not
+ // enter the countdown as a small negative duration, which the list would
+ // render red and timeout() would expire after one tick.
+ bool permanent = (c->duration == -1);
+ int duration = permanent ? 0 : c->duration * 6;
SpellItem *item = findSpell(c->spellid, m_player->id(), m_player->name());
- if (item)
+ if (item)
{ // exists
- item->update(c->spellid, spell, duration,
+ item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
+ item->setPermanent(permanent);
emit changeSpell(item);
- }
- else
+ }
+ else
{ // new spell
item = new SpellItem();
- item->update(c->spellid, spell, duration,
+ item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
+ item->setPermanent(permanent);
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
@@ -538,6 +547,14 @@
{
spell = *it;
+ // permanent buffs (profile duration -1, e.g. illusions/forms) do not
+ // count down or expire - only a fade removes them.
+ if (spell->permanent())
+ {
+ it++;
+ continue;
+ }
+
int d = spell->duration() -
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6);
if (d > -6)
Modified: showeq/branches/xerxes-trunk-dev/src/spellshell.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spellshell.h 2026-07-17 20:00:59 UTC (rev 1669)
+++ showeq/branches/xerxes-trunk-dev/src/spellshell.h 2026-07-17 20:05:20 UTC (rev 1670)
@@ -74,7 +74,9 @@
const QString targetName() const;
const QString casterName() const;
void setDuration(int);
-
+ bool permanent() const { return m_permanent; }
+ void setPermanent(bool p) { m_permanent = p; }
+
// set accessors
void setSpellId(uint16_t spellid);
void setTargetId(uint16_t target);
@@ -93,6 +95,7 @@
QString m_casterName;
QString m_targetName;
int m_duration;
+ bool m_permanent;
timeval m_castTime;
uint16_t m_spellId;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|