mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: flash action bar button red when spell cast fails
Add SpellCastFailedCallback to GameHandler, fired from SMSG_CAST_RESULT when result != 0. GameScreen registers the callback and records each failed spellId in actionFlashEndTimes_ (keyed by spell ID, value = expiry time). During action bar rendering, if a slot's spell has an active flash entry, an AddRectFilled overlay is drawn over the button with alpha proportional to remaining time (1.0→0.0 over 0.5 s), giving the same error-red flash visual feedback as the original WoW client.
This commit is contained in:
parent
c1765b6b39
commit
277a26b351
4 changed files with 41 additions and 0 deletions
|
|
@ -939,6 +939,10 @@ public:
|
|||
using SpellCastAnimCallback = std::function<void(uint64_t guid, bool start, bool isChannel)>;
|
||||
void setSpellCastAnimCallback(SpellCastAnimCallback cb) { spellCastAnimCallback_ = std::move(cb); }
|
||||
|
||||
// Fired when the player's own spell cast fails (spellId of the failed spell).
|
||||
using SpellCastFailedCallback = std::function<void(uint32_t spellId)>;
|
||||
void setSpellCastFailedCallback(SpellCastFailedCallback cb) { spellCastFailedCallback_ = std::move(cb); }
|
||||
|
||||
// Unit animation hint: signal jump (animId=38) for other players/NPCs
|
||||
using UnitAnimHintCallback = std::function<void(uint64_t guid, uint32_t animId)>;
|
||||
void setUnitAnimHintCallback(UnitAnimHintCallback cb) { unitAnimHintCallback_ = std::move(cb); }
|
||||
|
|
@ -3309,6 +3313,7 @@ private:
|
|||
MeleeSwingCallback meleeSwingCallback_;
|
||||
uint64_t lastMeleeSwingMs_ = 0; // system_clock ms at last player auto-attack swing
|
||||
SpellCastAnimCallback spellCastAnimCallback_;
|
||||
SpellCastFailedCallback spellCastFailedCallback_;
|
||||
UnitAnimHintCallback unitAnimHintCallback_;
|
||||
UnitMoveFlagsCallback unitMoveFlagsCallback_;
|
||||
NpcSwingCallback npcSwingCallback_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue