mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
"totem1" .. "totem4" now name the player's totem creature in each
totem slot (1 Fire, 2 Earth, 3 Water, 4 Air), so UnitGUID("totem1")
gives the slot's GUID and every other Unit* function works on it too.
GetTotemInfo keeps the 7 returns that retail has.
The token is a new branch in the existing hook on the token-to-GUID
resolver FUN_TOKEN_TO_GUID (0x515970), next to markN. All the Script_Unit*
globals, TargetUnit, IsUnitToken and the [@unit] macro conditions read
tokens through that one function, so they all accept it. The GUID comes
from Totem::Tracker, which finds the creature by its entry and
CreatedBy == player. The token is empty until the tracker finds that
creature.
Unit events reach the token the same way they reach markN: totemN is
appended to Unit::TokenEvents' token list, and the tracker calls
TokenEvents::Refresh when a slot gets its creature, when the creature
goes away, and when a recast replaces it. Refresh reruns the engine's
recompute FUN_UNIT_SCRIPT_RECOMPUTE, which sets or clears the
registration bit that makes the engine watch the unit's fields.