From 6fd8330e4962e7bb5ac10b0ce788c69c74ba0724 Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 11 Jan 2026 14:11:20 +0100 Subject: [PATCH 1/8] Add Masque button skin support --- Core/MultiBot.lua | 82 ++++++++++++++++++++++++++++++++++++++++ Core/MultiBotEngine.lua | 14 +++++++ Core/MultiBotHandler.lua | 3 ++ 3 files changed, 99 insertions(+) diff --git a/Core/MultiBot.lua b/Core/MultiBot.lua index 6af2ad4..667ecc9 100644 --- a/Core/MultiBot.lua +++ b/Core/MultiBot.lua @@ -1,5 +1,12 @@ MultiBot = CreateFrame("Frame", nil, UIParent) +-- MASQUE INTEGRATION -- +MultiBot.Masque = { + IsLoaded = false, + Group = nil, + Buttons = {} +} + -- GM core -- MultiBot.GM = MultiBot.GM or false @@ -301,6 +308,75 @@ function MultiBot.ToggleFavorite(name) MultiBot.SetFavorite(name, not MultiBot.IsFavorite(name)) end +-- ============================================================================ +-- MASQUE INTEGRATION +-- ============================================================================ + +-- Initialize Masque support +function MultiBot.InitializeMasque() + if MultiBot.Masque.IsLoaded then return end + + local Masque = LibStub and LibStub("Masque", true) + if not Masque then + return + end + + -- Create MultiBot button group + MultiBot.Masque.Group = Masque:Group("MultiBot", "MultiBot Buttons") + MultiBot.Masque.IsLoaded = true + + -- Apply current skin to existing buttons + if MultiBot.Masque.Group then + for button, _ in pairs(MultiBot.Masque.Buttons) do + if button and button:IsObjectType("Button") then + MultiBot.Masque.Group:AddButton(button, { + Icon = button.icon, + Normal = button:GetNormalTexture(), + Pushed = button:GetPushedTexture(), + Highlight = button:GetHighlightTexture(), + Border = button.border + }) + end + end + end +end + +-- Register a button with Masque +function MultiBot.RegisterButtonWithMasque(button) + if not MultiBot.Masque.IsLoaded then + MultiBot.InitializeMasque() + end + + if not MultiBot.Masque.IsLoaded or not button then return end + + -- Store button reference + MultiBot.Masque.Buttons[button] = true + + -- Add to Masque group if available + if MultiBot.Masque.Group and button.icon then + MultiBot.Masque.Group:AddButton(button, { + Icon = button.icon, + Normal = button:GetNormalTexture(), + Pushed = button:GetPushedTexture(), + Highlight = button:GetHighlightTexture(), + Border = button.border + }) + end +end + +-- Unregister a button from Masque +function MultiBot.UnregisterButtonFromMasque(button) + if not MultiBot.Masque.IsLoaded or not button then return end + + -- Remove from tracking + MultiBot.Masque.Buttons[button] = nil + + -- Remove from Masque group + if MultiBot.Masque.Group then + MultiBot.Masque.Group:RemoveButton(button) + end +end + MultiBot.timer = {} MultiBot.timer.sort = {} MultiBot.timer.sort.elapsed = 0 @@ -3709,6 +3785,12 @@ MultiBot.tips.every.misc = "|cffff0000Left-click to toggle this menu|r\n".. "|cff999999(Execution order: System)|r" +--[[MultiBot.tips.every.pvp = +"Send PvP command to bot|cffffffff\n".. +"Display pvp bots informations.|r\n\n".. +"|cffff0000Left-click to send command|r\n".. +"|cff999999(Execution order: Bot)|r";--]] + MultiBot.tips.every.pvptitle = "MultiBot PvP Panel"; diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index ed3dcaa..8742639 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1061,6 +1061,11 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) button:HookScript("OnShow", function() if(MultiBot.RequestClickBlockerUpdate) then MultiBot.RequestClickBlockerUpdate(button.parent) end end) button:HookScript("OnHide", function() if(MultiBot.RequestClickBlockerUpdate) then MultiBot.RequestClickBlockerUpdate(button.parent) end end) + -- Register with Masque if available + if MultiBot.RegisterButtonWithMasque then + MultiBot.RegisterButtonWithMasque(button) + end + -- ADD -- button.addMacro = function(pType, pMacro) @@ -1205,6 +1210,15 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) if(pEvent == "LeftButton" and button.doLeft ~= nil) then button.doLeft(button) end end) + -- CLEANUP -- + + button.cleanup = function() + if MultiBot.UnregisterButtonFromMasque then + MultiBot.UnregisterButtonFromMasque(button) + end + return button + end + return button end diff --git a/Core/MultiBotHandler.lua b/Core/MultiBotHandler.lua index 18b80b0..db4bcb1 100644 --- a/Core/MultiBotHandler.lua +++ b/Core/MultiBotHandler.lua @@ -137,6 +137,9 @@ MultiBot:SetScript("OnEvent", function() if MultiBot.EnsureFavorites then MultiBot.EnsureFavorites() end if MultiBot.UpdateFavoritesIndex then MultiBot.UpdateFavoritesIndex() end + -- Initialize Masque support + if MultiBot.InitializeMasque then MultiBot.InitializeMasque() end + -- [AJOUT] init config + applique timers + enregistre le panneau d'options if MultiBot.Config_Ensure then MultiBot.Config_Ensure() end if MultiBot.ApplyTimersToRuntime then MultiBot.ApplyTimersToRuntime() end From 147f418b0a86c42437f259d34277717e4f171c87 Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 11 Jan 2026 16:06:38 +0100 Subject: [PATCH 2/8] Fix button size when using masque (edge case) --- Core/MultiBotEngine.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index 8742639..d66b984 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1087,7 +1087,10 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) button.setButton = function(texture, tip) local safe = MultiBot.SafeTexturePath(texture) button.icon:SetTexture(safe) - button.icon:SetAllPoints(button) + -- Only reset icon positioning if not managed by Masque + if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then + button.icon:SetAllPoints(button) + end button.texture = safe button.tip = tip return button @@ -1096,7 +1099,10 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) button.setTexture = function(texture) local safe = MultiBot.SafeTexturePath(texture) button.icon:SetTexture(safe) - button.icon:SetAllPoints(button) + -- Only reset icon positioning if not managed by Masque + if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then + button.icon:SetAllPoints(button) + end button.texture = safe return button end @@ -1186,11 +1192,14 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) end) button:SetScript("OnLeave", function() - button:SetPoint("BOTTOMRIGHT", button.x, button.y) - button:SetSize(button.size, button.size) - - button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) - button.border:SetSize(button.size + 4, button.size + 4) + -- Don't reset positioning if button is managed by Masque + if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then + button:SetPoint("BOTTOMRIGHT", button.x, button.y) + button:SetSize(button.size, button.size) + + button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) + button.border:SetSize(button.size + 4, button.size + 4) + end if(type(button.tip) == "string") then GameTooltip:Hide() end if(type(button.tip) == "table") then button.tip:Hide() end From 53889f8abc09aec0da34c0d7fc9211726f3ffb5f Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 11 Jan 2026 16:24:42 +0100 Subject: [PATCH 3/8] Fix post click edge case when using masque --- Core/MultiBotEngine.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index d66b984..d8541c7 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1206,11 +1206,14 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) end) button:SetScript("PostClick", function(pSelf, pEvent) - button:SetPoint("BOTTOMRIGHT", button.x - 1, button.y + 1) - button:SetSize(button.size - 2, button.size - 2) + -- Don't modify positioning if button is managed by Masque + if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then + button:SetPoint("BOTTOMRIGHT", button.x - 1, button.y + 1) + button:SetSize(button.size - 2, button.size - 2) - button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) - button.border:SetSize(button.size + 2, button.size + 2) + button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) + button.border:SetSize(button.size + 2, button.size + 2) + end if(type(button.tip) == "string") then GameTooltip:Hide() end if(type(button.tip) == "table") then button.tip:Hide() end From cca1fe16e23ac4d67cf0a2c96fba777aa803227f Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 11 Jan 2026 17:04:30 +0100 Subject: [PATCH 4/8] fix lint errors --- Core/MultiBotEngine.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index d8541c7..69a7a0b 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1195,8 +1195,7 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) -- Don't reset positioning if button is managed by Masque if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then button:SetPoint("BOTTOMRIGHT", button.x, button.y) - button:SetSize(button.size, button.size) - + button:SetSize(button.size, button.size) button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) button.border:SetSize(button.size + 4, button.size + 4) end @@ -1210,7 +1209,6 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then button:SetPoint("BOTTOMRIGHT", button.x - 1, button.y + 1) button:SetSize(button.size - 2, button.size - 2) - button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) button.border:SetSize(button.size + 2, button.size + 2) end @@ -1223,7 +1221,6 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) end) -- CLEANUP -- - button.cleanup = function() if MultiBot.UnregisterButtonFromMasque then MultiBot.UnregisterButtonFromMasque(button) From 0a37fa53070263492c49b081aa678a69d8431754 Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 1 Feb 2026 19:50:57 +0100 Subject: [PATCH 5/8] Updates --- Core/MultiBot.lua | 22 ++++++++++++---------- Core/MultiBotEngine.lua | 5 ++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Core/MultiBot.lua b/Core/MultiBot.lua index 667ecc9..32a774c 100644 --- a/Core/MultiBot.lua +++ b/Core/MultiBot.lua @@ -315,16 +315,18 @@ end -- Initialize Masque support function MultiBot.InitializeMasque() if MultiBot.Masque.IsLoaded then return end - + + -- LibStub is embedded in addon, not a global - suppress linter warning + ---@diagnostic disable-next-line: undefined-global local Masque = LibStub and LibStub("Masque", true) - if not Masque then - return + if not Masque then + return end - + -- Create MultiBot button group MultiBot.Masque.Group = Masque:Group("MultiBot", "MultiBot Buttons") MultiBot.Masque.IsLoaded = true - + -- Apply current skin to existing buttons if MultiBot.Masque.Group then for button, _ in pairs(MultiBot.Masque.Buttons) do @@ -346,12 +348,12 @@ function MultiBot.RegisterButtonWithMasque(button) if not MultiBot.Masque.IsLoaded then MultiBot.InitializeMasque() end - + if not MultiBot.Masque.IsLoaded or not button then return end - + -- Store button reference MultiBot.Masque.Buttons[button] = true - + -- Add to Masque group if available if MultiBot.Masque.Group and button.icon then MultiBot.Masque.Group:AddButton(button, { @@ -367,10 +369,10 @@ end -- Unregister a button from Masque function MultiBot.UnregisterButtonFromMasque(button) if not MultiBot.Masque.IsLoaded or not button then return end - + -- Remove from tracking MultiBot.Masque.Buttons[button] = nil - + -- Remove from Masque group if MultiBot.Masque.Group then MultiBot.Masque.Group:RemoveButton(button) diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index 69a7a0b..19a6b0b 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1195,7 +1195,8 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) -- Don't reset positioning if button is managed by Masque if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then button:SetPoint("BOTTOMRIGHT", button.x, button.y) - button:SetSize(button.size, button.size) + button:SetSize(button.size, button.size) + button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) button.border:SetSize(button.size + 4, button.size + 4) end @@ -1209,6 +1210,7 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) if not (MultiBot.Masque and MultiBot.Masque.IsLoaded and MultiBot.Masque.Buttons[button]) then button:SetPoint("BOTTOMRIGHT", button.x - 1, button.y + 1) button:SetSize(button.size - 2, button.size - 2) + button.border:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) button.border:SetSize(button.size + 2, button.size + 2) end @@ -1221,6 +1223,7 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) end) -- CLEANUP -- + button.cleanup = function() if MultiBot.UnregisterButtonFromMasque then MultiBot.UnregisterButtonFromMasque(button) From 85e33f405e45d6e6769b4d5eb9fafbee6018f04d Mon Sep 17 00:00:00 2001 From: opicron Date: Mon, 2 Feb 2026 09:37:34 +0100 Subject: [PATCH 6/8] Updates --- .luacheckrc | 4 ++-- Core/MultiBotEngine.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index a5480e2..fa98620 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -27,8 +27,8 @@ globals = { "GetMacroIconInfo", "GetPlayerInfoByGUID", "UnitGUID", "ConvertToRaid", "HandleQuestsAllResponse", "UnitXPMax", "UnitXP", "UnitManaMax", "UnitMana", "GetCurrentMapContinent", "GetCurrentMapAreaID", "SLASH_MULTIBOT1", "SLASH_MULTIBOT2", "SLASH_MULTIBOT3", "SLASH_MULTIBOTOPTIONS1", "SLASH_MBFAKEGM1", "SLASH_MBCLASS1", "SLASH_MBCLASSTEST1", "UIDropDownMenu_SetText", "UIDropDownMenu_SetWidth", "UIDropDownMenu_Initialize", "UIDropDownMenu_CreateInfo", - "UIDropDownMenu_AddButton", "UIDropDownMenu_SetSelectedValue", "time", "isFav", "ToggleDropDownMenu" - + "UIDropDownMenu_AddButton", "UIDropDownMenu_SetSelectedValue", "time", "isFav", "LibStub" + } read_globals = { diff --git a/Core/MultiBotEngine.lua b/Core/MultiBotEngine.lua index 19a6b0b..f86a38f 100644 --- a/Core/MultiBotEngine.lua +++ b/Core/MultiBotEngine.lua @@ -1223,7 +1223,7 @@ MultiBot.newButton = function(pParent, pX, pY, pSize, pTexture, pTip, oTemplate) end) -- CLEANUP -- - + button.cleanup = function() if MultiBot.UnregisterButtonFromMasque then MultiBot.UnregisterButtonFromMasque(button) From b9aacdd06e1af9ee0fae27443bb2d91f52aa82e0 Mon Sep 17 00:00:00 2001 From: opicron Date: Tue, 3 Feb 2026 19:16:50 +0100 Subject: [PATCH 7/8] Updates --- .luacheckrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index fa98620..ffa64c4 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -27,8 +27,7 @@ globals = { "GetMacroIconInfo", "GetPlayerInfoByGUID", "UnitGUID", "ConvertToRaid", "HandleQuestsAllResponse", "UnitXPMax", "UnitXP", "UnitManaMax", "UnitMana", "GetCurrentMapContinent", "GetCurrentMapAreaID", "SLASH_MULTIBOT1", "SLASH_MULTIBOT2", "SLASH_MULTIBOT3", "SLASH_MULTIBOTOPTIONS1", "SLASH_MBFAKEGM1", "SLASH_MBCLASS1", "SLASH_MBCLASSTEST1", "UIDropDownMenu_SetText", "UIDropDownMenu_SetWidth", "UIDropDownMenu_Initialize", "UIDropDownMenu_CreateInfo", - "UIDropDownMenu_AddButton", "UIDropDownMenu_SetSelectedValue", "time", "isFav", "LibStub" - + "UIDropDownMenu_AddButton", "UIDropDownMenu_SetSelectedValue", "time", "isFav", "LibStub", "ToggleDropDownMenu" } read_globals = { From f443bdad1fa65641af993c5f84f9807a954f46d7 Mon Sep 17 00:00:00 2001 From: opicron Date: Tue, 3 Feb 2026 22:09:01 +0100 Subject: [PATCH 8/8] Edge case fix --- Core/MultiBot.lua | 12 ++++++------ Core/MultiBotHandler.lua | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Core/MultiBot.lua b/Core/MultiBot.lua index 32a774c..ae9f173 100644 --- a/Core/MultiBot.lua +++ b/Core/MultiBot.lua @@ -316,8 +316,6 @@ end function MultiBot.InitializeMasque() if MultiBot.Masque.IsLoaded then return end - -- LibStub is embedded in addon, not a global - suppress linter warning - ---@diagnostic disable-next-line: undefined-global local Masque = LibStub and LibStub("Masque", true) if not Masque then return @@ -345,14 +343,16 @@ end -- Register a button with Masque function MultiBot.RegisterButtonWithMasque(button) + if not button then return end + + -- Store button reference (even if Masque is not loaded yet) + MultiBot.Masque.Buttons[button] = true + if not MultiBot.Masque.IsLoaded then MultiBot.InitializeMasque() end - if not MultiBot.Masque.IsLoaded or not button then return end - - -- Store button reference - MultiBot.Masque.Buttons[button] = true + if not MultiBot.Masque.IsLoaded then return end -- Add to Masque group if available if MultiBot.Masque.Group and button.icon then diff --git a/Core/MultiBotHandler.lua b/Core/MultiBotHandler.lua index db4bcb1..b765bf1 100644 --- a/Core/MultiBotHandler.lua +++ b/Core/MultiBotHandler.lua @@ -129,6 +129,9 @@ MultiBot:SetScript("OnEvent", function() local tPoint = MultiBot.doSplit(MultiBotSave["MultiBarPoint"], ", ") MultiBot.frames["MultiBar"].setPoint(tonumber(tPoint[1]), tonumber(tPoint[2])) end]]-- + if(event == "ADDON_LOADED" and arg1 == "Masque") then + if MultiBot.InitializeMasque then MultiBot.InitializeMasque() end + end if(event == "ADDON_LOADED" and arg1 == "MultiBot") then -- print("MultiBot: ADDON_LOADED fired") -- print("BuildOptionsPanel type:", type(MultiBot.BuildOptionsPanel))