diff --git a/README.md b/README.md index 523f7c0a..bf1793f9 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ when launching with `-console`), not as Lua functions. See the | `ITEM_DATA_LOAD_RESULT` | `itemID, success` | | `LOOT_SCAN_COMPLETED` | *(none)* | | `LOSS_OF_CONTROL_ADDED` | `eventIndex` | -| `LOSS_OF_CONTROL_UPDATE` | *(none)* | +| `LOSS_OF_CONTROL_UPDATE` | `unitToken` (always `"player"`) | | `MODIFIER_STATE_CHANGED` | `keyName, down` | | `NAME_PLATE_CREATED` | `nameplateFrame` | | `NAME_PLATE_UNIT_ADDED` | `unitToken` ("nameplateN") | diff --git a/docs/API.md b/docs/API.md index d9fe8867..bbb39d5c 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2321,7 +2321,7 @@ Register like any engine event | Event | Args | When | |---|---|---| | `LOSS_OF_CONTROL_ADDED` | `eventIndex` (number) | A new effect was applied — `eventIndex` is its 1-based index for [`C_LossOfControl.GetActiveLossOfControlData`](#c_lossofcontrolgetactivelossofcontroldataindex). | -| `LOSS_OF_CONTROL_UPDATE` | *(none)* | The active set changed — an effect was added, fell off, or expired. Re-scan with `GetActiveLossOfControlData`. | +| `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. | Detection is a per-frame diff of the active set (effect *expiry* has no engine packet to hook), so events land within a frame of the change and coalesce diff --git a/src/lossofcontrol/Info.cpp b/src/lossofcontrol/Info.cpp index db665169..921eb886 100644 --- a/src/lossofcontrol/Info.cpp +++ b/src/lossofcontrol/Info.cpp @@ -288,9 +288,13 @@ void OnWorldTick() { if (!ContainsKey(cur, n, g_prev[i])) changed = true; // an effect ended (fell off / lockout expired) } - // Any add or removal fires one coalesced "re-scan" signal. + // Any add or removal fires one coalesced "re-scan" signal. The payload is + // the affected unit — always "player" here (vanilla only exposes the local + // player's control-loss state), but passing it keeps the event shape + // forward-compatible with per-unit tracking and matches modern WoW, whose + // LOSS_OF_CONTROL_UPDATE carries the unit token. if (changed) - Event::Custom::Fire(Event::Custom::Lookup(kEventUpdate), ""); + Event::Custom::Fire(Event::Custom::Lookup(kEventUpdate), "%s", "player"); for (int i = 0; i < n; ++i) g_prev[i] = cur[i];