mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Consolidate all Spell.dbc record offsets into Offsets.h
Extend the single-source-of-truth cleanup to the whole Spell.dbc record layout. 40 local constexpr offset copies across 16 files (spell/, totem/, lossofcontrol/, macro/, aura/) redefined field offsets that belong in Offsets.h: name (0x1E0), icon (0x1D4), effect (0xF4), rank (0x204), effect implicit targets (0x148/0x154), powerType (0x7C), manaCost (0x80), rangeIndex (0x90), castingTimeIndex (0x48), maxLevel (0x6C), spellLevel (0x74), manaCostPercent (0x270). Add the ones Offsets.h lacked as OFF_SPELL_RECORD_* and repoint every local use to the Offsets:: constant, deleting the duplicates. Purely mechanical and behavior-preserving -- every local value already matched the canonical (verified before repointing). SpellIcon.dbc / SpellRange.dbc sub-record offsets (0x04/0x08) stay local; they are different structs.
This commit is contained in:
@@ -62,19 +62,15 @@ int NowMs() {
|
||||
reinterpret_cast<TickMs_t>(Offsets::FUN_OS_TICKCOUNT_MS)());
|
||||
}
|
||||
|
||||
// Spell.dbc field readers (mirrors the small locals in Spell::Cast).
|
||||
constexpr int OFF_NAME = 0x1E0; // localized name[9]
|
||||
constexpr int OFF_ICON_ID = 0x1D4; // -> SpellIcon.dbc
|
||||
|
||||
const char *SpellName(const uint8_t *rec) {
|
||||
const int locale = *reinterpret_cast<int *>(Offsets::VAR_LOCALE_INDEX);
|
||||
const char *n =
|
||||
*reinterpret_cast<const char *const *>(rec + OFF_NAME + locale * 4);
|
||||
*reinterpret_cast<const char *const *>(rec + Offsets::OFF_SPELL_NAMES + locale * 4);
|
||||
return (n != nullptr) ? n : "";
|
||||
}
|
||||
|
||||
const char *SpellIconPath(const uint8_t *rec) {
|
||||
const int iconID = *reinterpret_cast<const int *>(rec + OFF_ICON_ID);
|
||||
const int iconID = *reinterpret_cast<const int *>(rec + Offsets::OFF_SPELL_RECORD_ICON_ID);
|
||||
const uint8_t *iconRec = DBC::Record(Offsets::VAR_SPELL_ICON_RECORDS,
|
||||
Offsets::VAR_SPELL_ICON_COUNT,
|
||||
static_cast<uint32_t>(iconID));
|
||||
|
||||
Reference in New Issue
Block a user