mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-07-27 09:44:44 +00:00
refactor: replace MODIFIER_STATE_CHANGED event with polling in HealBot_OnUpdate to track modifier keys
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
HealBot_View_DirtyUnits = {}
|
HealBot_View_DirtyUnits = {}
|
||||||
local HealBot_Timer1, HealsIn_Timer = 0, 0;
|
local HealBot_Timer1, HealsIn_Timer = 0, 0;
|
||||||
|
HealBot_LastModState = ""
|
||||||
|
|
||||||
function HealBot_OnLoad(this)
|
function HealBot_OnLoad(this)
|
||||||
this:RegisterEvent("VARIABLES_LOADED");
|
this:RegisterEvent("VARIABLES_LOADED");
|
||||||
this:RegisterEvent("MODIFIER_STATE_CHANGED");
|
|
||||||
|
|
||||||
SLASH_HEALBOT1 = "/healbot";
|
SLASH_HEALBOT1 = "/healbot";
|
||||||
SLASH_HEALBOT2 = "/hb";
|
SLASH_HEALBOT2 = "/hb";
|
||||||
@@ -42,6 +42,20 @@ function HealBot_RegisterThis(this)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HealBot_OnUpdate(this, arg1)
|
function HealBot_OnUpdate(this, arg1)
|
||||||
|
if HealBot_Action_TooltipUnit and HealBot_Tooltip:IsVisible() then
|
||||||
|
local currentModState = ""
|
||||||
|
if IsShiftKeyDown() then currentModState = currentModState .. "S" end
|
||||||
|
if IsControlKeyDown() then currentModState = currentModState .. "C" end
|
||||||
|
if IsAltKeyDown() then currentModState = currentModState .. "A" end
|
||||||
|
|
||||||
|
if HealBot_LastModState ~= currentModState then
|
||||||
|
HealBot_LastModState = currentModState
|
||||||
|
HealBot_Action_RefreshTooltip(HealBot_Action_TooltipUnit)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
HealBot_LastModState = ""
|
||||||
|
end
|
||||||
|
|
||||||
if HealBot_TargetRestorePending then
|
if HealBot_TargetRestorePending then
|
||||||
HealBot_TargetRestoreTimer = HealBot_TargetRestoreTimer + arg1;
|
HealBot_TargetRestoreTimer = HealBot_TargetRestoreTimer + arg1;
|
||||||
if HealBot_TargetRestoreTimer >= 0.1 then
|
if HealBot_TargetRestoreTimer >= 0.1 then
|
||||||
@@ -179,11 +193,6 @@ local HealBot_EventHandlers = {
|
|||||||
["VARIABLES_LOADED"] = function(this)
|
["VARIABLES_LOADED"] = function(this)
|
||||||
HealBot_OnEvent_VariablesLoaded(this)
|
HealBot_OnEvent_VariablesLoaded(this)
|
||||||
end,
|
end,
|
||||||
["MODIFIER_STATE_CHANGED"] = function(this, arg1, arg2)
|
|
||||||
if HealBot_Action_TooltipUnit and HealBot_Tooltip:IsVisible() then
|
|
||||||
HealBot_Action_RefreshTooltip(HealBot_Action_TooltipUnit)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
-- Legacy pass-throughs
|
-- Legacy pass-throughs
|
||||||
["CHAT_MSG_ADDON"] = function(this, arg1, arg2, arg3, arg4) HealBot_OnEvent_AddonMsg(this, arg1, arg2, arg3, arg4) end,
|
["CHAT_MSG_ADDON"] = function(this, arg1, arg2, arg3, arg4) HealBot_OnEvent_AddonMsg(this, arg1, arg2, arg3, arg4) end,
|
||||||
["SPELLCAST_START"] = function(this, arg1, arg2) HealBot_OnEvent_SpellcastStart(this, arg1, arg2) end,
|
["SPELLCAST_START"] = function(this, arg1, arg2) HealBot_OnEvent_SpellcastStart(this, arg1, arg2) end,
|
||||||
|
|||||||
Reference in New Issue
Block a user