Commit graph

2594 commits

Author SHA1 Message Date
Kelsi
ac9214c03f feat: fire UNIT_THREAT_LIST_UPDATE event on threat changes
Fire UNIT_THREAT_LIST_UPDATE from SMSG_THREAT_UPDATE,
SMSG_HIGHEST_THREAT_UPDATE, and SMSG_THREAT_CLEAR. Threat data is
already parsed and stored in threatLists_ — this event notifies
addon systems when the data changes.

Used by Omen, ThreatPlates, and other threat meter addons to refresh
their displays when threat values update.
2026-03-21 09:08:02 -07:00
Kelsi
f580fd7e6b feat: add UnitDetailedThreatSituation for detailed threat queries
Implement UnitDetailedThreatSituation(unit, mobUnit) returning:
- isTanking (boolean)
- status (0-3, same as UnitThreatSituation)
- threatPct (100 if tanking, 0 otherwise)
- rawThreatPct (same)
- threatValue (0 — no server threat data available)

Used by Omen and other threat meter addons that query detailed threat
info per mob-target pair.
2026-03-21 09:02:47 -07:00
Kelsi
dcd78f4f28 feat: add UnitThreatSituation for threat meter and tank addons
Implement UnitThreatSituation(unit, mobUnit) returning 0-3 threat level:
- 0: not on threat table
- 1: in combat but not tanking (mob targeting someone else)
- 3: securely tanking (mob is targeting this unit)

Approximated from mob's UNIT_FIELD_TARGET to determine who the mob is
attacking. Used by threat meter addons (Omen, ThreatPlates) and tank
UI addons to display threat state.
2026-03-21 08:57:38 -07:00
Kelsi
4af9838ab4 feat: add UnitIsTapped, UnitIsTappedByPlayer, UnitIsTappedByAllThreatList
Add three tapped-state query functions for addons:
- UnitIsTapped(unit): true if any player has tagged the mob
- UnitIsTappedByPlayer(unit): true if local player can loot (tapped+lootable)
- UnitIsTappedByAllThreatList(unit): true if shared-tag mob

Used by nameplate addons (Plater, TidyPlates) and unit frame addons
to determine and display tap ownership state.
2026-03-21 08:48:58 -07:00
Kelsi
aebc905261 feat: show grey focus frame name for tapped mobs
Extend tapped-by-other detection to the focus frame, matching the
target frame and nameplate treatment. All three UI elements (nameplate,
target frame, focus frame) now consistently show grey for tapped mobs.
2026-03-21 08:42:56 -07:00
Kelsi
57ccee2c28 feat: show grey target frame name for tapped mobs
Extend the tapped-by-other-player check to the target frame. Mobs
tagged by another player now show a grey name color on the target
frame, matching the grey nameplate treatment and WoW's behavior.

Players can now see at a glance on both nameplates AND target frame
whether a mob is tagged.
2026-03-21 08:37:39 -07:00
Kelsi
586e9e74ff feat: show grey nameplates for mobs tapped by other players
Check UNIT_DYNFLAG_TAPPED_BY_PLAYER (0x0004) on hostile NPC nameplates.
Mobs tagged by another player now show grey health bars instead of red,
matching WoW's visual indication that the mob won't yield loot/XP.

Mobs with TAPPED_BY_ALL_THREAT_LIST (0x0008) still show red since
those are shared-tag mobs that give loot to everyone.
2026-03-21 08:33:54 -07:00
Kelsi
82990f5891 feat: fire UNIT_FLAGS event when unit flags change
Fire UNIT_FLAGS for player/target/focus when UNIT_FIELD_FLAGS updates.
Covers PvP flag, combat state, silenced, disarmed, and other flag
changes. Used by nameplate addons for PvP indicators and by unit frame
addons tracking CC/silence state.
2026-03-21 08:22:52 -07:00
Kelsi
e7be60c624 feat: fire UNIT_FACTION event when unit faction template changes
Fire UNIT_FACTION for player/target/focus when UNIT_FIELD_FACTIONTEMPLATE
updates. Covers PvP flag toggling, mind control faction swaps, and any
server-side faction changes. Used by nameplate addons to update hostility
coloring and by PvP addons tracking faction state.
2026-03-21 08:17:38 -07:00
Kelsi
2c6a345e32 feat: fire UNIT_MODEL_CHANGED event when unit display model changes
Fire UNIT_MODEL_CHANGED for player/target/focus/pet when their
UNIT_FIELD_DISPLAYID update field changes. This covers polymorph,
mount display changes, shapeshifting, and model swaps.

Used by unit frame addons that display 3D portraits and by nameplate
addons that track model state changes.
2026-03-21 08:13:47 -07:00
Kelsi
a4d54e83bc feat: fire MIRROR_TIMER_PAUSE event when breath/fatigue timer pauses
Fire MIRROR_TIMER_PAUSE from SMSG_PAUSE_MIRROR_TIMER with paused state
(1=paused, 0=resumed). Completes the mirror timer event trio alongside
MIRROR_TIMER_START and MIRROR_TIMER_STOP.
2026-03-21 08:07:39 -07:00
Kelsi
a73c680190 feat: add common WoW global constants for addon compatibility
Add frequently referenced WoW global constants that many addons check:
- MAX_TALENT_TABS, MAX_NUM_TALENTS
- BOOKTYPE_SPELL, BOOKTYPE_PET
- MAX_PARTY_MEMBERS, MAX_RAID_MEMBERS, MAX_ARENA_TEAMS
- INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED
- NUM_BAG_SLOTS, NUM_BANKBAGSLOTS, CONTAINER_BAG_OFFSET
- MAX_SKILLLINE_TABS, TRADE_ENCHANT_SLOT

Prevents nil-reference errors when addons use these standard constants.
2026-03-21 07:58:38 -07:00
Kelsi
2da0883544 feat: fire BARBER_SHOP_OPEN and BARBER_SHOP_CLOSE events
Fire BARBER_SHOP_OPEN when the barber shop UI is enabled
(SMSG_ENABLE_BARBER_SHOP). Fire BARBER_SHOP_CLOSE when the barber
shop completes or is dismissed. Used by UI customization addons.
2026-03-21 07:54:30 -07:00
Kelsi
5ee2b55f4b feat: fire MIRROR_TIMER_START and MIRROR_TIMER_STOP events
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Fire MIRROR_TIMER_START with type, value, maxValue, scale, and paused
args when breath/fatigue/fire timers begin. Fire MIRROR_TIMER_STOP with
type when they end. Timer types: 0=fatigue, 1=breath, 2=fire.

Used by timer bar addons to display breath/fatigue countdown overlays.
2026-03-21 07:48:06 -07:00
Kelsi
774f9bf214 feat: fire BAG_UPDATE and UNIT_INVENTORY_CHANGED on item received
Fire BAG_UPDATE and UNIT_INVENTORY_CHANGED from SMSG_ITEM_PUSH_RESULT
when any item is received (loot, quest reward, trade, mail). Bag addons
(Bagnon, AdiBags) immediately show new items, and equipment tracking
addons detect inventory changes.
2026-03-21 07:33:22 -07:00
Kelsi
c6a6849c86 feat: fire PET_BAR_UPDATE event when pet action bar changes
Fire PET_BAR_UPDATE when:
- Pet is summoned (SMSG_PET_SPELLS with new spell list)
- Pet learns a new spell (SMSG_PET_LEARNED_SPELL)

Used by pet action bar addons to refresh their display when the pet's
available abilities change.
2026-03-21 07:30:01 -07:00
Kelsi
6ab1a189c7 feat: fire GUILD_INVITE_REQUEST event with inviter and guild names
Fire GUILD_INVITE_REQUEST when another player invites the local player
to a guild. Includes inviterName and guildName as arguments. Used by
auto-accept guild addons and invitation notification addons.
2026-03-21 07:23:15 -07:00
Kelsi
d24d12fb8f feat: fire PARTY_INVITE_REQUEST event with inviter name
Fire PARTY_INVITE_REQUEST when another player invites the local player
to a group. Used by auto-accept group addons and invite notification
addons. Includes the inviter's name as the first argument.
2026-03-21 07:17:20 -07:00
Kelsi
70a50e45f5 feat: fire CONFIRM_TALENT_WIPE event with respec cost
Fire CONFIRM_TALENT_WIPE with the gold cost when the trainer offers
to reset talents (MSG_TALENT_WIPE_CONFIRM). Used by talent management
addons to show the respec cost dialog.
2026-03-21 07:12:38 -07:00
Kelsi
df79e08788 fix: fire GROUP_ROSTER_UPDATE when group is destroyed
SMSG_GROUP_DESTROYED clears all party state but wasn't firing addon
events. Raid frame addons (Grid, VuhDo, Healbot) now properly hide
when the group disbands. Also fires PARTY_MEMBERS_CHANGED for compat.
2026-03-21 07:07:32 -07:00
Kelsi
12fb8f73f7 feat: fire BAG_UPDATE and PLAYER_MONEY events after selling items
SMSG_SELL_ITEM success now fires BAG_UPDATE so bag addons refresh
their display, and PLAYER_MONEY so gold tracking addons see the
sell price income immediately.
2026-03-21 06:52:41 -07:00
Kelsi
b407d5d632 feat: fire RESURRECT_REQUEST event when another player offers resurrection
Fire RESURRECT_REQUEST with the caster's name from SMSG_RESURRECT_REQUEST
when a player/NPC offers to resurrect the dead player. Used by auto-accept
resurrection addons and death tracking addons.
2026-03-21 06:47:32 -07:00
Kelsi
5d93108a88 feat: fire CONFIRM_SUMMON event on warlock/meeting stone summons
Fire CONFIRM_SUMMON from SMSG_SUMMON_REQUEST when another player
summons via warlock portal or meeting stone. Used by auto-accept
summon addons and summon notification addons.
2026-03-21 06:42:59 -07:00
Kelsi
de903e363c feat: fire PLAYER_STARTED_MOVING and PLAYER_STOPPED_MOVING events
Track horizontal movement flag transitions (forward/backward/strafe)
and fire events when the player starts or stops moving. Used by
Healbot, cast-while-moving addons, and nameplate addons that track
player movement state for positioning optimization.
2026-03-21 06:38:48 -07:00
Kelsi
d36172fc90 fix: fire PLAYER_MONEY event from SMSG_LOOT_MONEY_NOTIFY
The loot money handler directly updates playerMoneyCopper_ but wasn't
firing PLAYER_MONEY. The update object path fires it when the coinage
field changes, but there can be a delay. Now gold-tracking addons
(Accountant, GoldTracker) immediately see looted money.
2026-03-21 06:32:41 -07:00
Kelsi
b3ad64099b feat: fire UNIT_PET event when pet is summoned, dismissed, or dies
Fire UNIT_PET with "player" as arg from SMSG_PET_SPELLS when:
- Pet is cleared (dismissed/dies) — both size-based and guid=0 paths
- Pet is summoned (new pet GUID received with spell list)

Used by pet frame addons and unit frame addons to show/hide pet
frames and update pet action bars when pet state changes.
2026-03-21 06:27:55 -07:00
Kelsi
5ab6286f7e fix: include pet unit ID in UNIT_HEALTH/POWER events from dedicated packets
SMSG_HEALTH_UPDATE and SMSG_POWER_UPDATE were not checking for the pet
GUID when dispatching addon events. Pet health/power bar addons now
properly receive UNIT_HEALTH and UNIT_POWER with unitId="pet".

The UPDATE_OBJECT and UNIT_AURA paths already had the pet check.
2026-03-21 06:23:03 -07:00
Kelsi
b04e36aaa4 fix: include pet unit ID in all spellcast addon events
Add pet GUID check to all spellcast event dispatchers:
- UNIT_SPELLCAST_START
- UNIT_SPELLCAST_SUCCEEDED
- UNIT_SPELLCAST_CHANNEL_START
- UNIT_SPELLCAST_CHANNEL_STOP
- UNIT_SPELLCAST_INTERRUPTED + STOP

Previously these events only fired for player/target/focus, meaning
pet cast bars and pet spell tracking addons wouldn't work. Now pet
spellcasts properly fire with unitId="pet".
2026-03-21 06:19:14 -07:00
Kelsi
6687c617d9 fix: display Lua errors from OnUpdate, executeFile, executeString as UI errors
Extend the Lua error UI display to cover all error paths:
- OnUpdate frame callbacks (previously only logged)
- executeFile loading errors (now also shown as UI error)
- executeString /run errors (now also shown as UI error)

This ensures addon developers see ALL Lua errors in-game, not just
event handler errors from the previous commit.
2026-03-21 06:08:17 -07:00
Kelsi
900626f5fe feat: fire UPDATE_BATTLEFIELD_STATUS event on BG queue/join/leave
Fire UPDATE_BATTLEFIELD_STATUS with the status code when battlefield
status changes (queued, ready to join, in progress, waiting to leave).
Used by BG queue addons and PvP addons to track battleground state.
2026-03-21 06:02:28 -07:00
Kelsi
19b8d31da2 feat: display Lua addon errors as in-game UI errors
Previously Lua addon errors only logged to the log file. Now they
display as red UI error text to the player (same as spell errors and
game warnings), helping addon developers debug issues in real-time.

Add LuaErrorCallback to LuaEngine, fire it from event handler and
frame OnEvent pcall error paths. Wire the callback to GameHandler's
addUIError in application.cpp.
2026-03-21 06:00:06 -07:00
Kelsi
64c0c75bbf feat: fire CHAT_MSG_COMBAT_HONOR_GAIN event on PvP honor kills
Fire CHAT_MSG_COMBAT_HONOR_GAIN from SMSG_PVP_CREDIT with the honor
message text. Used by PvP addons (HonorSpy, HonorTracker) to track
honor gains and kill counts.
2026-03-21 05:47:22 -07:00
Kelsi
d20357415b feat: fire PLAYER_CONTROL_LOST/GAINED on movement control changes
Fire PLAYER_CONTROL_LOST when SMSG_CLIENT_CONTROL_UPDATE revokes player
movement (stun, fear, mind control, etc.) and PLAYER_CONTROL_GAINED when
movement is restored.

Used by loss-of-control addons and action bar addons to show stun/CC
indicators and disable ability buttons during crowd control.
2026-03-21 05:42:57 -07:00
Kelsi
2e6400f22e feat: fire MAIL_INBOX_UPDATE and UPDATE_PENDING_MAIL events
Fire MAIL_INBOX_UPDATE when the mail list is received/refreshed
(SMSG_MAIL_LIST_RESULT), so mail addons can update their display.

Fire UPDATE_PENDING_MAIL when new mail arrives (SMSG_RECEIVED_MAIL),
enabling minimap mail icon addons and notification addons to react.
2026-03-21 05:38:35 -07:00
Kelsi
2560bd1307 feat: fire QUEST_WATCH_UPDATE on kill and item objective progress
Fire QUEST_WATCH_UPDATE (with quest ID for kills) and QUEST_LOG_UPDATE
when quest objectives progress:
- Kill objectives: when SMSG_QUESTUPDATE_ADD_KILL updates a kill count
- Item objectives: when SMSG_QUESTUPDATE_ADD_ITEM updates an item count

Used by quest tracker addons (Questie, QuestHelper) and the built-in
quest tracker to refresh objective display when progress changes.
2026-03-21 05:33:29 -07:00
Kelsi
b5f7659db5 feat: fire MERCHANT_UPDATE and BAG_UPDATE events after purchase
Fire MERCHANT_UPDATE after a successful SMSG_BUY_ITEM so vendor addons
refresh their stock display. Also fire BAG_UPDATE so bag addons show
the newly purchased item immediately.
2026-03-21 05:27:34 -07:00
Kelsi
a02e021730 fix: fire UNIT_SPELLCAST_FAILED/STOP for other units on SPELL_FAILED_OTHER
SMSG_SPELL_FAILED_OTHER was clearing the unit cast state but not firing
addon events. Cast bar addons (Quartz, ClassicCastbars) showing target/
focus cast bars need UNIT_SPELLCAST_FAILED and UNIT_SPELLCAST_STOP to
clear the bar when another unit's cast fails.

Now fires both events for target and focus units, matching the behavior
already implemented for the player's own cast failures.
2026-03-21 05:22:17 -07:00
Kelsi
7f0d9fe432 feat: fire PLAYER_GUILD_UPDATE event on guild join/disband
Fire PLAYER_GUILD_UPDATE when the player's guild membership changes:
- When guild name is first resolved (player joins guild/logs in)
- When guild is disbanded

Used by guild frame addons and guild info display to update when
guild status changes.
2026-03-21 05:17:40 -07:00
Kelsi
82d3abe5da feat: add GetAddOnMetadata for reading TOC directives from Lua
Implement GetAddOnMetadata(addonNameOrIndex, key) which reads arbitrary
TOC file directives. All directives are now stored in the addon info
registry table under a "metadata" sub-table.

This enables addons to read their own version, author, X-* custom
fields, and other TOC metadata at runtime. Used by addon managers,
version checkers, and self-updating addons.
2026-03-21 05:13:28 -07:00
Kelsi
d4c1eda22b feat: fire PARTY_LEADER_CHANGED event on leader changes
Fire PARTY_LEADER_CHANGED (with GROUP_ROSTER_UPDATE) from both:
- SMSG_GROUP_SET_LEADER: when a new leader is named by string
- SMSG_REAL_GROUP_UPDATE: when leader GUID changes via group update

Used by raid frame addons to update leader crown icons and by
group management addons to track leadership changes.
2026-03-21 05:03:03 -07:00
Kelsi
494175e2a7 feat: add remaining CHAT_MSG_* event mappings
Map 5 previously unmapped chat types to addon events:
- CHAT_MSG_MONSTER_PARTY (NPC party chat in dungeons/scripted events)
- CHAT_MSG_AFK (player AFK auto-reply messages)
- CHAT_MSG_DND (player DND auto-reply messages)
- CHAT_MSG_LOOT (loot roll/distribution messages)
- CHAT_MSG_SKILL (skill-up messages)

All WoW chat types in the ChatType enum are now mapped to addon events.
2026-03-21 04:57:19 -07:00
Kelsi
f99f4a732a feat: fire INSPECT_READY event from both WotLK and Classic inspect paths
Fire INSPECT_READY with the inspected player's GUID when inspection
results are received. Fires from both:
- WotLK SMSG_TALENTS_INFO type=1 (talent + gear inspect)
- Classic SMSG_INSPECT (gear-only inspect)

Used by GearScore, TacoTip, and other inspection addons that need
to know when inspect data is available for a specific player.
2026-03-21 04:53:08 -07:00
Kelsi
74d7e969ab feat: add action bar constants and functions for Bartender/Dominos compat
Add essential WoW action bar globals and functions that action bar
addons (Bartender4, Dominos, CT_BarMod) require on initialization:

Constants: NUM_ACTIONBAR_BUTTONS, NUM_ACTIONBAR_PAGES, NUM_PET_ACTION_SLOTS
Functions: GetActionBarPage, ChangeActionBarPage, GetBonusBarOffset,
  GetActionText, GetActionCount
Binding: GetBindingKey, GetBindingAction, SetBinding, SaveBindings
Macro: GetNumMacros, GetMacroInfo, GetMacroBody, GetMacroIndexByName
Stance: GetNumShapeshiftForms, GetShapeshiftFormInfo
Pet: GetPetActionInfo, GetPetActionsUsable

These prevent nil-reference errors during addon initialization and
enable basic action bar addon functionality.
2026-03-21 04:48:06 -07:00
Kelsi
1f3e362512 feat: add RAID_TARGET_UPDATE event and GetRaidTargetIndex/SetRaidTarget
Fire RAID_TARGET_UPDATE event when raid markers (skull, cross, etc.)
are set or cleared on targets. Add two Lua API functions:
- GetRaidTargetIndex(unit) returns marker index 1-8 (or nil)
- SetRaidTarget(unit, index) sets marker 1-8 (or 0 to clear)

Enables raid marking addons and nameplate addons that display raid
icons to react to marker changes in real-time.
2026-03-21 04:43:42 -07:00
Kelsi
8e51754615 feat: fire READY_CHECK, READY_CHECK_CONFIRM, READY_CHECK_FINISHED events
Fire addon events for the raid ready check system:
- READY_CHECK fires when a ready check is initiated, with initiator name
- READY_CHECK_CONFIRM fires for each player's response, with GUID and
  ready state (1=ready, 0=not ready)
- READY_CHECK_FINISHED fires when the ready check period ends

These events are used by raid frame addons (Grid, VuhDo, Healbot) to
show ready check status on unit frames, and by raid management addons
to track responsiveness.
2026-03-21 04:38:35 -07:00
Kelsi
70a5d3240c feat: add ACHIEVEMENT_EARNED event and 15 missing CHAT_MSG_* events
Fire ACHIEVEMENT_EARNED event when a player earns an achievement,
enabling achievement tracking addons.

Add 15 previously unmapped chat type → addon event mappings:
- CHAT_MSG_ACHIEVEMENT, CHAT_MSG_GUILD_ACHIEVEMENT
- CHAT_MSG_WHISPER_INFORM (echo of sent whispers)
- CHAT_MSG_RAID_LEADER, CHAT_MSG_BATTLEGROUND_LEADER
- CHAT_MSG_MONSTER_SAY/YELL/EMOTE/WHISPER
- CHAT_MSG_RAID_BOSS_EMOTE/WHISPER
- CHAT_MSG_BG_SYSTEM_NEUTRAL/ALLIANCE/HORDE

These events are needed by boss mod addons (DBM, BigWigs) to detect
boss emotes, by achievement trackers, and by chat filter addons that
process all message types.
2026-03-21 04:28:15 -07:00
Kelsi
6a0e86efe8 fix: IsUsableAction now checks spell power cost from DBC
IsUsableAction previously always returned notEnoughMana=false. Now it
checks the spell's mana cost from SpellDataResolver against the player's
current power, matching the same fix applied to IsUsableSpell.

This fixes action bar addons (Bartender, Dominos) incorrectly showing
abilities as usable when the player lacks mana/rage/energy.
2026-03-21 04:23:07 -07:00
Kelsi
91794f421e feat: add spell power cost to SpellDataResolver; fix IsUsableSpell mana check
Extend SpellDataInfo with manaCost and powerType fields, extracted from
Spell.dbc ManaCost and PowerType columns. This enables IsUsableSpell()
to properly check if the player has enough mana/rage/energy to cast.

Previously IsUsableSpell always returned notEnoughMana=false since cost
data wasn't available. Now it compares the spell's DBC mana cost against
the player's current power, returning accurate usability and mana state.

This fixes action bar addons showing abilities as usable when the player
lacks sufficient power, and enables OmniCC-style cooldown text to
properly dim insufficient-power abilities.
2026-03-21 04:20:58 -07:00
Kelsi
c7e16646fc feat: resolve spell cast time and range from DBC for GetSpellInfo
Add SpellDataResolver that lazily loads Spell.dbc, SpellCastTimes.dbc,
and SpellRange.dbc to provide cast time and range data. GetSpellInfo()
now returns real castTime (ms), minRange, and maxRange instead of
hardcoded 0 values.

This enables spell tooltip addons, cast bar addons (Quartz), and range
check addons to display accurate spell information. The DBC chain is:
  Spell.dbc[CastingTimeIndex] → SpellCastTimes.dbc[Base ms]
  Spell.dbc[RangeIndex] → SpellRange.dbc[MinRange, MaxRange]

Follows the same lazy-loading pattern as SpellIconPathResolver and
ItemIconPathResolver.
2026-03-21 04:16:12 -07:00
Kelsi
cfb9e09e1d feat: cache player class/race from name queries for UnitClass/UnitRace
Add playerClassRaceCache_ that stores classId and raceId from
SMSG_NAME_QUERY_RESPONSE. This enables UnitClass and UnitRace to return
correct data for players who were previously seen but are now out of
UPDATE_OBJECT range.

Fallback chain for UnitClass/UnitRace is now:
1. Entity update fields (UNIT_FIELD_BYTES_0) — for nearby entities
2. Name query cache — for previously queried players
3. getPlayerClass/Race() — for the local player

This improves class-colored names in chat, unit frames, and nameplates
for players who move out of view range.
2026-03-21 04:11:48 -07:00