mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add UnitCastingInfo/UnitChannelInfo Lua API and fix SMSG_CAST_FAILED events
Expose cast/channel state to Lua addons via UnitCastingInfo(unit) and UnitChannelInfo(unit), matching the WoW API signature (name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible). Works for player, target, focus, and pet units using existing UnitCastState tracking. Also fix handleCastFailed (SMSG_CAST_FAILED, Classic/TBC path) to fire UNIT_SPELLCAST_FAILED and UNIT_SPELLCAST_STOP events — previously only the WotLK SMSG_CAST_RESULT path fired these, leaving Classic/TBC addons unaware of cast failures. Adds isChannel field to UnitCastState and getCastTimeTotal() accessor.
This commit is contained in:
parent
1482694495
commit
ce4f93dfcb
3 changed files with 91 additions and 0 deletions
|
|
@ -882,6 +882,7 @@ public:
|
|||
uint32_t getCurrentCastSpellId() const { return currentCastSpellId; }
|
||||
float getCastProgress() const { return castTimeTotal > 0 ? (castTimeTotal - castTimeRemaining) / castTimeTotal : 0.0f; }
|
||||
float getCastTimeRemaining() const { return castTimeRemaining; }
|
||||
float getCastTimeTotal() const { return castTimeTotal; }
|
||||
|
||||
// Repeat-craft queue
|
||||
void startCraftQueue(uint32_t spellId, int count);
|
||||
|
|
@ -896,6 +897,7 @@ public:
|
|||
// Unit cast state (tracked per GUID for target frame + boss frames)
|
||||
struct UnitCastState {
|
||||
bool casting = false;
|
||||
bool isChannel = false; ///< true for channels (MSG_CHANNEL_START), false for casts (SMSG_SPELL_START)
|
||||
uint32_t spellId = 0;
|
||||
float timeRemaining = 0.0f;
|
||||
float timeTotal = 0.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue