From 6fd8330e4962e7bb5ac10b0ce788c69c74ba0724 Mon Sep 17 00:00:00 2001 From: opicron Date: Sun, 11 Jan 2026 14:11:20 +0100 Subject: [PATCH 1/4] 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/4] 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/4] 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/4] 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)