diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a8e42f..2ee30532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format of this changelog is based on [Keep a Changelog](https://keepachangel * Add support for Classic Era 1.15.1 * Add icons from Classic Era 1.15.1 to icon picker +* Onky re-process bingings when entering and leaving combat if required [#189] ## [1.14.3] - 2024-01-17 @@ -1377,6 +1378,7 @@ The format of this changelog is based on [Keep a Changelog](https://keepachangel [0.4.0]: https://github.com/Snakybo/Clicked/releases/tag/0.4.0 [0.3.0]: https://github.com/Snakybo/Clicked/releases/tag/0.3.0 +[#189]: https://github.com/Snakybo/Clicked/issues/189 [#186]: https://github.com/Snakybo/Clicked/issues/186 [#184]: https://github.com/Snakybo/Clicked/issues/184 [#182]: https://github.com/Snakybo/Clicked/issues/182 diff --git a/Clicked/Config/Bindings.lua b/Clicked/Config/Bindings.lua index 8493679e..dc4364e6 100644 --- a/Clicked/Config/Bindings.lua +++ b/Clicked/Config/Bindings.lua @@ -2127,6 +2127,17 @@ local function DrawMacroCombat(container, combat) } DrawDropdownLoadOption(container, Addon.L["Combat"], items, order, combat) + + local binding = GetCurrentBinding() + if binding ~= nil and combat.selected and (binding.type == Addon.BindingTypes.UNIT_MENU or binding.type == Addon.BindingTypes.UNIT_SELECT) then + local text = Addon.L["Combat state checks for this binding require additional processing when entering and leaving combat and may cause slight performance degradation."] + + local widget = Addon:GUI_Label(text) + widget:SetFullWidth(true) + widget:SetColor(1, 0, 0) + + container:AddChild(widget) + end end --- @param container AceGUIContainer diff --git a/Clicked/Core/Clicked.lua b/Clicked/Core/Clicked.lua index eccba0b4..712fdc83 100644 --- a/Clicked/Core/Clicked.lua +++ b/Clicked/Core/Clicked.lua @@ -102,7 +102,10 @@ local function PLAYER_REGEN_DISABLED() openConfigOnCombatExit = Addon:BindingConfig_Close() Addon:AbilityTooltips_Refresh() - Clicked:ProcessActiveBindings() + + if Addon:IsCombatProcessRequired() then + Clicked:ProcessActiveBindings() + end end local function PLAYER_REGEN_ENABLED() @@ -110,7 +113,10 @@ local function PLAYER_REGEN_ENABLED() Addon:ProcessFrameQueue() Addon:AbilityTooltips_Refresh() - Clicked:ProcessActiveBindings() + + if Addon:IsCombatProcessRequired() then + Clicked:ProcessActiveBindings() + end if openConfigOnCombatExit then Addon:BindingConfig_Open() diff --git a/Clicked/Core/CommandProcessor.lua b/Clicked/Core/CommandProcessor.lua index c20b6ac0..f3cb6326 100644 --- a/Clicked/Core/CommandProcessor.lua +++ b/Clicked/Core/CommandProcessor.lua @@ -22,6 +22,9 @@ Addon.MACRO_FRAME_HANDLER_NAME = "ClickedMacroFrameHandler" --- @type Button local macroFrameHandler +--- @type boolean +local requiresCombatProcess = false + -- Local support functions --- @param frame Frame @@ -183,6 +186,7 @@ function Addon:ProcessCommands(commands) -- Unregister all current keybinds macroFrameHandler:Hide() + requiresCombatProcess = false for _, command in ipairs(commands) do local attributes = {} @@ -217,6 +221,10 @@ function Addon:ProcessCommands(commands) for attribute, value in pairs(attributes) do targetAttributes[attribute] = value end + + if (command.action == Addon.CommandType.TARGET or command.action == Addon.CommandType.MENU) and command.data ~= nil then + requiresCombatProcess = true + end end Addon:StatusOutput_UpdateMacroHandlerAttributes(newMacroFrameHandlerAttributes) @@ -229,3 +237,10 @@ function Addon:ProcessCommands(commands) Addon:UpdateClickCastHeader(newClickCastFrameKeybinds) Addon:UpdateClickCastFrames(newClickCastFrameAttributes) end + +--- Get whether re-procesing of active bindings should happen when entering and leaving combat. +--- +---@return boolean +function Addon:IsCombatProcessRequired() + return requiresCombatProcess +end diff --git a/Clicked/Locales/enUS.lua b/Clicked/Locales/enUS.lua index b9522c5c..f5c2cd60 100644 --- a/Clicked/Locales/enUS.lua +++ b/Clicked/Locales/enUS.lua @@ -317,3 +317,4 @@ L["Show interface actions"] = true L["All"] = true L["External"] = true L["Filter bindings"] = true +L["Combat state checks for this binding require additional processing when entering and leaving combat and may cause slight performance degradation."] = true