Skip to content

Commit fe29ec0

Browse files
committed
loc: fire LOSS_OF_CONTROL_UPDATE with unit payload ("player")
1 parent 7fafb89 commit fe29ec0

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ when launching with `-console`), not as Lua functions. See the
122122
| `ITEM_DATA_LOAD_RESULT` | `itemID, success` |
123123
| `LOOT_SCAN_COMPLETED` | *(none)* |
124124
| `LOSS_OF_CONTROL_ADDED` | `eventIndex` |
125-
| `LOSS_OF_CONTROL_UPDATE` | *(none)* |
125+
| `LOSS_OF_CONTROL_UPDATE` | `unitToken` (always `"player"`) |
126126
| `MODIFIER_STATE_CHANGED` | `keyName, down` |
127127
| `NAME_PLATE_CREATED` | `nameplateFrame` |
128128
| `NAME_PLATE_UNIT_ADDED` | `unitToken` ("nameplateN") |

docs/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@ Register like any engine event
23212321
| Event | Args | When |
23222322
|---|---|---|
23232323
| `LOSS_OF_CONTROL_ADDED` | `eventIndex` (number) | A new effect was applied — `eventIndex` is its 1-based index for [`C_LossOfControl.GetActiveLossOfControlData`](#c_lossofcontrolgetactivelossofcontroldataindex). |
2324-
| `LOSS_OF_CONTROL_UPDATE` | *(none)* | The active set changed — an effect was added, fell off, or expired. Re-scan with `GetActiveLossOfControlData`. |
2324+
| `LOSS_OF_CONTROL_UPDATE` | `unitToken` (string) | The active set changed — an effect was added, fell off, or expired. Re-scan with `GetActiveLossOfControlData`. Always `"player"` (vanilla only tracks the local player), but passed so the event shape matches modern WoW and leaves room for per-unit tracking. |
23252325

23262326
Detection is a per-frame diff of the active set (effect *expiry* has no engine
23272327
packet to hook), so events land within a frame of the change and coalesce

src/lossofcontrol/Info.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,13 @@ void OnWorldTick() {
288288
if (!ContainsKey(cur, n, g_prev[i]))
289289
changed = true; // an effect ended (fell off / lockout expired)
290290
}
291-
// Any add or removal fires one coalesced "re-scan" signal.
291+
// Any add or removal fires one coalesced "re-scan" signal. The payload is
292+
// the affected unit — always "player" here (vanilla only exposes the local
293+
// player's control-loss state), but passing it keeps the event shape
294+
// forward-compatible with per-unit tracking and matches modern WoW, whose
295+
// LOSS_OF_CONTROL_UPDATE carries the unit token.
292296
if (changed)
293-
Event::Custom::Fire(Event::Custom::Lookup(kEventUpdate), "");
297+
Event::Custom::Fire(Event::Custom::Lookup(kEventUpdate), "%s", "player");
294298

295299
for (int i = 0; i < n; ++i)
296300
g_prev[i] = cur[i];

0 commit comments

Comments
 (0)