mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Vanilla 1.12 tracks nothing about totems client-side (the totem bar, PLAYER_TOTEM_UPDATE, and GetTotemInfo are all TBC additions), so Totem::Tracker tracks the four element slots itself — data-driven: - Slot from the summon spell's Spell.dbc effect (87-90 = SUMMON_TOTEM_SLOT1..4 = Fire/Earth/Water/Air; slot = effect - 86). - Creature entry from the effect's EffectMiscValue (for death detection). - Duration from SpellDuration.dbc via the engine duration helper. - haveTotem tool item from the spell's Totem[0] field (0xA0) — the totem the spell requires (a tool, not a consumed reagent) — resolved from the player's spellbook on SPELLS_CHANGED, not hardcoded. Casts are observed through Aura::Source's existing SMSG_SPELL_GO hook (a one-line notify before its aura gate, since a summon applies no aura) — no new hook, respects one-hook-per-target. Tool items resolve on SPELLS_CHANGED (a no-arg event via the shared Event::SignalHook), when the spellbook is populated. A slot clears when its duration elapses OR when the totem creature disappears early (killed / Totemic Recall / destroyed), detected by a throttled WorldTick object-manager scan for the player-owned creature of that entry (seen-then-gone latch; CreatedBy == player so another shaman's same-entry totem can't mask yours). GetTotemInfo returns haveTotem, totemName, startTime, duration, icon, modRate=1, spellID. Turtle-custom totems are tracked automatically. Also exposes Item::Count::InInventory (equipped + bags) as a shared helper for the tool-presence check. Verified in-game: Earthbind lands in slot 2, haveTotem reflects the Earth Totem tool, and Totemic Recall clears the slot early.