mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-26 17:36:04 +00:00
ab98bb7ab5
The central handler registered UNIT_AURA, UNIT_FLAGS and the four UNIT_SPELLCAST_* globally, so every unit event in the world woke it for a "^nameplate" prefix test, and each of the four branches that survived the test then resolved the plate back out of arg1 -- UnitGUID + plateByGuid, or GetNamePlateForUnit. Register them per plate instead, on the plate's own frame against its own token. The token is the subscription, so the event only reaches the plate it concerns and `this` is already that plate: the aura branch is now one assignment where it used to be a prefix test, an API call and a table lookup. This is also what makes the approach viable at all. A central listener would have had to name every token it might care about, and nameplate slots have no cap -- Events.cpp keeps them in a vector that grows by push_back, with only a "<80 even in AV-scale scenes" comment for sizing. Any nameplate1..N list would have been a guess that fails silently in exactly the crowded scenes where plates matter. Lifecycle: NAME_PLATE_UNIT_ADDED points the registrations at the new token, replacing the previous unit rather than stacking, since RegisterUnitEvent over an already-filtered registration swaps the units. NAME_PLATE_UNIT_REMOVED unregisters, which is required -- freed slots are reused, and a stale token would feed the frame another unit's events. PLAYER_LOGOUT now tears down the plates too. It silenced only the central frame before; leaving forty plate frames dispatching through logout is the crash 132 that branch exists to prevent.