diff --git a/HealBot_Controller_Aura.lua b/HealBot_Controller_Aura.lua index b499ede..5d57dfa 100644 --- a/HealBot_Controller_Aura.lua +++ b/HealBot_Controller_Aura.lua @@ -186,7 +186,7 @@ function HealBot_OnEvent_UnitAura(this, unit) local trackedTextures = {} while true do - local debuff, tmp, debuff_type = UnitDebuff(unit, i, 1) + local debuff, tmp, debuff_type = UnitDebuff(unit, i) if debuff then local mapped_type = nil if debuff_type then diff --git a/HealBot_Controller_Events.lua b/HealBot_Controller_Events.lua index 56a6853..390b25f 100644 --- a/HealBot_Controller_Events.lua +++ b/HealBot_Controller_Events.lua @@ -102,7 +102,7 @@ function HealBot_OnUpdate(this, arg1) baseSpell = string.gsub(baseSpell, "%s+$", "") -- Force MVC updates since we guarantee the cast will eventually pierce the server - HealBot_CastFailed = false + HealBot_CastFailed = true -- Trigger first attempt immediately HealBot_CastingSpell = baseSpell HealBot_CastingTarget = pendingCast.target HealBot_Process_HealValue(baseSpell, pendingCast.target) @@ -119,10 +119,10 @@ function HealBot_OnUpdate(this, arg1) HealBot_TargetRestoreTimer = 0 end - -- 2. Spam the raw cast silently to guarantee it pierces the server delay + -- 2. Spam the cast until the server explicitly accepts it (firing SPELLCAST_START) if pendingCast.started then if not pendingCast.nextSpam or GetTime() >= pendingCast.nextSpam then - pendingCast.nextSpam = GetTime() + 0.15 + pendingCast.nextSpam = GetTime() + 0.10 -- Safely suppress UI errors UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE") @@ -146,6 +146,8 @@ function HealBot_OnUpdate(this, arg1) -- Failsafe timeout if HealBot_PendingShapeshiftCast and GetTime() > pendingCast.expires then HealBot_PendingShapeshiftCast = nil + HealBot_StopCasting() + HealBot_RecalcHeals() end end @@ -580,10 +582,23 @@ end -- HealBot_OnEvent_SpellcastStop: Internal utility: HealBot_OnEvent_SpellcastStop function HealBot_OnEvent_SpellcastStop(this, eventName) HealBot_IsCasting = false; - HealBot_PendingShapeshiftCast = nil; - if eventName == "SPELLCAST_FAILED" then + if eventName == "SPELLCAST_FAILED" or eventName == "SPELLCAST_INTERRUPTED" then HealBot_CastFailed = true; + if HealBot_PendingShapeshiftCast then + return; + end end + + if HealBot_PendingShapeshiftCast and eventName == "SPELLCAST_STOP" then + if HealBot_CastFailed or not HealBot_PendingShapeshiftCast.started then + -- This STOP is either the trailing event of a failed/interrupted cast, + -- or it is the STOP event from the unshift spell itself. + -- Do not wipe the queue yet! + return; + end + end + + HealBot_PendingShapeshiftCast = nil; HealBot_StopCasting(); HealBot_RecalcHeals(); if HealBot_IamRessing then diff --git a/HealBot_Controller_Spells.lua b/HealBot_Controller_Spells.lua index 14e96d0..b05015b 100644 --- a/HealBot_Controller_Spells.lua +++ b/HealBot_Controller_Spells.lua @@ -211,6 +211,7 @@ end -- HealBot_StopCasting: Internal utility: HealBot_StopCasting function HealBot_StopCasting() + HealBot_IsCasting = false; if HealBot_CastingTarget then if HealBot_HealValue > 0 then local uname = UnitName(HealBot_CastingTarget) @@ -325,7 +326,7 @@ function HealBot_CastSpellOnFriend(spell, target) if formCancelled then -- ALWAYS put the cast into the Pending queue so the OnUpdate loop can wait for the server -- to process the unshift before attempting the cast, otherwise we get "You are in shapeshift form". - HealBot_PendingShapeshiftCast = { spell = spell, target = target, targetEnemy = targetEnemy, oldTarget = oldTarget, fireTime = GetTime() + 0.05, expires = GetTime() + 1.0 } + HealBot_PendingShapeshiftCast = { spell = spell, target = target, targetEnemy = targetEnemy, oldTarget = oldTarget, fireTime = GetTime() + 0.05, expires = GetTime() + 2.0 } return; end diff --git a/HealBot_Options_Integrations.xml b/HealBot_Options_Integrations.xml index af31f10..ab6cc20 100644 --- a/HealBot_Options_Integrations.xml +++ b/HealBot_Options_Integrations.xml @@ -83,7 +83,7 @@ - +