mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
1.12.1 calls type-wide field observers for every unit whose watched bytes change: ClntObjMgrSetTypeMirrorHandler (0x00468070) puts a record on the global list of a (bank, field), and CGUnit_C::RegisterFieldWatchers (0x006041F0) uses it for the engine's own unit handlers, among them OnPowerFieldChanged on the power block, which only refreshes usability. Two handlers join those lists, one record per POWER1..5 and MAXPOWER1..5 slot, so the callback's field offset is the power type. They fire UNIT_POWER_UPDATE and UNIT_POWER_FREQUENT, or UNIT_MAXPOWER, with (unitTarget, powerType) once per token of the unit. Every client power change is a server update, so FREQUENT fires with UPDATE. Each in-world registration pass removes and re-adds the records through 0x00468240: the first pass of a session runs in CGGameUI::InitializeGame, after MirrorInitialize (0x0047F840) has rebuilt the tables a record's copy offset comes from, and the removal keeps /reload from stacking a second record. The list array has no other writer, so nothing frees a record behind us. A group member the client cannot see has no unit to watch; its power comes in the party member stats packet. ReadPartyMemberStats (0x005E5110) and ComparePartyRecord (0x005F0B80) end in SignalPartyRecordChanges (0x005E5720), which fires the per-type power events for the changed record bits. Both E8 calls now reach a function that calls it and then fires the generic events for the same bits, the member's and its pet's.