|
From: <xer...@us...> - 2026-07-18 00:12:02
|
Revision: 1672
http://sourceforge.net/p/seq/svn/1672
Author: xerxes00
Date: 2026-07-18 00:12:00 +0000 (Sat, 18 Jul 2026)
Log Message:
-----------
Widen spell ids to 32-bit
EQ spell ids now exceed 65535 (e.g. pet illusions at 69633), so the
uint16_t spell id used throughout the spell subsystem truncated them and
resolved the wrong name (69633 & 0xffff = 4097). Widen the id to uint32_t
across Spell, SpellItem, the buff list, spell()/findSpell()/update()/
spell_name(), and the spell-file parse; the spell array stays a flat table
(max id ~74000, ~580KB). Show an unknown-id name in decimal so it can be
looked up, and fix an off-by-one so the highest-id spell is reachable.
Spell id 32-bit widening contributed by Skik.
Modified Paths:
--------------
showeq/branches/xerxes-trunk-dev/src/everquest.h
showeq/branches/xerxes-trunk-dev/src/spells.cpp
showeq/branches/xerxes-trunk-dev/src/spells.h
showeq/branches/xerxes-trunk-dev/src/spellshell.cpp
showeq/branches/xerxes-trunk-dev/src/spellshell.h
showeq/branches/xerxes-trunk-dev/src/util.cpp
showeq/branches/xerxes-trunk-dev/src/util.h
Modified: showeq/branches/xerxes-trunk-dev/src/everquest.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/everquest.h 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/everquest.h 2026-07-18 00:12:00 UTC (rev 1672)
@@ -2079,7 +2079,7 @@
{
/*0000*/ uint16_t target; // Target ID
/*0002*/ uint16_t source; // SourceID
-/*0004*/ int16_t spell; // SpellID
+/*0004*/ uint16_t spell; // SpellID (unsigned: modern IDs > 32767 sign-extend if int16)
/*0006*/ uint8_t unknown0006[6];
/*0012*/ uint8_t level; // Caster level
/*0013*/ uint8_t unknown0013[43]; // ***Placeholder
@@ -2095,7 +2095,7 @@
{
/*0000*/ uint16_t target; // Target ID
/*0002*/ uint16_t source; // SourceID
-/*0004*/ int16_t spell; // SpellID
+/*0004*/ uint16_t spell; // SpellID (unsigned: modern IDs > 32767 sign-extend if int16)
/*0006*/ uint8_t unknown0006[6];
/*0012*/ uint8_t level; // Caster level
/*0013*/ uint8_t unknown0013[43]; // ***Placeholder
Modified: showeq/branches/xerxes-trunk-dev/src/spells.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spells.cpp 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/spells.cpp 2026-07-18 00:12:00 UTC (rev 1672)
@@ -171,7 +171,7 @@
QStringList spellInfo = spells_enLine.split("^");
// I'll add support for the rest of the fields later
- m_spell = spellInfo[0].toUShort();
+ m_spell = spellInfo[0].toUInt();
m_name = spellInfo[1];
m_buffDurationFormula = spellInfo[11].toUShort(); //spells_us.txt layout changed December 2018
m_buffDurationArgument = spellInfo[12].toUShort(); //spells_us.txt layout changed December 2018
@@ -336,7 +336,7 @@
// if a spell list has been allocated, delete it's elements and then itself
if (m_spells)
{
- for (int i = 0; i <= m_maxSpell; i++)
+ for (uint32_t i = 0; i <= m_maxSpell; i++)
{
if (m_spells[i] != NULL)
{
@@ -350,10 +350,11 @@
}
}
-const Spell* Spells::spell(uint16_t spell) const
+const Spell* Spells::spell(uint32_t spell) const
{
- // make sure the spell is within range
- if (spell >= m_maxSpell)
+ // make sure the spell is within range (array is sized [m_maxSpell + 1], so
+ // the highest id is a valid index)
+ if (spell > m_maxSpell)
return NULL;
// return the appropriate spell
Modified: showeq/branches/xerxes-trunk-dev/src/spells.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spells.h 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/spells.h 2026-07-18 00:12:00 UTC (rev 1672)
@@ -45,7 +45,7 @@
~Spell();
// accessors
- uint16_t spell() const { return m_spell; }
+ uint32_t spell() const { return m_spell; }
const QString& name() const { return m_name; }
uint8_t level(uint8_t class_) const;
uint8_t targetType() const { return m_targetType; }
@@ -57,7 +57,7 @@
private:
QString m_name;
- uint16_t m_spell;
+ uint32_t m_spell;
int16_t m_buffDurationFormula;
int16_t m_buffDurationArgument;
uint8_t m_targetType;
@@ -73,11 +73,11 @@
void loadSpells(const QString& spellsFileName);
void unloadSpells(void);
- const Spell* spell(uint16_t spell) const;
- uint16_t maxSpell() const { return m_maxSpell; }
+ const Spell* spell(uint32_t spell) const;
+ uint32_t maxSpell() const { return m_maxSpell; }
private:
- uint16_t m_maxSpell;
+ uint32_t m_maxSpell;
Spell** m_spells;
};
Modified: showeq/branches/xerxes-trunk-dev/src/spellshell.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spellshell.cpp 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/spellshell.cpp 2026-07-18 00:12:00 UTC (rev 1672)
@@ -87,7 +87,7 @@
return text;
}
-void SpellItem::update(uint16_t spellId, const Spell* spell, int duration,
+void SpellItem::update(uint32_t spellId, const Spell* spell, int duration,
uint16_t casterId, const QString& casterName,
uint16_t targetId, const QString& targetName)
{
@@ -143,7 +143,7 @@
clear();
}
-SpellItem* SpellShell::findSpell(uint16_t spellId,
+SpellItem* SpellShell::findSpell(uint32_t spellId,
uint16_t targetId, const QString& targetName)
{
for(QList<SpellItem*>::Iterator it = m_spellList.begin();
@@ -162,7 +162,7 @@
return NULL;
}
-SpellItem* SpellShell::findSpell(int spell_id)
+SpellItem* SpellShell::findSpell(uint32_t spell_id)
{
for(QList<SpellItem*>::Iterator it = m_spellList.begin();
it != m_spellList.end();
@@ -363,7 +363,7 @@
uint32_t spawnId = *(const uint32_t*)data;
uint8_t count = data[9];
- QList<uint16_t> listed;
+ QList<uint32_t> listed;
// The list is scoped to the spawn id it carries: the player (OP_BuffList),
// the pet (OP_PetBuffList), etc. Resolve the owner - player when the id
@@ -406,7 +406,7 @@
if (pos < len) pos++; // NUL
pos += 4; // u32 slot
- listed.append(uint16_t(spellId));
+ listed.append(spellId);
// A null spell (id not in this spells_us.txt - e.g. a new spell after a
// game patch, or no spell file) is still shown and tracked: update() falls
Modified: showeq/branches/xerxes-trunk-dev/src/spellshell.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spellshell.h 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/spellshell.h 2026-07-18 00:12:00 UTC (rev 1672)
@@ -63,7 +63,7 @@
SpellItem();
// get accessors
- uint16_t spellId() const;
+ uint32_t spellId() const;
uint16_t targetId() const;
uint16_t casterId() const;
time_t castTime() const;
@@ -78,7 +78,7 @@
void setPermanent(bool p) { m_permanent = p; }
// set accessors
- void setSpellId(uint16_t spellid);
+ void setSpellId(uint32_t spellid);
void setTargetId(uint16_t target);
void setCasterId(uint16_t caster);
void setSpellName(const QString& name);
@@ -86,10 +86,10 @@
void setTargetName(const QString& name);
void updateCastTime();
- void update(uint16_t spellId, const Spell* spell, int duration,
+ void update(uint32_t spellId, const Spell* spell, int duration,
uint16_t casterId, const QString& casterName,
uint16_t targetId, const QString& targetName);
-
+
private:
QString m_spellName;
QString m_casterName;
@@ -98,8 +98,8 @@
bool m_permanent;
timeval m_castTime;
- uint16_t m_spellId;
- uint16_t m_casterId;
+ uint32_t m_spellId;
+ uint16_t m_casterId;
uint16_t m_targetId;
struct startCastStruct m_cast; // Needed?
@@ -106,7 +106,7 @@
};
-inline uint16_t SpellItem::spellId() const
+inline uint32_t SpellItem::spellId() const
{
return m_spellId;
}
@@ -151,7 +151,7 @@
return m_casterName;
}
-inline void SpellItem::setSpellId(uint16_t spellid)
+inline void SpellItem::setSpellId(uint32_t spellid)
{
m_spellId = spellid;
}
@@ -213,10 +213,10 @@
protected:
void deleteSpell(SpellItem *);
- SpellItem* findSpell(uint16_t spellId,
+ SpellItem* findSpell(uint32_t spellId,
uint16_t targetId, const QString& targetName);
- SpellItem* findSpell(int spell_id);
- SpellItem* FindSpell(int spell_id, int target_id);
+ SpellItem* findSpell(uint32_t spell_id);
+ SpellItem* FindSpell(uint32_t spell_id, int target_id);
private:
Player* m_player;
Modified: showeq/branches/xerxes-trunk-dev/src/util.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/util.cpp 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/util.cpp 2026-07-18 00:12:00 UTC (rev 1672)
@@ -121,12 +121,12 @@
}
QString
-spell_name (uint16_t spellId)
+spell_name (uint32_t spellId)
{
if (spellId < (sizeof(spellInfo) / sizeof(spellInfoStruct)))
return spellInfo[spellId].name;
else
- return QString::number(spellId, 16);
+ return QString::number(spellId);
}
QString
Modified: showeq/branches/xerxes-trunk-dev/src/util.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/util.h 2026-07-18 00:07:36 UTC (rev 1671)
+++ showeq/branches/xerxes-trunk-dev/src/util.h 2026-07-18 00:12:00 UTC (rev 1672)
@@ -51,7 +51,7 @@
QString Commanate (uint32_t number);
QString classString(uint8_t classVal);
-QString spell_name (uint16_t spellId);
+QString spell_name (uint32_t spellId);
QString language_name (uint8_t langId);
QString skill_name (uint16_t skillId);
QString size_name (uint8_t size);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|