From dbc8a0ecdf5612fb4756e704f8662d7b5ca61d31 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Thu, 18 Dec 2014 18:25:35 +0400 Subject: [PATCH] Just making shit smaller --- ElvUI_SLE/modules/uibuttons.lua | 624 +++++++++------------------------------ 1 file changed, 137 insertions(+), 487 deletions(-) diff --git a/ElvUI_SLE/modules/uibuttons.lua b/ElvUI_SLE/modules/uibuttons.lua index 165a1c6..88442bb 100644 --- a/ElvUI_SLE/modules/uibuttons.lua +++ b/ElvUI_SLE/modules/uibuttons.lua @@ -12,6 +12,15 @@ local AddonTable = {} local StatusTable = {} local RollTable = {} +local function CustomRollCall() + local min, max = tonumber(E.db.sle.uibuttons.roll.min), tonumber(E.db.sle.uibuttons.roll.max) + if min <= max then + RandomRoll(min, max) + else + SLE:Print(L["Custom roll limits are set incorrectly! Minimum should be smaller then or equial to maximum."]) + end +end + function UB:OnEnter(self) UB.menuHolder:SetAlpha(1) end @@ -40,48 +49,21 @@ function UB:CreateFrame() UB.menuHolder:HookScript('OnLeave', UB.OnLeave) UB.menuHolder.Config = CreateFrame("Frame", "SLEUIConfigHolder", UB.menuHolder) - UB.menuHolder.Config.Toggle = CreateFrame("Button", "SLEUIConfigToggle", UB.menuHolder) - UB.menuHolder.Config.Toggle.text = UB.menuHolder.Config.Toggle:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.Toggle.text:SetPoint("CENTER", UB.menuHolder.Config.Toggle, "CENTER", 0, 0) - UB.menuHolder.Config.Toggle.text:SetText("C") - UB.menuHolder.Config:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Config:HookScript('OnLeave', UB.OnLeave) + UB:CreateCoreButton("Config", "C") UB:ConfigSetup() - Sk:HandleButton(UB.menuHolder.Config.Toggle) UB.menuHolder.Addon = CreateFrame("Frame", "SLEUIAddonHolder", UB.menuHolder) - UB.menuHolder.Addon.Toggle = CreateFrame("Button", "SLEUIAddonToggle", UB.menuHolder) - UB.menuHolder.Addon.Toggle.text = UB.menuHolder.Addon.Toggle:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Toggle.text:SetPoint("CENTER", UB.menuHolder.Addon.Toggle, "CENTER", 0, 0) - UB.menuHolder.Addon.Toggle.text:SetText("A") - UB.menuHolder.Addon:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon:HookScript('OnLeave', UB.OnLeave) + UB:CreateCoreButton("Addon", "A") UB:AddonSetup() - Sk:HandleButton(UB.menuHolder.Addon.Toggle) UB.menuHolder.Status = CreateFrame("Frame", "SLEUIStatusHolder", UB.menuHolder) - UB.menuHolder.Status.Toggle = CreateFrame("Button", "SLEUIStatusToggle", UB.menuHolder) - UB.menuHolder.Status.Toggle.text = UB.menuHolder.Status.Toggle:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Status.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Status.Toggle.text:SetPoint("CENTER", UB.menuHolder.Status.Toggle, "CENTER", 0, 0) - UB.menuHolder.Status.Toggle.text:SetText("S") - UB.menuHolder.Status:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Status:HookScript('OnLeave', UB.OnLeave) + UB:CreateCoreButton("Status", "S") UB:StatusSetup() - Sk:HandleButton(UB.menuHolder.Status.Toggle) UB.menuHolder.Roll = CreateFrame("Frame", "SLEUIRollHolder", UB.menuHolder) - UB.menuHolder.Roll.Toggle = CreateFrame("Button", "SLEUIRollToggle", UB.menuHolder) - UB.menuHolder.Roll.Toggle.text = UB.menuHolder.Roll.Toggle:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Toggle.text:SetPoint("CENTER", UB.menuHolder.Roll.Toggle, "CENTER", 0, 0) - UB.menuHolder.Roll.Toggle.text:SetText("R") - UB.menuHolder.Roll:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll:HookScript('OnLeave', UB.OnLeave) + UB:CreateCoreButton("Roll", "R") UB:RollSetup() - Sk:HandleButton(UB.menuHolder.Roll.Toggle) + ToggleTable = { UB.menuHolder.Config.Toggle, @@ -91,6 +73,87 @@ function UB:CreateFrame() } end +function UB:CreateCoreButton(name, text) + UB.menuHolder[name].Toggle = CreateFrame("Button", "SLEUI"..name.."Toggle", UB.menuHolder) + local button = UB.menuHolder[name].Toggle + button.text = button:CreateFontString(nil, "OVERLAY") + button.text:SetPoint("CENTER", button, "CENTER", 0, 0) + UB.menuHolder[name]:HookScript('OnEnter', UB.OnEnter) + UB.menuHolder[name]:HookScript('OnLeave', UB.OnLeave) + Sk:HandleButton(button) + + if text then + local t = button:CreateFontString(nil,"OVERLAY",button) + t:FontTemplate() + t:SetPoint("CENTER", button, 'CENTER', 0, -1) + t:SetJustifyH("CENTER") + t:SetText(text) + button:SetFontString(t) + end +end + +function UB:CreateDropdownButton(parent, name, text, tooltip1, tooltip2, click, addon) + UB.menuHolder[parent][name] = CreateFrame("Button", "SLEUI"..parent..name, UB.menuHolder[parent]) + local b = UB.menuHolder[parent][name] + local toggle = UB.menuHolder[parent].Toggle + if addon and name == "Boss" then + b.shown = true + b.bossmode = function() end + if IsAddOnLoaded("DBM-Core") then + b.bossmode = function() DBM:LoadGUI() end + -- elseif IsAddOnLoaded("Bigwigs") then + -- b.bossmode = function() end + elseif IsAddOnLoaded("VEM-Core") then + b.bossmode = function() VEM:LoadGUI() end + -- elseif IsAddOnLoaded("DXE_Loader") then + -- b.bossmode = function() end + -- elseif IsAddOnLoaded("") then + -- b.bossmode = function() end + else + b.shown = false + end + elseif addon then + if IsAddOnLoaded(addon) then + b.shown = true + else + b.shown = false + end + end + + b:SetScript("OnClick", function(self) + click() + toggle.opened = false + UB:ToggleCats() + end) + + if tooltip1 then + b:SetScript("OnEnter", function(self) + UB:OnEnter() + GameTooltip:SetOwner(self) + GameTooltip:AddLine(tooltip1, .6, .6, .6, .6, .6, 1) + GameTooltip:AddLine(tooltip2, 1, 1, 1, 1, 1, 1) + GameTooltip:Show() + end) + b:SetScript("OnLeave", function(self) + UB:OnLeave() + GameTooltip:Hide() + end) + else + b:HookScript('OnEnter', UB.OnEnter) + b:HookScript('OnEnter', UB.OnEnter) + end + Sk:HandleButton(b) + + if text then + local t = b:CreateFontString(nil,"OVERLAY",b) + t:FontTemplate() + t:SetPoint("CENTER", b, 'CENTER', 0, -1) + t:SetJustifyH("CENTER") + t:SetText(text) + b:SetFontString(t) + end +end + function UB:ToggleCats() if UB.menuHolder.Config.Toggle.opened then UB.menuHolder.Config:Show() @@ -138,126 +201,12 @@ function UB:ConfigSetup() end) button:HookScript('OnEnter', UB.OnEnter) button:HookScript('OnLeave', UB.OnLeave) - do - UB.menuHolder.Config.Elv = CreateFrame("Button", "SLEUIConfigElv", UB.menuHolder.Config) - UB.menuHolder.Config.Elv.text = UB.menuHolder.Config.Elv:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.Elv.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.Elv.text:SetPoint("CENTER", UB.menuHolder.Config.Elv, "CENTER") - UB.menuHolder.Config.Elv.text:SetText("ElvUI") - UB.menuHolder.Config.Elv:SetScript("OnClick", function(self) - E:ToggleConfig() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Config.Elv:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["ElvUI Config"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle config window"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.Elv:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.Elv) - end - do - UB.menuHolder.Config.SLE = CreateFrame("Button", "SLEUIConfigSLE", UB.menuHolder.Config) - UB.menuHolder.Config.SLE.text = UB.menuHolder.Config.SLE:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.SLE.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.SLE.text:SetPoint("CENTER", UB.menuHolder.Config.SLE, "CENTER") - UB.menuHolder.Config.SLE.text:SetText("S&L") - UB.menuHolder.Config.SLE:SetScript("OnClick", function(self) - E:ToggleConfig() - ACD:SelectGroup("ElvUI", "sle", "options") - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Config.SLE:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["S&L Config"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle Shadow & Light config group"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.SLE:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.SLE) - end - do - UB.menuHolder.Config.Benik = CreateFrame("Button", "SLEUIConfigBenik", UB.menuHolder.Config) - UB.menuHolder.Config.Benik.text = UB.menuHolder.Config.Benik:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.Benik.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.Benik.text:SetPoint("CENTER", UB.menuHolder.Config.Benik, "CENTER") - UB.menuHolder.Config.Benik.text:SetText("BenikUI") - UB.menuHolder.Config.Benik:SetScript("OnClick", function(self) - E:ToggleConfig() - ACD:SelectGroup("ElvUI", "bui") - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Config.Benik:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["BenikUI Config"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle BenikUI config group"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.Benik:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.Benik) - end - do - UB.menuHolder.Config.Reload = CreateFrame("Button", "SLEUIConfigReload", UB.menuHolder.Config) - UB.menuHolder.Config.Reload.text = UB.menuHolder.Config.Reload:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.Reload.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.Reload.text:SetPoint("CENTER", UB.menuHolder.Config.Reload, "CENTER") - UB.menuHolder.Config.Reload.text:SetText("/reload") - UB.menuHolder.Config.Reload:SetScript("OnClick", function(self) - ReloadUI() - end) - UB.menuHolder.Config.Reload:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["Reload UI"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to reload your interface"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.Reload:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.Reload) - end - do - UB.menuHolder.Config.MoveUI = CreateFrame("Button", "SLEUIConfigMoveUI", UB.menuHolder.Config) - UB.menuHolder.Config.MoveUI.text = UB.menuHolder.Config.MoveUI:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.MoveUI.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.MoveUI.text:SetPoint("CENTER", UB.menuHolder.Config.MoveUI, "CENTER") - UB.menuHolder.Config.MoveUI.text:SetText("/moveui") - UB.menuHolder.Config.MoveUI:SetScript("OnClick", function(self) - E:ToggleConfigMode() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Config.MoveUI:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["Move UI"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to unlock moving ElvUI elements"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.MoveUI:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.MoveUI) - end + + UB:CreateDropdownButton("Config", "Elv", "ElvUI", L["ElvUI Config"], L["Click to toggle config window"], E.ToggleConfig) + UB:CreateDropdownButton("Config", "SLE", "S&L", L["S&L Config"], L["Click to toggle Shadow & Light config group"], function() E:ToggleConfig(); ACD:SelectGroup("ElvUI", "sle", "options") end) + UB:CreateDropdownButton("Config", "Benik", "BenikUI", L["BenikUI Config"], L["Click to toggle BenikUI config group"], function() E:ToggleConfig(); ACD:SelectGroup("ElvUI", "bui") end) + UB:CreateDropdownButton("Config", "Reload", "/reloadui", L["Reload UI"], L["Click to reload your interface"], ReloadUI) + UB:CreateDropdownButton("Config", "MoveUI", "/moveui", L["Move UI"], L["Click to unlock moving ElvUI elements"], function() E:ToggleConfigMode() end) ConfigTable = { UB.menuHolder.Config.Elv, @@ -292,201 +241,27 @@ function UB:AddonSetup() button:HookScript('OnEnter', UB.OnEnter) button:HookScript('OnLeave', UB.OnLeave) - do - UB.menuHolder.Addon.Manager = CreateFrame("Button", "SLEUIAddonManager", UB.menuHolder.Addon) - UB.menuHolder.Addon.Manager.text = UB.menuHolder.Addon.Manager:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Manager.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Manager.text:SetPoint("CENTER", UB.menuHolder.Addon.Manager, "CENTER") - UB.menuHolder.Addon.Manager.text:SetText(L["Addons"]) - UB.menuHolder.Addon.Manager:SetScript("OnClick", function(self) - GameMenuButtonAddons:Click() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Addon.Manager:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine(L["AddOns Manager"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle the AddOn Manager frame."], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.Manager:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - UB.menuHolder.Addon.Manager.shown = true - Sk:HandleButton(UB.menuHolder.Addon.Manager) - tinsert(AddonTable, UB.menuHolder.Addon.Manager) - end - do - UB.menuHolder.Addon.Boss = CreateFrame("Button", "SLEUIAddonBoss", UB.menuHolder.Addon) - UB.menuHolder.Addon.Boss.text = UB.menuHolder.Addon.Boss:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Boss.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Boss.text:SetPoint("CENTER", UB.menuHolder.Addon.Boss, "CENTER") - UB.menuHolder.Addon.Boss.text:SetText(L["Boss Mod"]) - UB.menuHolder.Addon.Boss:SetScript("OnClick", function(self) - UB.menuHolder.Addon.bossmode() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Addon.Boss:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine(L["Boss Mod"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle the Configuration/Option Window from the Bossmod you have enabled."], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.Boss:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - UB.menuHolder.Addon.Boss.shown = true - UB.menuHolder.Addon.bossmode = function() end - if IsAddOnLoaded("DBM-Core") then - UB.menuHolder.Addon.bossmode = function() DBM:LoadGUI() end - -- elseif IsAddOnLoaded("Bigwigs") then - -- UB.menuHolder.Addon.bossmode = function() end - elseif IsAddOnLoaded("VEM-Core") then - UB.menuHolder.Addon.bossmode = function() VEM:LoadGUI() end - -- elseif IsAddOnLoaded("DXE_Loader") then - -- UB.menuHolder.Addon.bossmode = function() end - -- elseif IsAddOnLoaded("") then - -- UB.menuHolder.Addon.bossmode = function() end - else - UB.menuHolder.Addon.Boss.shown = false - end - Sk:HandleButton(UB.menuHolder.Addon.Boss) - tinsert(AddonTable, UB.menuHolder.Addon.Boss) - end - do - UB.menuHolder.Addon.Altoholic = CreateFrame("Button", "SLEUIAddonAltoholic", UB.menuHolder.Addon) - UB.menuHolder.Addon.Altoholic.text = UB.menuHolder.Addon.Altoholic:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Altoholic.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Altoholic.text:SetInside(UB.menuHolder.Addon.Altoholic) - UB.menuHolder.Addon.Altoholic.text:SetText("Altoholic") - UB.menuHolder.Addon.Altoholic.text:SetJustifyH("CENTER") - UB.menuHolder.Addon.Altoholic:SetScript("OnClick", function(self) - Altoholic:ToggleUI() - button.opened = false - UB:ToggleCats() - end) - if IsAddOnLoaded("Altoholic") then - UB.menuHolder.Addon.Altoholic.shown = true - else - UB.menuHolder.Addon.Altoholic.shown = false - end - UB.menuHolder.Addon.Altoholic:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon.Altoholic:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Addon.Altoholic) - tinsert(AddonTable, UB.menuHolder.Addon.Altoholic) - end - do - UB.menuHolder.Addon.AtlasLoot = CreateFrame("Button", "SLEUIAddonAtlasLoot", UB.menuHolder.Addon) - UB.menuHolder.Addon.AtlasLoot.text = UB.menuHolder.Addon.AtlasLoot:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.AtlasLoot.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.AtlasLoot.text:SetPoint("CENTER", UB.menuHolder.Addon.AtlasLoot, "CENTER") - UB.menuHolder.Addon.AtlasLoot.text:SetText("AtlasLoot") - UB.menuHolder.Addon.AtlasLoot:SetScript("OnClick", function(self) - AtlasLoot.GUI:Toggle() - button.opened = false - UB:ToggleCats() - end) - if IsAddOnLoaded("AtlasLoot") then - UB.menuHolder.Addon.AtlasLoot.shown = true - else - UB.menuHolder.Addon.AtlasLoot.shown = false - end - UB.menuHolder.Addon.AtlasLoot:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon.AtlasLoot:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Addon.AtlasLoot) - tinsert(AddonTable, UB.menuHolder.Addon.AtlasLoot) - end - - do - UB.menuHolder.Addon.WeakAuras = CreateFrame("Button", "SLEUIAddonWeakAuras", UB.menuHolder.Addon) - UB.menuHolder.Addon.WeakAuras.text = UB.menuHolder.Addon.WeakAuras:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.WeakAuras.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.WeakAuras.text:SetPoint("CENTER", UB.menuHolder.Addon.WeakAuras, "CENTER") - UB.menuHolder.Addon.WeakAuras.text:SetText("WeakAuras") - UB.menuHolder.Addon.WeakAuras:SetScript("OnClick", function(self) - SlashCmdList.WEAKAURAS() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Addon.WeakAuras:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon.WeakAuras:HookScript('OnLeave', UB.OnLeave) - if IsAddOnLoaded("WeakAuras") then - UB.menuHolder.Addon.WeakAuras.shown = true - else - UB.menuHolder.Addon.WeakAuras.shown = false - end - Sk:HandleButton(UB.menuHolder.Addon.WeakAuras) - tinsert(AddonTable, UB.menuHolder.Addon.WeakAuras) - end + + UB:CreateDropdownButton("Addon", "Manager", L["AddOns"], L["AddOns Manager"], L["Click to toggle the AddOn Manager frame."], function() GameMenuButtonAddons:Click() end) + UB:CreateDropdownButton("Addon", "Boss", L["Boss Mod"], L["Boss Mod"], L["Click to toggle the Configuration/Option Window from the Bossmod you have enabled."], function() UB.menuHolder.Addon.Boss.bossmode() end, true) + UB:CreateDropdownButton("Addon", "Altoholic", "Altoholic", nil, nil, Altoholic.ToggleUI, "Altoholic") + UB:CreateDropdownButton("Addon", "AtlasLoot", "AtlasLoot", nil, nil, function() AtlasLoot.GUI:Toggle() end, "AtlasLoot") + UB:CreateDropdownButton("Addon", "WeakAuras", "WeakAuras", nil, nil, SlashCmdList.WEAKAURAS, "WeakAuras") + UB:CreateDropdownButton("Addon", "Swatter", "Swatter", nil, nil, Swatter.ErrorShow, "!Swatter") - do - UB.menuHolder.Addon.Swatter = CreateFrame("Button", "SLEUIAddonSwatter", UB.menuHolder.Addon) - UB.menuHolder.Addon.Swatter.text = UB.menuHolder.Addon.Swatter:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Swatter.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Swatter.text:SetPoint("CENTER", UB.menuHolder.Addon.Swatter, "CENTER") - UB.menuHolder.Addon.Swatter.text:SetText("Swatter") - UB.menuHolder.Addon.Swatter:SetScript("OnClick", function(self) - Swatter.ErrorShow() - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Addon.Swatter:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon.Swatter:HookScript('OnLeave', UB.OnLeave) - if IsAddOnLoaded("!Swatter") then - UB.menuHolder.Addon.Swatter.shown = true - else - UB.menuHolder.Addon.Swatter.shown = false - end - Sk:HandleButton(UB.menuHolder.Addon.Swatter) - tinsert(AddonTable, UB.menuHolder.Addon.Swatter) - end + tinsert(AddonTable, UB.menuHolder.Addon.Manager) + tinsert(AddonTable, UB.menuHolder.Addon.Boss) + tinsert(AddonTable, UB.menuHolder.Addon.Altoholic) + tinsert(AddonTable, UB.menuHolder.Addon.AtlasLoot) + tinsert(AddonTable, UB.menuHolder.Addon.WeakAuras) + tinsert(AddonTable, UB.menuHolder.Addon.Swatter) --Always keep at the bottom-- - do - UB.menuHolder.Addon.WowLua = CreateFrame("Button", "SLEUIAddonWowLua", UB.menuHolder.Addon) - UB.menuHolder.Addon.WowLua.text = UB.menuHolder.Addon.WowLua:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.WowLua.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.WowLua.text:SetPoint("CENTER", UB.menuHolder.Addon.WowLua, "CENTER") - UB.menuHolder.Addon.WowLua.text:SetText("WowLua") - UB.menuHolder.Addon.WowLua:SetScript("OnClick", function(self) - SlashCmdList["WOWLUA"]("") - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Addon.WowLua:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Addon.WowLua:HookScript('OnLeave', UB.OnLeave) - if IsAddOnLoaded("WowLua") then - UB.menuHolder.Addon.WowLua.shown = true - else - UB.menuHolder.Addon.WowLua.shown = false - end - Sk:HandleButton(UB.menuHolder.Addon.WowLua) - tinsert(AddonTable, UB.menuHolder.Addon.WowLua) - end - do - UB.menuHolder.Addon.Darth = CreateFrame("Button", "SLEUIAddonDarth", UB.menuHolder.Addon) - UB.menuHolder.Addon.Darth.text = UB.menuHolder.Addon.Darth:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Addon.Darth.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Addon.Darth.text:SetPoint("CENTER", UB.menuHolder.Addon.Darth, "CENTER") - UB.menuHolder.Addon.Darth.text:SetText("DarthUI") - UB.menuHolder.Addon.Darth:SetScript("OnClick", function(self) - DarthUI[1]:ToggleConfig() - button.opened = false - UB:ToggleCats() - end) - if IsAddOnLoaded("DarthUI") then - UB.menuHolder.Addon.Darth.shown = true - else - UB.menuHolder.Addon.Darth.shown = false - end - Sk:HandleButton(UB.menuHolder.Addon.Darth) - tinsert(AddonTable, UB.menuHolder.Addon.Darth) - end + UB:CreateDropdownButton("Addon", "WowLua", "WowLua", nil, nil, function() SlashCmdList["WOWLUA"]("") end, "WowLua") + UB:CreateDropdownButton("Addon", "Darth", "DarthUI", nil, nil, function() DarthUI[1]:ToggleConfig() end, "DarthUI") + + tinsert(AddonTable, UB.menuHolder.Addon.WowLua) + tinsert(AddonTable, UB.menuHolder.Addon.Darth) end function UB:StatusSetup() @@ -513,38 +288,9 @@ function UB:StatusSetup() end) button:HookScript('OnEnter', UB.OnEnter) button:HookScript('OnLeave', UB.OnLeave) - - do - UB.menuHolder.Status.AFK = CreateFrame("Button", "SLEUIStatusAFK", UB.menuHolder.Status) - UB.menuHolder.Status.AFK.text = UB.menuHolder.Status.AFK:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Status.AFK.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Status.AFK.text:SetPoint("CENTER", UB.menuHolder.Status.AFK, "CENTER") - UB.menuHolder.Status.AFK.text:SetText(L["AFK"]) - UB.menuHolder.Status.AFK:SetScript("OnClick", function(self) - SendChatMessage("" ,"AFK" ) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Status.AFK:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Status.AFK:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Status.AFK) - end - - do - UB.menuHolder.Status.DND = CreateFrame("Button", "SLEUIStatusDND", UB.menuHolder.Status) - UB.menuHolder.Status.DND.text = UB.menuHolder.Status.DND:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Status.DND.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Status.DND.text:SetPoint("CENTER", UB.menuHolder.Status.DND, "CENTER") - UB.menuHolder.Status.DND.text:SetText(L["DND"]) - UB.menuHolder.Status.DND:SetScript("OnClick", function(self) - SendChatMessage("" ,"DND" ) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Status.DND:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Status.DND:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Status.DND) - end + + UB:CreateDropdownButton("Status", "AFK", L["AFK"], nil, nil, function() SendChatMessage("" ,"AFK" ) end) + UB:CreateDropdownButton("Status", "DND", L["DND"], nil, nil, function() SendChatMessage("" ,"DND" ) end) StatusTable = { UB.menuHolder.Status.AFK, @@ -577,109 +323,12 @@ function UB:RollSetup() button:HookScript('OnEnter', UB.OnEnter) button:HookScript('OnLeave', UB.OnLeave) - do - UB.menuHolder.Roll.Ten = CreateFrame("Button", "SLEUIRollTen", UB.menuHolder.Roll) - UB.menuHolder.Roll.Ten.text = UB.menuHolder.Roll.Ten:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Ten.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Ten.text:SetPoint("CENTER", UB.menuHolder.Roll.Ten, "CENTER") - UB.menuHolder.Roll.Ten.text:SetText("1-10") - UB.menuHolder.Roll.Ten:SetScript("OnClick", function(self) - RandomRoll(1, 10) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Ten:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll.Ten:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Roll.Ten) - end - do - UB.menuHolder.Roll.Twenty = CreateFrame("Button", "SLEUIRollTwenty", UB.menuHolder.Roll) - UB.menuHolder.Roll.Twenty.text = UB.menuHolder.Roll.Twenty:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Twenty.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Twenty.text:SetPoint("CENTER", UB.menuHolder.Roll.Twenty, "CENTER") - UB.menuHolder.Roll.Twenty.text:SetText("1-20") - UB.menuHolder.Roll.Twenty:SetScript("OnClick", function(self) - RandomRoll(1, 20) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Twenty:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll.Twenty:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Roll.Twenty) - end - do - UB.menuHolder.Roll.Thirty = CreateFrame("Button", "SLEUIRollThirty", UB.menuHolder.Roll) - UB.menuHolder.Roll.Thirty.text = UB.menuHolder.Roll.Thirty:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Thirty.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Thirty.text:SetPoint("CENTER", UB.menuHolder.Roll.Thirty, "CENTER") - UB.menuHolder.Roll.Thirty.text:SetText("1-30") - UB.menuHolder.Roll.Thirty:SetScript("OnClick", function(self) - RandomRoll(1, 30) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Thirty:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll.Thirty:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Roll.Thirty) - end - do - UB.menuHolder.Roll.Forty = CreateFrame("Button", "SLEUIRollForty", UB.menuHolder.Roll) - UB.menuHolder.Roll.Forty.text = UB.menuHolder.Roll.Forty:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Forty.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Forty.text:SetPoint("CENTER", UB.menuHolder.Roll.Forty, "CENTER") - UB.menuHolder.Roll.Forty.text:SetText("1-40") - UB.menuHolder.Roll.Forty:SetScript("OnClick", function(self) - RandomRoll(1, 40) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Forty:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll.Forty:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Roll.Forty) - end - do - UB.menuHolder.Roll.Hundred = CreateFrame("Button", "SLEUIRollHundred", UB.menuHolder.Roll) - UB.menuHolder.Roll.Hundred.text = UB.menuHolder.Roll.Hundred:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Hundred.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Hundred.text:SetPoint("CENTER", UB.menuHolder.Roll.Hundred, "CENTER") - UB.menuHolder.Roll.Hundred.text:SetText("1-100") - UB.menuHolder.Roll.Hundred:SetScript("OnClick", function(self) - RandomRoll(1, 100) - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Hundred:HookScript('OnEnter', UB.OnEnter) - UB.menuHolder.Roll.Hundred:HookScript('OnLeave', UB.OnLeave) - Sk:HandleButton(UB.menuHolder.Roll.Hundred) - end - do - UB.menuHolder.Roll.Custom = CreateFrame("Button", "SLEUIRollCustom", UB.menuHolder.Roll) - UB.menuHolder.Roll.Custom.text = UB.menuHolder.Roll.Custom:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Roll.Custom.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Roll.Custom.text:SetPoint("CENTER", UB.menuHolder.Roll.Custom, "CENTER") - UB.menuHolder.Roll.Custom.text:SetText(L["Custom"]) - UB.menuHolder.Roll.Custom:SetScript("OnClick", function(self) - local min, max = tonumber(E.db.sle.uibuttons.roll.min), tonumber(E.db.sle.uibuttons.roll.max) - if min <= max then - RandomRoll(min, max) - else - SLE:Print(L["Custom roll limits are set incorrectly! Minimum should be smaller then or equial to maximum."]) - end - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Roll.Custom:SetScript("OnEnter", function(self) - UB:OnEnter() - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["Do a roll with custom limits. Those limits can be set in S&L config."], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Roll.Custom:SetScript("OnLeave", function(self) - UB:OnLeave() - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Roll.Custom) - end + UB:CreateDropdownButton("Roll", "Ten", "1-10", nil, nil, function() RandomRoll(1, 10) end) + UB:CreateDropdownButton("Roll", "Twenty", "1-20", nil, nil, function() RandomRoll(1, 20) end) + UB:CreateDropdownButton("Roll", "Thirty", "1-30", nil, nil, function() RandomRoll(1, 30) end) + UB:CreateDropdownButton("Roll", "Forty", "1-40", nil, nil, function() RandomRoll(1, 40) end) + UB:CreateDropdownButton("Roll", "Hundred", "1-100", nil, nil, function() RandomRoll(1, 100) end) + UB:CreateDropdownButton("Roll", "Custom", L["Custom"], nil, nil, CusomRollCall) RollTable = { UB.menuHolder.Roll.Ten, @@ -709,20 +358,20 @@ function UB:FrameSize(onLoad) for i = 1, #ToggleTable do ToggleTable[i]:Size(db.size) end - UB.menuHolder.Config:Size(db.size * 2.5, (db.size * #ConfigTable)+(db.spacing*(#ConfigTable-1))) + UB.menuHolder.Config:Size(db.size * 2.6, (db.size * #ConfigTable)+(db.spacing*(#ConfigTable-1))) for i = 1, #ConfigTable do - ConfigTable[i]:Size(db.size * 2.5, db.size) + ConfigTable[i]:Size(db.size * 2.6, db.size) end for i = 1, #AddonTable do - AddonTable[i]:Size(db.size * 3, db.size) + AddonTable[i]:Size(db.size * 3.1, db.size) end - UB.menuHolder.Status:Size(db.size * 2, (db.size * #StatusTable)+(db.spacing*(#StatusTable-1))) + UB.menuHolder.Status:Size(db.size * 2.1, (db.size * #StatusTable)+(db.spacing*(#StatusTable-1))) for i = 1, #StatusTable do - StatusTable[i]:Size(db.size * 2, db.size) + StatusTable[i]:Size(db.size * 2.1, db.size) end - UB.menuHolder.Roll:Size(db.size * 2, (db.size * #RollTable)+(db.spacing*(#RollTable-1))) + UB.menuHolder.Roll:Size(db.size * 2.1, (db.size * #RollTable)+(db.spacing*(#RollTable-1))) for i = 1, #RollTable do - RollTable[i]:Size(db.size * 2, db.size) + RollTable[i]:Size(db.size * 2.1, db.size) end UB:Positioning(onLoad) @@ -763,7 +412,7 @@ function UB:UpdateAddonLayout(load) AddonTable[i]:Hide() end end - UB.menuHolder.Addon:Size(db.size * 3, (db.size * (count+1))+(db.spacing*(count))) + UB.menuHolder.Addon:Size(db.size * 3.1, (db.size * (count+1))+(db.spacing*(count))) end end @@ -817,6 +466,7 @@ function UB:Positioning(load) UB:UpdateRollLayout(load) end + function UB:Toggle() if not E.db.sle.uibuttons.enable then UB.menuHolder:Hide() -- 1.7.9.5