diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua index 9870f70..ae781e8 100644 --- a/ElvUI_SLE/defaults/private.lua +++ b/ElvUI_SLE/defaults/private.lua @@ -36,6 +36,7 @@ V["sle"] = { ["timewalking"] = "NONE", }, ["setoverlay"] = false, + ["lockbutton"] = false, }, --Minimap Module diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua index c30b90f..aabc82a 100644 --- a/ElvUI_SLE/locales/english.lua +++ b/ElvUI_SLE/locales/english.lua @@ -411,6 +411,12 @@ L["Use a dedicated set for PvP situations."] = true L["Use Timewalking Set"] = true L["Use a dedicated set for timewalking instances."] = true L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = true +L["SLE_EM_LOCK_TITLE"] = "|cff9482c9S&L|r" +L["SLE_EM_LOCK_TOOLTIP"] = [[This button is designed for temporary disable +Equip Manager's auto switch gear sets. +While locked (red colored state) it will disable auto swap.]] +L["Block button"] = true +L["Create a button in character frame to allow temp blocking of auto set swap."] = true --Loot L["Loot Dropped:"] = true diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua index c66c4d0..2cd1cb0 100644 --- a/ElvUI_SLE/locales/russian.lua +++ b/ElvUI_SLE/locales/russian.lua @@ -408,7 +408,12 @@ L["Use a dedicated set for PvP situations."] = "Использовать отд L["Use Timewalking Set"] = "Сет путешествий во времени" L["Use a dedicated set for timewalking instances."] = "Использовать отдельный комплект для путешствий во времени." L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = "Невозможно переключиться на подходящий комплект в бою. Переключение произойдет после окончания боя." - +L["SLE_EM_LOCK_TITLE"] = "|cff9482c9S&L|r" +L["SLE_EM_LOCK_TOOLTIP"] = [[Эта кнопка позволит временно отключить автоматическую +смену экипировки при помощи менеджера экипировки. +В заблокированном состоянии (красный цвет) автоматическая смена отключена.]] +L["Block button"] = "Кнопка блокировки" +L["Create a button in character frame to allow temp blocking of auto set swap."] = "Создать в окне персонажа кнопку, позволяющую временно отключить автоматическую смену комплектов." --Loot L["Loot Dropped:"] = "Список добычи:" diff --git a/ElvUI_SLE/media/textures/lock.blp b/ElvUI_SLE/media/textures/lock.blp new file mode 100644 index 0000000..704e25f Binary files /dev/null and b/ElvUI_SLE/media/textures/lock.blp differ diff --git a/ElvUI_SLE/modules/equipmanager.lua b/ElvUI_SLE/modules/equipmanager.lua index 77ccbfe..955e257 100644 --- a/ElvUI_SLE/modules/equipmanager.lua +++ b/ElvUI_SLE/modules/equipmanager.lua @@ -76,7 +76,7 @@ function EM:WrongSet(equipSet, group, inCombat) end local function Equip(event) - if EM.Processing then return end + if EM.Processing or EM.lock then return end EM.Processing = true local inCombat = false E:Delay(1, function() EM.Processing = false end) @@ -96,13 +96,50 @@ local function Equip(event) end end +function EM:CreateLock() + if _G["SLE_Equip_Lock_Button"] or not EM.db.lockbutton then return end + local button = CreateFrame("Button", "SLE_Equip_Lock_Button", CharacterFrame) + button:Size(20, 20) + button:Point("BOTTOMLEFT", _G["CharacterFrame"], "BOTTOMLEFT", 4, 4) + -- button:CreateBackdrop("Default") + button:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 2) + button:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self) + GameTooltip:AddLine(L["SLE_EM_LOCK_TOOLTIP"]) + GameTooltip:Show() + end) + button:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + E:GetModule("Skins"):HandleButton(button) + + button.TitleText = button:CreateFontString(nil, "OVERLAY") + button.TitleText:FontTemplate() + button.TitleText:SetPoint("BOTTOMLEFT", button, "TOPLEFT", 0, 0) + button.TitleText:SetJustifyH("LEFT") + button.TitleText:SetText(L["SLE_EM_LOCK_TITLE"]) + + button.Icon = button:CreateTexture(nil, "OVERLAY") + button.Icon:SetAllPoints() + button.Icon:SetTexture([[Interface\AddOns\ElvUI_SLE\media\textures\lock]]) + button.Icon:SetVertexColor(0, 1, 0) + + button:SetScript("OnClick", function() + EM.lock = not EM.lock + button.Icon:SetVertexColor(EM.lock and 1 or 0, EM.lock and 0 or 1, 0) + end) +end + function EM:Initialize() EM.db = E.private.sle.equip + EM.lock = false if not SLE.initialized then return end if not EM.db.enable then return end self:RegisterEvent("PLAYER_ENTERING_WORLD", Equip) self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", Equip) self:RegisterEvent("ZONE_CHANGED", Equip) + + self:CreateLock() end SLE:RegisterModule(EM:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/options/equipmanager_c.lua b/ElvUI_SLE/options/equipmanager_c.lua index 4ee5d8b..5bf1db1 100644 --- a/ElvUI_SLE/options/equipmanager_c.lua +++ b/ElvUI_SLE/options/equipmanager_c.lua @@ -121,10 +121,13 @@ local function configTable() get = function(info) return EM.db.setoverlay end, set = function(info, value) EM.db.setoverlay = value; SLE:GetModule('BagInfo'):ToggleSettings(); end, }, - spacer = { + lockbutton = { order = 6, - type = "description", - name = "", + type = "toggle", + name = L["Block button"], + desc = L["Create a button in character frame to allow temp blocking of auto set swap."], + get = function(info) return EM.db.lockbutton end, + set = function(info, value) EM.db.lockbutton = value; E:StaticPopup_Show("PRIVATE_RL") end }, instanceSet = { type = "toggle",