diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua index e2c1ca3..426c3a1 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua @@ -36,6 +36,8 @@ GET ADDON DATA local SuperVillain, L = unpack(select(2, ...)); local MOD = {}; local LibAB = LibStub("LibActionButton-1.0"); +local NUM_ACTIONBAR_BUTTONS = NUM_ACTIONBAR_BUTTONS + MOD.Storage = {}; MOD.Storage["Cache"] = {}; MOD.Storage["Bar1"] = {}; @@ -232,6 +234,22 @@ local CLEANFONT = SuperVillain.Media.font.roboto; local SetSpellFlyoutHook; local NewFrame = CreateFrame; local NewHook = hooksecurefunc; +local ICON_FILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\MICROMENU]] +local ICON_DATA = { + {"CharacterMicroButton",0,0.25,0,0.25}, -- MICRO-CHARACTER + {"SpellbookMicroButton",0.25,0.5,0,0.25}, -- MICRO-SPELLBOOK + {"TalentMicroButton",0.5,0.75,0,0.25}, -- MICRO-TALENTS + {"AchievementMicroButton",0.75,1,0,0.25}, -- MICRO-ACHIEVEMENTS + {"QuestLogMicroButton",0,0.25,0.25,0.5}, -- MICRO-QUESTS + {"GuildMicroButton",0.25,0.5,0.25,0.5}, -- MICRO-GUILD + {"PVPMicroButton",0.5,0.75,0.25,0.5}, -- MICRO-PVP + {"LFDMicroButton",0.75,1,0.25,0.5}, -- MICRO-LFD + {"EJMicroButton",0,0.25,0.5,0.75}, -- MICRO-ENCOUNTER + {"StoreMicroButton",0.25,0.5,0.5,0.75}, -- MICRO-STORE + {"CompanionsMicroButton",0.5,0.75,0.5,0.75},-- MICRO-COMPANION + {"MainMenuMicroButton",0.75,1,0.5,0.75}, -- MICRO-SYSTEM + {"HelpMicroButton",0,0.25,0.75,1}, -- MICRO-HELP +}; --[[ ########################################################## LOCAL FUNCTIONS @@ -247,6 +265,87 @@ local Bar_OnLeave = function(self) if(self._fade) then SuperVillain:SecureFadeOut(self, 1, self:GetAlpha(), 0) end +end + +local function RefreshMicrobar() + if not SVUI_MicroBar then return end + local lastParent = SVUI_MicroBar; + local buttonSize = MOD.db.Micro.buttonsize or 30; + local spacing = MOD.db.Micro.buttonspacing or 1; + local barWidth = (buttonSize + spacing) * 13; + SVUI_MicroBar_MOVE:Size(barWidth, buttonSize + 6) + SVUI_MicroBar:SetAllPoints(SVUI_MicroBar_MOVE) + for i=1,13 do + local data = ICON_DATA[i] + local button = _G[data[1]] + button:ClearAllPoints() + button:Size(buttonSize, buttonSize + 28) + button._fade = MOD.db.Micro.mouseover + if lastParent == SVUI_MicroBar then + button:SetPoint("BOTTOMLEFT",lastParent,"BOTTOMLEFT",1,1) + else + button:SetPoint('LEFT',lastParent,'RIGHT',spacing,0) + end + lastParent = button; + button:Show() + end +end + +local SVUIMicroButton_SetNormal = function() + local level = MainMenuMicroButton:GetFrameLevel() + if(level > 0) then + MainMenuMicroButton:SetFrameLevel(level - 1) + else + MainMenuMicroButton:SetFrameLevel(0) + end + MainMenuMicroButton:SetFrameStrata("BACKGROUND") + MainMenuMicroButton.overlay:SetFrameLevel(level + 1) + MainMenuMicroButton.overlay:SetFrameStrata("HIGH") + MainMenuBarPerformanceBar:Hide() + HelpMicroButton:Show() +end + +local SVUIMicroButtonsParent = function(self) + if self ~= SVUI_MicroBar then + self = SVUI_MicroBar + end + for i=1,13 do + local data = ICON_DATA[i] + _G[data[1]]:SetParent(SVUI_MicroBar) + end +end + +local MicroButton_OnEnter = function(self) + if InCombatLockdown()then return end + self.overlay:SetPanelColor("highlight") + self.overlay.icon:SetGradient("VERTICAL", 0.75, 0.75, 0.75, 1, 1, 1) + if(self._fade) then + SuperVillain:SecureFadeIn(SVUI_MicroBar,0.2,SVUI_MicroBar:GetAlpha(),1) + SuperVillain:SecureFadeOut(SVUI_MicroBar.screenMarker,0.1,SVUI_MicroBar:GetAlpha(),0) + end +end + +local MicroButton_OnLeave = function(self) + if InCombatLockdown()then return end + self.overlay:SetPanelColor("special") + self.overlay.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + if(self._fade) then + SuperVillain:SecureFadeOut(SVUI_MicroBar,1,SVUI_MicroBar:GetAlpha(),0) + SuperVillain:SecureFadeIn(SVUI_MicroBar.screenMarker,5,SVUI_MicroBar:GetAlpha(),1) + end +end + +local MicroButton_OnUpdate = function() + if(not MOD.db.Micro.mouseover) then + SVUI_MicroBar:SetAlpha(1) + SVUI_MicroBar.screenMarker:SetAlpha(0) + else + SVUI_MicroBar:SetAlpha(0) + SVUI_MicroBar.screenMarker:SetAlpha(1) + end + GuildMicroButtonTabard:ClearAllPoints(); + GuildMicroButtonTabard:Hide(); + RefreshMicrobar() end function MOD:FixKeybindText(button) @@ -485,13 +584,15 @@ do local SpellFlyout_OnShow = function() for i=1,maxFlyoutCount do - if _G["SpellFlyoutButton"..i] then - ModifyActionButton(_G["SpellFlyoutButton"..i]) - SaveActionButton(_G["SpellFlyoutButton"..i]) + local name = ("SpellFlyoutButton%s"):format(i) + local button = _G[name] + if(button) then + ModifyActionButton(button) + SaveActionButton(button) - _G["SpellFlyoutButton"..i]:HookScript('OnEnter', SpellFlyoutButton_OnEnter) + button:HookScript('OnEnter', SpellFlyoutButton_OnEnter) - _G["SpellFlyoutButton"..i]:HookScript('OnLeave', SpellFlyoutButton_OnLeave) + button:HookScript('OnLeave', SpellFlyoutButton_OnLeave) end end SpellFlyout:HookScript('OnEnter', SpellFlyout_OnEnter) @@ -522,29 +623,35 @@ function MOD:UpdateBarBindings(pet,stance) local preset = self.Storage['Stance']; local bindText = preset.binding; for i=1,NUM_STANCE_SLOTS do + local name = ("SVUI_StanceBarButton%s"):format(i) + local hkname = ("SVUI_StanceBarButton%sHotKey"):format(i) + local hotkey = _G[hkname] if self.db.hotkeytext then - local key = format(bindText, i); + local key = bindText:format(i); local binding = GetBindingKey(key) - _G["SVUI_StanceBarButton"..i.."HotKey"]:Show() - _G["SVUI_StanceBarButton"..i.."HotKey"]:SetText(binding) - MOD:FixKeybindText(_G["SVUI_StanceBarButton"..i]) + hotkey:Show() + hotkey:SetText(binding) + MOD:FixKeybindText(_G[name]) else - _G["SVUI_StanceBarButton"..i.."HotKey"]:Hide() + hotkey:Hide() end end end if pet == true then local preset = self.Storage['Pet']; local bindText = preset.binding; - for i=1,NUM_PET_ACTION_SLOTS do + for i=1,NUM_PET_ACTION_SLOTS do + local name = ("PetActionButton%s"):format(i) + local hkname = ("PetActionButton%sHotKey"):format(i) + local hotkey = _G[hkname] if self.db.hotkeytext then - local key = format(bindText, i); + local key = bindText:format(i); local binding = GetBindingKey(key) - _G["PetActionButton"..i.."HotKey"]:Show() - _G["PetActionButton"..i.."HotKey"]:SetText(binding) - MOD:FixKeybindText(_G["PetActionButton"..i]) + hotkey:Show() + hotkey:SetText(binding) + MOD:FixKeybindText(_G[name]) else - _G["PetActionButton"..i.."HotKey"]:Hide() + hotkey:Hide() end end end @@ -562,11 +669,11 @@ function MOD:UpdateAllBindings(event) local buttons = stored.buttons; if not bar or not buttons then return end ClearOverrideBindings(bar); - local nameMod = bar:GetName().."Button"; + local nameMod = bar:GetName(); local thisBinding = stored.binding; for i=1,#buttons do - local binding = format(thisBinding, i); - local btn = nameMod..i; + local binding = thisBinding:format(i); + local btn = ("%sButton%d"):format(nameMod,i); for x=1,select('#',GetBindingKey(binding)) do local key = select(x,GetBindingKey(binding)) if (key and key ~= "") then @@ -592,7 +699,7 @@ function MOD:SetBarConfigData(barID) SetModifiedClick("PICKUPACTION", self.db.unlock) for i,button in pairs(buttonList)do if thisBinding then - data.config.keyBoundTarget = format(thisBinding,i) + data.config.keyBoundTarget = thisBinding:format(i) end button.keyBoundTarget = data.config.keyBoundTarget; button.postKeybind = self.FixKeybindText; @@ -604,19 +711,27 @@ function MOD:SetBarConfigData(barID) end function MOD:UpdateBarPagingDefaults() - local parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6;"; + local parse, custom; if self.db.Bar6.enable then - parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6;"; + parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; + else + parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; end if self.db.Bar1.useCustomPaging then - parse = parse .. " " .. self.db.Bar1.customPaging[SuperVillain.class]; + custom = self.db.Bar1.customPaging[SuperVillain.class]; + else + custom = "" end - self.Storage['Bar1'].conditions = format(parse, GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex()); + + self.Storage['Bar1'].conditions = parse:format(GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex(), custom); + for i=2, 6 do - if self.db['Bar'..i].useCustomPaging then - self.Storage['Bar'..i].conditions = self.db['Bar'..i].customPaging[SuperVillain.class]; + local id = ("Bar%d"):format(i) + if self.db[id].useCustomPaging then + self.Storage[id].conditions = self.db[id].customPaging[SuperVillain.class]; end end + if((not SuperVillain.db.SVBar.enable or InCombatLockdown()) or not self.isInitialized) then return end local Bar2Option = InterfaceOptionsActionBarsPanelBottomRight local Bar3Option = InterfaceOptionsActionBarsPanelBottomLeft @@ -836,10 +951,11 @@ do end --RegisterStateDriver(bar, "show", barVisibility) else - local page = _getPage(id, data.page, data.conditions) - if data.conditions:find("[form, noform]") then + local p,c = data.page, data.conditions + local page = _getPage(id, p, c) + if c:find("[form, noform]") then bar:SetAttribute("hasTempBar", true) - local newCondition = gsub(data.conditions, " %[form, noform%] 0; ", ""); + local newCondition = c:gsub(" %[form, noform%] 0; ", ""); bar:SetAttribute("newCondition", newCondition) else bar:SetAttribute("hasTempBar", false) @@ -858,8 +974,8 @@ do else bar:Hide() UnregisterStateDriver(bar, "visibility") - end - SuperVillain:SetSnapOffset("SVUI_Action"..id.."_MOVE", (space / 2)) + end + SuperVillain:SetSnapOffset(("SVUI_Action%d_MOVE"):format(id), (space / 2)) end end end @@ -867,7 +983,7 @@ end function MOD:RefreshActionBars() if InCombatLockdown() then return end self:UpdateBarPagingDefaults() - for button,_ in pairs(self.Storage.Cache)do + for button, _ in pairs(self.Storage.Cache)do if button then ModifyActionButton(button) SaveActionButton(button) @@ -875,16 +991,17 @@ function MOD:RefreshActionBars() SetFlyoutButton(button) end else - self.Storage.Cache[button]=nil + self.Storage.Cache[button] = nil end end - for t=1,6 do - self:RefreshBar("Bar"..t) + for i = 1, 6 do + local id = ("Bar%d"):format(i) + self:RefreshBar(id) end self:RefreshBar("Pet") self:RefreshBar("Stance") - self:UpdateBarBindings(true,true) - for barID,stored in pairs(self.Storage)do + self:UpdateBarBindings(true, true) + for barID, stored in pairs(self.Storage)do if barID ~= "Pet" and barID ~= "Stance" then self:SetBarConfigData(barID) end @@ -892,16 +1009,16 @@ function MOD:RefreshActionBars() end local Vehicle_Updater = function() - local bar = MOD.Storage['Bar1'].bar - local space = SuperVillain:Scale(MOD.db['Bar1'].buttonspacing) - local total = MOD.db['Bar1'].buttons; - local rows = MOD.db['Bar1'].buttonsPerRow; - local size = SuperVillain:Scale(MOD.db['Bar1'].buttonsize) - local point = MOD.db['Bar1'].point; + local bar = MOD.Storage["Bar1"].bar + local space = SuperVillain:Scale(MOD.db["Bar1"].buttonspacing) + local total = MOD.db["Bar1"].buttons; + local rows = MOD.db["Bar1"].buttonsPerRow; + local size = SuperVillain:Scale(MOD.db["Bar1"].buttonsize) + local point = MOD.db["Bar1"].point; local columns = ceil(total / rows) - if (HasOverrideActionBar() or HasVehicleActionBar()) and total==12 then + if (HasOverrideActionBar() or HasVehicleActionBar()) and total == 12 then bar.backdrop:ClearAllPoints() - bar.backdrop:Point(MOD.db['Bar1'].point, bar, MOD.db['Bar1'].point) + bar.backdrop:Point(MOD.db["Bar1"].point, bar, MOD.db["Bar1"].point) bar.backdrop:Width(space + ((size * rows) + (space * (rows - 1)) + space)) bar.backdrop:Height(space + ((size * columns) + (space * (columns - 1)) + space)) bar.backdrop:SetFrameLevel(0); @@ -916,41 +1033,11 @@ end HOOKED / REGISTERED FUNCTIONS ########################################################## ]]-- -local CreateExtraBar = function(self) - local specialBar = CreateFrame("Frame", "SVUI_SpecialAbility", SuperVillain.UIParent) - specialBar:Point("TOP", SuperVillain.UIParent, "CENTER", 0, -50) - specialBar:Size(ExtraActionBarFrame:GetSize()) - ExtraActionBarFrame:SetParent(specialBar) - ExtraActionBarFrame:ClearAllPoints() - ExtraActionBarFrame:SetPoint("CENTER", specialBar, "CENTER") - ExtraActionBarFrame.ignoreFramePositionManager = true; - local max = ExtraActionBarFrame:GetNumChildren() - for i = 1, max do - if _G["ExtraActionButton"..i] then - _G["ExtraActionButton"..i].noResize = true; - _G["ExtraActionButton"..i].pushed = true; - _G["ExtraActionButton"..i].checked = true; - ModifyActionButton(_G["ExtraActionButton"..i]) - _G["ExtraActionButton"..i]:SetFixedPanelTemplate() - _G["ExtraActionButton"..i.."Icon"]:SetDrawLayer("ARTWORK") - _G["ExtraActionButton"..i.."Cooldown"]:FillInner() - local checkedTexture = _G["ExtraActionButton"..i]:CreateTexture(nil, "OVERLAY") - checkedTexture:SetTexture(0.9, 0.8, 0.1, 0.3) - checkedTexture:FillInner() - _G["ExtraActionButton"..i]:SetCheckedTexture(checkedTexture) - end - end - if HasExtraActionBar()then - ExtraActionBarFrame:Show() - end - SuperVillain:SetSVMovable(specialBar, "SVUI_SpecialAbility_MOVE", L["Boss Button"], nil, nil, nil, "ALL, ACTIONBAR") -end - local SVUIOptionsPanel_OnEvent = function() - InterfaceOptionsActionBarsPanelBottomRight.Text:SetText(format(L['Remove Bar %d Action Page'],2)) - InterfaceOptionsActionBarsPanelBottomLeft.Text:SetText(format(L['Remove Bar %d Action Page'],3)) - InterfaceOptionsActionBarsPanelRightTwo.Text:SetText(format(L['Remove Bar %d Action Page'],4)) - InterfaceOptionsActionBarsPanelRight.Text:SetText(format(L['Remove Bar %d Action Page'],5)) + InterfaceOptionsActionBarsPanelBottomRight.Text:SetText((L['Remove Bar %d Action Page']):format(2)) + InterfaceOptionsActionBarsPanelBottomLeft.Text:SetText((L['Remove Bar %d Action Page']):format(3)) + InterfaceOptionsActionBarsPanelRightTwo.Text:SetText((L['Remove Bar %d Action Page']):format(4)) + InterfaceOptionsActionBarsPanelRight.Text:SetText((L['Remove Bar %d Action Page']):format(5)) InterfaceOptionsActionBarsPanelBottomRight:SetScript('OnEnter',nil) InterfaceOptionsActionBarsPanelBottomLeft:SetScript('OnEnter',nil) InterfaceOptionsActionBarsPanelRightTwo:SetScript('OnEnter',nil) @@ -963,63 +1050,527 @@ local SVUIButton_ShowOverlayGlow = function(self) self.overlay:WrapOuter(self, size) end -local function ResetAllBindings() +local ResetAllBindings = function(self) if InCombatLockdown()then return end - for barID,stored in pairs(MOD.Storage)do + for barID,stored in pairs(self.Storage)do local bar = stored.bar; if not bar then return end ClearOverrideBindings(bar); end - MOD:RegisterEvent("PLAYER_REGEN_DISABLED","UpdateAllBindings") + self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateAllBindings") end +--[[ +########################################################## +BAR CREATION +########################################################## +]]-- +local CreateActionBars, CreateStanceBar, CreatePetBar, CreateMicroBar; + +CreateActionBars = function(self) + for i = 1, 6 do + local barID = ("Bar%d"):format(i) + local barName = ("SVUI_Action%s"):format(barID) + local buttonMax = NUM_ACTIONBAR_BUTTONS + + local thisBar = CreateFrame("Frame", barName, SuperVillain.UIParent, "SecureHandlerStateTemplate") + + if(i == 1) then + thisBar:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 28) + elseif(i == 2) then + thisBar:Point("BOTTOM", _G["SVUI_ActionBar1"], "TOP", 0, 4) + elseif(i == 3) then + thisBar:Point("BOTTOMLEFT", _G["SVUI_ActionBar1"], "BOTTOMRIGHT", 4, 0) + elseif(i == 4) then + thisBar:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -4, 0) + elseif(i == 5) then + thisBar:Point("BOTTOMRIGHT", _G["SVUI_ActionBar1"], "BOTTOMLEFT", -4, 0) + else + thisBar:Point("BOTTOM", _G["SVUI_ActionBar2"], "TOP", 0, 4) + end + + local bg = CreateFrame("Frame", nil, thisBar) + bg:SetAllPoints() + bg:SetFrameLevel(0) + thisBar:SetFrameLevel(5) + bg:SetPanelTemplate("Component") + bg:SetPanelColor("dark") + thisBar.backdrop = bg + + self.Storage[barID].buttons = {} + + for k = 1, buttonMax do + local buttonName = ("%sButton%d"):format(barName, k) + self.Storage[barID].buttons[k] = LibAB:CreateButton(k, buttonName, thisBar, nil) + self.Storage[barID].buttons[k]:SetState(0, "action", k) + for x = 1, 14 do + local calc = (x - 1) * buttonMax + k; + self.Storage[barID].buttons[k]:SetState(x, "action", calc) + end; + if k == 12 then + self.Storage[barID].buttons[k]:SetState(12, "custom", { + func = function(...) + if UnitExists("vehicle") then + VehicleExit() + else + PetDismiss() + end + end, + texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down", + tooltip = LEAVE_VEHICLE + }); + end + end; + self:SetBarConfigData(barID) + if i == 1 then + thisBar:SetAttribute("hasTempBar", true) + else + thisBar:SetAttribute("hasTempBar", false) + end; + thisBar:SetAttribute("_onstate-page", [[ + if HasTempShapeshiftActionBar() and self:GetAttribute("hasTempBar") then + newstate = GetTempShapeshiftBarIndex() or newstate + end + + if newstate ~= 0 then + self:SetAttribute("state", newstate) + control:ChildUpdate("state", newstate) + else + local newCondition = self:GetAttribute("newCondition") + if newCondition then + newstate = SecureCmdOptionParse(newCondition) + self:SetAttribute("state", newstate) + control:ChildUpdate("state", newstate) + end + end + ]]); + self.Storage[barID].bar = thisBar; + self:RefreshBar(barID) + SuperVillain:SetSVMovable(thisBar, L[barID], nil, nil, nil, "ALL, ACTIONBARS") + end +end + +do + local function SetStanceBarButtons() + local maxForms = GetNumShapeshiftForms(); + local currentForm = GetShapeshiftForm(); + local maxButtons = NUM_STANCE_SLOTS; + local texture, name, isActive, isCastable, _; + for i = 1, maxButtons do + local button = _G["SVUI_StanceBarButton"..i] + local icon = _G["SVUI_StanceBarButton"..i.."Icon"] + local cd = _G["SVUI_StanceBarButton"..i.."Cooldown"] + if i <= maxForms then + texture, name, isActive, isCastable = GetShapeshiftFormInfo(i) + if texture == "Interface\\Icons\\Spell_Nature_WispSplode" and MOD.db.Stance.style == "darkenInactive" then + _, _, texture = GetSpellInfo(name) + end + icon:SetTexture(texture) + if texture then + cd:SetAlpha(1) + else + cd:SetAlpha(0) + end + if isActive then + StanceBarFrame.lastSelected = button:GetID() + if maxForms == 1 then + button:SetChecked(1) + else + if button.checked then button.checked:SetTexture(0, 0.5, 0, 0.2) end + button:SetBackdropBorderColor(0.4, 0.8, 0) + button:SetChecked(MOD.db.Stance.style ~= "darkenInactive") + end + else + if maxForms == 1 or currentForm == 0 then + button:SetChecked(0) + else + button:SetBackdropBorderColor(0, 0, 0) + button:SetChecked(MOD.db.Stance.style == "darkenInactive") + if button.checked then + button.checked:SetAlpha(1) + if MOD.db.Stance.style == "darkenInactive" then + button.checked:SetTexture(0, 0, 0, 0.75) + else + button.checked:SetTexture(1, 1, 1, 0.25) + end + end + end + end + if isCastable then + icon:SetVertexColor(1.0, 1.0, 1.0) + else + icon:SetVertexColor(0.4, 0.4, 0.4) + end + end + end + end + + local function UpdateShapeshiftForms(self, event) + if InCombatLockdown() or not _G["SVUI_StanceBar"] then return end + local bar = _G["SVUI_StanceBar"]; + for i = 1, #MOD.Storage["Stance"].buttons do + MOD.Storage["Stance"].buttons[i]:Hide() + end + local ready = false; + local maxForms = GetNumShapeshiftForms() + for i = 1, NUM_STANCE_SLOTS do + if not MOD.Storage["Stance"].buttons[i]then + MOD.Storage["Stance"].buttons[i] = CreateFrame("CheckButton", format("SVUI_StanceBarButton%d", i), bar, "StanceButtonTemplate") + MOD.Storage["Stance"].buttons[i]:SetID(i) + ready = true + end + if i <= maxForms then + MOD.Storage["Stance"].buttons[i]:Show() + else + MOD.Storage["Stance"].buttons[i]:Hide() + end + end + MOD:RefreshBar("Stance") + if event == "UPDATE_SHAPESHIFT_FORMS" then + SetStanceBarButtons() + end + if not C_PetBattles.IsInBattle() or ready then + if maxForms == 0 then + UnregisterStateDriver(bar, "show") + bar:Hide() + else + bar:Show() + RegisterStateDriver(bar, "show", "[petbattle] hide;show") + end + end + end + + local function UpdateShapeshiftCD() + local maxForms = GetNumShapeshiftForms() + for i = 1, NUM_STANCE_SLOTS do + if i <= maxForms then + local cooldown = _G["SVUI_StanceBarButton"..i.."Cooldown"] + local start, duration, enable = GetShapeshiftFormCooldown(i) + CooldownFrame_SetTimer(cooldown, start, duration, enable) + end + end + end + + CreateStanceBar = function(self) + local barID = "Stance"; + local parent = _G["SVUI_ActionBar1"] + local maxForms = GetNumShapeshiftForms(); + if self.db["Bar2"].enable then + parent = _G["SVUI_ActionBar2"] + end + local stanceBar = CreateFrame("Frame", "SVUI_StanceBar", SuperVillain.UIParent, "SecureHandlerStateTemplate") + stanceBar:Point("BOTTOMRIGHT",parent,"TOPRIGHT",0,2); + stanceBar:SetFrameLevel(5); + local bg = CreateFrame("Frame", nil, stanceBar) + bg:SetAllPoints(); + bg:SetFrameLevel(0); + bg:SetPanelTemplate("Component") + bg:SetPanelColor("dark") + stanceBar.backdrop = bg; + for i = 1, NUM_STANCE_SLOTS do + self.Storage[barID].buttons[i] = _G["SVUI_StanceBarButton"..i] + end + stanceBar:SetAttribute("_onstate-show", [[ + if newstate == "hide" then + self:Hide(); + else + self:Show(); + end + ]]); + self.Storage[barID].bar = stanceBar; + self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", UpdateShapeshiftForms) + self:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN", UpdateShapeshiftCD) + self:RegisterEvent("UPDATE_SHAPESHIFT_USABLE", SetStanceBarButtons) + self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", SetStanceBarButtons) + self:RegisterEvent("ACTIONBAR_PAGE_CHANGED", SetStanceBarButtons) + UpdateShapeshiftForms() + SuperVillain:SetSVMovable(stanceBar, L["Stance Bar"], nil, -3, nil, "ALL, ACTIONBARS") + self:RefreshBar("Stance") + SetStanceBarButtons() + self:UpdateBarBindings(false, true) + end +end + +do + local RefreshPet = function(self, event, arg) + if event == "UNIT_AURA" and arg ~= "pet" then return end + for i = 1, NUM_PET_ACTION_SLOTS, 1 do + local name = "PetActionButton"..i; + local button = _G[name] + local icon = _G[name.."Icon"] + local auto = _G[name.."AutoCastable"] + local shine = _G[name.."Shine"] + local checked = button:GetCheckedTexture() + local actionName, subtext, actionIcon, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i) + button:SetChecked(0) + button:SetBackdropBorderColor(0, 0, 0) + checked:SetAlpha(0) + if(not isToken) then + icon:SetTexture(actionIcon) + button.tooltipName = actionName + else + icon:SetTexture(_G[actionIcon]) + button.tooltipName = _G[actionName] + end + button.isToken = isToken; + button.tooltipSubtext = subtext; + if arg and actionName ~= "PET_ACTION_FOLLOW" then + if(IsPetAttackAction(i)) then PetActionButton_StartFlash(button) end + else + if(IsPetAttackAction(i)) then PetActionButton_StopFlash(button) end + end + if autoCastAllowed then + auto:Show() + else + auto:Hide() + end + if (isActive and actionName ~= "PET_ACTION_FOLLOW") then + button:SetChecked(1) + checked:SetAlpha(1) + button:SetBackdropBorderColor(0.4, 0.8, 0) + else + button:SetChecked(0) + checked:SetAlpha(0) + button:SetBackdropBorderColor(0, 0, 0) + end + if(autoCastEnabled) then + AutoCastShine_AutoCastStart(shine) + else + AutoCastShine_AutoCastStop(shine) + end + button:SetAlpha(1) + if actionIcon then + icon:Show() + if GetPetActionSlotUsable(i)then + SetDesaturation(icon, nil) + else + SetDesaturation(icon, 1) + end + else + icon:Hide() + end + if(not PetHasActionBar() and actionIcon and actionName ~= "PET_ACTION_FOLLOW") then + PetActionButton_StopFlash(button) + SetDesaturation(icon, 1) + button:SetChecked(0) + end + end + end + + CreatePetBar = function(self) + local barID = "Pet"; + local parent = _G["SVUI_ActionBar1"] + if self.db["Bar2"].enable then + parent = _G["SVUI_ActionBar2"] + end + local petBar = CreateFrame("Frame", "SVUI_PetActionBar", SuperVillain.UIParent, "SecureHandlerStateTemplate") + petBar:Point("BOTTOMLEFT",parent,"TOPLEFT",0,2); + petBar:SetFrameLevel(5); + local bg = CreateFrame("Frame", nil, petBar) + bg:SetAllPoints(); + bg:SetFrameLevel(0); + bg:SetPanelTemplate("Component") + bg:SetPanelColor("dark") + petBar.backdrop = bg; + for i = 1, NUM_PET_ACTION_SLOTS do + self.Storage[barID].buttons[i] = _G["PetActionButton"..i] + end + petBar:SetAttribute("_onstate-show", [[ + if newstate == "hide" then + self:Hide(); + else + self:Show(); + end + ]]); + self.Storage[barID].bar = petBar; + PetActionBarFrame.showgrid = 1; + PetActionBar_ShowGrid(); + self:RefreshBar("Pet") + self:UpdateBarBindings(true, false) + self:RegisterEvent("PLAYER_CONTROL_GAINED", RefreshPet) + self:RegisterEvent("PLAYER_ENTERING_WORLD", RefreshPet) + self:RegisterEvent("PLAYER_CONTROL_LOST", RefreshPet) + self:RegisterEvent("PET_BAR_UPDATE", RefreshPet) + self:RegisterEvent("UNIT_PET", RefreshPet) + self:RegisterEvent("UNIT_FLAGS", RefreshPet) + self:RegisterEvent("UNIT_AURA", RefreshPet) + self:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED", RefreshPet) + self:RegisterEvent("PET_BAR_UPDATE_COOLDOWN", PetActionBar_UpdateCooldowns) + + SuperVillain:SetSVMovable(petBar, L["Pet Bar"], nil, nil, nil, "ALL, ACTIONBARS") + end +end + +CreateMicroBar = function(self) + local buttonSize = self.db.Micro.buttonsize or 30; + local spacing = self.db.Micro.buttonspacing or 1; + local barWidth = (buttonSize + spacing) * 13; + local microBar = NewFrame('Frame','SVUI_MicroBar',SuperVillain.UIParent) + microBar:Size(barWidth,buttonSize + 6) + microBar:SetFrameStrata("HIGH") + microBar:SetFrameLevel(0) + microBar:Point('TOP',SuperVillain.UIParent,'TOP',0,4) + SuperVillain:AddToDisplayAudit(microBar) + for i=1,13 do + local data = ICON_DATA[i] + local button = _G[data[1]] + button:SetParent(SVUI_MicroBar) + button:Size(buttonSize, buttonSize + 28) + button.Flash:SetTexture("") + if button.SetPushedTexture then + button:SetPushedTexture("") + end + if button.SetNormalTexture then + button:SetNormalTexture("") + end + if button.SetDisabledTexture then + button:SetDisabledTexture("") + end + if button.SetHighlightTexture then + button:SetHighlightTexture("") + end + button:Formula409() + + local buttonMask = NewFrame("Frame",nil,button) + buttonMask:SetPoint("TOPLEFT",button,"TOPLEFT",0,-28) + buttonMask:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",0,0) + buttonMask:SetFramedButtonTemplate() + buttonMask:SetPanelColor() + buttonMask.icon = buttonMask:CreateTexture(nil,"OVERLAY",nil,2) + buttonMask.icon:FillInner(buttonMask,2,2) + buttonMask.icon:SetTexture(ICON_FILE) + buttonMask.icon:SetTexCoord(data[2],data[3],data[4],data[5]) + buttonMask.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + button.overlay = buttonMask; + button._fade = self.db.Micro.mouseover + button:HookScript('OnEnter', MicroButton_OnEnter) + button:HookScript('OnLeave', MicroButton_OnLeave) + button:Show() + end + + MicroButtonPortrait:ClearAllPoints() + MicroButtonPortrait:Hide() + MainMenuBarPerformanceBar:ClearAllPoints() + MainMenuBarPerformanceBar:Hide() + + NewHook('MainMenuMicroButton_SetNormal', SVUIMicroButton_SetNormal) + NewHook('UpdateMicroButtonsParent', SVUIMicroButtonsParent) + NewHook('MoveMicroButtons', RefreshMicrobar) + NewHook('UpdateMicroButtons', MicroButton_OnUpdate) + + SVUIMicroButtonsParent(microBar) + SVUIMicroButton_SetNormal() + + SuperVillain:SetSVMovable(microBar, L["Micro Bar"]) + + RefreshMicrobar() + + microBar.screenMarker = NewFrame('Frame',nil,SuperVillain.UIParent) + microBar.screenMarker:Point('TOP',SuperVillain.UIParent,'TOP',0,2) + microBar.screenMarker:Size(20,20) + microBar.screenMarker:SetFrameStrata("BACKGROUND") + microBar.screenMarker:SetFrameLevel(4) + microBar.screenMarker.icon = microBar.screenMarker:CreateTexture(nil,'OVERLAY') + microBar.screenMarker.icon:SetAllPoints(microBar.screenMarker) + microBar.screenMarker.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\ARROW-DOWN") + microBar.screenMarker.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + + SVUI_MicroBar:SetAlpha(0) +end + +local CreateExtraBar = function(self) + local specialBar = CreateFrame("Frame", "SVUI_SpecialAbility", SuperVillain.UIParent) + specialBar:Point("TOP", SuperVillain.UIParent, "CENTER", 0, -50) + specialBar:Size(ExtraActionBarFrame:GetSize()) + ExtraActionBarFrame:SetParent(specialBar) + ExtraActionBarFrame:ClearAllPoints() + ExtraActionBarFrame:SetPoint("CENTER", specialBar, "CENTER") + ExtraActionBarFrame.ignoreFramePositionManager = true; + local max = ExtraActionBarFrame:GetNumChildren() + for i = 1, max do + local name = ("ExtraActionButton%d"):format(i) + local icon = ("%sIcon"):format(name) + local cool = ("%sCooldown"):format(name) + local button = _G[name] + if(button) then + button.noResize = true; + button.pushed = true; + button.checked = true; + ModifyActionButton(button) + button:SetFixedPanelTemplate() + _G[icon]:SetDrawLayer("ARTWORK") + _G[cool]:FillInner() + local checkedTexture = button:CreateTexture(nil, "OVERLAY") + checkedTexture:SetTexture(0.9, 0.8, 0.1, 0.3) + checkedTexture:FillInner() + button:SetCheckedTexture(checkedTexture) + end + end + if HasExtraActionBar()then + ExtraActionBarFrame:Show() + end + SuperVillain:SetSVMovable(specialBar, L["Boss Button"], nil, nil, nil, "ALL, ACTIONBAR") +end +--[[ +########################################################## +DEFAULT REMOVAL +########################################################## +]]-- local function RemoveDefaults() - local removalManager=CreateFrame("Frame") + local removalManager = CreateFrame("Frame") removalManager:Hide() MultiBarBottomLeft:SetParent(removalManager) MultiBarBottomRight:SetParent(removalManager) MultiBarLeft:SetParent(removalManager) MultiBarRight:SetParent(removalManager) - for i=1,12 do - _G["ActionButton"..i]:Hide() - _G["ActionButton"..i]:UnregisterAllEvents() - _G["ActionButton"..i]:SetAttribute("statehidden",true) - _G["MultiBarBottomLeftButton"..i]:Hide() - _G["MultiBarBottomLeftButton"..i]:UnregisterAllEvents() - _G["MultiBarBottomLeftButton"..i]:SetAttribute("statehidden",true) - _G["MultiBarBottomRightButton"..i]:Hide() - _G["MultiBarBottomRightButton"..i]:UnregisterAllEvents() - _G["MultiBarBottomRightButton"..i]:SetAttribute("statehidden",true) - _G["MultiBarRightButton"..i]:Hide() - _G["MultiBarRightButton"..i]:UnregisterAllEvents() - _G["MultiBarRightButton"..i]:SetAttribute("statehidden",true) - _G["MultiBarLeftButton"..i]:Hide() - _G["MultiBarLeftButton"..i]:UnregisterAllEvents() - _G["MultiBarLeftButton"..i]:SetAttribute("statehidden",true) - if _G["VehicleMenuBarActionButton"..i] then - _G["VehicleMenuBarActionButton"..i]:Hide() - _G["VehicleMenuBarActionButton"..i]:UnregisterAllEvents() - _G["VehicleMenuBarActionButton"..i]:SetAttribute("statehidden",true) - end - if _G['OverrideActionBarButton'..i] then - _G['OverrideActionBarButton'..i]:Hide() - _G['OverrideActionBarButton'..i]:UnregisterAllEvents() - _G['OverrideActionBarButton'..i]:SetAttribute("statehidden",true) + for i = 1, 12 do + local ab = _G[("ActionButton%d"):format(i)] + ab:Hide() + ab:UnregisterAllEvents() + ab:SetAttribute("statehidden", true) + local mbl = _G[("MultiBarLeftButton%d"):format(i)] + mbl:Hide() + mbl:UnregisterAllEvents() + mbl:SetAttribute("statehidden", true) + local mbr = _G[("MultiBarRightButton%d"):format(i)] + mbr:Hide() + mbr:UnregisterAllEvents() + mbr:SetAttribute("statehidden", true) + local mbbl = _G[("MultiBarBottomLeftButton%d"):format(i)] + mbbl:Hide() + mbbl:UnregisterAllEvents() + mbbl:SetAttribute("statehidden", true) + local mbbr = _G[("MultiBarBottomRightButton%d"):format(i)] + mbbr:Hide() + mbbr:UnregisterAllEvents() + mbbr:SetAttribute("statehidden", true) + local mca = _G[("MultiCastActionButton%d"):format(i)] + mca:Hide() + mca:UnregisterAllEvents() + mca:SetAttribute("statehidden", true) + local vb = _G[("VehicleMenuBarActionButton%d"):format(i)] + if(vb) then + vb:Hide() + vb:UnregisterAllEvents() + vb:SetAttribute("statehidden", true) + end + local ob = _G[("OverrideActionBarButton%d"):format(i)] + if(ob) then + ob:Hide() + ob:UnregisterAllEvents() + ob:SetAttribute("statehidden", true) end - _G['MultiCastActionButton'..i]:Hide() - _G['MultiCastActionButton'..i]:UnregisterAllEvents() - _G['MultiCastActionButton'..i]:SetAttribute("statehidden",true) end ActionBarController:UnregisterAllEvents() - ActionBarController:RegisterEvent('UPDATE_EXTRA_ACTIONBAR') + ActionBarController:RegisterEvent("UPDATE_EXTRA_ACTIONBAR") MainMenuBar:EnableMouse(false) MainMenuBar:SetAlpha(0) MainMenuExpBar:UnregisterAllEvents() MainMenuExpBar:Hide() MainMenuExpBar:SetParent(removalManager) local maxChildren = MainMenuBar:GetNumChildren(); - for i=1,maxChildren do - local child=select(i,MainMenuBar:GetChildren()) + for i = 1, maxChildren do + local child = select(i, MainMenuBar:GetChildren()) if child then child:UnregisterAllEvents() child:Hide() @@ -1075,6 +1626,8 @@ end BUILD FUNCTION / UPDATE ########################################################## ]]-- +MOD.UpdateMicroButtons = MicroButton_OnUpdate + function MOD:ReLoad() self:RefreshActionBars(); end @@ -1084,14 +1637,21 @@ function MOD:Load() RemoveDefaults(); self:Protect("RefreshActionBars"); self:UpdateBarPagingDefaults(); - SuperVillain.Registry:RunTemp("SVBar"); + CreateActionBars(self) + CreateStanceBar(self) + CreatePetBar(self) + CreateMicroBar(self) + CreateExtraBar(self) + + self:LoadKeyBinder() + self:RegisterEvent("UPDATE_BINDINGS", "UpdateAllBindings") self:RegisterEvent("PET_BATTLE_CLOSE", "UpdateAllBindings") self:RegisterEvent("PET_BATTLE_OPENING_DONE", ResetAllBindings) self:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR", Vehicle_Updater) self:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR", Vehicle_Updater) if C_PetBattles.IsInBattle()then - ResetAllBindings() + ResetAllBindings(self) else self:UpdateAllBindings() end @@ -1102,5 +1662,4 @@ function MOD:Load() MOD.IsLoaded = true end -SuperVillain.Registry:NewPackage(MOD, "SVBar") -SuperVillain.Registry:Temp("SVBar", CreateExtraBar) \ No newline at end of file +SuperVillain.Registry:NewPackage(MOD, "SVBar") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.xml b/Interface/AddOns/SVUI/packages/actionbar/SVBar.xml index 0ce0c19..d9ab5f5 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.xml +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.xml @@ -1,4 +1,4 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVBar.lua'/> - <Include file='common\_load.xml'/> + <Script file='SVBar_KeyBind.lua'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar_KeyBind.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar_KeyBind.lua new file mode 100644 index 0000000..c44bf2e --- /dev/null +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar_KeyBind.lua @@ -0,0 +1,513 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local GetTime = _G.GetTime; +--[[ STRING METHODS ]]-- +local format, find = string.format, string.find; +--[[ MATH METHODS ]]-- +local floor = math.floor; +local tonumber = tonumber; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.Registry:Expose('SVBar'); +local LibAB = LibStub("LibActionButton-1.0") + +local _G = getfenv(0); + +local RefreshBindings +local NewFrame = CreateFrame; +local NewHook = hooksecurefunc; + +local Binder = NewFrame("Frame", nil, UIParent); +--[[ +########################################################## +BINDING UPDATES +########################################################## +]]-- +do + --[[ HANDLERS ]]-- + local GameTooltip_OnHide = function(self) + self:SetOwner(Binder, "ANCHOR_TOP") + self:SetPoint("BOTTOM", Binder, "TOP", 0, 1) + self:AddLine(Binder.button.name, 1, 1, 1) + Binder.button.bindings = {GetBindingKey(Binder.button.bindstring)} + local count = #Binder.button.bindings + if(count == 0) then + self:AddLine(L["No bindings set."], .6, .6, .6) + else + self:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) + for i = 1, count do + self:AddDoubleLine(i, Binder.button.bindings[i]) + end + end; + self:Show() + self:SetScript("OnHide", nil) + end + --[[ END OF HANDLERS ]]-- + + function RefreshBindings(bindTarget, bindType) + if(not Binder.active or InCombatLockdown()) then return end; + Binder.button = bindTarget; + Binder.spellmacro = bindType; + Binder:ClearAllPoints() + Binder:SetAllPoints(bindTarget) + Binder:Show() + ShoppingTooltip1:Hide() + if(bindTarget.FlyoutArrow and bindTarget.FlyoutArrow:IsShown()) then + Binder:EnableMouse(false) + elseif(not Binder:IsMouseEnabled()) then + Binder:EnableMouse(true) + end; + local keyBindID, keyBindName, keyBindString; + if bindType == "FLYOUT" then + keyBindName = GetSpellInfo(bindTarget.spellID); + keyBindString = "SPELL " .. keyBindName; + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + elseif bindType == "SPELL" then + keyBindID = SpellBook_GetSpellBookSlot(bindTarget) + keyBindName = GetSpellBookItemName(keyBindID, SpellBookFrame.bookType); + keyBindString = "SPELL " .. keyBindName; + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + elseif bindType == "MACRO" then + keyBindID = bindTarget:GetID() + if(floor(.5 + select(2, MacroFrameTab1Text:GetTextColor()) * 10) / 10 == .8) then + keyBindID = keyBindID + 36 + end; + keyBindName = GetMacroInfo(keyBindID) + keyBindString = "MACRO " .. keyBindName; + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + Binder.button.bindings = {GetBindingKey(keyBindString)} + GameTooltip:SetOwner(Binder, "ANCHOR_TOP") + GameTooltip:SetPoint("BOTTOM", Binder, "TOP", 0, 1) + GameTooltip:AddLine(keyBindName, 1, 1, 1) + if #Binder.button.bindings == 0 then + GameTooltip:AddLine(L["No bindings set."], .6, .6, .6) + else + GameTooltip:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) + for i = 1, #Binder.button.bindings do + GameTooltip:AddDoubleLine(L["Binding"]..i, Binder.button.bindings[i], 1, 1, 1) + end + end; + GameTooltip:Show() + elseif bindType == "STANCE" or bindType == "PET" then + keyBindID = tonumber(bindTarget:GetID()) + keyBindName = bindTarget:GetName() + if(not keyBindName) then return end; + if ((not keyBindID) or (keyBindID < 1) or (keyBindID > (bindType == "STANCE" and 10 or 12))) then + keyBindString = "CLICK "..keyBindName..":LeftButton" + else + keyBindString = (bindType == "STANCE" and "StanceButton" or "BONUSACTIONBUTTON")..keyBindID + end; + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + else + keyBindID = tonumber(bindTarget.action) + keyBindName = bindTarget:GetName() + if(not keyBindName) then return end; + if(not bindTarget.keyBoundTarget and ((not keyBindID) or (keyBindID < 1) or (keyBindID > 132))) then + keyBindString = "CLICK "..keyBindName..":LeftButton" + elseif(bindTarget.keyBoundTarget) then + keyBindString = bindTarget.keyBoundTarget + else + local slotID = 1 + (keyBindID - 1) % 12; + if((keyBindID < 25) or (keyBindID > 72)) then + keyBindString = "ACTIONBUTTON"..slotID; + elseif((keyBindID < 73) and (keyBindID > 60)) then + keyBindString = "MULTIACTIONBAR1BUTTON"..slotID; + elseif(keyBindID < 61 and keyBindID > 48) then + keyBindString = "MULTIACTIONBAR2BUTTON"..slotID; + elseif(keyBindID < 49 and keyBindID > 36) then + keyBindString = "MULTIACTIONBAR4BUTTON"..slotID; + elseif(keyBindID < 37 and keyBindID > 24) then + keyBindString = "MULTIACTIONBAR3BUTTON"..slotID; + end + end; + Binder.button.action = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + end + end; +end +--[[ +########################################################## +PACKAGE PLUGIN +########################################################## +]]-- +function MOD:ToggleKeyBindingMode(deactivate, saveRequested) + if not deactivate then + Binder.active = true; + SuperVillain:StaticPopupSpecial_Show(SVUI_KeyBindPopup) + MOD:RegisterEvent('PLAYER_REGEN_DISABLED','ToggleKeyBindingMode',true,false) + else + if saveRequested then + SaveBindings(GetCurrentBindingSet()) + SuperVillain:AddonMessage(L["Binding Changes Stored"]) + else + LoadBindings(GetCurrentBindingSet()) + SuperVillain:AddonMessage(L["Binding Changes Discarded"]) + end; + Binder.active = false; + Binder:ClearAllPoints() + Binder:Hide() + GameTooltip:Hide() + MOD:UnregisterEvent("PLAYER_REGEN_DISABLED") + SuperVillain:StaticPopupSpecial_Hide(SVUI_KeyBindPopup) + MOD.bindingsChanged = false + end +end; + +blockedButtons = { LSHIFT = true, RSHIFT = true, LCTRL = true, RCTRL = true, LALT = true, RALT = true, UNKNOWN = true, LeftButton = true} + +--[[ HANDLERS ]]-- +local tipTimeLapse = 0; +local GameTooltip_OnUpdate = function(self, elapsed) + tipTimeLapse = (tipTimeLapse + elapsed); + if tipTimeLapse < .2 then + return + else + tipTimeLapse = 0 + end; + if(not self.comparing and IsModifiedClick("COMPAREITEMS")) then + GameTooltip_ShowCompareItem(self) + self.comparing = true + elseif(self.comparing and not IsModifiedClick("COMPAREITEMS")) then + for _,tip in pairs(self.shoppingTooltips)do + tip:Hide() + end; + self.comparing = false + end +end; + +local GameTooltip_OnHide = function(self) + for _, tip in pairs(self.shoppingTooltips)do + tip:Hide() + end +end; + +local GameTooltip_OnHide = function(self) + for _, tip in pairs(self.shoppingTooltips)do + tip:Hide() + end +end; + +local SpellButton_OnEnter = function(self) + RefreshBindings(self, "SPELL") +end + +local Button_Proxy = function(self) + RefreshBindings(self) +end +local Stance_Proxy = function(self) + RefreshBindings(self,"STANCE") +end +local Pet_Proxy = function(self) + RefreshBindings(self,"PET") +end +local Flyout_Proxy = function(self) + RefreshBindings(self,"FLYOUT") +end +local Macro_Proxy = function(self) + RefreshBindings(self, "MACRO") +end + +local BinderButton_OnEnter = function(self) + local parent = self.button:GetParent() + if parent and parent._fade then + SuperVillain:SecureFadeIn(parent, 0.2, parent:GetAlpha(), parent._alpha) + end +end; + +local BinderButton_OnLeave = function(self) + local parent = self.button:GetParent() + self:ClearAllPoints() + self:Hide() + GameTooltip:Hide() + if parent and parent._fade then + SuperVillain:SecureFadeOut(parent, 1, parent:GetAlpha(), 0) + end +end; + +local Binder_OnBinding = function(self, event) + MOD.bindingsChanged = true; + if(event == "ESCAPE" or event == "RightButton") then + local count = #Binder.button.bindings + for i=1, count do + SetBinding(Binder.button.bindings[i]) + end; + SuperVillain:AddonMessage(format(L["All keybindings cleared for |cff00ff00%s|r."], Binder.button.name)) + RefreshBindings(Binder.button, Binder.spellmacro) + if(Binder.spellmacro ~= "MACRO") then + GameTooltip:Hide() + end; + return + end; + + if(blockedButtons[event]) then return end; + if(event == "MiddleButton") then + event = "BUTTON3" + end; + if(event:find('Button%d')) then + event = event:upper() + end; + + local altText = IsAltKeyDown() and "ALT-" or ""; + local ctrlText = IsControlKeyDown() and "CTRL-" or ""; + local shiftText = IsShiftKeyDown() and "SHIFT-" or ""; + + if(not Binder.spellmacro or Binder.spellmacro == "PET" or Binder.spellmacro == "STANCE" or Binder.spellmacro == "FLYOUT") then + SetBinding(altText..ctrlText..shiftText..event, Binder.button.bindstring) + else + SetBinding(altText..ctrlText..shiftText..event, Binder.spellmacro.." "..Binder.button.name) + end; + + SuperVillain:AddonMessage(altText..ctrlText..shiftText..event..L[" |cff00ff00bound to |r"]..Binder.button.name..".") + RefreshBindings(Binder.button, Binder.spellmacro) + + if Binder.spellmacro~="MACRO" then + GameTooltip:Hide() + end +end; + +local BinderButton_OnMouseWheel = function(self, delta) + if delta > 0 then + Binder_OnBinding(self, "MOUSEWHEELUP") + else + Binder_OnBinding(self, "MOUSEWHEELDOWN") + end +end; + +local SetBindingMacro = function(self, arg) + if(arg == "Blizzard_MacroUI") then + for i=1,36 do + local btn = _G["MacroButton"..i] + btn:HookScript("OnEnter", MacroBinding_OnEnter) + end + end +end; + +local Check_OnShow = function(self) + self:SetChecked(GetCurrentBindingSet() == 2) +end; + +local Check_OnEnter = function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP, nil, nil, nil, nil, 1) +end; + +local Check_OnClick = function(self) + if(MOD.bindingsChanged) then + SuperVillain:StaticPopup_Show("CONFIRM_LOSE_BINDING_CHANGES") + else + if SVUI_KeyBindPopupCheckButton:GetChecked() then + LoadBindings(2) + SaveBindings(2) + else + LoadBindings(1) + SaveBindings(1) + end + end +end; + +local Save_OnClick = function(self) + MOD:ToggleKeyBindingMode(true, true) +end; + +local Discard_OnClick = function(self) + MOD:ToggleKeyBindingMode(true, false) +end; +--[[ END OF HANDLERS ]]-- + +local function SetBindingButton(button, force) + local click1 = StanceButton1:GetScript("OnClick") + local click2 = PetActionButton1:GetScript("OnClick") + local click3 = SecureActionButton_OnClick; + local button_OnClick = button:GetScript("OnClick") + if button_OnClick == click3 or force then + button:HookScript("OnEnter", Button_Proxy) + elseif button_OnClick == click1 then + button:HookScript("OnEnter", Stance_Proxy) + elseif button_OnClick == click2 then + button:HookScript("OnEnter", Pet_Proxy) + end +end; + +local function RefreshAllFlyouts() + local count = GetNumFlyouts() + for i = 1, count do + local id = GetFlyoutID(i) + local _,_,numSlots,isKnown = GetFlyoutInfo(id) + if isKnown then + for x = 1, numSlots do + local btn = _G["SpellFlyoutButton"..x] + if(SpellFlyout:IsShown() and btn and btn:IsShown()) then + if(not btn.hookedFlyout) then + btn:HookScript("OnEnter", Flyout_Proxy) + btn.hookedFlyout = true + end + end + end + end + end +end; + +function MOD:LoadKeyBinder() + self:RefreshActionBars() + Binder:SetParent(SuperVillain.UIParent) + Binder:SetFrameStrata("DIALOG") + Binder:SetFrameLevel(99) + Binder:EnableMouse(true) + Binder:EnableKeyboard(true) + Binder:EnableMouseWheel(true) + Binder.texture = Binder:CreateTexture() + Binder.texture:SetAllPoints(a) + Binder.texture:SetTexture(0, 0, 0, .25) + Binder:Hide() + + GameTooltip:HookScript("OnUpdate", GameTooltip_OnUpdate) + NewHook(GameTooltip, "Hide", GameTooltip_OnHide) + + Binder:SetScript("OnEnter", BinderButton_OnEnter) + Binder:SetScript("OnLeave", BinderButton_OnLeave) + Binder:SetScript("OnKeyUp", Binder_OnBinding) + Binder:SetScript("OnMouseUp", Binder_OnBinding) + Binder:SetScript("OnMouseWheel", BinderButton_OnMouseWheel) + + local OBJECT = EnumerateFrames() + while OBJECT do + if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then + SetBindingButton(OBJECT) + end + OBJECT = EnumerateFrames(OBJECT) + end; + + for OBJECT, _ in pairs(self.Storage.Cache)do + if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then + SetBindingButton(OBJECT, true) + end + end; + + for l = 1, 12 do + local spellButton = _G["SpellButton"..l] + spellButton:HookScript("OnEnter", SpellButton_OnEnter) + end; + + if not IsAddOnLoaded("Blizzard_MacroUI")then + NewHook("LoadAddOn", SetBindingMacro) + else + for i=1,36 do + local btn = _G["MacroButton"..i] + btn:HookScript("OnEnter", Macro_Proxy) + end + end; + + NewHook("ActionButton_UpdateFlyout", RefreshAllFlyouts) + RefreshAllFlyouts() + + local pop = NewFrame("Frame", "SVUI_KeyBindPopup", UIParent) + pop:SetFrameStrata("DIALOG") + pop:SetToplevel(true) + pop:EnableMouse(true) + pop:SetMovable(true) + pop:SetFrameLevel(99) + pop:SetClampedToScreen(true) + pop:SetWidth(360) + pop:SetHeight(130) + pop:SetFixedPanelTemplate("Transparent") + pop:Hide() + + local moveHandle = NewFrame("Button", nil, pop) + moveHandle:SetFixedPanelTemplate("Button", true) + moveHandle:SetWidth(100) + moveHandle:SetHeight(25) + moveHandle:SetPoint("CENTER", pop, "TOP") + moveHandle:SetFrameLevel(moveHandle:GetFrameLevel() + 2) + moveHandle:EnableMouse(true) + moveHandle:RegisterForClicks("AnyUp", "AnyDown") + local onMouseDown = function() pop:StartMoving() end + moveHandle:SetScript("OnMouseDown", onMouseDown) + local onMouseUp = function() pop:StopMovingOrSizing() end + moveHandle:SetScript("OnMouseUp", onMouseUp) + + local moveText = moveHandle:CreateFontString("OVERLAY") + moveText:SetFontTemplate() + moveText:SetPoint("CENTER", moveHandle, "CENTER") + moveText:SetText("Key Binds") + + local moveDesc = pop:CreateFontString("ARTWORK") + moveDesc:SetFontObject("GameFontHighlight") + moveDesc:SetJustifyV("TOP") + moveDesc:SetJustifyH("LEFT") + moveDesc:SetPoint("TOPLEFT", 18, -32) + moveDesc:SetPoint("BOTTOMRIGHT", -18, 48) + moveDesc:SetText(L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."]) + + local checkButton = NewFrame("CheckButton", "SVUI_KeyBindPopupCheckButton", pop, "OptionsCheckButtonTemplate") + checkButton:SetCheckboxTemplate(true) + _G["SVUI_KeyBindPopupCheckButtonText"]:SetText(CHARACTER_SPECIFIC_KEYBINDINGS) + checkButton:SetScript("OnShow", Check_OnShow) + checkButton:SetScript("OnClick", Check_OnClick) + checkButton:SetScript("OnEnter", Check_OnEnter) + checkButton:SetScript("OnLeave", GameTooltip_Hide) + + local saveButton = NewFrame("Button", "SVUI_KeyBindPopupSaveButton", pop, "OptionsButtonTemplate") + saveButton:Width(150) + saveButton:SetButtonTemplate() + _G["SVUI_KeyBindPopupSaveButtonText"]:SetText(L["Save"]) + saveButton:SetScript("OnClick", Save_OnClick) + + local discardButton = NewFrame("Button", "SVUI_KeyBindPopupDiscardButton", pop, "OptionsButtonTemplate") + discardButton:Width(150) + discardButton:SetButtonTemplate() + _G["SVUI_KeyBindPopupDiscardButtonText"]:SetText(L["Discard"]) + discardButton:SetScript("OnClick", Discard_OnClick) + + checkButton:SetPoint("BOTTOMLEFT", discardButton, "TOPLEFT", 0, 2) + saveButton:SetPoint("BOTTOMRIGHT", -14, 10) + discardButton:SetPoint("BOTTOMLEFT", 14, 10) +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/_load.xml b/Interface/AddOns/SVUI/packages/actionbar/common/_load.xml deleted file mode 100644 index 3bee589..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/_load.xml +++ /dev/null @@ -1,7 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='actionbar.lua'/> - <Script file='petbar.lua'/> - <Script file='stancebar.lua'/> - <Script file='microbar.lua'/> - <Script file='keybinds.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/actionbar.lua b/Interface/AddOns/SVUI/packages/actionbar/common/actionbar.lua deleted file mode 100644 index d2a7d77..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/actionbar.lua +++ /dev/null @@ -1,98 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local LibAB = LibStub("LibActionButton-1.0"); -local NUM_ACTIONBAR_BUTTONS = NUM_ACTIONBAR_BUTTONS -local pointSets = { - {"BOTTOM","SVUIParent","BOTTOM",0,28}, - {"BOTTOM","SVUI_ActionBar1","TOP",0,4}, - {"BOTTOMLEFT","SVUI_ActionBar1","BOTTOMRIGHT",4,0}, - {"RIGHT","SVUIParent","RIGHT",-4,0}, - {"BOTTOMRIGHT","SVUI_ActionBar1","BOTTOMLEFT",-4,0}, - {"BOTTOM","SVUI_ActionBar2","TOP",0,4}, -}; ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -local CreateActionBars = function(self) - for i = 1, 6 do - local barID = "Bar"..i; - local position = pointSets[i] - local parent = _G[position[2]] - local buttonMax = NUM_ACTIONBAR_BUTTONS; - local thisBar = CreateFrame("Frame", "SVUI_Action"..barID, SuperVillain.UIParent, "SecureHandlerStateTemplate") - thisBar:Point(position[1], parent, position[3], position[4], position[5]) - local bg = CreateFrame("Frame", nil, thisBar) - bg:SetAllPoints() - bg:SetFrameLevel(0); - thisBar:SetFrameLevel(5); - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - thisBar.backdrop = bg; - self.Storage[barID].buttons = {} - for k = 1, buttonMax do - self.Storage[barID].buttons[k] = LibAB:CreateButton(k, "SVUI_Action"..barID.."Button"..k, thisBar, nil) - self.Storage[barID].buttons[k]:SetState(0, "action", k) - for x = 1, 14 do - local calc = (x - 1) * buttonMax + k; - self.Storage[barID].buttons[k]:SetState(x, "action", calc) - end; - if k == 12 then - self.Storage[barID].buttons[k]:SetState(12, "custom", { - func = function(...) - if UnitExists("vehicle") then - VehicleExit() - else - PetDismiss() - end - end, - texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down", - tooltip = LEAVE_VEHICLE - }); - end - end; - self:SetBarConfigData(barID) - if i == 1 then - thisBar:SetAttribute("hasTempBar", true) - else - thisBar:SetAttribute("hasTempBar", false) - end; - thisBar:SetAttribute("_onstate-page", [[ - if HasTempShapeshiftActionBar() and self:GetAttribute("hasTempBar") then - newstate = GetTempShapeshiftBarIndex() or newstate - end - - if newstate ~= 0 then - self:SetAttribute("state", newstate) - control:ChildUpdate("state", newstate) - else - local newCondition = self:GetAttribute("newCondition") - if newCondition then - newstate = SecureCmdOptionParse(newCondition) - self:SetAttribute("state", newstate) - control:ChildUpdate("state", newstate) - end - end - ]]); - self.Storage[barID].bar = thisBar; - self:RefreshBar(barID) - SuperVillain:SetSVMovable(thisBar, "SVUI_Action"..barID.."_MOVE", L[barID], nil, nil, nil, "ALL, ACTIONBARS") - end -end; - -SuperVillain.Registry:Temp("SVBar", CreateActionBars) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/keybinds.lua b/Interface/AddOns/SVUI/packages/actionbar/common/keybinds.lua deleted file mode 100644 index 9124d29..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/keybinds.lua +++ /dev/null @@ -1,525 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local GetTime = _G.GetTime; ---[[ STRING METHODS ]]-- -local format, find = string.format, string.find; ---[[ MATH METHODS ]]-- -local floor = math.floor; -local tonumber = tonumber; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBar'); -local LibAB = LibStub("LibActionButton-1.0") - -local _G = getfenv(0); - -local RefreshBindings -local NewFrame = CreateFrame; -local NewHook = hooksecurefunc; - -local Binder = NewFrame("Frame", nil, UIParent); ---[[ -########################################################## -BINDING UPDATES -########################################################## -]]-- -do - --[[ HANDLERS ]]-- - local GameTooltip_OnHide = function(self) - self:SetOwner(Binder, "ANCHOR_TOP") - self:SetPoint("BOTTOM", Binder, "TOP", 0, 1) - self:AddLine(Binder.button.name, 1, 1, 1) - Binder.button.bindings = {GetBindingKey(Binder.button.bindstring)} - local count = #Binder.button.bindings - if(count == 0) then - self:AddLine(L["No bindings set."], .6, .6, .6) - else - self:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) - for i = 1, count do - self:AddDoubleLine(i, Binder.button.bindings[i]) - end - end; - self:Show() - self:SetScript("OnHide", nil) - end - --[[ END OF HANDLERS ]]-- - - function RefreshBindings(bindTarget, bindType) - if(not Binder.active or InCombatLockdown()) then return end; - Binder.button = bindTarget; - Binder.spellmacro = bindType; - Binder:ClearAllPoints() - Binder:SetAllPoints(bindTarget) - Binder:Show() - ShoppingTooltip1:Hide() - if(bindTarget.FlyoutArrow and bindTarget.FlyoutArrow:IsShown()) then - Binder:EnableMouse(false) - elseif(not Binder:IsMouseEnabled()) then - Binder:EnableMouse(true) - end; - local keyBindID, keyBindName, keyBindString; - if bindType == "FLYOUT" then - keyBindName = GetSpellInfo(bindTarget.spellID); - keyBindString = "SPELL " .. keyBindName; - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - elseif bindType == "SPELL" then - keyBindID = SpellBook_GetSpellBookSlot(bindTarget) - keyBindName = GetSpellBookItemName(keyBindID, SpellBookFrame.bookType); - keyBindString = "SPELL " .. keyBindName; - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - elseif bindType == "MACRO" then - keyBindID = bindTarget:GetID() - if(floor(.5 + select(2, MacroFrameTab1Text:GetTextColor()) * 10) / 10 == .8) then - keyBindID = keyBindID + 36 - end; - keyBindName = GetMacroInfo(keyBindID) - keyBindString = "MACRO " .. keyBindName; - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - Binder.button.bindings = {GetBindingKey(keyBindString)} - GameTooltip:SetOwner(Binder, "ANCHOR_TOP") - GameTooltip:SetPoint("BOTTOM", Binder, "TOP", 0, 1) - GameTooltip:AddLine(keyBindName, 1, 1, 1) - if #Binder.button.bindings == 0 then - GameTooltip:AddLine(L["No bindings set."], .6, .6, .6) - else - GameTooltip:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) - for i = 1, #Binder.button.bindings do - GameTooltip:AddDoubleLine(L["Binding"]..i, Binder.button.bindings[i], 1, 1, 1) - end - end; - GameTooltip:Show() - elseif bindType == "STANCE" or bindType == "PET" then - keyBindID = tonumber(bindTarget:GetID()) - keyBindName = bindTarget:GetName() - if(not keyBindName) then return end; - if ((not keyBindID) or (keyBindID < 1) or (keyBindID > (bindType == "STANCE" and 10 or 12))) then - keyBindString = "CLICK "..keyBindName..":LeftButton" - else - keyBindString = (bindType == "STANCE" and "StanceButton" or "BONUSACTIONBUTTON")..keyBindID - end; - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - else - keyBindID = tonumber(bindTarget.action) - keyBindName = bindTarget:GetName() - if(not keyBindName) then return end; - if(not bindTarget.keyBoundTarget and ((not keyBindID) or (keyBindID < 1) or (keyBindID > 132))) then - keyBindString = "CLICK "..keyBindName..":LeftButton" - elseif(bindTarget.keyBoundTarget) then - keyBindString = bindTarget.keyBoundTarget - else - local slotID = 1 + (keyBindID - 1) % 12; - if((keyBindID < 25) or (keyBindID > 72)) then - keyBindString = "ACTIONBUTTON"..slotID; - elseif((keyBindID < 73) and (keyBindID > 60)) then - keyBindString = "MULTIACTIONBAR1BUTTON"..slotID; - elseif(keyBindID < 61 and keyBindID > 48) then - keyBindString = "MULTIACTIONBAR2BUTTON"..slotID; - elseif(keyBindID < 49 and keyBindID > 36) then - keyBindString = "MULTIACTIONBAR4BUTTON"..slotID; - elseif(keyBindID < 37 and keyBindID > 24) then - keyBindString = "MULTIACTIONBAR3BUTTON"..slotID; - end - end; - Binder.button.action = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - end - end; -end ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -function MOD:ToggleKeyBindingMode(deactivate, saveRequested) - if not deactivate then - Binder.active = true; - SuperVillain:StaticPopupSpecial_Show(SVUI_KeyBindPopup) - MOD:RegisterEvent('PLAYER_REGEN_DISABLED','ToggleKeyBindingMode',true,false) - else - if saveRequested then - SaveBindings(GetCurrentBindingSet()) - SuperVillain:AddonMessage(L["Binding Changes Stored"]) - else - LoadBindings(GetCurrentBindingSet()) - SuperVillain:AddonMessage(L["Binding Changes Discarded"]) - end; - Binder.active = false; - Binder:ClearAllPoints() - Binder:Hide() - GameTooltip:Hide() - MOD:UnregisterEvent("PLAYER_REGEN_DISABLED") - SuperVillain:StaticPopupSpecial_Hide(SVUI_KeyBindPopup) - MOD.bindingsChanged = false - end -end; - -local blockedButtons = {true,true,true,true,true,true,true,true} -blockedButtons = { - ["LSHIFT"] = true, - ["RSHIFT"] = true, - ["LCTRL"] = true, - ["RCTRL"] = true, - ["LALT"] = true, - ["RALT"] = true, - ["UNKNOWN"] = true, - ["LeftButton"] = true -} - ---[[ HANDLERS ]]-- -local tipTimeLapse = 0; -local GameTooltip_OnUpdate = function(self, elapsed) - tipTimeLapse = (tipTimeLapse + elapsed); - if tipTimeLapse < .2 then - return - else - tipTimeLapse = 0 - end; - if(not self.comparing and IsModifiedClick("COMPAREITEMS")) then - GameTooltip_ShowCompareItem(self) - self.comparing = true - elseif(self.comparing and not IsModifiedClick("COMPAREITEMS")) then - for _,tip in pairs(self.shoppingTooltips)do - tip:Hide() - end; - self.comparing = false - end -end; - -local GameTooltip_OnHide = function(self) - for _, tip in pairs(self.shoppingTooltips)do - tip:Hide() - end -end; - -local GameTooltip_OnHide = function(self) - for _, tip in pairs(self.shoppingTooltips)do - tip:Hide() - end -end; - -local SpellButton_OnEnter = function(self) - RefreshBindings(self, "SPELL") -end - -local Button_Proxy = function(self) - RefreshBindings(self) -end -local Stance_Proxy = function(self) - RefreshBindings(self,"STANCE") -end -local Pet_Proxy = function(self) - RefreshBindings(self,"PET") -end -local Flyout_Proxy = function(self) - RefreshBindings(self,"FLYOUT") -end -local Macro_Proxy = function(self) - RefreshBindings(self, "MACRO") -end - -local BinderButton_OnEnter = function(self) - local parent = self.button:GetParent() - if parent and parent._fade then - SuperVillain:SecureFadeIn(parent, 0.2, parent:GetAlpha(), parent._alpha) - end -end; - -local BinderButton_OnLeave = function(self) - local parent = self.button:GetParent() - self:ClearAllPoints() - self:Hide() - GameTooltip:Hide() - if parent and parent._fade then - SuperVillain:SecureFadeOut(parent, 1, parent:GetAlpha(), 0) - end -end; - -local Binder_OnBinding = function(self, event) - MOD.bindingsChanged = true; - if(event == "ESCAPE" or event == "RightButton") then - local count = #Binder.button.bindings - for i=1, count do - SetBinding(Binder.button.bindings[i]) - end; - SuperVillain:AddonMessage(format(L["All keybindings cleared for |cff00ff00%s|r."], Binder.button.name)) - RefreshBindings(Binder.button, Binder.spellmacro) - if(Binder.spellmacro ~= "MACRO") then - GameTooltip:Hide() - end; - return - end; - - if(blockedButtons[event]) then return end; - if(event == "MiddleButton") then - event = "BUTTON3" - end; - if(event:find('Button%d')) then - event = event:upper() - end; - - local altText = IsAltKeyDown() and "ALT-" or ""; - local ctrlText = IsControlKeyDown() and "CTRL-" or ""; - local shiftText = IsShiftKeyDown() and "SHIFT-" or ""; - - if(not Binder.spellmacro or Binder.spellmacro == "PET" or Binder.spellmacro == "STANCE" or Binder.spellmacro == "FLYOUT") then - SetBinding(altText..ctrlText..shiftText..event, Binder.button.bindstring) - else - SetBinding(altText..ctrlText..shiftText..event, Binder.spellmacro.." "..Binder.button.name) - end; - - SuperVillain:AddonMessage(altText..ctrlText..shiftText..event..L[" |cff00ff00bound to |r"]..Binder.button.name..".") - RefreshBindings(Binder.button, Binder.spellmacro) - - if Binder.spellmacro~="MACRO" then - GameTooltip:Hide() - end -end; - -local BinderButton_OnMouseWheel = function(self, delta) - if delta > 0 then - Binder_OnBinding(self, "MOUSEWHEELUP") - else - Binder_OnBinding(self, "MOUSEWHEELDOWN") - end -end; - -local SetBindingMacro = function(self, arg) - if(arg == "Blizzard_MacroUI") then - for i=1,36 do - local btn = _G["MacroButton"..i] - btn:HookScript("OnEnter", MacroBinding_OnEnter) - end - end -end; - -local Check_OnShow = function(self) - self:SetChecked(GetCurrentBindingSet() == 2) -end; - -local Check_OnEnter = function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP, nil, nil, nil, nil, 1) -end; - -local Check_OnClick = function(self) - if(MOD.bindingsChanged) then - SuperVillain:StaticPopup_Show("CONFIRM_LOSE_BINDING_CHANGES") - else - if SVUI_KeyBindPopupCheckButton:GetChecked() then - LoadBindings(2) - SaveBindings(2) - else - LoadBindings(1) - SaveBindings(1) - end - end -end; - -local Save_OnClick = function(self) - MOD:ToggleKeyBindingMode(true, true) -end; - -local Discard_OnClick = function(self) - MOD:ToggleKeyBindingMode(true, false) -end; ---[[ END OF HANDLERS ]]-- - -local function SetBindingButton(button, force) - local click1 = StanceButton1:GetScript("OnClick") - local click2 = PetActionButton1:GetScript("OnClick") - local click3 = SecureActionButton_OnClick; - local button_OnClick = button:GetScript("OnClick") - if button_OnClick == click3 or force then - button:HookScript("OnEnter", Button_Proxy) - elseif button_OnClick == click1 then - button:HookScript("OnEnter", Stance_Proxy) - elseif button_OnClick == click2 then - button:HookScript("OnEnter", Pet_Proxy) - end -end; - -local function RefreshAllFlyouts() - local count = GetNumFlyouts() - for i = 1, count do - local id = GetFlyoutID(i) - local _,_,numSlots,isKnown = GetFlyoutInfo(id) - if isKnown then - for x = 1, numSlots do - local btn = _G["SpellFlyoutButton"..x] - if(SpellFlyout:IsShown() and btn and btn:IsShown()) then - if(not btn.hookedFlyout) then - btn:HookScript("OnEnter", Flyout_Proxy) - btn.hookedFlyout = true - end - end - end - end - end -end; - -local CreateKeyBinder = function(self) - self:RefreshActionBars() - Binder:SetParent(SuperVillain.UIParent) - Binder:SetFrameStrata("DIALOG") - Binder:SetFrameLevel(99) - Binder:EnableMouse(true) - Binder:EnableKeyboard(true) - Binder:EnableMouseWheel(true) - Binder.texture = Binder:CreateTexture() - Binder.texture:SetAllPoints(a) - Binder.texture:SetTexture(0, 0, 0, .25) - Binder:Hide() - - GameTooltip:HookScript("OnUpdate", GameTooltip_OnUpdate) - NewHook(GameTooltip, "Hide", GameTooltip_OnHide) - - Binder:SetScript("OnEnter", BinderButton_OnEnter) - Binder:SetScript("OnLeave", BinderButton_OnLeave) - Binder:SetScript("OnKeyUp", Binder_OnBinding) - Binder:SetScript("OnMouseUp", Binder_OnBinding) - Binder:SetScript("OnMouseWheel", BinderButton_OnMouseWheel) - - local OBJECT = EnumerateFrames() - while OBJECT do - if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then - SetBindingButton(OBJECT) - end - OBJECT = EnumerateFrames(OBJECT) - end; - - for OBJECT, _ in pairs(self.Storage.Cache)do - if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then - SetBindingButton(OBJECT, true) - end - end; - - for l = 1, 12 do - local spellButton = _G["SpellButton"..l] - spellButton:HookScript("OnEnter", SpellButton_OnEnter) - end; - - if not IsAddOnLoaded("Blizzard_MacroUI")then - NewHook("LoadAddOn", SetBindingMacro) - else - for i=1,36 do - local btn = _G["MacroButton"..i] - btn:HookScript("OnEnter", Macro_Proxy) - end - end; - - NewHook("ActionButton_UpdateFlyout", RefreshAllFlyouts) - RefreshAllFlyouts() - - local pop = NewFrame("Frame", "SVUI_KeyBindPopup", UIParent) - pop:SetFrameStrata("DIALOG") - pop:SetToplevel(true) - pop:EnableMouse(true) - pop:SetMovable(true) - pop:SetFrameLevel(99) - pop:SetClampedToScreen(true) - pop:SetWidth(360) - pop:SetHeight(130) - pop:SetFixedPanelTemplate("Transparent") - pop:Hide() - - local moveHandle = NewFrame("Button", nil, pop) - moveHandle:SetFixedPanelTemplate("Button", true) - moveHandle:SetWidth(100) - moveHandle:SetHeight(25) - moveHandle:SetPoint("CENTER", pop, "TOP") - moveHandle:SetFrameLevel(moveHandle:GetFrameLevel() + 2) - moveHandle:EnableMouse(true) - moveHandle:RegisterForClicks("AnyUp", "AnyDown") - local onMouseDown = function() pop:StartMoving() end - moveHandle:SetScript("OnMouseDown", onMouseDown) - local onMouseUp = function() pop:StopMovingOrSizing() end - moveHandle:SetScript("OnMouseUp", onMouseUp) - - local moveText = moveHandle:CreateFontString("OVERLAY") - moveText:SetFontTemplate() - moveText:SetPoint("CENTER", moveHandle, "CENTER") - moveText:SetText("Key Binds") - - local moveDesc = pop:CreateFontString("ARTWORK") - moveDesc:SetFontObject("GameFontHighlight") - moveDesc:SetJustifyV("TOP") - moveDesc:SetJustifyH("LEFT") - moveDesc:SetPoint("TOPLEFT", 18, -32) - moveDesc:SetPoint("BOTTOMRIGHT", -18, 48) - moveDesc:SetText(L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."]) - - local checkButton = NewFrame("CheckButton", "SVUI_KeyBindPopupCheckButton", pop, "OptionsCheckButtonTemplate") - checkButton:SetCheckboxTemplate(true) - _G["SVUI_KeyBindPopupCheckButtonText"]:SetText(CHARACTER_SPECIFIC_KEYBINDINGS) - checkButton:SetScript("OnShow", Check_OnShow) - checkButton:SetScript("OnClick", Check_OnClick) - checkButton:SetScript("OnEnter", Check_OnEnter) - checkButton:SetScript("OnLeave", GameTooltip_Hide) - - local saveButton = NewFrame("Button", "SVUI_KeyBindPopupSaveButton", pop, "OptionsButtonTemplate") - saveButton:Width(150) - saveButton:SetButtonTemplate() - _G["SVUI_KeyBindPopupSaveButtonText"]:SetText(L["Save"]) - saveButton:SetScript("OnClick", Save_OnClick) - - local discardButton = NewFrame("Button", "SVUI_KeyBindPopupDiscardButton", pop, "OptionsButtonTemplate") - discardButton:Width(150) - discardButton:SetButtonTemplate() - _G["SVUI_KeyBindPopupDiscardButtonText"]:SetText(L["Discard"]) - discardButton:SetScript("OnClick", Discard_OnClick) - - checkButton:SetPoint("BOTTOMLEFT", discardButton, "TOPLEFT", 0, 2) - saveButton:SetPoint("BOTTOMRIGHT", -14, 10) - discardButton:SetPoint("BOTTOMLEFT", 14, 10) -end - -SuperVillain.Registry:Temp("SVBar", CreateKeyBinder) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/microbar.lua b/Interface/AddOns/SVUI/packages/actionbar/common/microbar.lua deleted file mode 100644 index 3193f8f..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/microbar.lua +++ /dev/null @@ -1,208 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBar'); -local NewFrame = CreateFrame; -local NewHook = hooksecurefunc; -local ICON_FILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\MICROMENU]] -local ICON_DATA = { - {"CharacterMicroButton",0,0.25,0,0.25}, -- MICRO-CHARACTER - {"SpellbookMicroButton",0.25,0.5,0,0.25}, -- MICRO-SPELLBOOK - {"TalentMicroButton",0.5,0.75,0,0.25}, -- MICRO-TALENTS - {"AchievementMicroButton",0.75,1,0,0.25}, -- MICRO-ACHIEVEMENTS - {"QuestLogMicroButton",0,0.25,0.25,0.5}, -- MICRO-QUESTS - {"GuildMicroButton",0.25,0.5,0.25,0.5}, -- MICRO-GUILD - {"PVPMicroButton",0.5,0.75,0.25,0.5}, -- MICRO-PVP - {"LFDMicroButton",0.75,1,0.25,0.5}, -- MICRO-LFD - {"EJMicroButton",0,0.25,0.5,0.75}, -- MICRO-ENCOUNTER - {"StoreMicroButton",0.25,0.5,0.5,0.75}, -- MICRO-STORE - {"CompanionsMicroButton",0.5,0.75,0.5,0.75},-- MICRO-COMPANION - {"MainMenuMicroButton",0.75,1,0.5,0.75}, -- MICRO-SYSTEM - {"HelpMicroButton",0,0.25,0.75,1}, -- MICRO-HELP -}; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function RefreshMicrobar() - if not SVUI_MicroBar then return end; - local lastParent = SVUI_MicroBar; - local buttonSize = MOD.db.Micro.buttonsize or 30; - local spacing = MOD.db.Micro.buttonspacing or 1; - local barWidth = (buttonSize + spacing) * 13; - SVUI_MicroBar_MOVE:Size(barWidth, buttonSize + 6) - SVUI_MicroBar:SetAllPoints(SVUI_MicroBar_MOVE) - for i=1,13 do - local data = ICON_DATA[i] - local button = _G[data[1]] - button:ClearAllPoints() - button:Size(buttonSize, buttonSize + 28) - button._fade = MOD.db.Micro.mouseover - if lastParent == SVUI_MicroBar then - button:SetPoint("BOTTOMLEFT",lastParent,"BOTTOMLEFT",1,1) - else - button:SetPoint('LEFT',lastParent,'RIGHT',spacing,0) - end; - lastParent = button; - button:Show() - end; -end; - -local SVUIMicroButton_SetNormal = function() - local level = MainMenuMicroButton:GetFrameLevel() - if(level > 0) then - MainMenuMicroButton:SetFrameLevel(level - 1) - else - MainMenuMicroButton:SetFrameLevel(0) - end - MainMenuMicroButton:SetFrameStrata("BACKGROUND") - MainMenuMicroButton.overlay:SetFrameLevel(level + 1) - MainMenuMicroButton.overlay:SetFrameStrata("HIGH") - MainMenuBarPerformanceBar:Hide() - HelpMicroButton:Show() -end; - -local SVUIMicroButtonsParent = function(self) - if self ~= SVUI_MicroBar then - self = SVUI_MicroBar - end; - for i=1,13 do - local data = ICON_DATA[i] - _G[data[1]]:SetParent(SVUI_MicroBar) - end -end; - -local MicroButton_OnEnter = function(self) - if InCombatLockdown()then return end; - self.overlay:SetPanelColor("highlight") - self.overlay.icon:SetGradient("VERTICAL", 0.75, 0.75, 0.75, 1, 1, 1) - if(self._fade) then - SuperVillain:SecureFadeIn(SVUI_MicroBar,0.2,SVUI_MicroBar:GetAlpha(),1) - SuperVillain:SecureFadeOut(SVUI_MicroBar.screenMarker,0.1,SVUI_MicroBar:GetAlpha(),0) - end -end - -local MicroButton_OnLeave = function(self) - if InCombatLockdown()then return end; - self.overlay:SetPanelColor("special") - self.overlay.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - if(self._fade) then - SuperVillain:SecureFadeOut(SVUI_MicroBar,1,SVUI_MicroBar:GetAlpha(),0) - SuperVillain:SecureFadeIn(SVUI_MicroBar.screenMarker,5,SVUI_MicroBar:GetAlpha(),1) - end -end ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -function MOD:UpdateMicroButtons() - if(not MOD.db.Micro.mouseover) then - SVUI_MicroBar:SetAlpha(1) - SVUI_MicroBar.screenMarker:SetAlpha(0) - else - SVUI_MicroBar:SetAlpha(0) - SVUI_MicroBar.screenMarker:SetAlpha(1) - end - GuildMicroButtonTabard:ClearAllPoints(); - GuildMicroButtonTabard:Hide(); - RefreshMicrobar() -end; - -local MicroButton_OnUpdate = function() - MOD:UpdateMicroButtons() -end; - -local CreateMicroBar = function(self) - local buttonSize = self.db.Micro.buttonsize or 30; - local spacing = self.db.Micro.buttonspacing or 1; - local barWidth = (buttonSize + spacing) * 13; - local microBar = NewFrame('Frame','SVUI_MicroBar',SuperVillain.UIParent) - microBar:Size(barWidth,buttonSize + 6) - microBar:SetFrameStrata("HIGH") - microBar:SetFrameLevel(0) - microBar:Point('TOP',SuperVillain.UIParent,'TOP',0,4) - SuperVillain:AddToDisplayAudit(microBar) - - for i=1,13 do - local data = ICON_DATA[i] - local button = _G[data[1]] - button:SetParent(SVUI_MicroBar) - button:Size(buttonSize, buttonSize + 28) - button.Flash:SetTexture("") - if button.SetPushedTexture then - button:SetPushedTexture("") - end; - if button.SetNormalTexture then - button:SetNormalTexture("") - end; - if button.SetDisabledTexture then - button:SetDisabledTexture("") - end; - if button.SetHighlightTexture then - button:SetHighlightTexture("") - end; - button:Formula409() - - local buttonMask = NewFrame("Frame",nil,button) - buttonMask:SetPoint("TOPLEFT",button,"TOPLEFT",0,-28) - buttonMask:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",0,0) - buttonMask:SetFramedButtonTemplate() - buttonMask:SetPanelColor() - buttonMask.icon = buttonMask:CreateTexture(nil,"OVERLAY",nil,2) - buttonMask.icon:FillInner(buttonMask,2,2) - buttonMask.icon:SetTexture(ICON_FILE) - buttonMask.icon:SetTexCoord(data[2],data[3],data[4],data[5]) - buttonMask.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - button.overlay = buttonMask; - button._fade = self.db.Micro.mouseover - button:HookScript('OnEnter', MicroButton_OnEnter) - button:HookScript('OnLeave', MicroButton_OnLeave) - button:Show() - end; - - MicroButtonPortrait:ClearAllPoints() - MicroButtonPortrait:Hide() - MainMenuBarPerformanceBar:ClearAllPoints() - MainMenuBarPerformanceBar:Hide() - - NewHook('MainMenuMicroButton_SetNormal', SVUIMicroButton_SetNormal) - NewHook('UpdateMicroButtonsParent', SVUIMicroButtonsParent) - NewHook('MoveMicroButtons', RefreshMicrobar) - NewHook('UpdateMicroButtons', MicroButton_OnUpdate) - - SVUIMicroButtonsParent(microBar) - SVUIMicroButton_SetNormal() - - SuperVillain:SetSVMovable(microBar, "SVUI_MicroBar_MOVE", L["Micro Bar"]) - - RefreshMicrobar() - - microBar.screenMarker = NewFrame('Frame',nil,SuperVillain.UIParent) - microBar.screenMarker:Point('TOP',SuperVillain.UIParent,'TOP',0,2) - microBar.screenMarker:Size(20,20) - microBar.screenMarker:SetFrameStrata("BACKGROUND") - microBar.screenMarker:SetFrameLevel(4) - microBar.screenMarker.icon = microBar.screenMarker:CreateTexture(nil,'OVERLAY') - microBar.screenMarker.icon:SetAllPoints(microBar.screenMarker) - microBar.screenMarker.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\ARROW-DOWN") - microBar.screenMarker.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - - SVUI_MicroBar:SetAlpha(0) -end; - -SuperVillain.Registry:Temp("SVBar", CreateMicroBar) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/petbar.lua b/Interface/AddOns/SVUI/packages/actionbar/common/petbar.lua deleted file mode 100644 index 11f37c9..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/petbar.lua +++ /dev/null @@ -1,130 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -local RefreshPet = function(self, event, arg) - if event == "UNIT_AURA" and arg ~= "pet" then return end; - for i = 1, NUM_PET_ACTION_SLOTS, 1 do - local name = "PetActionButton"..i; - local button = _G[name] - local icon = _G[name.."Icon"] - local auto = _G[name.."AutoCastable"] - local shine = _G[name.."Shine"] - local checked = button:GetCheckedTexture() - local actionName, subtext, actionIcon, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i) - button:SetChecked(0) - button:SetBackdropBorderColor(0, 0, 0) - checked:SetAlpha(0) - if(not isToken) then - icon:SetTexture(actionIcon) - button.tooltipName = actionName - else - icon:SetTexture(_G[actionIcon]) - button.tooltipName = _G[actionName] - end; - button.isToken = isToken; - button.tooltipSubtext = subtext; - if arg and actionName ~= "PET_ACTION_FOLLOW" then - if(IsPetAttackAction(i)) then PetActionButton_StartFlash(button) end - else - if(IsPetAttackAction(i)) then PetActionButton_StopFlash(button) end - end; - if autoCastAllowed then - auto:Show() - else - auto:Hide() - end; - if (isActive and actionName ~= "PET_ACTION_FOLLOW") then - button:SetChecked(1) - checked:SetAlpha(1) - button:SetBackdropBorderColor(0.4, 0.8, 0) - else - button:SetChecked(0) - checked:SetAlpha(0) - button:SetBackdropBorderColor(0, 0, 0) - end; - if(autoCastEnabled) then - AutoCastShine_AutoCastStart(shine) - else - AutoCastShine_AutoCastStop(shine) - end - button:SetAlpha(1) - if actionIcon then - icon:Show() - if GetPetActionSlotUsable(i)then - SetDesaturation(icon, nil) - else - SetDesaturation(icon, 1) - end; - else - icon:Hide() - end; - if(not PetHasActionBar() and actionIcon and actionName ~= "PET_ACTION_FOLLOW") then - PetActionButton_StopFlash(button) - SetDesaturation(icon, 1) - button:SetChecked(0) - end; - end -end; - -local CreatePetBar = function(self) - local barID = "Pet"; - local parent = _G["SVUI_ActionBar1"] - if self.db["Bar2"].enable then - parent = _G["SVUI_ActionBar2"] - end; - local petBar = CreateFrame("Frame", "SVUI_PetActionBar", SuperVillain.UIParent, "SecureHandlerStateTemplate") - petBar:Point("BOTTOMLEFT",parent,"TOPLEFT",0,2); - petBar:SetFrameLevel(5); - local bg = CreateFrame("Frame", nil, petBar) - bg:SetAllPoints(); - bg:SetFrameLevel(0); - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - petBar.backdrop = bg; - for i = 1, NUM_PET_ACTION_SLOTS do - self.Storage[barID].buttons[i] = _G["PetActionButton"..i] - end - petBar:SetAttribute("_onstate-show", [[ - if newstate == "hide" then - self:Hide(); - else - self:Show(); - end - ]]); - self.Storage[barID].bar = petBar; - PetActionBarFrame.showgrid = 1; - PetActionBar_ShowGrid(); - self:RefreshBar("Pet") - self:UpdateBarBindings(true, false) - self:RegisterEvent("PLAYER_CONTROL_GAINED", RefreshPet) - self:RegisterEvent("PLAYER_ENTERING_WORLD", RefreshPet) - self:RegisterEvent("PLAYER_CONTROL_LOST", RefreshPet) - self:RegisterEvent("PET_BAR_UPDATE", RefreshPet) - self:RegisterEvent("UNIT_PET", RefreshPet) - self:RegisterEvent("UNIT_FLAGS", RefreshPet) - self:RegisterEvent("UNIT_AURA", RefreshPet) - self:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED", RefreshPet) - self:RegisterEvent("PET_BAR_UPDATE_COOLDOWN", PetActionBar_UpdateCooldowns) - - SuperVillain:SetSVMovable(petBar, "SVUI_PetActionBar_MOVE", L["Pet Bar"], nil, nil, nil, "ALL, ACTIONBARS") -end; - -SuperVillain.Registry:Temp("SVBar", CreatePetBar) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/common/stancebar.lua b/Interface/AddOns/SVUI/packages/actionbar/common/stancebar.lua deleted file mode 100644 index 6ce1f9e..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/common/stancebar.lua +++ /dev/null @@ -1,162 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBar'); ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -local function SetStanceBarButtons() - local maxForms = GetNumShapeshiftForms(); - local currentForm = GetShapeshiftForm(); - local maxButtons = NUM_STANCE_SLOTS; - local texture, name, isActive, isCastable, _; - for i = 1, maxButtons do - local button = _G["SVUI_StanceBarButton"..i] - local icon = _G["SVUI_StanceBarButton"..i.."Icon"] - local cd = _G["SVUI_StanceBarButton"..i.."Cooldown"] - if i <= maxForms then - texture, name, isActive, isCastable = GetShapeshiftFormInfo(i) - if texture == "Interface\\Icons\\Spell_Nature_WispSplode" and MOD.db.Stance.style == "darkenInactive" then - _, _, texture = GetSpellInfo(name) - end; - icon:SetTexture(texture) - if texture then - cd:SetAlpha(1) - else - cd:SetAlpha(0) - end; - if isActive then - StanceBarFrame.lastSelected = button:GetID() - if maxForms == 1 then - button:SetChecked(1) - else - if button.checked then button.checked:SetTexture(0, 0.5, 0, 0.2) end - button:SetBackdropBorderColor(0.4, 0.8, 0) - button:SetChecked(MOD.db.Stance.style ~= "darkenInactive") - end - else - if maxForms == 1 or currentForm == 0 then - button:SetChecked(0) - else - button:SetBackdropBorderColor(0, 0, 0) - button:SetChecked(MOD.db.Stance.style == "darkenInactive") - if button.checked then - button.checked:SetAlpha(1) - if MOD.db.Stance.style == "darkenInactive" then - button.checked:SetTexture(0, 0, 0, 0.75) - else - button.checked:SetTexture(1, 1, 1, 0.25) - end - end - end - end; - if isCastable then - icon:SetVertexColor(1.0, 1.0, 1.0) - else - icon:SetVertexColor(0.4, 0.4, 0.4) - end - end - end -end; - -local function UpdateShapeshiftForms(self, event) - if InCombatLockdown() or not _G["SVUI_StanceBar"] then return end; - local bar = _G["SVUI_StanceBar"]; - for i = 1, #MOD.Storage["Stance"].buttons do - MOD.Storage["Stance"].buttons[i]:Hide() - end; - local ready = false; - local maxForms = GetNumShapeshiftForms() - for i = 1, NUM_STANCE_SLOTS do - if not MOD.Storage["Stance"].buttons[i]then - MOD.Storage["Stance"].buttons[i] = CreateFrame("CheckButton", format("SVUI_StanceBarButton%d", i), bar, "StanceButtonTemplate") - MOD.Storage["Stance"].buttons[i]:SetID(i) - ready = true - end; - if i <= maxForms then - MOD.Storage["Stance"].buttons[i]:Show() - else - MOD.Storage["Stance"].buttons[i]:Hide() - end - end; - MOD:RefreshBar("Stance") - if event == "UPDATE_SHAPESHIFT_FORMS" then - SetStanceBarButtons() - end; - if not C_PetBattles.IsInBattle() or ready then - if maxForms == 0 then - UnregisterStateDriver(bar, "show") - bar:Hide() - else - bar:Show() - RegisterStateDriver(bar, "show", "[petbattle] hide;show") - end - end -end; - -local function UpdateShapeshiftCD() - local maxForms = GetNumShapeshiftForms() - for i = 1, NUM_STANCE_SLOTS do - if i <= maxForms then - local cooldown = _G["SVUI_StanceBarButton"..i.."Cooldown"] - local start, duration, enable = GetShapeshiftFormCooldown(i) - CooldownFrame_SetTimer(cooldown, start, duration, enable) - end - end -end; - -local CreateStanceBar = function(self) - local barID = "Stance"; - local parent = _G["SVUI_ActionBar1"] - local maxForms = GetNumShapeshiftForms(); - if self.db["Bar2"].enable then - parent = _G["SVUI_ActionBar2"] - end; - local stanceBar = CreateFrame("Frame", "SVUI_StanceBar", SuperVillain.UIParent, "SecureHandlerStateTemplate") - stanceBar:Point("BOTTOMRIGHT",parent,"TOPRIGHT",0,2); - stanceBar:SetFrameLevel(5); - local bg = CreateFrame("Frame", nil, stanceBar) - bg:SetAllPoints(); - bg:SetFrameLevel(0); - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - stanceBar.backdrop = bg; - for i = 1, NUM_STANCE_SLOTS do - self.Storage[barID].buttons[i] = _G["SVUI_StanceBarButton"..i] - end - stanceBar:SetAttribute("_onstate-show", [[ - if newstate == "hide" then - self:Hide(); - else - self:Show(); - end - ]]); - self.Storage[barID].bar = stanceBar; - self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", UpdateShapeshiftForms) - self:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN", UpdateShapeshiftCD) - self:RegisterEvent("UPDATE_SHAPESHIFT_USABLE", SetStanceBarButtons) - self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", SetStanceBarButtons) - self:RegisterEvent("ACTIONBAR_PAGE_CHANGED", SetStanceBarButtons) - UpdateShapeshiftForms() - SuperVillain:SetSVMovable(stanceBar, "SVUI_StanceBar_MOVE", L["Stance Bar"], nil, -3, nil, "ALL, ACTIONBARS") - self:RefreshBar("Stance") - SetStanceBarButtons() - self:UpdateBarBindings(false, true) -end; - -SuperVillain.Registry:Temp("SVBar", CreateStanceBar) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/aura/SVAura.lua b/Interface/AddOns/SVUI/packages/aura/SVAura.lua index 8d9eece..6bea61c 100644 --- a/Interface/AddOns/SVUI/packages/aura/SVAura.lua +++ b/Interface/AddOns/SVUI/packages/aura/SVAura.lua @@ -540,6 +540,6 @@ function MOD:Load() self:Update_ConsolidatedBuffsSettings() - SuperVillain:SetSVMovable(auras, "SVUI_Auras_MOVE", L["Auras Frame"]) + SuperVillain:SetSVMovable(auras, L["Auras Frame"]) end SuperVillain.Registry:NewPackage(MOD, "SVAura") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index fbb2050..4a7f4bc 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -618,7 +618,7 @@ do count = count + 1 bar.buttons[count] = bagSlot end - SuperVillain:SetSVMovable(bar, "Bags_MOVE", L["Bags"]) + SuperVillain:SetSVMovable(bar, L["Bags"]) MOD.BagBarLoaded = true end diff --git a/Interface/AddOns/SVUI/packages/chat/SVChat.lua b/Interface/AddOns/SVUI/packages/chat/SVChat.lua index f3601c4..5248857 100644 --- a/Interface/AddOns/SVUI/packages/chat/SVChat.lua +++ b/Interface/AddOns/SVUI/packages/chat/SVChat.lua @@ -333,7 +333,7 @@ do end local test, text = link:match("(%a+):(.+)"); if(test == "url") then - local editBox = LAST_ACTIVE_CHAT_EDIT_BOX or _G[self:GetName()..'EditBox'] + local editBox = LAST_ACTIVE_CHAT_EDIT_BOX or _G[("%sEditBox"):format(self:GetName())] if editBox then editBox:SetText(text) editBox:SetFocus() @@ -354,7 +354,7 @@ do end local Tab_OnEnter = function(self) - local chatFrame = _G["ChatFrame"..self:GetID()]; + local chatFrame = _G[("ChatFrame%d"):format(self:GetID())]; GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT"); GameTooltip:ClearLines(); GameTooltip:AddLine(self.TText,1,1,1); @@ -378,7 +378,7 @@ do local Tab_OnClick = function(self,button) FCF_Tab_OnClick(self,button); - local chatFrame = _G["ChatFrame"..self:GetID()]; + local chatFrame = _G[("ChatFrame%d"):format(self:GetID())]; if ( chatFrame.isDocked and FCFDock_GetSelectedWindow(GENERAL_CHAT_DOCK) ~= chatFrame ) then self.IsOpen = true self:SetPanelColor("highlight") @@ -546,6 +546,10 @@ do CHAT_FONTSIZE = fontSize chat:SetFont(CHAT_FONT, CHAT_FONTSIZE, CHAT_FONTOUTLINE) tabText:SetFont(TAB_FONT, TAB_FONTSIZE, TAB_FONTOUTLINE) + if(not chat.Panel) then + chat:SetPanelTemplate("Transparent") + chat.Panel:Hide() + end if(CHAT_FONTOUTLINE ~= 'NONE' )then chat:SetShadowColor(0, 0, 0, 0) chat:SetShadowOffset(0, 0) @@ -675,6 +679,7 @@ do tab.owner = chat; if not chat.isDocked and chat:IsShown() then chat:SetParent(UIParent) + chat.Panel:Show() if(not TAB_SKINS) then tab.isDocked = chat.isDocked; tab:SetParent(chat) @@ -687,7 +692,8 @@ do _removeTab(tab.Holder,chat) end end - else + else + chat.Panel:Hide() if id == 1 then chat:ClearAllPoints() chat:Width(CHAT_WIDTH - 12) @@ -875,11 +881,13 @@ function MOD:ReLoad() end; function MOD:Load() - if(not SuperVillain.db.SVChat.enable) then return end; + if(not SuperVillain.db.SVChat.enable) then return end + self:RegisterEvent('UPDATE_CHAT_WINDOWS', 'RefreshChatFrames') self:RegisterEvent('UPDATE_FLOATING_CHAT_WINDOWS', 'RefreshChatFrames') self:RegisterEvent('PET_BATTLE_CLOSE') - SetParseHandlers(); + + SetParseHandlers() self:RefreshChatFrames(true) _G.GeneralDockManagerOverflowButton:ClearAllPoints() _G.GeneralDockManagerOverflowButton:SetPoint('BOTTOMRIGHT', SuperDockChatTabBar, 'BOTTOMRIGHT', -2, 2) diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua index 4fd2176..36dbeb5 100644 --- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua +++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua @@ -26,7 +26,7 @@ local math = _G.math; local table = _G.table; --[[ MATH METHODS ]]-- local min = math.min; -local tinsert, wipe, pairs, ipairs, unpack, pcall, select = tinsert, table.wipe, pairs, ipairs, unpack, pcall, select; +local tinsert, twipe, pairs, ipairs, unpack, pcall, select = tinsert, table.wipe, pairs, ipairs, unpack, pcall, select; local format, gsub, strfind, strmatch, tonumber = format, gsub, strfind, strmatch, tonumber; --[[ ########################################################## @@ -34,7 +34,33 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); -local MOD = {} +local MOD, DOCKLET_CACHE, TOOL_CACHE, SAFETY_CACHE = {}, {}, {}, {}; +local PREV_TOOL, DEFAULT_DOCKLET; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local AddOnButton = CreateFrame("Button", "SVUI_AddonDocklet", UIParent); +local SuperDockletMain = CreateFrame('Frame', 'SuperDockletMain', UIParent); +local SuperDockletExtra = CreateFrame('Frame', 'SuperDockletExtra', UIParent); +SuperDockletMain.FrameName = "None"; +SuperDockletExtra.FrameName = "None"; +local ICONFILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-BAG-MICRO]]; +local TOOL_DATA = { + [171] = {0,0.25,0,0.25}, -- PRO-ALCHEMY + [794] = {0.25,0.5,0,0.25,"Survey"}, -- PRO-ARCHAELOGY + [164] = {0.5,0.75,0,0.25}, -- PRO-BLACKSMITH + [184] = {0.75,1,0,0.25,"Cooking Fire"}, -- PRO-COOKING + [333] = {0,0.25,0.25,0.5,"Disenchant"}, -- PRO-ENCHANTING + [202] = {0.25,0.5,0.25,0.5}, -- PRO-ENGINEERING + [129] = {0.5,0.75,0.25,0.5}, -- PRO-FIRSTAID + [773] = {0,0.25,0.5,0.75,"Milling"}, -- PRO-INSCRIPTION + [755] = {0.25,0.5,0.5,0.75,"Prospecting"},-- PRO-JEWELCRAFTING + [165] = {0.5,0.75,0.5,0.75}, -- PRO-LEATHERWORKING + [186] = {0.75,1,0.5,0.75}, -- PRO-MINING + [197] = {0.25,0.5,0.75,1}, -- PRO-TAILORING +} --[[ ########################################################## PRE VARS/FUNCTIONS @@ -59,6 +85,12 @@ local rightalert = CreateFrame("Frame", "SuperDockAlertRight", UIParent) rightalert.Activate = AlertActivate rightalert.Deactivate = AlertDeactivate +local rightDockSizeHook = function(self,width,height) + SuperDockWindowRight:Width(width) + SuperDockWindowRight:Height(height) + SuperDockWindowRight:SetPoint("BOTTOMLEFT", SuperDockAlertRight, "TOPLEFT", 0, 0) +end + local Dock_OnEnter = function(self, ...) if InCombatLockdown() then return end self:SetPanelColor("highlight") @@ -96,8 +128,34 @@ local Dock_OnClick = function(self) SuperVillain:SecureFadeOut(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 0, true) end SVUI_Cache["Dock"].SuperDockFaded = MOD.SuperDockFaded +end + +local Docklet_OnShow = function(self) + if(_G[SuperDockWindowRight.FrameName]) then + if(InCombatLockdown() and (_G[SuperDockWindowRight.FrameName].IsProtected and _G[SuperDockWindowRight.FrameName]:IsProtected())) then return end + _G[SuperDockWindowRight.FrameName]:Show() + end + if _G[SuperDockWindowRight.SecondName] then + if(InCombatLockdown() and (_G[SuperDockWindowRight.SecondName].IsProtected and _G[SuperDockWindowRight.SecondName]:IsProtected())) then return end + _G[SuperDockWindowRight.SecondName]:Show() + end end +local Docklet_OnHide = function(self) + for i=1, #DOCKLET_CACHE do + local f = DOCKLET_CACHE[i] + if(not InCombatLockdown() or (InCombatLockdown() and (f.IsProtected and not f:IsProtected()))) then + f.IsOpen = false; + local b = _G[f.ToggleName] + b:SetPanelColor("special") + b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + if f.Hide then + f:Hide() + end + end + end +end + local Button_OnEnter = function(self, ...) self:SetPanelColor("highlight") self.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) @@ -111,6 +169,93 @@ local Button_OnLeave = function(self, ...) self:SetPanelColor("special") self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) GameTooltip:Hide() +end + +local DockletFrame_OnShow = function(self) + local frameName = self.FrameName; + if (frameName and _G[frameName]) then + _G[frameName]:Show() + end +end + +local Addon_OnEnter = function(self) + if not self.IsOpen then + self:SetPanelColor("highlight") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) + end + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) + GameTooltip:ClearLines() + GameTooltip:AddLine(self.TText, 1, 1, 1) + GameTooltip:Show() +end + +local Addon_OnLeave = function(self) + if not self.IsOpen then + self:SetPanelColor("special") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end + GameTooltip:Hide() +end + +local Addon_OnClick = function(self) + if SuperDockletMain.FrameName and _G[SuperDockletMain.FrameName] then + if not _G[SuperDockletMain.FrameName]:IsShown() then + MOD:DockletHide() + if not InCombatLockdown() and not SuperDockletMain:IsShown()then + SuperDockletMain:Show() + end + _G[SuperDockletMain.FrameName]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + elseif not SuperDockletMain:IsShown()then + if not InCombatLockdown() then SuperDockletMain:Show() end + _G[SuperDockletMain.FrameName]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + end + else + SuperDockletMain.FrameName = "None" + if InCombatLockdown()then return end + if SuperDockletMain:IsShown()then + SuperDockletMain:Hide() + else + SuperDockletMain:Show() + end + self:SetPanelColor("special") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end + if MOD.db.docklets.enableExtra and SuperDockletExtra.FrameName and _G[SuperDockletExtra.FrameName] then + if not _G[SuperDockletExtra.FrameName]:IsShown() then + if not InCombatLockdown() and not SuperDockletExtra:IsShown()then + SuperDockletExtra:Show() + SuperDockletMain:Show() + end + _G[SuperDockletExtra.FrameName]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + elseif not SuperDockletExtra:IsShown() then + if not InCombatLockdown() then + SuperDockletExtra:Show() + SuperDockletMain:Show() + end + _G[SuperDockletExtra.FrameName]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + else + if not InCombatLockdown() then + SuperDockletExtra:Hide() + SuperDockletMain:Hide() + end + self:SetPanelColor("special") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end + else + SuperDockletExtra.FrameName = "None" + end end local function SetSuperDockStyle(dock) @@ -152,68 +297,111 @@ end CORE FUNCTIONS ########################################################## ]]-- -function MOD:UpdateSuperDock() - local leftWidth = self.db.dockLeftWidth or 350; - local leftHeight = self.db.dockLeftHeight or 180; - local rightWidth = self.db.dockRightWidth or 350; - local rightHeight = self.db.dockRightHeight or 180; - local buttonsize = self.db.buttonSize or 22; - local spacing = self.db.buttonSpacing or 4; - local statBarWidth = self.db.dockStatWidth - - _G["LeftSuperDock"]:Size(leftWidth, leftHeight) - _G["SuperDockAlertLeft"]:Width(leftWidth) - _G["SuperDockWindowLeft"]:Size(leftWidth, leftHeight) - _G["RightSuperDock"]:Size(rightWidth, rightHeight) - _G["SuperDockAlertRight"]:Width(rightWidth) - _G["SuperDockWindowRight"]:Size(rightWidth, rightHeight) - _G["SuperDockBottomDataAnchor"]:Size(statBarWidth - 2, buttonsize - 8) - _G["BottomLeftDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8) - _G["BottomRightDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8) - - self:BottomPanelVisibility(); - self:TopPanelVisibility(); - self:UpdateDockBackdrops(); - self:ReloadDocklets() -end - -function MOD:UpdateDockBackdrops() - if self.db.rightDockBackdrop then - RightSuperDock.backdrop:Show() - RightSuperDock.backdrop:ClearAllPoints() - RightSuperDock.backdrop:WrapOuter(RightSuperDock, 4, 4) - else - RightSuperDock.backdrop:Hide() - end - if self.db.leftDockBackdrop then - LeftSuperDock.backdrop:Show() - LeftSuperDock.backdrop:ClearAllPoints() - LeftSuperDock.backdrop:WrapOuter(LeftSuperDock, 4, 4) - else - LeftSuperDock.backdrop:Hide() +function HideSuperDocks() + Dock_OnClick(LeftDockToggleButton) +end +--[[ +########################################################## +DOCKLET HELPERS +########################################################## +]]-- +do + local function GetDefaultWindow() + local window = DEFAULT_DOCKLET + if window and _G[window] and not _G[window]:IsShown() then + SuperDockWindowRight.FrameName = window + SuperDockWindowRight:Show() + end end -end -function MOD:BottomPanelVisibility() - if self.db.bottomPanel then - self.BottomPanel:Show() - else - self.BottomPanel:Hide() + local Button_OnEnter = function(b) + if not b.IsOpen then + b:SetPanelColor("highlight") + b.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) + end + GameTooltip:SetOwner(b, "ANCHOR_TOPLEFT", 0, 4) + GameTooltip:ClearLines() + GameTooltip:AddLine(b.TText, 1, 1, 1) + GameTooltip:Show() end -end -function MOD:TopPanelVisibility() - if self.db.topPanel then - self.TopPanel:Show() - else - self.TopPanel:Hide() + local Button_OnLeave = function(b) + if not b.IsOpen then + b:SetPanelColor("special") + b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end + GameTooltip:Hide() end -end -function HideSuperDocks() - Dock_OnClick(LeftDockToggleButton) -end + local Button_OnClick = function(self) + if InCombatLockdown() then return end + local linkedFrame = self.FrameName + if linkedFrame and _G[linkedFrame] then + SuperDockWindowRight.FrameName = linkedFrame + if not _G[linkedFrame]:IsShown() then + if not SuperDockWindowRight:IsShown()then + SuperDockWindowRight:Show() + end + MOD:DockletHide() + _G[linkedFrame]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + elseif not SuperDockWindowRight:IsShown()then + SuperDockWindowRight:Show() + _G[linkedFrame]:Show() + self.IsOpen = true; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + end + else + if SuperDockWindowRight:IsShown()then + SuperDockWindowRight:Hide() + else + SuperDockWindowRight:Show() + end + self.IsOpen = false; + self:SetPanelColor("special") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + GetDefaultWindow() + end + end + function MOD:CreateBasicToolButton(name,texture,onclick,frameName,isdefault) + local fName = frameName or name; + local dockIcon = texture or [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-ADDON]]; + local clickFunction = (type(onclick)=="function") and onclick or Button_OnClick; + local size = SuperDockToolBarRight.currentSize; + local button = _G[fName .. "_ToolBarButton"] or CreateFrame("Button",("%s_ToolBarButton"):format(fName),SuperDockToolBarRight) + SuperVillain.AddTool(button) + button:Size(size,size) + button:SetFramedButtonTemplate() + button.icon = button:CreateTexture(nil,"OVERLAY") + button.icon:FillInner(button,2,2) + button.icon:SetTexture(dockIcon) + button.TText = "Open " .. name; + button.FrameName = fName; + if isdefault == true then + DEFAULT_DOCKLET = fName; + end + button.IsOpen = isdefault and true or false; + button:SetScript("OnEnter",Button_OnEnter) + button:SetScript("OnLeave",Button_OnLeave) + button:SetScript("OnClick",clickFunction) + _G[fName].ToggleName = fName.."_ToolBarButton"; + if(isdefault) then + button:SetPanelColor("green") + button.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + else + button.icon:SetGradient(unpack(SuperVillain.Media.gradient.light)) + end + end +end +--[[ +########################################################## +DOCKS +########################################################## +]]-- function MOD:CreateSuperBorders() local texture = [[Interface\AddOns\SVUI\assets\artwork\Template\BUTTON]]; @@ -318,7 +506,7 @@ function MOD:CreateDockPanels() leftdock:SetFrameStrata("BACKGROUND") leftdock:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", 1, buttonsize + 10) leftdock:Size(leftWidth, leftHeight) - SuperVillain:SetSVMovable(leftdock, "LeftDock_MOVE", L["Left Dock"]) + SuperVillain:SetSVMovable(leftdock, L["Left Dock"]) leftalert:SetParent(leftdock) leftalert:SetFrameStrata("BACKGROUND") @@ -366,7 +554,7 @@ function MOD:CreateDockPanels() rightdock:SetFrameStrata("BACKGROUND") rightdock:Point("BOTTOMRIGHT", SuperVillain.UIParent, "BOTTOMRIGHT", -1, buttonsize + 10) rightdock:Size(rightWidth, rightHeight) - SuperVillain:SetSVMovable(rightdock, "RightDock_MOVE", L["Right Dock"]) + SuperVillain:SetSVMovable(rightdock, L["Right Dock"]) rightalert:SetParent(rightdock) rightalert:SetFrameStrata("BACKGROUND") @@ -420,8 +608,394 @@ function MOD:CreateDockPanels() bottomrightdata:Size((statBarWidth * 0.5) - 1, buttonsize - 8) bottomrightdata:Point("RIGHT", bottomanchor, "RIGHT", 0, 0) STATS:NewAnchor(bottomrightdata, 3, "ANCHOR_CURSOR") +end + +do + local LastAddedMacro; + local MacroCount = 0; + + local function HearthTime() + local start,duration = GetItemCooldown(6948) + local expires = duration - (GetTime() - start) + if expires > 0.05 then + local timeLeft = 0; + local calc = 0; + if expires < 4 then + return format("|cffff0000%.1f|r", expires) + elseif expires < 60 then + return format("|cffffff00%d|r", floor(expires)) + elseif expires < 3600 then + timeLeft = ceil(expires / 60); + calc = floor((expires / 60) + .5); + return format("|cffff9900%dm|r", timeLeft) + elseif expires < 86400 then + timeLeft = ceil(expires / 3600); + calc = floor((expires / 3600) + .5); + return format("|cff66ffff%dh|r", timeLeft) + else + timeLeft = ceil(expires / 86400); + calc = floor((expires / 86400) + .5); + return format("|cff6666ff%dd|r", timeLeft) + end + else + return "|cff6666ffReady|r" + end + end + + local Hearth_OnEnter = function(self) + if InCombatLockdown() then return end + self.glow:Show() + self:SetPanelColor("highlight") + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) + GameTooltip:ClearLines() + GameTooltip:AddLine(L["Hearthstone"], 1, 1, 1) + local remaining = HearthTime() + GameTooltip:AddDoubleLine(L["Time Remaining"], remaining, 1, 1, 1, 0, 1, 1) + if(self.ExtraSpell) then + GameTooltip:AddLine(" ", 1, 1, 1) + GameTooltip:AddDoubleLine(self.ExtraSpell, "[Right Click]", 1, 1, 1, 0, 1, 0) + end + GameTooltip:Show() + end + + local Hearth_OnLeave = function(self) + if InCombatLockdown() then return end + self.glow:Hide() + self:SetPanelColor("special") + GameTooltip:Hide() + end + + local function AddMacroTool(frame) + local width; + local height = SuperDockToolBarRight.currentSize; + if not LastAddedMacro then + frame:Point("RIGHT", SuperDockMacroBar, "RIGHT", -6, 0); + else + frame:Point("RIGHT", LastAddedMacro, "LEFT", -6, 0); + end + LastAddedMacro = frame; + MacroCount = MacroCount + 1; + width = MacroCount * (height + 6) + SuperDockMacroBar:Size(width, height) + end + + local function CreateMacroToolButton(proName, proID, itemID, size) + if proName == "Mining" then proName = "Smelting" end + local data = TOOL_DATA[proID] + if(not data) then return end + local button = CreateFrame("Button", ("%s_MacroBarButton"):format(itemID), SuperDockMacroBar, "SecureActionButtonTemplate") + button:Size(size, size) + AddMacroTool(button) + button:SetFramedButtonTemplate() + button.icon = button:CreateTexture(nil, "OVERLAY") + button.icon:FillInner(button, 2, 2) + button.icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\PROFESSIONS]]) + button.icon:SetTexCoord(data[1], data[2], data[3], data[4]) + button.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + button.skillName = proName; + button.itemId = itemID; + button.TText = "Open " .. proName; + button:SetAttribute("type", "macro") + if(data[5]) then + local rightClickSpell = data[5] + button:SetAttribute("macrotext", "/cast [mod:shift]" .. rightClickSpell .. "; " .. proName) + button.TText2 = "Shift-Click to use " .. rightClickSpell + else + button:SetAttribute("macrotext","/cast " .. proName) + end + button:SetScript("OnEnter", Macro_OnEnter) + button:SetScript("OnLeave", Macro_OnLeave) + end + + function MOD:LoadToolBarProfessions() + if(MOD.ToolBarLoaded) then return end + local size = SuperDockMacroBar.currentSize + local hearth = CreateFrame("Button", "RightSuperDockHearthButton", SuperDockMacroBar, "SecureActionButtonTemplate") + hearth:Size(size, size) + AddMacroTool(hearth) + hearth:SetFramedButtonTemplate() + hearth.icon = hearth:CreateTexture(nil, "OVERLAY", nil, 0) + hearth.icon:FillInner(hearth,2,2) + hearth.icon:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Icons\\DOCK-HEARTH") + hearth.icon:SetTexCoord(0,0.5,0,1) + hearth.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + hearth.glow = hearth:CreateTexture(nil, "OVERLAY", nil, 2) + hearth.glow:FillInner(hearth,2,2) + hearth.glow:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Icons\\DOCK-HEARTH") + hearth.glow:SetTexCoord(0.5,1,0,1) + hearth.glow:Hide() + hearth:SetScript("OnEnter", Hearth_OnEnter) + hearth:SetScript("OnLeave", Hearth_OnLeave) + + hearth:RegisterForClicks("AnyUp") + hearth:SetAttribute("type", "item") + hearth:SetAttribute("item", "Hearthstone") + + if(SuperVillain.class == "SHAMAN") then + hearth:SetAttribute("type2", "spell") + hearth:SetAttribute("spell", "Astral Recall") + hearth.ExtraSpell = "Astral Recall" + elseif(SuperVillain.class == "DEATHKNIGHT") then + hearth:SetAttribute("type2","spell") + hearth:SetAttribute("spell","Death Gate") + hearth.ExtraSpell = "Death Gate" + elseif(SuperVillain.class == "DRUID") then + hearth:SetAttribute("type2", "spell") + hearth:SetAttribute("spell", "Teleport: Moonglade") + hearth.ExtraSpell = "Teleport: Moonglade" + elseif(SuperVillain.class == "MONK") then + hearth:SetAttribute("type2", "spell") + hearth:SetAttribute("spell", "Zen Pilgrimage") + hearth.ExtraSpell = "Zen Pilgrimage" + end + + local proName, proID + local prof1, prof2, archaeology, _, cooking, firstAid = GetProfessions() + if(firstAid ~= nil) then + proName, _, _, _, _, _, proID = GetProfessionInfo(firstAid) + CreateMacroToolButton(proName, proID, firstAid, size) + end + if(archaeology ~= nil) then + proName, _, _, _, _, _, proID = GetProfessionInfo(archaeology) + CreateMacroToolButton(proName, proID, archaeology, size) + end + if(cooking ~= nil) then + proName, _, _, _, _, _, proID = GetProfessionInfo(cooking) + CreateMacroToolButton(proName, proID, cooking, size) + end + if(prof2 ~= nil) then + proName, _, _, _, _, _, proID = GetProfessionInfo(prof2) + if(proID ~= 182 and proID ~= 393) then + CreateMacroToolButton(proName, proID, prof2, size) + end + end + if(prof1 ~= nil) then + proName, _, _, _, _, _, proID = GetProfessionInfo(prof1) + if(proID ~= 182 and proID ~= 393) then + CreateMacroToolButton(proName, proID, prof1, size) + end + end + + MOD.ToolBarLoaded = true + end +end +--[[ +########################################################## +EXTERNALLY ACCESSIBLE METHODS +########################################################## +]]-- +SuperVillain.CycleDocklets = Docklet_OnHide +SuperVillain.CurrentlyDocked = {}; +function SuperVillain:IsDockletReady(arg) + local addon = arg; + if arg == "DockletMain" or arg == "DockletExtra" then + addon = MOD.db.docklets[arg] + end + if addon:find("Skada") then addon = "Skada" end + if addon == nil or addon == "None" or not IsAddOnLoaded(addon) then + return false + end + return true +end + +function SuperVillain:RemoveTool() + if not self or not self.listIndex then return end + local name = self:GetName(); + if not SAFETY_CACHE[name] then return end + SAFETY_CACHE[name] = false; + local i = self.listIndex; + tremove(TOOL_CACHE, i) + local width; + local height = SuperDockToolBarRight.currentSize; + PREV_TOOL = TOOL_CACHE[#TOOL_CACHE] + width = #TOOL_CACHE * (height + 6) + SuperDockToolBarRight:Size(width, height) + self:Hide() +end + +function SuperVillain:AddTool() + local name = self:GetName(); + if SAFETY_CACHE[name] then return end + SAFETY_CACHE[name] = true; + local width; + local height = SuperDockToolBarRight.currentSize; + if not PREV_TOOL or PREV_TOOL == self then + self:Point("RIGHT", SuperDockToolBarRight, "RIGHT", -6, 0); + else + self:Point("RIGHT", PREV_TOOL, "LEFT", -6, 0); + end + tinsert(TOOL_CACHE, self) + self.listIndex = #TOOL_CACHE; + PREV_TOOL = self; + width = #TOOL_CACHE * (height + 6) + SuperDockToolBarRight:Size(width, height) + self:Show() +end + +do + local function UnregisterDocklet(name) + local frame = _G[name]; + if not frame or not frame.listIndex then return end + local i = frame.listIndex; + tremove(DOCKLET_CACHE, i) + end + + local function UnregisterDocklets() + local frame, i; + twipe(SuperVillain.CurrentlyDocked); + if SuperVillain:IsDockletReady("DockletMain") then + frame = MOD.db.docklets.MainWindow + if frame ~= nil and frame ~= "None" and _G[frame] then + UnregisterDocklet(frame) + MOD.db.docklets.MainWindow = "None" + end + elseif AddOnButton.IsRegistered then + SuperVillain.RemoveTool(AddOnButton) + AddOnButton.TText = ""; + AddOnButton.IsOpen = false; + AddOnButton.IsRegistered = false; + end + if SuperVillain:IsDockletReady("DockletExtra") then + frame = MOD.db.docklets.ExtraWindow + if frame ~= nil and frame ~= "None" and _G[frame] then + UnregisterDocklet(frame) + MOD.db.docklets.ExtraWindow = "None" + end + end + SuperDockletMain.FrameName = "None" + SuperDockletExtra.FrameName = "None" + end + + function SuperVillain:ReloadDocklets(alert) + UnregisterDocklets() + if InCombatLockdown()then return end + local width = MOD.db.dockRightWidth or 350; + local height = (MOD.db.dockRightHeight or 180) - 22 + if SuperVillain:IsDockletReady('DockletMain') then + if SuperVillain:IsDockletReady("DockletExtra") and MOD.db.docklets.enableExtra then + width = width * 0.5; + end + SuperDockletMain:ClearAllPoints() + SuperDockletMain:Size(width,height) + SuperDockletMain:Point('BOTTOMLEFT',RightSuperDock,'BOTTOMLEFT',1,1) + SuperDockletExtra:ClearAllPoints() + SuperDockletExtra:Size(width,height) + SuperDockletExtra:Point('BOTTOMLEFT',SuperDockletMain,'BOTTOMRIGHT',0,0) + end + end +end + +function SuperVillain:RegisterDocklet(name, tooltip, texture, onclick, isdefault) + local frame = _G[name]; + if frame and (frame.IsObjectType and frame:IsObjectType("Frame")) and (frame.IsProtected and not frame:IsProtected()) then + frame:ClearAllPoints() + frame:SetParent(SuperDockWindowRight) + frame:FillInner(SuperDockWindowRight, 4, 4) + frame.FrameName = name; + tinsert(DOCKLET_CACHE, frame); + frame.listIndex = #DOCKLET_CACHE; + MOD:CreateBasicToolButton(tooltip, texture, onclick, name, isdefault) + end +end + +function SuperVillain:RegisterMainDocklet(name) + local frame = _G[name]; + if (frame and (frame.IsObjectType and frame:IsObjectType("Frame")) and (frame.IsProtected and not frame:IsProtected())) then + SuperDockletMain.FrameName = name; + MOD.db.docklets.MainWindow = name; + frame:ClearAllPoints() + frame:SetParent(SuperDockletMain) + frame:SetAllPoints(SuperDockletMain) + frame.ToggleName = "SVUI_AddonDocklet"; + tinsert(DOCKLET_CACHE, frame); + frame.listIndex = #DOCKLET_CACHE; + self.AddTool(AddOnButton) + AddOnButton.TText = ""; + AddOnButton.IsRegistered = true + self.CurrentlyDocked[name] = true + if not InCombatLockdown() and frame:IsShown() then frame:Hide() end + end +end + +function SuperVillain:RegisterExtraDocklet(name) + local frame = _G[name]; + if (frame and (frame.IsObjectType and frame:IsObjectType("Frame")) and (frame.IsProtected and not frame:IsProtected())) then + SuperDockletExtra.FrameName = name; + MOD.db.docklets.ExtraWindow = name; + frame:ClearAllPoints() + frame:SetParent(SuperDockletExtra) + frame:SetAllPoints(SuperDockletExtra) + frame.ToggleName = "SVUI_AddonDocklet"; + tinsert(DOCKLET_CACHE, frame); + frame.listIndex = #DOCKLET_CACHE; + AddOnButton.TText = ""; + self.CurrentlyDocked[name] = true; + if not InCombatLockdown() and frame:IsShown() then frame:Hide() end + end +end +--[[ +########################################################## +BUILD/UPDATE +########################################################## +]]-- +function MOD:UpdateSuperDock() + local leftWidth = self.db.dockLeftWidth or 350; + local leftHeight = self.db.dockLeftHeight or 180; + local rightWidth = self.db.dockRightWidth or 350; + local rightHeight = self.db.dockRightHeight or 180; + local buttonsize = self.db.buttonSize or 22; + local spacing = self.db.buttonSpacing or 4; + local statBarWidth = self.db.dockStatWidth + + _G["LeftSuperDock"]:Size(leftWidth, leftHeight) + _G["SuperDockAlertLeft"]:Width(leftWidth) + _G["SuperDockWindowLeft"]:Size(leftWidth, leftHeight) + _G["RightSuperDock"]:Size(rightWidth, rightHeight) + _G["SuperDockAlertRight"]:Width(rightWidth) + _G["SuperDockWindowRight"]:Size(rightWidth, rightHeight) + _G["SuperDockBottomDataAnchor"]:Size(statBarWidth - 2, buttonsize - 8) + _G["BottomLeftDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8) + _G["BottomRightDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8) + + self:BottomPanelVisibility(); + self:TopPanelVisibility(); + self:UpdateDockBackdrops(); + SuperVillain:ReloadDocklets() +end + +function MOD:UpdateDockBackdrops() + if self.db.rightDockBackdrop then + RightSuperDock.backdrop:Show() + RightSuperDock.backdrop:ClearAllPoints() + RightSuperDock.backdrop:WrapOuter(RightSuperDock, 4, 4) + else + RightSuperDock.backdrop:Hide() + end + if self.db.leftDockBackdrop then + LeftSuperDock.backdrop:Show() + LeftSuperDock.backdrop:ClearAllPoints() + LeftSuperDock.backdrop:WrapOuter(LeftSuperDock, 4, 4) + else + LeftSuperDock.backdrop:Hide() + end +end + +function MOD:BottomPanelVisibility() + if self.db.bottomPanel then + self.BottomPanel:Show() + else + self.BottomPanel:Hide() + end end +function MOD:TopPanelVisibility() + if self.db.topPanel then + self.TopPanel:Show() + else + self.TopPanel:Hide() + end +end + function MOD:ReLoad() self:UpdateSuperDock(); end @@ -429,12 +1003,44 @@ end function MOD:Load() self:CreateSuperBorders() self:CreateDockPanels() - self:CreateDockWindow() - self:Protect("LoadToolBarProfessions"); - SuperVillain:ExecuteTimer(MOD.LoadToolBarProfessions, 5) - --self:RegisterEvent("PLAYER_REGEN_DISABLED", "DockletEnterCombat") - --self:RegisterEvent("PLAYER_REGEN_ENABLED", "DockletExitCombat") - self:DockletInit() + + local width = RightSuperDock:GetWidth(); + local height = RightSuperDock:GetHeight() - 22 + SuperDockWindowRight:Size(width, height) + SuperDockWindowRight:SetPoint("BOTTOMLEFT", SuperDockAlertRight, "TOPLEFT", 0, 0) + SuperDockWindowRight:SetScript('OnShow', Docklet_OnShow) + SuperDockWindowRight:SetScript('OnHide', Docklet_OnHide) + if not InCombatLockdown()then + Docklet_OnHide() + end + hooksecurefunc(RightSuperDock, 'SetSize', rightDockSizeHook) self:UpdateDockBackdrops() -end + + SuperDockletMain:SetFrameLevel(SuperDockWindowRight:GetFrameLevel() + 50) + SuperDockletExtra:SetFrameLevel(SuperDockWindowRight:GetFrameLevel() + 50) + local size = SuperDockToolBarRight.currentSize; + AddOnButton:SetParent(SuperDockToolBarRight) + AddOnButton:Size(size,size) + AddOnButton:SetFramedButtonTemplate() + AddOnButton.icon = AddOnButton:CreateTexture(nil,"OVERLAY") + AddOnButton.icon:FillInner() + AddOnButton.icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-ADDON]]) + AddOnButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + AddOnButton.TText=""; + AddOnButton.IsOpen=false; + AddOnButton.IsRegistered=false; + AddOnButton:SetScript("OnEnter",Addon_OnEnter) + AddOnButton:SetScript("OnLeave",Addon_OnLeave) + AddOnButton:SetScript("OnClick",Addon_OnClick) + AddOnButton:Hide() + + SuperDockletMain:SetScript('OnShow', DockletFrame_OnShow) + SuperDockletExtra:SetScript('OnShow', DockletFrame_OnShow) + + SuperVillain:ReloadDocklets(true) + + self:Protect("LoadToolBarProfessions") + SuperVillain:ExecuteTimer(MOD.LoadToolBarProfessions, 5) +end + SuperVillain.Registry:NewPackage(MOD, "SVDock") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.xml b/Interface/AddOns/SVUI/packages/dock/SVDock.xml index 8a304b1..bba6efc 100644 --- a/Interface/AddOns/SVUI/packages/dock/SVDock.xml +++ b/Interface/AddOns/SVUI/packages/dock/SVDock.xml @@ -1,4 +1,3 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVDock.lua'/> - <Include file='common\_load.xml'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/dock/common/_load.xml b/Interface/AddOns/SVUI/packages/dock/common/_load.xml deleted file mode 100644 index 05582f9..0000000 --- a/Interface/AddOns/SVUI/packages/dock/common/_load.xml +++ /dev/null @@ -1,4 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='toolbar.lua'/> - <Script file='docklets.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/dock/common/docklets.lua b/Interface/AddOns/SVUI/packages/dock/common/docklets.lua deleted file mode 100644 index 99342a7..0000000 --- a/Interface/AddOns/SVUI/packages/dock/common/docklets.lua +++ /dev/null @@ -1,382 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local type = _G.type; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local format,find = string.format, string.find; ---[[ MATH METHODS ]]-- -local floor = math.floor; ---[[ TABLE METHODS ]]-- -local tremove, twipe = table.remove, table.wipe; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVDock'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local AddOnButton = CreateFrame("Button","ToolBarDockletButton",UIParent); -local DOCK_HEIGHT,DOCK_WIDTH; -local SuperDockletMain = CreateFrame('Frame', 'SuperDockletMain', UIParent); -local SuperDockletExtra = CreateFrame('Frame', 'SuperDockletExtra', UIParent); -SuperDockletMain.FrameName = "None"; -SuperDockletExtra.FrameName = "None"; -local ICONFILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-BAG-MICRO]]; ---[[ -########################################################## -PRE VARS/FUNCTIONS -########################################################## -]]-- -MOD.DockletList={}; -MOD.MainToolTip = ""; -MOD.ExtraToolTip = ""; -MOD.CurrentlyDocked = {}; - -local resizeHook = function() - MOD:ReloadDocklets() -end - -local rightDockSizeHook = function(self,width,height) - SuperDockWindowRight:Width(width) - SuperDockWindowRight:Height(height) - SuperDockWindowRight:SetPoint("BOTTOMLEFT", SuperDockAlertRight, "TOPLEFT", 0, 0) -end - -local DockletFrame_OnShow = function(self) - local frameName = self.FrameName; - if (frameName and _G[frameName]) then - _G[frameName]:Show() - end -end - -local Addon_OnEnter=function(b) - if not b.IsOpen then - b:SetPanelColor("highlight") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) - end - GameTooltip:SetOwner(b,'ANCHOR_TOPLEFT',0,4) - GameTooltip:ClearLines() - GameTooltip:AddLine(b.TText,1,1,1) - GameTooltip:Show() -end - -local Addon_OnLeave=function(b) - if not b.IsOpen then - b:SetPanelColor("special") - b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - end - GameTooltip:Hide() -end - -local Addon_OnClick=function(b) - if SuperDockletMain.FrameName and _G[SuperDockletMain.FrameName] then - if not _G[SuperDockletMain.FrameName]:IsShown() then - MOD:DockletHide() - if not InCombatLockdown() and not SuperDockletMain:IsShown()then - SuperDockletMain:Show() - end - _G[SuperDockletMain.FrameName]:Show() - b.IsOpen=true; - b:SetPanelColor("green") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - elseif not SuperDockletMain:IsShown()then - if not InCombatLockdown() then SuperDockletMain:Show() end - _G[SuperDockletMain.FrameName]:Show() - b.IsOpen=true; - b:SetPanelColor("green") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - end - else - SuperDockletMain.FrameName="None" - if InCombatLockdown()then return end - if SuperDockletMain:IsShown()then - SuperDockletMain:Hide() - else - SuperDockletMain:Show() - end - b:SetPanelColor("special") - b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - end - if SuperVillain.db.SVDock.docklets.enableExtra and SuperDockletExtra.FrameName and _G[SuperDockletExtra.FrameName] then - if not _G[SuperDockletExtra.FrameName]:IsShown() then - if not InCombatLockdown() and not SuperDockletExtra:IsShown()then - SuperDockletExtra:Show() - SuperDockletMain:Show() - end - _G[SuperDockletExtra.FrameName]:Show() - b.IsOpen=true; - b:SetPanelColor("green") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - elseif not SuperDockletExtra:IsShown() then - if not InCombatLockdown() then - SuperDockletExtra:Show() - SuperDockletMain:Show() - end - _G[SuperDockletExtra.FrameName]:Show() - b.IsOpen=true; - b:SetPanelColor("green") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - else - if not InCombatLockdown() then - SuperDockletExtra:Hide() - SuperDockletMain:Hide() - end - b:SetPanelColor("special") - b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - end - else - SuperDockletExtra.FrameName="None" - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:DockletShow() - if(_G[SuperDockWindowRight.FrameName]) then - if(InCombatLockdown() and (_G[SuperDockWindowRight.FrameName].IsProtected and _G[SuperDockWindowRight.FrameName]:IsProtected())) then return end - _G[SuperDockWindowRight.FrameName]:Show() - end - if _G[SuperDockWindowRight.SecondName] then - if(InCombatLockdown() and (_G[SuperDockWindowRight.SecondName].IsProtected and _G[SuperDockWindowRight.SecondName]:IsProtected())) then return end - _G[SuperDockWindowRight.SecondName]:Show() - end -end - -function MOD:DockletHide() - --if InCombatLockdown()then SuperVillain:AddonMessage("Cant close any windows in combat. Try again after combat ends...")return end - for i=1, #MOD.DockletList do - local f = MOD.DockletList[i] - if(not InCombatLockdown() or (InCombatLockdown() and (f.IsProtected and not f:IsProtected()))) then - f.IsOpen = false; - local b = _G[f.ToggleName] - b:SetPanelColor("special") - b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - if f.Hide then - f:Hide() - end - end - end - -- SuperDockWindowRight:Show() -end - -function MOD:DockWindowResize() - if InCombatLockdown()then return end - local width=RightSuperDock:GetWidth(); - local height=RightSuperDock:GetHeight() - 22 - SuperDockWindowRight:Size(width,height) - SuperDockWindowRight:SetPoint("BOTTOMLEFT", SuperDockAlertRight, "TOPLEFT", 0, 0) -end - -function MOD:RegisterDocklet(name,tooltip,texture,onclick,isdefault) - local frame=_G[name]; - if frame and (frame.IsObjectType and frame:IsObjectType('Frame')) and (frame.IsProtected and not frame:IsProtected()) then - frame:ClearAllPoints() - frame:SetParent(SuperDockWindowRight) - frame:FillInner(SuperDockWindowRight,4,4) - frame.FrameName=name; - tinsert(MOD.DockletList,frame); - frame.listIndex=#MOD.DockletList; - MOD:CreateBasicToolButton(tooltip,texture,onclick,name,isdefault) - end -end - -function MOD:UnregisterDocklet(name) - local frame=_G[name]; - if not frame or not frame.listIndex then return end - local i=frame.listIndex; - tremove(MOD.DockletList,i) -end - -function MOD:CreateDockWindow() - DOCK_HEIGHT,DOCK_WIDTH = SuperVillain.db.SVDock.dockRightHeight, SuperVillain.db.SVDock.dockRightWidth; - MOD:DockWindowResize() - SuperDockWindowRight:SetScript('OnShow',MOD.DockletShow) - SuperDockWindowRight:SetScript('OnHide',MOD.DockletHide) - if not InCombatLockdown()then - MOD:DockletHide() - end - hooksecurefunc(RightSuperDock,'SetSize', rightDockSizeHook) -end - -function MOD:IsDockletReady(arg) - local addon = arg; - if arg == "DockletMain" or arg == "DockletExtra" then - addon = SuperVillain.db.SVDock.docklets[arg] - end - if find(addon, "Skada") then addon = "Skada" end - if addon == nil or addon == 'None' or not IsAddOnLoaded(addon) then - return false - end - return true -end - -function MOD:ResizeDocklets() - if InCombatLockdown()then return end - local width = SuperVillain.db.SVDock.dockRightWidth or 350; - local height = (SuperVillain.db.SVDock.dockRightHeight or 180) - 22 - if MOD:IsDockletReady('DockletMain') then - if MOD:IsDockletReady("DockletExtra") and SuperVillain.db.SVDock.docklets.enableExtra then - width = width * 0.5; - end - SuperDockletMain:ClearAllPoints() - SuperDockletMain:Size(width,height) - SuperDockletMain:Point('BOTTOMLEFT',RightSuperDock,'BOTTOMLEFT',1,1) - SuperDockletExtra:ClearAllPoints() - SuperDockletExtra:Size(width,height) - SuperDockletExtra:Point('BOTTOMLEFT',SuperDockletMain,'BOTTOMRIGHT',0,0) - end -end - -function MOD:UnsetDockletButton() - MOD.RemoveTool(AddOnButton) - AddOnButton.TText=""; - AddOnButton.IsOpen=false; - AddOnButton.IsRegistered=false; -end - -function MOD:RegisterMainDocklet(name) - local frame = _G[name]; - if (frame and (frame.IsObjectType and frame:IsObjectType('Frame')) and (frame.IsProtected and not frame:IsProtected())) then - SuperDockletMain.FrameName=name; - SuperVillain.db.SVDock.docklets.MainWindow = name; - frame:ClearAllPoints() - frame:SetParent(SuperDockletMain) - frame:SetAllPoints(SuperDockletMain) - frame.ToggleName="ToolBarDockletButton"; - tinsert(MOD.DockletList,frame); - frame.listIndex=#MOD.DockletList; - MOD.AddTool(AddOnButton) - AddOnButton.TText="Open "..MOD.MainToolTip; - AddOnButton.IsRegistered = true - MOD.CurrentlyDocked[name] = true - if not InCombatLockdown() and frame:IsShown() then frame:Hide() end - end -end - -function MOD:RegisterExtraDocklet(name) - local frame = _G[name]; - if (frame and (frame.IsObjectType and frame:IsObjectType('Frame')) and (frame.IsProtected and not frame:IsProtected())) then - SuperDockletExtra.FrameName=name; - SuperVillain.db.SVDock.docklets.ExtraWindow=name; - frame:ClearAllPoints() - frame:SetParent(SuperDockletExtra) - frame:SetAllPoints(SuperDockletExtra) - frame.ToggleName="ToolBarDockletButton"; - tinsert(MOD.DockletList,frame); - frame.listIndex=#MOD.DockletList; - AddOnButton.TText = MOD.MainToolTip.." and "..MOD.ExtraToolTip; - MOD.CurrentlyDocked[name] = true; - if not InCombatLockdown() and frame:IsShown() then frame:Hide() end - end -end - -function MOD:UnregisterDocklets() - local frame,i; - twipe(MOD.CurrentlyDocked); - if MOD:IsDockletReady('DockletMain') then - frame=SuperVillain.db.SVDock.docklets.MainWindow - if frame~=nil and frame~="None" and _G[frame] then - MOD:UnregisterDocklet(frame) - SuperVillain.db.SVDock.docklets.MainWindow="None" - end - elseif AddOnButton.IsRegistered then - MOD:UnsetDockletButton() - end - if MOD:IsDockletReady('DockletExtra') then - frame=SuperVillain.db.SVDock.docklets.ExtraWindow - if frame~=nil and frame~="None" and _G[frame] then - MOD:UnregisterDocklet(frame) - SuperVillain.db.SVDock.docklets.ExtraWindow="None" - end - end - SuperDockletMain.FrameName="None" - SuperDockletExtra.FrameName="None" -end - -function MOD:ReloadDocklets(alert) - MOD:UnregisterDocklets() - MOD:ResizeDocklets() - MOD.MainToolTip = ""; - MOD.ExtraToolTip = ""; -end - -function MOD:DockletEnterCombat(D) - MOD.CombatLocked = true; - if SuperVillain.db.SVDock.docklets.DockletCombatFade then - SuperDockletMain:Show() - SuperDockletExtra:Show() - end -end - -local timeOutFunc = function() - if not MOD.CombatLocked then - SuperDockletMain:Hide() - SuperDockletExtra:Hide() - end -end - -function MOD:DockletExitCombat(D) - MOD.CombatLocked = false; - if SuperVillain.db.SVDock.docklets.DockletCombatFade then - SuperVillain:ExecuteTimer(timeOutFunc, 10) - end -end - -function MOD:CreateDockletButton() - SuperDockletMain:SetFrameLevel(SuperDockWindowRight:GetFrameLevel() + 50) - SuperDockletExtra:SetFrameLevel(SuperDockWindowRight:GetFrameLevel() + 50) - local size = SuperDockToolBarRight.currentSize; - AddOnButton:SetParent(SuperDockToolBarRight) - AddOnButton:Size(size,size) - AddOnButton:SetFramedButtonTemplate() - AddOnButton.icon=AddOnButton:CreateTexture(nil,"OVERLAY") - AddOnButton.icon:FillInner() - AddOnButton.icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-ADDON]]) - AddOnButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - AddOnButton.TText=""; - AddOnButton.IsOpen=false; - AddOnButton.IsRegistered=false; - AddOnButton:SetScript("OnEnter",Addon_OnEnter) - AddOnButton:SetScript("OnLeave",Addon_OnLeave) - AddOnButton:SetScript("OnClick",Addon_OnClick) - AddOnButton:Hide() -end - -function MOD:DockletInit() - MOD:CreateDockletButton() - MOD:ReloadDocklets(true) - SuperDockletMain:SetScript('OnShow', DockletFrame_OnShow) - SuperDockletExtra:SetScript('OnShow', DockletFrame_OnShow) - hooksecurefunc(MOD,'DockWindowResize', resizeHook) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/dock/common/toolbar.lua b/Interface/AddOns/SVUI/packages/dock/common/toolbar.lua deleted file mode 100644 index 94bcd91..0000000 --- a/Interface/AddOns/SVUI/packages/dock/common/toolbar.lua +++ /dev/null @@ -1,365 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVDock'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -MOD.DefaultWindow = false -local tinsert, wipe, pairs, ipairs, unpack, pcall, select = tinsert, table.wipe, pairs, ipairs, unpack, pcall, select; -local format, gsub, strfind, strmatch, tonumber = format, gsub, strfind, strmatch, tonumber; -local TOOL_DATA = { - [171] = {0,0.25,0,0.25}, -- PRO-ALCHEMY - [794] = {0.25,0.5,0,0.25,"Survey"}, -- PRO-ARCHAELOGY - [164] = {0.5,0.75,0,0.25}, -- PRO-BLACKSMITH - [184] = {0.75,1,0,0.25,"Cooking Fire"}, -- PRO-COOKING - [333] = {0,0.25,0.25,0.5,"Disenchant"}, -- PRO-ENCHANTING - [202] = {0.25,0.5,0.25,0.5}, -- PRO-ENGINEERING - [129] = {0.5,0.75,0.25,0.5}, -- PRO-FIRSTAID - [773] = {0,0.25,0.5,0.75,"Milling"}, -- PRO-INSCRIPTION - [755] = {0.25,0.5,0.5,0.75,"Prospecting"},-- PRO-JEWELCRAFTING - [165] = {0.5,0.75,0.5,0.75}, -- PRO-LEATHERWORKING - [186] = {0.75,1,0.5,0.75}, -- PRO-MINING - [197] = {0.25,0.5,0.75,1}, -- PRO-TAILORING -} ---[[ -########################################################## -PRE VARS/FUNCTIONS -########################################################## -]]-- -local function GetDefaultWindow() - local window = MOD.DefaultWindow - if window and _G[window] and not _G[window]:IsShown() then - SuperDockWindowRight.FrameName = window - SuperDockWindowRight:Show() - end -end - -local Button_OnEnter = function(b) - if not b.IsOpen then - b:SetPanelColor("highlight") - b.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) - end - GameTooltip:SetOwner(b, "ANCHOR_TOPLEFT", 0, 4) - GameTooltip:ClearLines() - GameTooltip:AddLine(b.TText, 1, 1, 1) - GameTooltip:Show() -end - -local Button_OnLeave = function(b) - if not b.IsOpen then - b:SetPanelColor("special") - b.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - end - GameTooltip:Hide() -end - -local Button_OnClick = function(self) - if InCombatLockdown() then return end - local linkedFrame = self.FrameName - if linkedFrame and _G[linkedFrame] then - SuperDockWindowRight.FrameName = linkedFrame - if not _G[linkedFrame]:IsShown() then - if not SuperDockWindowRight:IsShown()then - SuperDockWindowRight:Show() - end - MOD:DockletHide() - _G[linkedFrame]:Show() - self.IsOpen = true; - self:SetPanelColor("green") - self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - elseif not SuperDockWindowRight:IsShown()then - SuperDockWindowRight:Show() - _G[linkedFrame]:Show() - self.IsOpen = true; - self:SetPanelColor("green") - self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - end - else - if SuperDockWindowRight:IsShown()then - SuperDockWindowRight:Hide() - else - SuperDockWindowRight:Show() - end - self.IsOpen = false; - self:SetPanelColor("special") - self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - GetDefaultWindow() - end -end - -local Macro_OnEnter = function(self) - self:SetPanelColor("highlight") - self.icon:SetGradient(unpack(SuperVillain.Media.gradient.bizzaro)) - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 2, 4) - GameTooltip:ClearLines() - if not self.TText2 then - GameTooltip:AddLine(self.TText, 1, 1, 1) - else - GameTooltip:AddDoubleLine(self.TText, self.TText2, 1, 1, 1) - end - GameTooltip:Show() -end - -local Macro_OnLeave = function(self) - self:SetPanelColor("special") - self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - GameTooltip:Hide() -end - -MOD.ToolsList = {}; -MOD.ToolsSafty = {}; -MOD.LastAddedTool = false; ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:RemoveTool() - if not self or not self.listIndex then return end - local name = self:GetName(); - if not MOD.ToolsSafty[name] then return end - MOD.ToolsSafty[name] = false; - local i = self.listIndex; - tremove(MOD.ToolsList, i) - local width; - local height = SuperDockToolBarRight.currentSize; - MOD.LastAddedTool = MOD.ToolsList[#MOD.ToolsList] - width = #MOD.ToolsList * (height + 6) - SuperDockToolBarRight:Size(width, height) - self:Hide() -end - -function MOD:AddTool() - local name = self:GetName(); - if MOD.ToolsSafty[name] then return end - MOD.ToolsSafty[name] = true; - local width; - local height = SuperDockToolBarRight.currentSize; - if not MOD.LastAddedTool or MOD.LastAddedTool == self then - self:Point("RIGHT", SuperDockToolBarRight, "RIGHT", -6, 0); - else - self:Point("RIGHT", MOD.LastAddedTool, "LEFT", -6, 0); - end - tinsert(MOD.ToolsList, self) - self.listIndex = #MOD.ToolsList; - MOD.LastAddedTool = self; - width = #MOD.ToolsList * (height + 6) - SuperDockToolBarRight:Size(width, height) - self:Show() -end - -function MOD:CreateBasicToolButton(name,texture,onclick,frameName,isdefault) - local fName = frameName or name; - local dockIcon = texture or [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-ADDON]]; - local clickFunction = (type(onclick)=="function") and onclick or Button_OnClick; - local size = SuperDockToolBarRight.currentSize; - local button = _G[fName .. "_ToolBarButton"] or CreateFrame("Button",("%s_ToolBarButton"):format(fName),SuperDockToolBarRight) - MOD.AddTool(button) - button:Size(size,size) - button:SetFramedButtonTemplate() - button.icon = button:CreateTexture(nil,"OVERLAY") - button.icon:FillInner(button,2,2) - button.icon:SetTexture(dockIcon) - button.TText = "Open " .. name; - button.FrameName = fName; - if isdefault == true then - MOD.DefaultWindow = fName; - end - button.IsOpen = isdefault and true or false; - button:SetScript("OnEnter",Button_OnEnter) - button:SetScript("OnLeave",Button_OnLeave) - button:SetScript("OnClick",clickFunction) - _G[fName].ToggleName = fName.."_ToolBarButton"; - if(isdefault) then - button:SetPanelColor("green") - button.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - else - button.icon:SetGradient(unpack(SuperVillain.Media.gradient.light)) - end -end - -do - local LastAddedMacro; - local MacroCount = 0; - - local function HearthTime() - local start,duration = GetItemCooldown(6948) - local expires = duration - (GetTime() - start) - if expires > 0.05 then - local timeLeft = 0; - local calc = 0; - if expires < 4 then - return format("|cffff0000%.1f|r", expires) - elseif expires < 60 then - return format("|cffffff00%d|r", floor(expires)) - elseif expires < 3600 then - timeLeft = ceil(expires / 60); - calc = floor((expires / 60) + .5); - return format("|cffff9900%dm|r", timeLeft) - elseif expires < 86400 then - timeLeft = ceil(expires / 3600); - calc = floor((expires / 3600) + .5); - return format("|cff66ffff%dh|r", timeLeft) - else - timeLeft = ceil(expires / 86400); - calc = floor((expires / 86400) + .5); - return format("|cff6666ff%dd|r", timeLeft) - end - else - return "|cff6666ffReady|r" - end - end - - local Hearth_OnEnter = function(self) - if InCombatLockdown() then return end - self.glow:Show() - self:SetPanelColor("highlight") - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) - GameTooltip:ClearLines() - GameTooltip:AddLine(L["Hearthstone"], 1, 1, 1) - local remaining = HearthTime() - GameTooltip:AddDoubleLine(L["Time Remaining"], remaining, 1, 1, 1, 0, 1, 1) - if(self.ExtraSpell) then - GameTooltip:AddLine(" ", 1, 1, 1) - GameTooltip:AddDoubleLine(self.ExtraSpell, "[Right Click]", 1, 1, 1, 0, 1, 0) - end - GameTooltip:Show() - end - - local Hearth_OnLeave = function(self) - if InCombatLockdown() then return end - self.glow:Hide() - self:SetPanelColor("special") - GameTooltip:Hide() - end - - local function AddMacroTool(frame) - local width; - local height = SuperDockToolBarRight.currentSize; - if not LastAddedMacro then - frame:Point("RIGHT", SuperDockMacroBar, "RIGHT", -6, 0); - else - frame:Point("RIGHT", LastAddedMacro, "LEFT", -6, 0); - end - LastAddedMacro = frame; - MacroCount = MacroCount + 1; - width = MacroCount * (height + 6) - SuperDockMacroBar:Size(width, height) - end - - local function CreateMacroToolButton(proName, proID, itemID, size) - if proName == "Mining" then proName = "Smelting" end - local data = TOOL_DATA[proID] - if(not data) then return end - local button = CreateFrame("Button", ("%s_MacroBarButton"):format(itemID), SuperDockMacroBar, "SecureActionButtonTemplate") - button:Size(size, size) - AddMacroTool(button) - button:SetFramedButtonTemplate() - button.icon = button:CreateTexture(nil, "OVERLAY") - button.icon:FillInner(button, 2, 2) - button.icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\PROFESSIONS]]) - button.icon:SetTexCoord(data[1], data[2], data[3], data[4]) - button.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - button.skillName = proName; - button.itemId = itemID; - button.TText = "Open " .. proName; - button:SetAttribute("type", "macro") - if(data[5]) then - local rightClickSpell = data[5] - button:SetAttribute("macrotext", "/cast [mod:shift]" .. rightClickSpell .. "; " .. proName) - button.TText2 = "Shift-Click to use " .. rightClickSpell - else - button:SetAttribute("macrotext","/cast " .. proName) - end - button:SetScript("OnEnter", Macro_OnEnter) - button:SetScript("OnLeave", Macro_OnLeave) - end - - function MOD:LoadToolBarProfessions() - if(MOD.ToolBarLoaded) then return end - local size = SuperDockMacroBar.currentSize - local hearth = CreateFrame("Button", "RightSuperDockHearthButton", SuperDockMacroBar, "SecureActionButtonTemplate") - hearth:Size(size, size) - AddMacroTool(hearth) - hearth:SetFramedButtonTemplate() - hearth.icon = hearth:CreateTexture(nil, "OVERLAY", nil, 0) - hearth.icon:FillInner(hearth,2,2) - hearth.icon:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Icons\\DOCK-HEARTH") - hearth.icon:SetTexCoord(0,0.5,0,1) - hearth.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - hearth.glow = hearth:CreateTexture(nil, "OVERLAY", nil, 2) - hearth.glow:FillInner(hearth,2,2) - hearth.glow:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Icons\\DOCK-HEARTH") - hearth.glow:SetTexCoord(0.5,1,0,1) - hearth.glow:Hide() - hearth:SetScript("OnEnter", Hearth_OnEnter) - hearth:SetScript("OnLeave", Hearth_OnLeave) - - hearth:RegisterForClicks("AnyUp") - hearth:SetAttribute("type", "item") - hearth:SetAttribute("item", "Hearthstone") - - if(SuperVillain.class == "SHAMAN") then - hearth:SetAttribute("type2", "spell") - hearth:SetAttribute("spell", "Astral Recall") - hearth.ExtraSpell = "Astral Recall" - elseif(SuperVillain.class == "DEATHKNIGHT") then - hearth:SetAttribute("type2","spell") - hearth:SetAttribute("spell","Death Gate") - hearth.ExtraSpell = "Death Gate" - elseif(SuperVillain.class == "DRUID") then - hearth:SetAttribute("type2", "spell") - hearth:SetAttribute("spell", "Teleport: Moonglade") - hearth.ExtraSpell = "Teleport: Moonglade" - elseif(SuperVillain.class == "MONK") then - hearth:SetAttribute("type2", "spell") - hearth:SetAttribute("spell", "Zen Pilgrimage") - hearth.ExtraSpell = "Zen Pilgrimage" - end - - local proName, proID - local prof1, prof2, archaeology, _, cooking, firstAid = GetProfessions() - if(firstAid ~= nil) then - proName, _, _, _, _, _, proID = GetProfessionInfo(firstAid) - CreateMacroToolButton(proName, proID, firstAid, size) - end - if(archaeology ~= nil) then - proName, _, _, _, _, _, proID = GetProfessionInfo(archaeology) - CreateMacroToolButton(proName, proID, archaeology, size) - end - if(cooking ~= nil) then - proName, _, _, _, _, _, proID = GetProfessionInfo(cooking) - CreateMacroToolButton(proName, proID, cooking, size) - end - if(prof2 ~= nil) then - proName, _, _, _, _, _, proID = GetProfessionInfo(prof2) - if(proID ~= 182 and proID ~= 393) then - CreateMacroToolButton(proName, proID, prof2, size) - end - end - if(prof1 ~= nil) then - proName, _, _, _, _, _, proID = GetProfessionInfo(prof1) - if(proID ~= 182 and proID ~= 393) then - CreateMacroToolButton(proName, proID, prof1, size) - end - end - - MOD.ToolBarLoaded = true - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua index 4022a2f..8a91f8d 100644 --- a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua +++ b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua @@ -21,6 +21,7 @@ SuperVillain.Henchmen = MOD; LOCAL VARS ########################################################## ]]-- +local NOOP = function() end local HenchmenFrame = CreateFrame("Frame", "HenchmenFrame", UIParent); local STANDARD_TEXT_FONT = _G.STANDARD_TEXT_FONT local OPTION_LEFT = [[Interface\Addons\SVUI\assets\artwork\Doodads\HENCHMEN-OPTION-LEFT]]; @@ -54,16 +55,34 @@ local HENCHMEN_DATA = { {2323,67,113,69,70,73,75}, --Defias Henchman } }; +local takingOnlyCash,deletedelay,mailElapsed,childCount=false,0.5,0,-1; +local GetAllMail, GetAllMailCash, OpenMailItem, WaitForMail, StopOpeningMail, FancifyMoneys, lastopened, needsToWait, total_cash, baseInboxFrame_OnClick; +local incpat = gsub(gsub(FACTION_STANDING_INCREASED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); +local changedpat = gsub(gsub(FACTION_STANDING_CHANGED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); +local decpat = gsub(gsub(FACTION_STANDING_DECREASED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); +local standing = ('%s:'):format(STANDING); +local reputation = ('%s:'):format(REPUTATION); +local hideStatic = false; +local AutomatedEvents = { + "CHAT_MSG_COMBAT_FACTION_CHANGE", + "MERCHANT_SHOW", + "QUEST_COMPLETE", + "QUEST_GREETING", + "GOSSIP_SHOW", + "QUEST_DETAIL", + "QUEST_ACCEPT_CONFIRM", + "QUEST_PROGRESS" +}; --[[ ########################################################## SCRIPT HANDLERS ########################################################## ]]-- -local ColorFunc = function(arg) SuperVillain:SetColorTheme(arg, true); SuperVillain:ToggleHenchman() end; -local UnitFunc = function(arg) SuperVillain:SetUnitframeLayout(arg, true); SuperVillain:ToggleHenchman() end; -local BarFunc = function(arg) SuperVillain:SetupBarLayout(arg, true); SuperVillain:ToggleHenchman() end; -local AuraFunc = function(arg) SuperVillain:SetupAuralayout(arg, true); SuperVillain:ToggleHenchman() end; -local ConfigFunc = function() SuperVillain:ToggleConfig(); SuperVillain:ToggleHenchman() end; +local ColorFunc = function(arg) SuperVillain:SetColorTheme(arg, true); SuperVillain:ToggleHenchman() end +local UnitFunc = function(arg) SuperVillain:SetUnitframeLayout(arg, true); SuperVillain:ToggleHenchman() end +local BarFunc = function(arg) SuperVillain:SetupBarLayout(arg, true); SuperVillain:ToggleHenchman() end +local AuraFunc = function(arg) SuperVillain:SetupAuralayout(arg, true); SuperVillain:ToggleHenchman() end +local ConfigFunc = function() SuperVillain:ToggleConfig(); SuperVillain:ToggleHenchman() end local speechTimer; local Tooltip_Show = function(self) @@ -71,11 +90,11 @@ local Tooltip_Show = function(self) GameTooltip:ClearLines() GameTooltip:AddLine(self.ttText) GameTooltip:Show() -end; +end local Tooltip_Hide = function(self) GameTooltip:Hide() -end; +end local Minion_OnMouseUp = function(self) if(not self.setting()) then @@ -85,7 +104,7 @@ local Minion_OnMouseUp = function(self) self.indicator:SetTexCoord(0,1,0,0.5) self.setting(false) end -end; +end local Option_OnMouseUp = function(self) local param = self.value @@ -93,7 +112,7 @@ local Option_OnMouseUp = function(self) if(type(func) == "function") then func(param) end -end; +end local SubOption_OnMouseUp = function(self) if not InCombatLockdown()then @@ -101,31 +120,31 @@ local SubOption_OnMouseUp = function(self) for _,frame in pairs(SUBOPTIONS) do frame.anim:Finish() frame:Hide() - end; + end if not self.isopen then for i=1, self.suboptions do _G[name.."Sub"..i]:Show() _G[name.."Sub"..i].anim:Play() _G[name.."Sub"..i].anim:Finish() - end; + end self.isopen=true else self.isopen=false end end -end; +end local Speech_OnTimeout = function() HenchmenSpeechBubble:Hide() speechTimer = nil -end; +end local Speech_OnEnter = function(self) SuperVillain:SecureFadeOut(self, 0.5, 1, 0) local newTimer = SuperVillain:ExecuteTimer(Speech_OnTimeout, 0.5, speechTimer) speechTimer = newTimer self:SetScript("OnEnter", nil) -end; +end local Speech_OnShow = function(self) if self.message then @@ -137,7 +156,7 @@ local Speech_OnShow = function(self) else self:Hide() end -end; +end --[[ ########################################################## LOCAL FUNCTIONS @@ -157,70 +176,97 @@ local function UpdateHenchmanModel(hide) else HenchmenFrameModel:Hide() end -end; +end + +function GetAllMail() + if GetInboxNumItems()==0 then return end + SVUI_GetMailButton:SetScript("OnClick",nil) + SVUI_GetGoldButton:SetScript("OnClick",nil) + baseInboxFrame_OnClick=InboxFrame_OnClick; + InboxFrame_OnClick=NOOP; + SVUI_GetMailButton:RegisterEvent("UI_ERROR_MESSAGE") + OpenMailItem(GetInboxNumItems()) +end + +function GetAllMailCash() + takingOnlyCash = true; + GetAllMail() +end + +function OpenMailItem(mail) + if not InboxFrame:IsVisible()then return StopOpeningMail("Mailbox Minion Needs a Mailbox!")end + if mail==0 then + MiniMapMailFrame:Hide() + return StopOpeningMail("Finished getting your mail!") + end + local _, _, _, _, money, CODAmount, _, itemCount = GetInboxHeaderInfo(mail) + if not takingOnlyCash then + if money > 0 or itemCount and itemCount > 0 and CODAmount <= 0 then + AutoLootMailItem(mail) + needsToWait=true + end + elseif money > 0 then + TakeInboxMoney(mail) + needsToWait=true; + if total_cash then total_cash = total_cash - money end + end + local numMail = GetInboxNumItems() + if itemCount and itemCount > 0 or numMail > 1 and mail <= numMail then + lastopened = mail; + SVUI_GetMailButton:SetScript("OnUpdate",WaitForMail) + else + MiniMapMailFrame:Hide() + StopOpeningMail() + end +end + +function WaitForMail(_, elapsed) + mailElapsed = mailElapsed + elapsed; + if not needsToWait or mailElapsed > deletedelay then + if not InboxFrame:IsVisible() then return StopOpeningMail("The Mailbox Minion Needs a Mailbox!") end + mailElapsed = 0; + needsToWait = false; + SVUI_GetMailButton:SetScript("OnUpdate", nil) + local _, _, _, _, money, CODAmount, _, itemCount = GetInboxHeaderInfo(lastopened) + if money > 0 or not takingOnlyCash and CODAmount <= 0 and itemCount and itemCount > 0 then + OpenMailItem(lastopened) + else + OpenMailItem(lastopened - 1) + end + end +end + +function StopOpeningMail(msg, ...) + SVUI_GetMailButton:SetScript("OnUpdate", nil) + SVUI_GetMailButton:SetScript("OnClick", GetAllMail) + SVUI_GetGoldButton:SetScript("OnClick", GetAllMailCash) + if baseInboxFrame_OnClick then + InboxFrame_OnClick = baseInboxFrame_OnClick + end + SVUI_GetMailButton:UnregisterEvent("UI_ERROR_MESSAGE") + takingOnlyCash = false; + total_cash = nil; + needsToWait = false; + if msg then + SuperVillain:HenchmanSays(msg) + end +end + +function FancifyMoneys(cash) + if cash > 10000 then + return("%d|cffffd700g|r%d|cffc7c7cfs|r%d|cffeda55fc|r"):format((cash / 10000), ((cash / 100) % 100), (cash % 100)) + elseif cash > 100 then + return("%d|cffc7c7cfs|r%d|cffeda55fc|r"):format(((cash / 100) % 100), (cash % 100)) + else + return("%d|cffeda55fc|r"):format(cash%100) + end +end --[[ ########################################################## CORE FUNCTIONS ########################################################## ]]-- -function SuperVillain:ToggleHenchman() - if InCombatLockdown()then return end; - if(not MOD.PostLoaded) then - MOD:CreateHenchmenFrame() - end - if not HenchmenFrame:IsShown()then - HenchmenFrameBG:Show() - - UpdateHenchmanModel() - - HenchmenFrame.anim:Finish() - HenchmenFrame:Show() - HenchmenFrame.anim:Play() - HenchmenCalloutFrame.anim:Finish() - HenchmenCalloutFrame:Show() - HenchmenCalloutFrame:SetAlpha(1) - HenchmenCalloutFrame.anim:Play() - UIFrameFadeOut(HenchmenCalloutFrame,5) - for i=1,5 do - local option=_G["HenchmenOptionButton"..i] - option.anim:Finish() - option:Show() - option.anim:Play() - - local minion=_G["MinionOptionButton"..i] - minion.anim:Finish() - minion:Show() - minion.anim:Play() - end; - RightSuperDockToggleButton.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - else - UpdateHenchmanModel(true) - for _,frame in pairs(SUBOPTIONS)do - frame.anim:Finish() - frame:Hide() - end; - HenchmenOptionButton1.isopen=false; - HenchmenOptionButton2.isopen=false; - HenchmenOptionButton3.isopen=false; - HenchmenCalloutFrame.anim:Finish() - HenchmenCalloutFrame:Hide() - HenchmenFrame.anim:Finish() - HenchmenFrame:Hide() - HenchmenFrameBG:Hide() - for i=1,5 do - local option=_G["HenchmenOptionButton"..i] - option.anim:Finish() - option:Hide() - - local minion=_G["MinionOptionButton"..i] - minion.anim:Finish() - minion:Hide() - end; - RightSuperDockToggleButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - end -end; - -function MOD:CreateMinionOptions(i) +local function CreateMinionOptions(i) local lastIndex = i - 1; local options = HENCHMEN_DATA[2][i] local offsetX = options[1] * -1 @@ -231,15 +277,15 @@ function MOD:CreateMinionOptions(i) option:Point("TOPRIGHT",HenchmenFrame,"TOPLEFT",-32,-32) else option:Point("TOP",_G["MinionOptionButton"..lastIndex],"BOTTOM",offsetX,-32) - end; + end local setting = options[4]; - local dbSet = SuperVillain.db.SVHenchmen[setting]; + local dbSet = MOD.db[setting]; option.setting = function(toggle) if(toggle == nil) then - return SuperVillain.db.SVHenchmen[setting] + return MOD.db[setting] else - SuperVillain.db.SVHenchmen[setting] = toggle; + MOD.db[setting] = toggle; end end SuperVillain.Animate:Slide(option,-500,-500) @@ -279,9 +325,9 @@ function MOD:CreateMinionOptions(i) option:SetScript("OnEnter", Tooltip_Show) option:SetScript("OnLeave", Tooltip_Hide) option:SetScript("OnMouseUp", Minion_OnMouseUp) -end; +end -function MOD:CreateHenchmenOptions(i) +local function CreateHenchmenOptions(i) local lastIndex = i - 1; local options = HENCHMEN_DATA[1][i] local offsetX = options[1] @@ -291,7 +337,7 @@ function MOD:CreateHenchmenOptions(i) option:Point("TOPLEFT",HenchmenFrame,"TOPRIGHT",32,-32) else option:Point("TOP",_G["HenchmenOptionButton"..lastIndex],"BOTTOM",offsetX,-32) - end; + end SuperVillain.Animate:Slide(option,500,-500) option:SetFrameStrata("DIALOG") option:SetFrameLevel(24) @@ -318,9 +364,9 @@ function MOD:CreateHenchmenOptions(i) option.ttText = options[3] option:SetScript("OnEnter", Tooltip_Show) option:SetScript("OnLeave", Tooltip_Hide) -end; +end -function MOD:CreateHenchmenSubOptions(buttonIndex,optionIndex) +local function CreateHenchmenSubOptions(buttonIndex,optionIndex) local parent = _G["HenchmenOptionButton"..buttonIndex] local name = format("HenchmenOptionButton%dSub%d", buttonIndex, optionIndex); local calc = 90 * optionIndex; @@ -349,9 +395,9 @@ function MOD:CreateHenchmenSubOptions(buttonIndex,optionIndex) SuperVillain.Animate:Slide(frame,500,0) tinsert(SUBOPTIONS,frame) -end; +end -function MOD:CreateHenchmenFrame() +local function CreateHenchmenFrame() HenchmenFrame:SetParent(SuperVillain.UIParent) HenchmenFrame:SetPoint("CENTER",UIParent,"CENTER",0,0) HenchmenFrame:SetWidth(500) @@ -391,32 +437,32 @@ function MOD:CreateHenchmenFrame() HenchmenFrameBG:SetScript("OnMouseUp", SuperVillain.ToggleHenchman) for i=1, 5 do - MOD:CreateHenchmenOptions(i) - MOD:CreateMinionOptions(i) + CreateHenchmenOptions(i) + CreateMinionOptions(i) end ------------------------------------------------------------------------ - MOD:CreateHenchmenSubOptions(1,1) + CreateHenchmenSubOptions(1,1) HenchmenOptionButton1Sub1.txt:SetText("KABOOM!") HenchmenOptionButton1Sub1.txthigh:SetText("KABOOM!") HenchmenOptionButton1Sub1.value = "kaboom" HenchmenOptionButton1Sub1.callback = ColorFunc HenchmenOptionButton1Sub1:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(1,2) + CreateHenchmenSubOptions(1,2) HenchmenOptionButton1Sub2.txt:SetText("Darkness") HenchmenOptionButton1Sub2.txthigh:SetText("Darkness") HenchmenOptionButton1Sub2.value = "dark" HenchmenOptionButton1Sub2.callback = ColorFunc HenchmenOptionButton1Sub2:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(1,3) + CreateHenchmenSubOptions(1,3) HenchmenOptionButton1Sub3.txt:SetText("Classy") HenchmenOptionButton1Sub3.txthigh:SetText("Classy") HenchmenOptionButton1Sub3.value = "classy" HenchmenOptionButton1Sub3.callback = ColorFunc HenchmenOptionButton1Sub3:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(1,4) + CreateHenchmenSubOptions(1,4) HenchmenOptionButton1Sub4.txt:SetText("Vintage") HenchmenOptionButton1Sub4.txthigh:SetText("Vintage") HenchmenOptionButton1Sub4.value = "default" @@ -427,21 +473,21 @@ function MOD:CreateHenchmenFrame() HenchmenOptionButton1.isopen = false; HenchmenOptionButton1:SetScript("OnMouseUp",SubOption_OnMouseUp) ------------------------------------------------------------------------ - MOD:CreateHenchmenSubOptions(2,1) + CreateHenchmenSubOptions(2,1) HenchmenOptionButton2Sub1.txt:SetText("SUPER: Elaborate Frames") HenchmenOptionButton2Sub1.txthigh:SetText("SUPER: Elaborate Frames") HenchmenOptionButton2Sub1.value = "super" HenchmenOptionButton2Sub1.callback = UnitFunc HenchmenOptionButton2Sub1:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(2,2) + CreateHenchmenSubOptions(2,2) HenchmenOptionButton2Sub2.txt:SetText("Simple: Basic Frames") HenchmenOptionButton2Sub2.txthigh:SetText("Simple: Basic Frames") HenchmenOptionButton2Sub2.value = "simple" HenchmenOptionButton2Sub2.callback = UnitFunc HenchmenOptionButton2Sub2:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(2,3) + CreateHenchmenSubOptions(2,3) HenchmenOptionButton2Sub3.txt:SetText("Compact: Minimal Frames") HenchmenOptionButton2Sub3.txthigh:SetText("Compact: Minimal Frames") HenchmenOptionButton2Sub3.value = "compact" @@ -452,28 +498,28 @@ function MOD:CreateHenchmenFrame() HenchmenOptionButton2.isopen = false; HenchmenOptionButton2:SetScript("OnMouseUp",SubOption_OnMouseUp) ------------------------------------------------------------------------ - MOD:CreateHenchmenSubOptions(3,1) + CreateHenchmenSubOptions(3,1) HenchmenOptionButton3Sub1.txt:SetText("One Row: Small Buttons") HenchmenOptionButton3Sub1.txthigh:SetText("One Row: Small Buttons") HenchmenOptionButton3Sub1.value = "onesmall" HenchmenOptionButton3Sub1.callback = BarFunc HenchmenOptionButton3Sub1:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(3,2) + CreateHenchmenSubOptions(3,2) HenchmenOptionButton3Sub2.txt:SetText("Two Rows: Small Buttons") HenchmenOptionButton3Sub2.txthigh:SetText("Two Rows: Small Buttons") HenchmenOptionButton3Sub2.value = "twosmall" HenchmenOptionButton3Sub2.callback = BarFunc HenchmenOptionButton3Sub2:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(3,3) + CreateHenchmenSubOptions(3,3) HenchmenOptionButton3Sub3.txt:SetText("One Row: Large Buttons") HenchmenOptionButton3Sub3.txthigh:SetText("One Row: Large Buttons") HenchmenOptionButton3Sub3.value = "default" HenchmenOptionButton3Sub3.callback = BarFunc HenchmenOptionButton3Sub3:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(3,4) + CreateHenchmenSubOptions(3,4) HenchmenOptionButton3Sub4.txt:SetText("Two Rows: Large Buttons") HenchmenOptionButton3Sub4.txthigh:SetText("Two Rows: Large Buttons") HenchmenOptionButton3Sub4.value = "twobig" @@ -484,21 +530,21 @@ function MOD:CreateHenchmenFrame() HenchmenOptionButton3.isopen = false; HenchmenOptionButton3:SetScript("OnMouseUp",SubOption_OnMouseUp) ------------------------------------------------------------------------ - MOD:CreateHenchmenSubOptions(4,1) + CreateHenchmenSubOptions(4,1) HenchmenOptionButton4Sub1.txt:SetText("Icons Only") HenchmenOptionButton4Sub1.txthigh:SetText("Icons Only") HenchmenOptionButton4Sub1.value = "icons" HenchmenOptionButton4Sub1.callback = AuraFunc HenchmenOptionButton4Sub1:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(4,2) + CreateHenchmenSubOptions(4,2) HenchmenOptionButton4Sub2.txt:SetText("Bars Only") HenchmenOptionButton4Sub2.txthigh:SetText("Bars Only") HenchmenOptionButton4Sub2.value = "bars" HenchmenOptionButton4Sub2.callback = AuraFunc HenchmenOptionButton4Sub2:SetScript("OnMouseUp", Option_OnMouseUp) - MOD:CreateHenchmenSubOptions(4,3) + CreateHenchmenSubOptions(4,3) HenchmenOptionButton4Sub3.txt:SetText("The Works: Bars and Icons") HenchmenOptionButton4Sub3.txthigh:SetText("The Works: Bars and Icons") HenchmenOptionButton4Sub3.value = "theworks" @@ -517,14 +563,323 @@ function MOD:CreateHenchmenFrame() end MOD.PostLoaded = true -end; +end + +function SuperVillain:ToggleHenchman() + if InCombatLockdown()then return end + if(not MOD.PostLoaded) then + CreateHenchmenFrame() + end + if not HenchmenFrame:IsShown()then + HenchmenFrameBG:Show() + + UpdateHenchmanModel() + + HenchmenFrame.anim:Finish() + HenchmenFrame:Show() + HenchmenFrame.anim:Play() + HenchmenCalloutFrame.anim:Finish() + HenchmenCalloutFrame:Show() + HenchmenCalloutFrame:SetAlpha(1) + HenchmenCalloutFrame.anim:Play() + UIFrameFadeOut(HenchmenCalloutFrame,5) + for i=1,5 do + local option=_G["HenchmenOptionButton"..i] + option.anim:Finish() + option:Show() + option.anim:Play() + + local minion=_G["MinionOptionButton"..i] + minion.anim:Finish() + minion:Show() + minion.anim:Play() + end + RightSuperDockToggleButton.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + else + UpdateHenchmanModel(true) + for _,frame in pairs(SUBOPTIONS)do + frame.anim:Finish() + frame:Hide() + end + HenchmenOptionButton1.isopen=false; + HenchmenOptionButton2.isopen=false; + HenchmenOptionButton3.isopen=false; + HenchmenCalloutFrame.anim:Finish() + HenchmenCalloutFrame:Hide() + HenchmenFrame.anim:Finish() + HenchmenFrame:Hide() + HenchmenFrameBG:Hide() + for i=1,5 do + local option=_G["HenchmenOptionButton"..i] + option.anim:Finish() + option:Hide() + + local minion=_G["MinionOptionButton"..i] + minion.anim:Finish() + minion:Hide() + end + RightSuperDockToggleButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end +end function SuperVillain:HenchmanSays(msg) HenchmenSpeechBubble.message = msg; HenchmenSpeechBubble:Show(); -end; - -function MOD:CreateHenchmanSpeech() +end +--[[ +########################################################## +MAIL HELPER +########################################################## +]]-- +function MOD:ToggleMailMinions() + if not self.db.mailOpener then + SVUI_MailMinion:Hide() + else + SVUI_MailMinion:Show() + end +end + +function MOD:LoadMailMinions() + local SVUI_MailMinion = CreateFrame("Frame","SVUI_MailMinion",InboxFrame); + SVUI_MailMinion:SetWidth(150) + SVUI_MailMinion:SetHeight(25) + SVUI_MailMinion:SetPoint("CENTER",InboxFrame,"TOP",-22,-400) + + local SVUI_GetMailButton=CreateFrame("Button","SVUI_GetMailButton",SVUI_MailMinion,"UIPanelButtonTemplate") + SVUI_GetMailButton:SetWidth(70) + SVUI_GetMailButton:SetHeight(25) + SVUI_GetMailButton:SetButtonTemplate() + SVUI_GetMailButton:SetPoint("LEFT",SVUI_MailMinion,"LEFT",0,0) + SVUI_GetMailButton:SetText("Get All") + SVUI_GetMailButton:SetScript("OnClick",GetAllMail) + SVUI_GetMailButton:SetScript("OnEnter",function() + GameTooltip:SetOwner(SVUI_GetMailButton,"ANCHOR_RIGHT") + GameTooltip:AddLine(string.format("%d messages",GetInboxNumItems()),1,1,1) + GameTooltip:Show() + end) + SVUI_GetMailButton:SetScript("OnLeave",function()GameTooltip:Hide()end) + SVUI_GetMailButton:SetScript("OnEvent",function(l,m,h,n,o,p) + if m=="UI_ERROR_MESSAGE"then + if h==ERR_INV_FULL or h==ERR_ITEM_MAX_COUNT then + StopOpeningMail("Your bags are too full!") + end + end + end) + + local SVUI_GetGoldButton=CreateFrame("Button","SVUI_GetGoldButton",SVUI_MailMinion,"UIPanelButtonTemplate") + SVUI_GetGoldButton:SetWidth(70) + SVUI_GetGoldButton:SetHeight(25) + SVUI_GetGoldButton:SetButtonTemplate() + SVUI_GetGoldButton:SetPoint("RIGHT",SVUI_MailMinion,"RIGHT",0,0) + SVUI_GetGoldButton:SetText("Get Gold") + SVUI_GetGoldButton:SetScript("OnClick",GetAllMailCash) + SVUI_GetGoldButton:SetScript("OnEnter",function() + if not total_cash then + total_cash=0; + for a=0,GetInboxNumItems()do + total_cash=total_cash + select(5,GetInboxHeaderInfo(a)) + end + end + GameTooltip:SetOwner(SVUI_GetGoldButton,"ANCHOR_RIGHT") + GameTooltip:AddLine(FancifyMoneys(total_cash),1,1,1) + GameTooltip:Show() + end) + SVUI_GetGoldButton:SetScript("OnLeave",function()GameTooltip:Hide()end) +end +--[[ +########################################################## +INVITE AUTOMATONS +########################################################## +]]-- +function MOD:AutoGroupInvite(b, B) + if not self.db.autoAcceptInvite then return end + if b == "PARTY_INVITE_REQUEST" then + if QueueStatusMinimapButton:IsShown() then return end + if IsInGroup() then return end + hideStatic = true; + if GetNumFriends()>0 then ShowFriends() end + if IsInGuild()then GuildRoster()end + local r = false; + for C = 1, GetNumFriends()do + local D = GetFriendInfo(C) + if D == B then + AcceptGroup()r = true; + SuperVillain:HenchmanSays("Accepted an Invite From Your Friends!") + break + end + end + if not r then + for E = 1, GetNumGuildMembers(true)do + local F = GetGuildRosterInfo(E) + if F == B then + AcceptGroup()r = true; + SuperVillain:HenchmanSays("Accepted an Invite From Your Guild!") + break + end + end + end + if not r then + for G = 1, BNGetNumFriends()do + local m, m, m, H = BNGetFriendInfo(G) + B = B:match("(.+)%-.+") or B; + if H == B then + AcceptGroup() + SuperVillain:HenchmanSays("Accepted an Invite!") + break + end + end + end + elseif b == "GROUP_ROSTER_UPDATE" and hideStatic == true then + StaticPopup_Hide("PARTY_INVITE") + hideStatic = false + end +end +--[[ +########################################################## +REPAIR AUTOMATONS +########################################################## +]]-- +function MOD:MERCHANT_SHOW() + if self.db.vendorGrays then SuperVillain.Registry:Expose('SVBag'):VendorGrays(nil,true) end + local autoRepair = self.db.autoRepair; + if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end + local repairCost,canRepair=GetRepairAllCost() + local loan=GetGuildBankWithdrawMoney() + if autoRepair == "GUILD" and (not CanGuildBankRepair() or (repairCost > loan)) then autoRepair = "PLAYER" end + if repairCost > 0 then + if canRepair then + RepairAllItems(autoRepair=='GUILD') + local x,y,z= repairCost % 100,floor((repairCost % 10000)/100), floor(repairCost / 10000) + if autoRepair=='GUILD' then + SuperVillain:HenchmanSays("Repairs Complete! ...Using Guild Money!\n"..GetCoinTextureString(repairCost,12)) + else + SuperVillain:HenchmanSays("Repairs Complete!\n"..GetCoinTextureString(repairCost,12)) + end + else + SuperVillain:HenchmanSays("The Minions Say You Are Too Broke To Repair! They Are Laughing..") + end + end +end +--[[ +########################################################## +REP AUTOMATONS +########################################################## +]]-- +function MOD:CHAT_MSG_COMBAT_FACTION_CHANGE(event, msg) + if not self.db.autorepchange then return end + local _, _, faction, amount = find(msg, incpat) + if not faction then + _, _, faction, amount = find(msg, changedpat) or find(msg, decpat) + end + if faction and faction ~= GUILD_REPUTATION then + local active = GetWatchedFactionInfo() + for factionIndex = 1, GetNumFactions() do + local name = GetFactionInfo(factionIndex) + if name == faction and name ~= active then + local inactive = IsFactionInactive(factionIndex) or SetWatchedFactionIndex(factionIndex) + SuperVillain:AddonMessage("Now Tracking: "..name.." Reputation") + break + end + end + end +end +--[[ +########################################################## +QUEST AUTOMATONS +########################################################## +]]-- +function MOD:AutoQuestProxy() + if(IsShiftKeyDown()) then return false; end + if((not QuestIsDaily() or not QuestIsWeekly()) and (self.db.autodailyquests)) then return false; end + if(QuestFlagsPVP() and (not self.db.autopvpquests)) then return false; end + return true +end + +function MOD:QUEST_GREETING() + if(self.db.autoquestaccept == true and self:AutoQuestProxy()) then + local active,available = GetNumActiveQuests(), GetNumAvailableQuests() + if(active + available == 0) then return end + if(available > 0) then + SelectAvailableQuest(1) + end + if(active > 0) then + SelectActiveQuest(1) + end + end +end + +function MOD:GOSSIP_SHOW() + if(self.db.autoquestaccept == true and self:AutoQuestProxy()) then + if GetGossipAvailableQuests() then + SelectGossipAvailableQuest(1) + elseif GetGossipActiveQuests() then + SelectGossipActiveQuest(1) + end + end +end + +function MOD:QUEST_DETAIL() + if(self.db.autoquestaccept == true and self:AutoQuestProxy()) then + AcceptQuest() + end +end + +function MOD:QUEST_ACCEPT_CONFIRM() + if(self.db.autoquestaccept == true and self:AutoQuestProxy()) then + ConfirmAcceptQuest() + end +end + +function MOD:QUEST_PROGRESS() + if(IsShiftKeyDown()) then return false; end + if(self.db.autoquestcomplete == true) then + CompleteQuest() + end +end + +function MOD:QUEST_COMPLETE() + if(not self.db.autoquestcomplete and (not self.db.autoquestreward)) then return end + if(IsShiftKeyDown()) then return false; end + local rewards = GetNumQuestChoices() + local auto_select = QuestFrameRewardPanel.itemChoice or QuestInfoFrame.itemChoice; + local selection, value = 1, 0; + if rewards > 0 then + if self.db.autoquestreward == true then + for i = 1, rewards do + local iLink = GetQuestItemLink("choice", i) + if iLink then + local iValue = select(11,GetItemInfo(iLink)) + if iValue and iValue > value then + value = iValue; + selection = i + end + end + end + local chosenItem = _G[("QuestInfoItem%d"):format(selection)] + if chosenItem.type == "choice" then + QuestInfoItemHighlight:ClearAllPoints() + QuestInfoItemHighlight:SetAllPoints(chosenItem) + QuestInfoItemHighlight:Show() + QuestInfoFrame.itemChoice = chosenItem:GetID() + SuperVillain:HenchmanSays("A Minion Has Chosen Your Reward!") + end + end + auto_select = selection + if self.db.autoquestcomplete == true then + GetQuestReward(auto_select) + end + else + if(self.db.autoquestreward == true and self.db.autoquestcomplete == true) then + GetQuestReward(auto_select) + end + end +end +--[[ +########################################################## +BUILD FUNCTION / UPDATE +########################################################## +]]-- +function MOD:Load() local bubble = CreateFrame("Frame", "HenchmenSpeechBubble", SuperVillain.UIParent) bubble:SetSize(256,128) bubble:Point("BOTTOMRIGHT", RightSuperDockToggleButton, "TOPLEFT", 0, 0) @@ -543,16 +898,55 @@ function MOD:CreateHenchmanSpeech() bubble.txt:SetWordWrap(true) bubble:Hide() bubble:SetScript('OnShow', Speech_OnShow) -end; ---[[ -########################################################## -BUILD FUNCTION / UPDATE -########################################################## -]]-- -function MOD:Load() - --self:CreateHenchmenFrame() - self:CreateHenchmanSpeech() - self:LoadAllMinions() -end; + + if IsAddOnLoaded("Postal") then + self.db.mailOpener = false + else + self:LoadMailMinions() + self:ToggleMailMinions() + end + + self:RegisterEvent('PARTY_INVITE_REQUEST','AutoGroupInvite') + self:RegisterEvent('GROUP_ROSTER_UPDATE','AutoGroupInvite') + for _,event in pairs(AutomatedEvents) do + self:RegisterEvent(event) + end + + if self.db.pvpautorelease then + local autoReleaseHandler = CreateFrame("frame") + autoReleaseHandler:RegisterEvent("PLAYER_DEAD") + autoReleaseHandler:SetScript("OnEvent",function(self,event) + local isInstance, instanceType = IsInInstance() + if(isInstance and instanceType == "pvp") then + local spell = GetSpellInfo(20707) + if(SuperVillain.class ~= "SHAMAN" and not(spell and UnitBuff("player",spell))) then + RepopMe() + end + end + for i=1,GetNumWorldPVPAreas() do + local _,localizedName, isActive = GetWorldPVPAreaInfo(i) + if(GetRealZoneText() == localizedName and isActive) then RepopMe() end + end + end) + end + + local skippy = CreateFrame("Frame") + skippy:RegisterEvent("CINEMATIC_START") + skippy:SetScript("OnEvent", function(_, event) + if event == "CINEMATIC_START" then + if(MOD.db.skipcinematics) then + CinematicFrame_CancelCinematic() + end + end + end) + local PlayMovie_hook = MovieFrame_PlayMovie + MovieFrame_PlayMovie = function(...) + if(MOD.db.skipcinematics) then + GameMovieFinished() + else + PlayMovie_hook(...) + end + end +end SuperVillain.Registry:NewPackage(MOD, "SVHenchmen", "post") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.xml b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.xml index d0a6677..9ae82f1 100644 --- a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.xml +++ b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.xml @@ -1,4 +1,3 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVHenchmen.lua'/> - <Include file='common\_load.xml'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml b/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml deleted file mode 100644 index b7e0939..0000000 --- a/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml +++ /dev/null @@ -1,3 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='minions.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/henchmen/common/minions.lua b/Interface/AddOns/SVUI/packages/henchmen/common/minions.lua deleted file mode 100644 index c94490c..0000000 --- a/Interface/AddOns/SVUI/packages/henchmen/common/minions.lua +++ /dev/null @@ -1,458 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local find, format, len, split = string.find, string.format, string.len, string.split; -local gmatch, gsub, join = string.gmatch, string.gsub, string.join; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; ---[[ TABLE METHODS ]]-- -local twipe = table.wipe; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVHenchmen'); -local NOOP = function() end; ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local takingOnlyCash,deletedelay,mailElapsed,childCount=false,0.5,0,-1; -local GetAllMail, GetAllMailCash, OpenMailItem, WaitForMail, StopOpeningMail, FancifyMoneys, lastopened, needsToWait, total_cash, baseInboxFrame_OnClick; -local incpat = gsub(gsub(FACTION_STANDING_INCREASED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); -local changedpat = gsub(gsub(FACTION_STANDING_CHANGED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); -local decpat = gsub(gsub(FACTION_STANDING_DECREASED, "(%%s)", "(.+)"), "(%%d)", "(.+)"); -local standing = ('%s:'):format(STANDING); -local reputation = ('%s:'):format(REPUTATION); -local hideStatic = false; -local AutomatedEvents = { - "CHAT_MSG_COMBAT_FACTION_CHANGE", - "MERCHANT_SHOW", - "QUEST_COMPLETE", - "QUEST_GREETING", - "GOSSIP_SHOW", - "QUEST_DETAIL", - "QUEST_ACCEPT_CONFIRM", - "QUEST_PROGRESS" -}; ---[[ -########################################################## -PRE VARS/FUNCTIONS -########################################################## -]]-- -function GetAllMail() - if GetInboxNumItems()==0 then return end; - SVUI_GetMailButton:SetScript("OnClick",nil) - SVUI_GetGoldButton:SetScript("OnClick",nil) - baseInboxFrame_OnClick=InboxFrame_OnClick; - InboxFrame_OnClick=NOOP; - SVUI_GetMailButton:RegisterEvent("UI_ERROR_MESSAGE") - OpenMailItem(GetInboxNumItems()) -end; - -function GetAllMailCash() - takingOnlyCash = true; - GetAllMail() -end; - -function OpenMailItem(mail) - if not InboxFrame:IsVisible()then return StopOpeningMail("Mailbox Minion Needs a Mailbox!")end; - if mail==0 then - MiniMapMailFrame:Hide() - return StopOpeningMail("Finished getting your mail!") - end; - local _, _, _, _, money, CODAmount, _, itemCount = GetInboxHeaderInfo(mail) - if not takingOnlyCash then - if money > 0 or itemCount and itemCount > 0 and CODAmount <= 0 then - AutoLootMailItem(mail) - needsToWait=true - end - elseif money > 0 then - TakeInboxMoney(mail) - needsToWait=true; - if total_cash then total_cash = total_cash - money end - end; - local numMail = GetInboxNumItems() - if itemCount and itemCount > 0 or numMail > 1 and mail <= numMail then - lastopened = mail; - SVUI_GetMailButton:SetScript("OnUpdate",WaitForMail) - else - MiniMapMailFrame:Hide() - StopOpeningMail() - end -end; - -function WaitForMail(_, elapsed) - mailElapsed = mailElapsed + elapsed; - if not needsToWait or mailElapsed > deletedelay then - if not InboxFrame:IsVisible() then return StopOpeningMail("The Mailbox Minion Needs a Mailbox!") end; - mailElapsed = 0; - needsToWait = false; - SVUI_GetMailButton:SetScript("OnUpdate", nil) - local _, _, _, _, money, CODAmount, _, itemCount = GetInboxHeaderInfo(lastopened) - if money > 0 or not takingOnlyCash and CODAmount <= 0 and itemCount and itemCount > 0 then - OpenMailItem(lastopened) - else - OpenMailItem(lastopened - 1) - end - end -end; - -function StopOpeningMail(msg, ...) - SVUI_GetMailButton:SetScript("OnUpdate", nil) - SVUI_GetMailButton:SetScript("OnClick", GetAllMail) - SVUI_GetGoldButton:SetScript("OnClick", GetAllMailCash) - if baseInboxFrame_OnClick then - InboxFrame_OnClick = baseInboxFrame_OnClick - end; - SVUI_GetMailButton:UnregisterEvent("UI_ERROR_MESSAGE") - takingOnlyCash = false; - total_cash = nil; - needsToWait = false; - if msg then - SuperVillain:HenchmanSays(msg) - end -end; - -function FancifyMoneys(cash) - if cash > 10000 then - return("%d|cffffd700g|r%d|cffc7c7cfs|r%d|cffeda55fc|r"):format((cash / 10000), ((cash / 100) % 100), (cash % 100)) - elseif cash > 100 then - return("%d|cffc7c7cfs|r%d|cffeda55fc|r"):format(((cash / 100) % 100), (cash % 100)) - else - return("%d|cffeda55fc|r"):format(cash%100) - end -end; ---[[ -########################################################## -MAIL HELPER -########################################################## -]]-- -function MOD:ToggleMailMinions() - if not SuperVillain.db.SVHenchmen.mailOpener then - SVUI_MailMinion:Hide() - else - SVUI_MailMinion:Show() - end; -end; - -function MOD:LoadMailMinions() - local SVUI_MailMinion = CreateFrame("Frame","SVUI_MailMinion",InboxFrame); - SVUI_MailMinion:SetWidth(150) - SVUI_MailMinion:SetHeight(25) - SVUI_MailMinion:SetPoint("CENTER",InboxFrame,"TOP",-22,-400) - - local SVUI_GetMailButton=CreateFrame("Button","SVUI_GetMailButton",SVUI_MailMinion,"UIPanelButtonTemplate") - SVUI_GetMailButton:SetWidth(70) - SVUI_GetMailButton:SetHeight(25) - SVUI_GetMailButton:SetButtonTemplate() - SVUI_GetMailButton:SetPoint("LEFT",SVUI_MailMinion,"LEFT",0,0) - SVUI_GetMailButton:SetText("Get All") - SVUI_GetMailButton:SetScript("OnClick",GetAllMail) - SVUI_GetMailButton:SetScript("OnEnter",function() - GameTooltip:SetOwner(SVUI_GetMailButton,"ANCHOR_RIGHT") - GameTooltip:AddLine(string.format("%d messages",GetInboxNumItems()),1,1,1) - GameTooltip:Show() - end) - SVUI_GetMailButton:SetScript("OnLeave",function()GameTooltip:Hide()end) - SVUI_GetMailButton:SetScript("OnEvent",function(l,m,h,n,o,p) - if m=="UI_ERROR_MESSAGE"then - if h==ERR_INV_FULL or h==ERR_ITEM_MAX_COUNT then - StopOpeningMail("Your bags are too full!") - end - end - end) - - local SVUI_GetGoldButton=CreateFrame("Button","SVUI_GetGoldButton",SVUI_MailMinion,"UIPanelButtonTemplate") - SVUI_GetGoldButton:SetWidth(70) - SVUI_GetGoldButton:SetHeight(25) - SVUI_GetGoldButton:SetButtonTemplate() - SVUI_GetGoldButton:SetPoint("RIGHT",SVUI_MailMinion,"RIGHT",0,0) - SVUI_GetGoldButton:SetText("Get Gold") - SVUI_GetGoldButton:SetScript("OnClick",GetAllMailCash) - SVUI_GetGoldButton:SetScript("OnEnter",function() - if not total_cash then - total_cash=0; - for a=0,GetInboxNumItems()do - total_cash=total_cash + select(5,GetInboxHeaderInfo(a)) - end - end; - GameTooltip:SetOwner(SVUI_GetGoldButton,"ANCHOR_RIGHT") - GameTooltip:AddLine(FancifyMoneys(total_cash),1,1,1) - GameTooltip:Show() - end) - SVUI_GetGoldButton:SetScript("OnLeave",function()GameTooltip:Hide()end) -end; ---[[ -########################################################## -INVITE AUTOMATONS -########################################################## -]]-- -function MOD:AutoGroupInvite(b,B) - if not SuperVillain.db.SVHenchmen.autoAcceptInvite then return end; - if b=="PARTY_INVITE_REQUEST"then - if QueueStatusMinimapButton:IsShown()then return end; - if IsInGroup()then return end; - hideStatic=true; - if GetNumFriends()>0 then ShowFriends()end; - if IsInGuild()then GuildRoster()end; - local r=false; - for C=1,GetNumFriends()do - local D=GetFriendInfo(C) - if D==B then - AcceptGroup()r=true; - SuperVillain:HenchmanSays("Accepted an Invite From Your Friends!") - break - end - end; - if not r then - for E=1,GetNumGuildMembers(true)do - local F=GetGuildRosterInfo(E) - if F==B then - AcceptGroup()r=true; - SuperVillain:HenchmanSays("Accepted an Invite From Your Guild!") - break - end - end - end; - if not r then - for G=1,BNGetNumFriends()do - local m,m,m,H=BNGetFriendInfo(G) - B=B:match("(.+)%-.+") or B; - if H==B then - AcceptGroup() - SuperVillain:HenchmanSays("Accepted an Invite!") - break - end - end - end - elseif b=="GROUP_ROSTER_UPDATE" and hideStatic==true then - StaticPopup_Hide("PARTY_INVITE") - hideStatic=false - end -end; ---[[ -########################################################## -REPAIR AUTOMATONS -########################################################## -]]-- -function MOD:MERCHANT_SHOW() - if SuperVillain.db.SVHenchmen.vendorGrays then SuperVillain.Registry:Expose('SVBag'):VendorGrays(nil,true) end; - local autoRepair = SuperVillain.db.SVHenchmen.autoRepair; - if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end; - local repairCost,canRepair=GetRepairAllCost() - local loan=GetGuildBankWithdrawMoney() - if autoRepair == "GUILD" and (not CanGuildBankRepair() or (repairCost > loan)) then autoRepair = "PLAYER" end; - if repairCost > 0 then - if canRepair then - RepairAllItems(autoRepair=='GUILD') - local x,y,z= repairCost % 100,floor((repairCost % 10000)/100), floor(repairCost / 10000) - if autoRepair=='GUILD' then - SuperVillain:HenchmanSays("Repairs Complete! ...Using Guild Money!\n"..GetCoinTextureString(repairCost,12)) - else - SuperVillain:HenchmanSays("Repairs Complete!\n"..GetCoinTextureString(repairCost,12)) - end - else - SuperVillain:HenchmanSays("The Minions Say You Are Too Broke To Repair! They Are Laughing..") - end - end -end; ---[[ -########################################################## -REP AUTOMATONS -########################################################## -]]-- -function MOD:CHAT_MSG_COMBAT_FACTION_CHANGE(event, msg) - if not SuperVillain.db.SVHenchmen.autorepchange then return end; - local _, _, faction, amount = find(msg, incpat) - if not faction then - _, _, faction, amount = find(msg, changedpat) or find(msg, decpat) - end - if faction and faction ~= GUILD_REPUTATION then - local active = GetWatchedFactionInfo() - for factionIndex = 1, GetNumFactions() do - local name = GetFactionInfo(factionIndex) - if name == faction and name ~= active then - local inactive = IsFactionInactive(factionIndex) or SetWatchedFactionIndex(factionIndex) - SuperVillain:AddonMessage("Now Tracking: "..name.." Reputation") - break - end - end - end -end; ---[[ -########################################################## -QUEST AUTOMATONS -########################################################## -]]-- -function MOD:AutoQuestProxy() - if(IsShiftKeyDown()) then return false; end - if((not QuestIsDaily() or not QuestIsWeekly()) and (SuperVillain.db.SVHenchmen.autodailyquests)) then return false; end - if(QuestFlagsPVP() and (not SuperVillain.db.SVHenchmen.autopvpquests)) then return false; end - return true -end - -function MOD:QUEST_GREETING() - if(SuperVillain.db.SVHenchmen.autoquestaccept == true and MOD:AutoQuestProxy()) then - local active,available = GetNumActiveQuests(), GetNumAvailableQuests() - if(active + available == 0) then return end - if(available > 0) then - SelectAvailableQuest(1) - end - if(active > 0) then - SelectActiveQuest(1) - end - end -end - -function MOD:GOSSIP_SHOW() - if(SuperVillain.db.SVHenchmen.autoquestaccept == true and MOD:AutoQuestProxy()) then - if GetGossipAvailableQuests() then - SelectGossipAvailableQuest(1) - elseif GetGossipActiveQuests() then - SelectGossipActiveQuest(1) - end - end -end - -function MOD:QUEST_DETAIL() - if(SuperVillain.db.SVHenchmen.autoquestaccept == true and MOD:AutoQuestProxy()) then - AcceptQuest() - end -end - -function MOD:QUEST_ACCEPT_CONFIRM() - if(SuperVillain.db.SVHenchmen.autoquestaccept == true and MOD:AutoQuestProxy()) then - ConfirmAcceptQuest() - end -end - -function MOD:QUEST_PROGRESS() - if(IsShiftKeyDown()) then return false; end - if(SuperVillain.db.SVHenchmen.autoquestcomplete == true) then - CompleteQuest() - end -end - -function MOD:QUEST_COMPLETE() - if(not SuperVillain.db.SVHenchmen.autoquestcomplete and (not SuperVillain.db.SVHenchmen.autoquestreward)) then return end; - if(IsShiftKeyDown()) then return false; end - local rewards = GetNumQuestChoices() - local auto_select = QuestFrameRewardPanel.itemChoice or QuestInfoFrame.itemChoice; - local selection, value = 1, 0; - if rewards > 0 then - if SuperVillain.db.SVHenchmen.autoquestreward == true then - for i = 1, rewards do - local iLink = GetQuestItemLink("choice", i) - if iLink then - local iValue = select(11,GetItemInfo(iLink)) - if iValue and iValue > value then - value = iValue; - selection = i - end - end - end; - local chosenItem = _G[("QuestInfoItem%d"):format(selection)] - if chosenItem.type == "choice" then - QuestInfoItemHighlight:ClearAllPoints() - QuestInfoItemHighlight:SetAllPoints(chosenItem) - QuestInfoItemHighlight:Show() - QuestInfoFrame.itemChoice = chosenItem:GetID() - SuperVillain:HenchmanSays("A Minion Has Chosen Your Reward!") - end - end - auto_select = selection - if SuperVillain.db.SVHenchmen.autoquestcomplete == true then - GetQuestReward(auto_select) - end - else - if(SuperVillain.db.SVHenchmen.autoquestreward == true and SuperVillain.db.SVHenchmen.autoquestcomplete == true) then - GetQuestReward(auto_select) - end - end -end; ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:LoadAllMinions() - if IsAddOnLoaded("Postal") then - SuperVillain.db.SVHenchmen.mailOpener = false - else - self:LoadMailMinions() - self:ToggleMailMinions() - end; - - self:RegisterEvent('PARTY_INVITE_REQUEST','AutoGroupInvite') - self:RegisterEvent('GROUP_ROSTER_UPDATE','AutoGroupInvite') - for _,event in pairs(AutomatedEvents) do - self:RegisterEvent(event) - end - - if SuperVillain.db.SVHenchmen.pvpautorelease then - local autoReleaseHandler = CreateFrame("frame") - autoReleaseHandler:RegisterEvent("PLAYER_DEAD") - autoReleaseHandler:SetScript("OnEvent",function(self,event) - local isInstance, instanceType = IsInInstance() - if(isInstance and instanceType == "pvp") then - local spell = GetSpellInfo(20707) - if(SuperVillain.class ~= "SHAMAN" and not(spell and UnitBuff("player",spell))) then - RepopMe() - end - end; - for i=1,GetNumWorldPVPAreas() do - local _,localizedName, isActive = GetWorldPVPAreaInfo(i) - if(GetRealZoneText() == localizedName and isActive) then RepopMe() end - end - end) - end; - - local skippy = CreateFrame("Frame") - skippy:RegisterEvent("CINEMATIC_START") - skippy:SetScript("OnEvent", function(_, event) - if event == "CINEMATIC_START" then - if(SuperVillain.db.SVHenchmen.skipcinematics) then - CinematicFrame_CancelCinematic() - end - end - end) - local PlayMovie_hook = MovieFrame_PlayMovie - MovieFrame_PlayMovie = function(...) - if(SuperVillain.db.SVHenchmen.skipcinematics) then - GameMovieFinished() - else - PlayMovie_hook(...) - end - end -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua index 80b2d32..0791a22 100644 --- a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua +++ b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua @@ -40,7 +40,6 @@ SuperVillain.Modes = MOD; LOCALIZED GLOBALS ########################################################## ]]-- -local LABORER_FONT = SuperVillain.Media.font.system local LOOT_ITEM_SELF = _G.LOOT_ITEM_SELF; local LOOT_ITEM_CREATED_SELF = _G.LOOT_ITEM_CREATED_SELF; local LOOT_ITEM_SELF_MULTIPLE = _G.LOOT_ITEM_SELF_MULTIPLE @@ -52,9 +51,9 @@ LOCAL VARS ########################################################## ]]-- local currentModeKey = false; -local ModeAlert = CreateFrame("Frame", "SVUI_ModeAlert", SuperDockAlertRight) local ModeLogsFrame = CreateFrame("Frame", "SVUI_ModeLogsFrame", UIParent) -local classR, classG, classB = 0,0,0 +local classColors = SVUI_CLASS_COLORS[SuperVillain.class] +local classR, classG, classB = classColors.r, classColors.g, classColors.b local classA = 0.35 local lastClickTime; --[[ @@ -129,37 +128,37 @@ CORE FUNCTIONS ########################################################## ]]-- function MOD:LaborerReset() - MOD.TitleWindow:Clear(); - MOD.LogWindow:Clear(); - MOD.TitleWindow:AddMessage("Laborer Modes", 1, 1, 0); - MOD.LogWindow:AddMessage("Select a Tool to Begin", 1, 1, 1); - MOD.LogWindow:AddMessage(" ", 0, 1, 1); + self.TitleWindow:Clear(); + self.LogWindow:Clear(); + self.TitleWindow:AddMessage("Laborer Modes", 1, 1, 0); + self.LogWindow:AddMessage("Select a Tool to Begin", 1, 1, 1); + self.LogWindow:AddMessage(" ", 0, 1, 1); end function MOD:ModeLootLoader(mode, msg, info) - MOD.TitleWindow:Clear(); - MOD.LogWindow:Clear(); - ModeAlert.HelpText = info - if(mode and MOD[mode]) then - if(MOD[mode].Log) then - local stored = MOD[mode].Log; - MOD.TitleWindow:AddMessage(msg, 1, 1, 1); + self.TitleWindow:Clear(); + self.LogWindow:Clear(); + self.ModeAlert.HelpText = info + if(mode and self[mode]) then + if(self[mode].Log) then + local stored = self[mode].Log; + self.TitleWindow:AddMessage(msg, 1, 1, 1); local previous = false for name,data in pairs(stored) do if type(data) == "table" and data.amount and data.texture then - MOD.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, 0.8, 0.8, 0.8); + self.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, 0.8, 0.8, 0.8); previous = true end end; if(previous) then - MOD.LogWindow:AddMessage("----------------", 0, 0, 0); - MOD.LogWindow:AddMessage(" ", 0, 0, 0); + self.LogWindow:AddMessage("----------------", 0, 0, 0); + self.LogWindow:AddMessage(" ", 0, 0, 0); end - MOD.LogWindow:AddMessage(info, 1, 1, 1); - MOD.LogWindow:AddMessage(" ", 1, 1, 1); + self.LogWindow:AddMessage(info, 1, 1, 1); + self.LogWindow:AddMessage(" ", 1, 1, 1); end else - MOD:LaborerReset() + self:LaborerReset() end; end @@ -213,7 +212,7 @@ function MOD:EndJobModes() currentModeKey = false; if SVUI_ModesDockFrame:IsShown() then SVUI_ModesDockFrame_ToolBarButton:Click() end self:ChangeModeGear() - SVUI_ModeAlert:Hide(); + self.ModeAlert:Hide(); SendModeMessage("Mode Disabled", CombatText_StandardScroll, 1, 0.35, 0); PlaySound("UndeadExploration"); self:LaborerReset() @@ -249,7 +248,7 @@ function MOD:ChangeModeGear() end function MOD:UpdateLogWindow() - MOD.LogWindow:SetFont(LABORER_FONT, MOD.db.fontSize, "OUTLINE") + self.LogWindow:SetFont(SuperVillain.Media.font.system, self.db.fontSize, "OUTLINE") end function MOD:MakeLogWindow() @@ -293,7 +292,7 @@ function MOD:MakeLogWindow() log:SetFrameStrata("MEDIUM") log:SetPoint("TOPLEFT",title,"BOTTOMLEFT",0,0) log:SetPoint("BOTTOMRIGHT",ModeLogsFrame,"BOTTOMRIGHT",0,0) - log:SetFont(LABORER_FONT, MOD.db.fontSize, "OUTLINE") + log:SetFont(SuperVillain.Media.font.system, self.db.fontSize, "OUTLINE") log:SetJustifyH("CENTER") log:SetJustifyV("MIDDLE") log:SetShadowColor(0, 0, 0, 0) @@ -310,12 +309,12 @@ function MOD:MakeLogWindow() bottomleftline:SetPoint("BOTTOMLEFT") bottomleftline:SetWidth(1) - MOD.TitleWindow = title - MOD.LogWindow = log + self.TitleWindow = title + self.LogWindow = log - MOD.ListenerEnabled = false; - SuperVillain.Registry:Expose('SVDock'):RegisterDocklet("SVUI_ModesDockFrame", "Laborer Modes", [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-LABORER]], false) - MOD:LaborerReset() + self.ListenerEnabled = false; + SuperVillain:RegisterDocklet("SVUI_ModesDockFrame", "Laborer Modes", [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-LABORER]], false) + self:LaborerReset() end function MOD:SKILL_LINES_CHANGED() @@ -357,16 +356,13 @@ local ModeAlert_OnShow = function(self) self:Hide() return; end - UIFrameFadeIn(self, 0.3, 0, 1) + SuperVillain:SecureFadeIn(self, 0.3, 0, 1) SuperDockAlertRight:Activate(self) end -local _hide_me = function() ModeAlert:Hide() end - local ModeAlert_OnMouseDown = function(self) MOD:EndJobModes() - UIFrameFadeOut(self, 0.5, 1, 0) - SuperVillain:ExecuteTimer(_hide_me, 0.5) + SuperVillain:SecureFadeOut(self, 0.5, 1, 0, true) end local ModeButton_OnEnter = function(self) @@ -391,25 +387,10 @@ local ModeButton_OnMouseDown = function(self) end function MOD:Load() - classR, classG, classB = SuperVillain.Media.color.class[1], SuperVillain.Media.color.class[2], SuperVillain.Media.color.class[3] - LABORER_FONT = LibStub("LibSharedMedia-3.0"):Fetch("font", SuperVillain.db.media.fonts.default) - local _,_,arch,_,cook,_ = GetProfessions(); - self.ArcheologyToggle = false; - if arch ~= nil then - local name,_,_,_,_,_,_,_,_,_ = GetProfessionInfo(arch) - self.ArcheologyToggle = name - end; - self.CookingToggle = false; - if cook ~= nil then - local name,_,_,_,_,_,_,_,_,_ = GetProfessionInfo(cook) - self.CookingToggle = name - end; - self.BackupToggle = false; - self.WornItems = {}; lastClickTime = nil; - self.ModeSpellToCast = GetSpellInfo(131474); - self.ModeSpellIsKnown = IsSpellKnown(131474); + self.WornItems = {}; self.InModeGear = false; + local ALERT_HEIGHT = 60; local DOCK_WIDTH = SuperDockWindowRight:GetWidth(); local DOCK_HEIGHT = SuperDockWindowRight:GetHeight(); @@ -473,6 +454,7 @@ function MOD:Load() mode1Button:SetScript('OnLeave', ModeButton_OnLeave) mode1Button:SetScript('OnMouseDown', ModeButton_OnMouseDown) + local ModeAlert = CreateFrame("Frame", nil, SuperDockAlertRight) ModeAlert:SetAllPoints(SuperDockAlertRight) ModeAlert:SetBackdrop({ bgFile = [[Interface\AddOns\SVUI\assets\artwork\Bars\HALFTONE]], @@ -504,6 +486,8 @@ function MOD:Load() ModeAlert:SetScript('OnMouseDown', ModeAlert_OnMouseDown) ModeAlert:Hide() + self.ModeAlert = ModeAlert + self:MakeLogWindow() modesDocklet:Hide() self:LoadCookingMode() diff --git a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua b/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua index f1da0d2..2207647 100644 --- a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua +++ b/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua @@ -52,7 +52,7 @@ local CanSolveArtifact = CanSolveArtifact local GetContainerNumSlots = GetContainerNumSlots local GetContainerItemInfo = GetContainerItemInfo local GetContainerItemID = GetContainerItemID -local DockButton, ModeAlert, ModeLogsFrame; +local DockButton, ModeLogsFrame; local refArtifacts = {}; for i = 1, 12 do refArtifacts[i] = {} @@ -264,12 +264,12 @@ do if(ArchCanSurvey and not ArchWillSurvey) then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) - ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to survey."; + MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to survey."; ArchWillSurvey = true elseif(not ArchCanSurvey and ArchWillSurvey) then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) - ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to open the artifacts window."; + MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to open the artifacts window."; ArchWillSurvey = false end if(event == "ZONE_CHANGED_NEW_AREA") then ArchSiteFound = nil end @@ -354,7 +354,7 @@ function MOD.Archaeology:Enable() if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end PlaySoundFile("Sound\\Item\\UseSounds\\UseCrinklingPaper.wav") - ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) if(not IsSpellKnown(80451)) then MOD:ModeLootLoader("Archaeology", "WTF is Archaeology?", "You don't know archaeology! \nPicking up a rock and telling everyone that \nyou found a fossil is cute, BUT WRONG!! \nGo find someone who can train you to do this job."); MOD.TitleWindow:Clear(); @@ -378,7 +378,7 @@ function MOD.Archaeology:Enable() MOD.TitleWindow:AddMessage(msg); end EnableListener() - ModeAlert:Show() + MOD.ModeAlert:Show() SendModeMessage("Archaeology Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end @@ -393,11 +393,11 @@ function MOD.Archaeology:Bind() if surveyIsKnown and CanScanResearchSite() then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) - ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to survey.' + MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to survey.' else _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) - ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to open the artifacts window.' + MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to open the artifacts window.' end SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); _G["SVUI_ModeCaptureWindow"].Grip:Show(); @@ -420,7 +420,6 @@ LOADER function MOD:LoadArchaeologyMode() ModeLogsFrame = MOD.LogWindow; DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; - ModeAlert = _G["SVUI_ModeAlert"]; local progressBars = MOD.Archaeology.Bars diff --git a/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua b/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua index daa31a1..c010149 100644 --- a/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua +++ b/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua @@ -40,7 +40,7 @@ LOCAL VARS ########################################################## ]]-- local cookingSpell, campFire, skillRank, skillModifier; -local DockButton, ModeAlert; +local DockButton; --[[ ########################################################## LOCAL FUNCTIONS @@ -172,7 +172,7 @@ function MOD.Cooking:Enable() UpdateChefWear(); end PlaySoundFile("Sound\\Spells\\Tradeskills\\CookingPrepareA.wav") - ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) if(not IsSpellKnown(818)) then MOD:ModeLootLoader("Cooking", "WTF is Cooking?", "You have no clue how to cook! \nEven toast is a mystery to you. \nGo find a trainer and learn \nhow to do this simple job."); @@ -189,7 +189,7 @@ function MOD.Cooking:Enable() end end EnableListener() - ModeAlert:Show() + MOD.ModeAlert:Show() SendModeMessage("Cooking Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end @@ -203,7 +203,7 @@ function MOD.Cooking:Bind() if cookingSpell and GetSpellCooldown(campFire) > 0 then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', cookingSpell) - ModeAlert.HelpText = 'Double-Right-Click to open the cooking window.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to open the cooking window.' end SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); _G["SVUI_ModeCaptureWindow"].Grip:Show(); @@ -224,5 +224,4 @@ LOADER ]]-- function MOD:LoadCookingMode() DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; - ModeAlert = _G["SVUI_ModeAlert"]; end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/farming.lua b/Interface/AddOns/SVUI/packages/laborer/common/farming.lua index 0cd558e..5293188 100644 --- a/Interface/AddOns/SVUI/packages/laborer/common/farming.lua +++ b/Interface/AddOns/SVUI/packages/laborer/common/farming.lua @@ -42,7 +42,7 @@ LOCAL VARS local NUM_SEED_BARS = 7 local EnableListener, DisableListener, InventoryUpdate, LoadFarmingModeTools; local seedButtons,farmToolButtons,portalButtons = {},{},{}; -local DockButton, ModeAlert, ModeLogsFrame; +local DockButton, ModeLogsFrame; local refSeeds = {[79102]={1},[89328]={1},[80590]={1},[80592]={1},[80594]={1},[80593]={1},[80591]={1},[89329]={1},[80595]={1},[89326]={1},[80809]={3},[95434]={4},[89848]={3},[95437]={4},[84782]={3},[95436]={4},[85153]={3},[95438]={4},[85162]={3},[95439]={4},[85158]={3},[95440]={4},[84783]={3},[95441]={4},[89849]={3},[95442]={4},[85163]={3},[95443]={4},[89847]={3},[95444]={4},[85216]={2},[85217]={2},[89202]={2},[85215]={2},[89233]={2},[89197]={2},[85219]={2},[91806]={2},[95449]={5},[95450]={6},[95451]={5},[95452]={6},[95457]={5},[95458]={6},[95447]={5},[95448]={6},[95445]={5},[95446]={6},[95454]={5},[95456]={6},[85267]={7},[85268]={7},[85269]={7}}; local refTools = {[79104]={30254},[80513]={30254},[89880]={30535},[89815]={31938}}; local refPortals = {[91850]={"Horde"},[91861]={"Horde"},[91862]={"Horde"},[91863]={"Horde"},[91860]={"Alliance"},[91864]={"Alliance"},[91865]={"Alliance"},[91866]={"Alliance"}}; @@ -97,13 +97,13 @@ do local InFarmZone = function() local zone = GetSubZoneText() if (zone == L["Sunsong Ranch"] or zone == L["The Halfhill Market"]) then - if MOD.Farming.ToolsLoaded and ModeAlert:IsShown() then + if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then MOD.TitleWindow:Clear() MOD.TitleWindow:AddMessage("|cff22ff11Farming Mode|r") end return true else - if MOD.Farming.ToolsLoaded and ModeAlert:IsShown() then + if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then MOD.TitleWindow:Clear() MOD.TitleWindow:AddMessage("|cffff2211Must be in Sunsong Ranch|r") end @@ -363,7 +363,7 @@ function MOD.Farming:Enable() if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end PlaySoundFile("Sound\\Effects\\DeathImpacts\\mDeathImpactColossalDirtA.wav") MOD.TitleWindow:AddMessage("|cffffff11Loading Farm Tools...|r") - ModeAlert:Show() + MOD.ModeAlert:Show() SuperVillain:ExecuteTimer(InventoryUpdate, 1) MOD.Farming.ToolsLoaded = true EnableListener() @@ -494,12 +494,11 @@ function MOD:RefreshFarmingTools() end function MOD:PrepareFarmingTools() - local horizontal = self.db.farming.toolbardirection == 'HORIZONTAL' + local horizontal = self.db.farming.toolbardirection == "HORIZONTAL" local BUTTONSPACE = self.db.farming.buttonspacing or 2; ModeLogsFrame = MOD.LogWindow; - DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; - ModeAlert = _G["SVUI_ModeAlert"]; + DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] if not self.db.farming.undocked then local bgTex = [[Interface\BUTTONS\WHITE8X8]] @@ -567,7 +566,7 @@ function MOD:PrepareFarmingTools() local seedBar = CreateFrame("Frame", "FarmSeedBar"..i, farmSeedBarAnchor) seedBar.ButtonSize = BUTTONSIZE; seedBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 10)) - if i==1 then + if i == 1 then seedBar:SetPoint("TOPLEFT", farmSeedBarAnchor, "TOPLEFT", 0, 0) else seedBar:SetPoint("TOPLEFT", "FarmSeedBar"..i-1, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) @@ -588,7 +587,7 @@ function MOD:PrepareFarmingTools() seedBar:SetPoint("TOPRIGHT", _G["FarmSeedBarAnchor"], "TOPRIGHT", (horizontal and 0 or -((BUTTONSIZE + BUTTONSPACE) * i)), (horizontal and -((BUTTONSIZE + BUTTONSPACE) * i) or 0)) seedBar.ButtonSize = BUTTONSIZE; end - SuperVillain:SetSVMovable(farmSeedBarAnchor, 'FarmSeedBar_MOVE', 'Farming Seeds') + SuperVillain:SetSVMovable(farmSeedBarAnchor, "Farming Seeds") -- FARM TOOLS local farmToolBarAnchor = CreateFrame("Frame", "FarmToolBarAnchor", SuperVillain.UIParent) @@ -598,7 +597,7 @@ function MOD:PrepareFarmingTools() farmToolBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) farmToolBar:SetPoint("TOPRIGHT", farmToolBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) farmToolBar.ButtonSize = BUTTONSIZE; - SuperVillain:SetSVMovable(farmToolBarAnchor, 'FarmToolBar_MOVE', 'Farming Tools') + SuperVillain:SetSVMovable(farmToolBarAnchor, "Farming Tools") -- PORTALS local farmPortalBarAnchor = CreateFrame("Frame", "FarmPortalBarAnchor", SuperVillain.UIParent) @@ -608,6 +607,6 @@ function MOD:PrepareFarmingTools() farmPortalBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) farmPortalBar:SetPoint("TOPRIGHT", farmPortalBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) farmPortalBar.ButtonSize = BUTTONSIZE; - SuperVillain:SetSVMovable(farmPortalBarAnchor, 'FarmPortalBar_MOVE', 'Farming Portals') + SuperVillain:SetSVMovable(farmPortalBarAnchor, "Farming Portals") end end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua b/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua index cf2cdcf..49b0ea7 100644 --- a/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua +++ b/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua @@ -84,7 +84,7 @@ local refPoles = { { ["id"] = 84660, ["weight"] = 10 }, --Pandaren { ["id"] = 6256, ["weight"] = 1 } --Standard } -local DockButton, ModeAlert; +local DockButton; --[[ ########################################################## LOCAL FUNCTIONS @@ -314,7 +314,7 @@ function MOD.Fishing:Enable() if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end UpdateFishingGear(MOD.db.fishing.autoequip); PlaySoundFile("Sound\\Spells\\Tradeskills\\FishCast.wav") - ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) if(not IsSpellKnown(131474)) then MOD:ModeLootLoader("Fishing", "WTF is Fishing?", "You have no clue how to fish! \nThe last time you tried \nyou hooked yourself through the eyelid. \nGo find a trainer and learn \nhow to do this properly!"); else @@ -322,7 +322,7 @@ function MOD.Fishing:Enable() MOD:ModeLootLoader("Fishing", msg, "Double-Right-Click anywhere on the screen \nto cast your fishing line."); end EnableListener() - ModeAlert:Show() + MOD.ModeAlert:Show() SendModeMessage("Fishing Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end @@ -338,26 +338,26 @@ function MOD.Fishing:Bind() if hasMainHandEnchant then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - ModeAlert.HelpText = 'Double-Right-Click to fish.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' elseif(fishingLure) then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "item") _G["SVUI_ModeCaptureWindow"]:SetAttribute("item", "item:" .. fishingLure) if(GetItemCooldown(fishingLure) > 0) then _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - ModeAlert.HelpText = 'Double-Right-Click to fish.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' else - ModeAlert.HelpText = 'Double-Right-Click to apply fishing enchants.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to apply fishing enchants.' end else _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - ModeAlert.HelpText = 'Double-Right-Click to fish.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' end else _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - ModeAlert.HelpText = 'Double-Right-Click to fish.' + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' end SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); _G["SVUI_ModeCaptureWindow"].Grip:Show(); @@ -375,6 +375,5 @@ end function MOD:LoadFishingMode() DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] - ModeAlert = _G["SVUI_ModeAlert"] MOD:UpdateFishingMode() end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.lua b/Interface/AddOns/SVUI/packages/map/SVMap.lua index 1e6d0cc..7292b5f 100644 --- a/Interface/AddOns/SVUI/packages/map/SVMap.lua +++ b/Interface/AddOns/SVUI/packages/map/SVMap.lua @@ -27,8 +27,8 @@ local tinsert = _G.tinsert; local string = _G.string; local math = _G.math; --[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local match, gsub = string.match, string.gsub; +local lower, upper, len = string.lower, string.upper, string.len; +local match, gsub, find = string.match, string.gsub, string.find; --[[ MATH METHODS ]]-- local parsefloat = math.parsefloat; -- Uncommon --[[ @@ -50,9 +50,8 @@ local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS LOCAL VARS ########################################################## ]]-- -local gsub,upper = string.gsub,string.upper; -local temp = gsub(SLASH_CALENDAR1, "/", ""); -local calendar_string = gsub(temp, "^%l", upper) +local temp = SLASH_CALENDAR1:gsub("/", ""); +local calendar_string = temp:gsub("^%l", upper) local cColor = RAID_CLASS_COLORS[SuperVillain.class]; local MM_COLOR = {"VERTICAL", 0.65, 0.65, 0.65, 0.95, 0.95, 0.95} local MM_BRDR = 0 @@ -61,17 +60,35 @@ local MM_OFFSET_TOP = (MM_SIZE * 0.07) local MM_OFFSET_BOTTOM = (MM_SIZE * 0.11) local MM_WIDTH = MM_SIZE + (MM_BRDR * 2) local MM_HEIGHT = (MM_SIZE - (MM_OFFSET_TOP + MM_OFFSET_BOTTOM) + (MM_BRDR * 2)) - -local SVUI_MinimapFrame = CreateFrame('Frame', 'SVUI_MinimapFrame', UIParent) -SVUI_MinimapFrame.backdrop = SVUI_MinimapFrame:CreateTexture(nil,"BACKGROUND",nil,-2) -local SVUI_MinimapZonetext = CreateFrame("Frame", 'SVUI_MinimapZonetext', SVUI_MinimapFrame) -local SVUI_MinimapNarrator = CreateFrame("Frame", 'SVUI_MinimapNarrator', SVUI_MinimapFrame) +local MMBHolder, MMBBar, SetMiniMapCoords; +local SVUI_MinimapFrame = CreateFrame("Frame", "SVUI_MinimapFrame", UIParent) +SVUI_MinimapFrame.backdrop = SVUI_MinimapFrame:CreateTexture(nil, "BACKGROUND", nil, -2) +local SVUI_MinimapZonetext = CreateFrame("Frame", "SVUI_MinimapZonetext", SVUI_MinimapFrame) +local SVUI_MinimapNarrator = CreateFrame("Frame", "SVUI_MinimapNarrator", SVUI_MinimapFrame) +local NewHook = hooksecurefunc +local Initialized = false --[[ ########################################################## LOCAL FUNCTIONS ########################################################## ]]-- -local function MiniMap_MouseUp(self,btn) +local MMB_OnEnter = function(self) + if(not MOD.db.minimapbar.mouseover or MOD.db.minimapbar.styleType == "NOANCHOR") then return end + UIFrameFadeIn(SVUI_MiniMapButtonBar, 0.2, SVUI_MiniMapButtonBar:GetAlpha(), 1) + if self:GetName() ~= "SVUI_MiniMapButtonBar" then + self:SetBackdropBorderColor(.7, .7, 0) + end +end + +local MMB_OnLeave = function(self) + if(not MOD.db.minimapbar.mouseover or MOD.db.minimapbar.styleType == "NOANCHOR") then return end + UIFrameFadeOut(SVUI_MiniMapButtonBar, 0.2, SVUI_MiniMapButtonBar:GetAlpha(), 0) + if self:GetName() ~= "SVUI_MiniMapButtonBar" then + self:SetBackdropBorderColor(0, 0, 0) + end +end + +local MiniMap_MouseUp = function(self, btn) local position = self:GetPoint() if btn == "RightButton" then local xoff = -1 @@ -82,74 +99,323 @@ local function MiniMap_MouseUp(self,btn) end end -local function MiniMap_MouseWheel(self,d) - if d > 0 then +local MiniMap_MouseWheel = function(self, delta) + if delta > 0 then _G.MinimapZoomIn:Click() - elseif d < 0 then + elseif delta < 0 then _G.MinimapZoomOut:Click() end end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -MOD.narrative = ""; -MOD.locationPrefix = ""; -function MOD:UpdateSizing() - MM_COLOR = SuperVillain.Media.gradient[MOD.db.bordercolor] - MM_BRDR = MOD.db.bordersize or 0 - MM_SIZE = MOD.db.size or 240 - MM_OFFSET_TOP = (MM_SIZE * 0.07) - MM_OFFSET_BOTTOM = (MM_SIZE * 0.11) - MM_WIDTH = MM_SIZE + (MM_BRDR * 2) - MM_HEIGHT = MOD.db.customshape and (MM_SIZE - (MM_OFFSET_TOP + MM_OFFSET_BOTTOM) + (MM_BRDR * 2)) or MM_WIDTH -end; +do + local buttonCache = { + {"Node", "Tab", "Pin", "SVUI_ConsolidatedBuffs", "GameTimeframe", "HelpOpenTicketButton", "SVUI_MinimapFrame", "SVUI_EnhancedMinimap", "QueueStatusMinimapButton", "TimeManagerClockButton", "Archy", "GatherMatePin", "GatherNote", "GuildInstance", "HandyNotesPin", "MinimMap", "Spy_MapNoteList_mini", "ZGVMarker"}, + {} + } + + local function UpdateMinimapButtons() + if(not MOD.db.minimapbar.enable) then return end + MMBBar:SetPoint("CENTER", MMBHolder, "CENTER", 0, 0) + MMBBar:Height(MOD.db.minimapbar.buttonSize + 4) + MMBBar:Width(MOD.db.minimapbar.buttonSize + 4) + local lastButton, anchor, relative, xPos, yPos; + local list = buttonCache[2] + local count = #list + for i = 1, count do + local btn = _G[list[i]] + local preset = btn.preset; + if MOD.db.minimapbar.styleType == "NOANCHOR"then + btn:SetParent(preset.Parent) + if preset.DragStart then + btn:SetScript("OnDragStart", preset.DragStart) + end + if preset.DragEnd then + btn:SetScript("OnDragStop", preset.DragEnd) + end + btn:ClearAllPoints() + btn:SetSize(preset.Width, preset.Height) + btn:SetPoint(preset.Point, preset.relativeTo, preset.relativePoint, preset.xOfs, preset.yOfs) + btn:SetFrameStrata(preset.FrameStrata) + btn:SetFrameLevel(preset.FrameLevel) + btn:SetScale(preset.Scale) + btn:SetMovable(true) + else + btn:SetParent(MMBBar) + btn:SetMovable(false) + btn:SetScript("OnDragStart", nil) + btn:SetScript("OnDragStop", nil) + btn:ClearAllPoints() + btn:SetFrameStrata("LOW") + btn:SetFrameLevel(20) + btn:Size(MOD.db.minimapbar.buttonSize) + if MOD.db.minimapbar.styleType == "HORIZONTAL"then + anchor = "RIGHT" + relative = "LEFT" + xPos = -2; + yPos = 0 + else + anchor = "TOP" + relative = "BOTTOM" + xPos = 0; + yPos = -2 + end + if not lastButton then + btn:SetPoint(anchor, MMBBar, anchor, xPos, yPos) + else + btn:SetPoint(anchor, lastButton, relative, xPos, yPos) + end + end + lastButton = btn + end + if (MOD.db.minimapbar.styleType ~= "NOANCHOR" and (count > 0)) then + if MOD.db.minimapbar.styleType == "HORIZONTAL" then + MMBBar:Width((MOD.db.minimapbar.buttonSize * count) + count * 2) + else + MMBBar:Height((MOD.db.minimapbar.buttonSize * count) + count * 2) + end + MMBHolder:SetSize(MMBBar:GetSize()) + MMBBar:Show() + else + MMBBar:Hide() + end + end + + local function SetMinimapButton(btn) + if btn == nil or btn:GetName() == nil or btn:GetObjectType() ~= "Button" or not btn:IsVisible() then return end + local name = btn:GetName() + local isLib = false; + if name:sub(1,len("LibDBIcon")) == "LibDBIcon" then isLib = true end + if(not isLib) then + local reserved = buttonCache[1] + local count = #reserved + for i = 1, count do + if name:sub(1,len(reserved[i])) == reserved[i] then return end + if name:find(reserved[i]) ~= nil then return end + end + end + btn:SetPushedTexture(nil) + btn:SetHighlightTexture(nil) + btn:SetDisabledTexture(nil) + if name == "DBMMinimapButton" then + btn:SetNormalTexture("Interface\\Icons\\INV_Helmet_87") + end + if name == "SmartBuff_MiniMapButton" then + btn:SetNormalTexture(select(3, GetSpellInfo(12051))) + end + if not btn.isStyled then + btn:HookScript("OnEnter", MMB_OnEnter) + btn:HookScript("OnLeave", MMB_OnLeave) + btn:HookScript("OnClick", UpdateMinimapButtons) + for i = 1, btn:GetNumRegions() do + local frame = select(i, btn:GetRegions()) + btn.preset = {} + btn.preset.Width, btn.preset.Height = btn:GetSize() + btn.preset.Point, btn.preset.relativeTo, btn.preset.relativePoint, btn.preset.xOfs, btn.preset.yOfs = btn:GetPoint() + btn.preset.Parent = btn:GetParent() + btn.preset.FrameStrata = btn:GetFrameStrata() + btn.preset.FrameLevel = btn:GetFrameLevel() + btn.preset.Scale = btn:GetScale() + if btn:HasScript("OnDragStart") then + btn.preset.DragStart = btn:GetScript("OnDragStart") + end + if btn:HasScript("OnDragEnd") then + btn.preset.DragEnd = btn:GetScript("OnDragEnd") + end + if frame:GetObjectType() == "Texture" then + local icon = frame:GetTexture() + if icon and icon ~= nil and icon:find("Border") or icon:find("Background") or icon:find("AlphaMask") then + frame:SetTexture(nil) + else + frame:ClearAllPoints() + frame:Point("TOPLEFT", btn, "TOPLEFT", 4, -4) + frame:Point("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -4, 4) + frame:SetTexCoord(0.1, 0.9, 0.1, 0.9 ) + frame:SetDrawLayer("ARTWORK") + if name == "PS_MinimapButton" then + frame.SetPoint = function()end + end + end + end + end + btn:SetButtonTemplate() + btn.isStyled = true + local nextindex = #buttonCache[2] + 1 + buttonCache[2][nextindex] = name + end + end -function MOD:RefreshMiniMap() - MOD:UpdateSizing() - if(SVUI_MinimapFrame and SVUI_MinimapFrame:IsShown()) then - --local minimapRotationEnabled = GetCVar("rotateMinimap") ~= "0" - SVUI_MinimapFrame:Size(MM_WIDTH, MM_HEIGHT) - SVUI_MinimapFrame.backdrop:SetGradient(unpack(MM_COLOR)) - Minimap:Size(MM_SIZE,MM_SIZE) - if MOD.db.customshape then - Minimap:SetPoint("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", MM_BRDR, -(MM_OFFSET_BOTTOM - MM_BRDR)) - Minimap:SetPoint("TOPRIGHT", SVUI_MinimapFrame, "TOPRIGHT", -MM_BRDR, (MM_OFFSET_TOP - MM_BRDR)) - Minimap:SetMaskTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_MASK_RECTANGLE') - else - Minimap:SetHitRectInsets(0, 0, 0, 0) - Minimap:FillInner(SVUI_MinimapFrame, MM_BRDR, MM_BRDR) - Minimap:SetMaskTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_MASK_SQUARE') + local StyleMinimapButtons = function() + local count = Minimap:GetNumChildren() + for i=1, count do + local child = select(i,Minimap:GetChildren()) + SetMinimapButton(child) + end + UpdateMinimapButtons() + if MOD.db.minimapbar.mouseover then + MMBBar:SetAlpha(0) + else + MMBBar:SetAlpha(1) end - Minimap:SetParent(SVUI_MinimapFrame) - Minimap:SetZoom(1) - Minimap:SetZoom(0) end - SVUI_MinimapZonetext:SetSize(MM_WIDTH,28) - SVUI_MinimapZonetext.Text:SetSize(MM_WIDTH,32) - + function MOD:UpdateMinimapButtonSettings() + if(not self.db.minimapbar.enable) then return end + SuperVillain:ExecuteTimer(StyleMinimapButtons, 5) + end +end - if SVUI_AurasAnchor then - SVUI_AurasAnchor:Height(MM_HEIGHT) - if SVUI_Auras_MOVE and not SuperVillain:TestMovableMoved('SVUI_Auras_MOVE') and not SuperVillain:TestMovableMoved('Minimap_MOVE') then - SVUI_Auras_MOVE:ClearAllPoints() - SVUI_Auras_MOVE:Point("TOPRIGHT", Minimap_MOVE, "TOPLEFT", -8, 0) +local function SetLargeWorldMap() + if InCombatLockdown() then return end + if MOD.db.tinyWorldMap == true then + WorldMapFrame:SetParent(SuperVillain.UIParent) + WorldMapFrame:EnableMouse(false) + WorldMapFrame:EnableKeyboard(false) + WorldMapFrame:SetScale(1) + if WorldMapFrame:GetAttribute('UIPanelLayout-area') ~= 'center'then + SetUIPanelAttribute(WorldMapFrame, "area", "center") + end + if WorldMapFrame:GetAttribute('UIPanelLayout-allowOtherPanels') ~= true then + SetUIPanelAttribute(WorldMapFrame, "allowOtherPanels", true) end - if SVSVUI_Auras_MOVE then - SVUI_Auras_MOVE:Height(MM_HEIGHT) + end + WorldMapFrameSizeUpButton:Hide() + WorldMapFrameSizeDownButton:Show() +end + +local function SetQuestWorldMap() + if InCombatLockdown() then return end + if MOD.db.tinyWorldMap == true then + WorldMapFrame:SetParent(SuperVillain.UIParent) + WorldMapFrame:EnableMouse(false) + WorldMapFrame:EnableKeyboard(false) + if WorldMapFrame:GetAttribute('UIPanelLayout-area') ~= 'center'then + SetUIPanelAttribute(WorldMapFrame, "area", "center") + end + if WorldMapFrame:GetAttribute('UIPanelLayout-allowOtherPanels') ~= true then + SetUIPanelAttribute(WorldMapFrame, "allowOtherPanels", true) + end + end + WorldMapFrameSizeUpButton:Hide() + WorldMapFrameSizeDownButton:Show() +end + +local function SetSmallWorldMap() + if InCombatLockdown() then return end + WorldMapLevelDropDown:ClearAllPoints() + WorldMapLevelDropDown:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -10, -4) + WorldMapFrameSizeUpButton:Show() + WorldMapFrameSizeDownButton:Hide() +end + +local function AdjustMapLevel() + if InCombatLockdown()then return end + WorldMapFrame:SetFrameLevel(2) + WorldMapDetailFrame:SetFrameLevel(4) + WorldMapFrame:SetFrameStrata('HIGH') + WorldMapArchaeologyDigSites:SetFrameLevel(6) + WorldMapArchaeologyDigSites:SetFrameStrata('DIALOG') +end + +local function AdjustMapSize() + if InCombatLockdown() then return end + if MOD.db.tinyWorldMap == true then + if WORLDMAP_SETTINGS.size == WORLDMAP_FULLMAP_SIZE then + SetLargeWorldMap() + elseif WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then + SetSmallWorldMap() + elseif WORLDMAP_SETTINGS.size == WORLDMAP_QUESTLIST_SIZE then + SetQuestWorldMap() end - end - if SVUI_HyperBuffs then - SuperVillain.Registry:Expose('SVAura'):Update_HyperBuffsSettings() - end - if TimeManagerClockButton then - TimeManagerClockButton:MUNG() - end + BlackoutWorld:SetTexture(nil) + else + if WORLDMAP_SETTINGS.size == WORLDMAP_FULLMAP_SIZE then + WorldMapFrame_SetFullMapView() + elseif WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then + WorldMap_ToggleSizeDown() + elseif WORLDMAP_SETTINGS.size == WORLDMAP_QUESTLIST_SIZE then + WorldMapFrame_SetQuestMapView() + end + BlackoutWorld:SetTexture(0, 0, 0, 1) + end + AdjustMapLevel() +end + +local function CheckMovement() + if(not WorldMapFrame:IsShown()) then return end + if GetUnitSpeed("player") ~= 0 then + WorldMapFrame:SetAlpha(MOD.db.mapAlpha) + else + WorldMapFrame:SetAlpha(1) + end end +local function UpdateWorldMapCoords() + if(not WorldMapFrame:IsShown() or not SVUI_WorldMapCoords) then return end + local a, b = IsInInstance() + local c, d = GetPlayerMapPosition("player") + c = parsefloat(100 * c, 2) + d = parsefloat(100 * d, 2) + if c ~= 0 and d ~= 0 then + SVUI_WorldMapCoords.playerCoords:SetText(PLAYER..": "..c..", "..d) + else + SVUI_WorldMapCoords.playerCoords:SetText("") + end + local e = WorldMapDetailFrame:GetEffectiveScale() + local f = WorldMapDetailFrame:GetWidth() + local g = WorldMapDetailFrame:GetHeight() + local h, i = WorldMapDetailFrame:GetCenter() + local c, d = GetCursorPosition() + local j = (c / e - (h - (f / 2))) / f; + local k = (i + (g / 2)-d / e) / g; + if j >= 0 and k >= 0 and j <= 1 and k <= 1 then + j = parsefloat(100 * j, 2) + k = parsefloat(100 * k, 2) + SVUI_WorldMapCoords.mouseCoords:SetText(MOUSE_LABEL..": "..j..", "..k) + else + SVUI_WorldMapCoords.mouseCoords:SetText("") + end +end + +local function UpdateWorldMapConfig() + if InCombatLockdown()then return end + if(not MOD.WorldMapHooked) then + NewHook("WorldMap_ToggleSizeUp", AdjustMapSize) + NewHook("WorldMap_ToggleSizeDown", SetSmallWorldMap) + NewHook("WorldMapFrame_SetFullMapView", SetLargeWorldMap) + NewHook("WorldMapFrame_SetQuestMapView", SetQuestWorldMap) + MOD.WorldMapHooked = true + end + if(MOD.db.mapAlpha == 100) then + if MOD.MovingTimer then + SuperVillain:RemoveLoop(MOD.MovingTimer) + MOD.MovingTimer = nil + end + elseif(not MOD.MovingTimer) then + MOD.MovingTimer = SuperVillain:ExecuteLoop(CheckMovement, 0.2) + end + AdjustMapSize() +end + +local ResetDropDownList_Hook = function(self) + DropDownList1:ClearAllPoints() + DropDownList1:Point("TOPRIGHT",self,"BOTTOMRIGHT",-17,-4) +end + +local WorldMapFrameOnShow_Hook = function() + if InCombatLockdown()then return end + if(not SuperVillain.db.SVMap.tinyWorldMap and not Initialized) then + WorldMap_ToggleSizeUp() + Initialized = true + end + AdjustMapLevel() +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +MOD.narrative = ""; +MOD.locationPrefix = ""; do local function _updateCoords() local a, b = IsInInstance() @@ -214,7 +480,7 @@ do GameTooltip:Hide() end - function MOD:SetMiniMapCoords() + function SetMiniMapCoords() if(not SVUI_MiniMapCoords) then local CoordsHolder = CreateFrame("Frame", "SVUI_MiniMapCoords", Minimap) CoordsHolder:SetFrameLevel(Minimap:GetFrameLevel() + 1) @@ -266,7 +532,7 @@ local function UpdateMinimapLocation() SVUI_MinimapZonetext.Text:SetText(MOD.locationPrefix .. strsub(GetMinimapZoneText(), 1, 25)) end; -function MOD:UpdateMinimapTexts() +local function UpdateMinimapTexts() MOD.narrative = ""; MOD.locationPrefix = ""; if(not MOD.db.locationText or MOD.db.locationText == "HIDE") then @@ -287,41 +553,97 @@ function MOD:UpdateMinimapTexts() end end; -function MOD:CreateMiniMapElements() - MOD:UpdateSizing() +local function UpdateSizing() + MM_COLOR = SuperVillain.Media.gradient[MOD.db.bordercolor] + MM_BRDR = MOD.db.bordersize or 0 + MM_SIZE = MOD.db.size or 240 + MM_OFFSET_TOP = (MM_SIZE * 0.07) + MM_OFFSET_BOTTOM = (MM_SIZE * 0.11) + MM_WIDTH = MM_SIZE + (MM_BRDR * 2) + MM_HEIGHT = MOD.db.customshape and (MM_SIZE - (MM_OFFSET_TOP + MM_OFFSET_BOTTOM) + (MM_BRDR * 2)) or MM_WIDTH +end; + +function MOD:RefreshMiniMap() + UpdateSizing() + if(SVUI_MinimapFrame and SVUI_MinimapFrame:IsShown()) then + --local minimapRotationEnabled = GetCVar("rotateMinimap") ~= "0" + SVUI_MinimapFrame:Size(MM_WIDTH, MM_HEIGHT) + SVUI_MinimapFrame.backdrop:SetGradient(unpack(MM_COLOR)) + Minimap:Size(MM_SIZE,MM_SIZE) + if MOD.db.customshape then + Minimap:SetPoint("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", MM_BRDR, -(MM_OFFSET_BOTTOM - MM_BRDR)) + Minimap:SetPoint("TOPRIGHT", SVUI_MinimapFrame, "TOPRIGHT", -MM_BRDR, (MM_OFFSET_TOP - MM_BRDR)) + Minimap:SetMaskTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_MASK_RECTANGLE') + else + Minimap:SetHitRectInsets(0, 0, 0, 0) + Minimap:FillInner(SVUI_MinimapFrame, MM_BRDR, MM_BRDR) + Minimap:SetMaskTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_MASK_SQUARE') + end + Minimap:SetParent(SVUI_MinimapFrame) + Minimap:SetZoom(1) + Minimap:SetZoom(0) + end + + SVUI_MinimapZonetext:SetSize(MM_WIDTH,28) + SVUI_MinimapZonetext.Text:SetSize(MM_WIDTH,32) + UpdateMinimapTexts() + + if SVUI_AurasAnchor then + SVUI_AurasAnchor:Height(MM_HEIGHT) + if SVUI_AurasAnchor_MOVE and not SuperVillain:TestMovableMoved('SVUI_AurasAnchor_MOVE') and not SuperVillain:TestMovableMoved('SVUI_MinimapFrame_MOVE') then + SVUI_AurasAnchor_MOVE:ClearAllPoints() + SVUI_AurasAnchor_MOVE:Point("TOPRIGHT", SVUI_MinimapFrame_MOVE, "TOPLEFT", -8, 0) + end + if SVSVUI_AurasAnchor_MOVE then + SVUI_AurasAnchor_MOVE:Height(MM_HEIGHT) + end + end + if SVUI_HyperBuffs then + SuperVillain.Registry:Expose('SVAura'):Update_HyperBuffsSettings() + end + if TimeManagerClockButton then + TimeManagerClockButton:MUNG() + end + + UpdateWorldMapConfig() + SetMiniMapCoords() +end + +local function CreateMiniMapElements() + UpdateSizing() - Minimap:SetPlayerTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_ARROW') - Minimap:SetCorpsePOIArrowTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_CORPSE_ARROW') - Minimap:SetPOIArrowTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_GUIDE_ARROW') - Minimap:SetBlipTexture('Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_ICONS') + Minimap:SetPlayerTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_ARROW") + Minimap:SetCorpsePOIArrowTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_CORPSE_ARROW") + Minimap:SetPOIArrowTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_GUIDE_ARROW") + Minimap:SetBlipTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Minimap\\MINIMAP_ICONS") Minimap:SetClampedToScreen(false) SVUI_MinimapFrame:Point("TOPRIGHT", SuperVillain.UIParent, "TOPRIGHT", -10, -10) SVUI_MinimapFrame:Size(MM_WIDTH, MM_HEIGHT) SVUI_MinimapFrame.backdrop:ClearAllPoints() - SVUI_MinimapFrame.backdrop:WrapOuter(SVUI_MinimapFrame,2) + SVUI_MinimapFrame.backdrop:WrapOuter(SVUI_MinimapFrame, 2) SVUI_MinimapFrame.backdrop:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) SVUI_MinimapFrame.backdrop:SetGradient(unpack(MM_COLOR)) local border = CreateFrame("Frame", nil, SVUI_MinimapFrame) border:WrapOuter(SVUI_MinimapFrame.backdrop) - border.left = border:CreateTexture(nil,"BACKGROUND",nil,-1) - border.left:SetTexture(0,0,0) + border.left = border:CreateTexture(nil, "BACKGROUND", nil, -1) + border.left:SetTexture(0, 0, 0) border.left:SetPoint("TOPLEFT") border.left:SetPoint("BOTTOMLEFT") border.left:SetWidth(1) - border.right = border:CreateTexture(nil,"BACKGROUND",nil,-1) - border.right:SetTexture(0,0,0) + border.right = border:CreateTexture(nil, "BACKGROUND", nil, -1) + border.right:SetTexture(0, 0, 0) border.right:SetPoint("TOPRIGHT") border.right:SetPoint("BOTTOMRIGHT") border.right:SetWidth(1) - border.top = border:CreateTexture(nil,"BACKGROUND",nil,-1) - border.top:SetTexture(0,0,0) + border.top = border:CreateTexture(nil, "BACKGROUND", nil, -1) + border.top:SetTexture(0, 0, 0) border.top:SetPoint("TOPLEFT") border.top:SetPoint("TOPRIGHT") border.top:SetHeight(1) - border.bottom = border:CreateTexture(nil,"BACKGROUND",nil,-1) - border.bottom:SetTexture(0,0,0) + border.bottom = border:CreateTexture(nil, "BACKGROUND", nil, -1) + border.bottom:SetTexture(0, 0, 0) border.bottom:SetPoint("BOTTOMLEFT") border.bottom:SetPoint("BOTTOMRIGHT") border.bottom:SetHeight(1) @@ -359,15 +681,15 @@ function MOD:CreateMiniMapElements() MiniMapChallengeMode:Point("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", 8, -8) QueueStatusMinimapButton:ClearAllPoints() QueueStatusMinimapButton:Point("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", 6, 5) - QueueStatusMinimapButton:SetPanelTemplate("Button",false,1,-2,-2) + QueueStatusMinimapButton:SetPanelTemplate("Button", false, 1, -2, -2) QueueStatusFrame:SetClampedToScreen(true) QueueStatusMinimapButtonBorder:Hide() - QueueStatusMinimapButton:SetScript("OnShow",function() + QueueStatusMinimapButton:SetScript("OnShow", function() MiniMapInstanceDifficulty:Point("BOTTOMLEFT", QueueStatusMinimapButton, "TOPLEFT", 0, 0) GuildInstanceDifficulty:Point("BOTTOMLEFT", QueueStatusMinimapButton, "BOTTOMLEFT", 0, 0) MiniMapChallengeMode:Point("BOTTOMLEFT", QueueStatusMinimapButton, "BOTTOMLEFT", 0, 0) end) - QueueStatusMinimapButton:SetScript("OnHide",function() + QueueStatusMinimapButton:SetScript("OnHide", function() MiniMapInstanceDifficulty:Point("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, 0) GuildInstanceDifficulty:Point("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, 0) MiniMapChallengeMode:Point("BOTTOMLEFT", SVUI_MinimapFrame, "BOTTOMLEFT", 8, -8) @@ -379,45 +701,86 @@ function MOD:CreateMiniMapElements() local mwfont = SuperVillain.Media.font.dialog SVUI_MinimapNarrator:Point("TOPLEFT", SVUI_MinimapFrame, "TOPLEFT", 2, -2) - SVUI_MinimapNarrator:SetSize(100,22) + SVUI_MinimapNarrator:SetSize(100, 22) SVUI_MinimapNarrator:SetFixedPanelTemplate("Component", true) - SVUI_MinimapNarrator:SetPanelColor("yellow") - SVUI_MinimapNarrator:SetBackdropColor(1,1,0,1) + SVUI_MinimapNarrator:SetPanelColor("yellow") + SVUI_MinimapNarrator:SetBackdropColor(1, 1, 0, 1) SVUI_MinimapNarrator:SetFrameLevel(Minimap:GetFrameLevel() + 2) SVUI_MinimapNarrator:SetParent(Minimap) SVUI_MinimapNarrator.Text = SVUI_MinimapNarrator:CreateFontString(nil, "ARTWORK", nil, 7) SVUI_MinimapNarrator.Text:SetFontTemplate(mwfont, 12, "OUTLINE", "CENTER", "MIDDLE") SVUI_MinimapNarrator.Text:SetAllPoints(SVUI_MinimapNarrator) - SVUI_MinimapNarrator.Text:SetTextColor(1,1,1) - SVUI_MinimapNarrator.Text:SetShadowColor(0,0,0,0.3) - SVUI_MinimapNarrator.Text:SetShadowOffset(2,-2) + SVUI_MinimapNarrator.Text:SetTextColor(1, 1, 1) + SVUI_MinimapNarrator.Text:SetShadowColor(0, 0, 0, 0.3) + SVUI_MinimapNarrator.Text:SetShadowOffset(2, -2) SVUI_MinimapZonetext:Point("BOTTOMRIGHT", SVUI_MinimapFrame, "BOTTOMRIGHT", 2, -3) - SVUI_MinimapZonetext:SetSize(MM_WIDTH,28) + SVUI_MinimapZonetext:SetSize(MM_WIDTH, 28) SVUI_MinimapZonetext:SetFrameLevel(Minimap:GetFrameLevel() + 1) SVUI_MinimapZonetext:SetParent(Minimap) - SVUI_MinimapZonetext.Text = SVUI_MinimapZonetext:CreateFontString(nil, 'ARTWORK', nil, 7) + SVUI_MinimapZonetext.Text = SVUI_MinimapZonetext:CreateFontString(nil, "ARTWORK", nil, 7) SVUI_MinimapZonetext.Text:SetFontTemplate(mwfont, 12, "OUTLINE", "RIGHT", "MIDDLE") - SVUI_MinimapZonetext.Text:Point("RIGHT",SVUI_MinimapZonetext) - SVUI_MinimapZonetext.Text:SetSize(MM_WIDTH,32) - SVUI_MinimapZonetext.Text:SetTextColor(1,1,0) - SVUI_MinimapZonetext.Text:SetShadowColor(0,0,0,0.3) - SVUI_MinimapZonetext.Text:SetShadowOffset(-2,2) + SVUI_MinimapZonetext.Text:Point("RIGHT", SVUI_MinimapZonetext) + SVUI_MinimapZonetext.Text:SetSize(MM_WIDTH, 32) + SVUI_MinimapZonetext.Text:SetTextColor(1, 1, 0) + SVUI_MinimapZonetext.Text:SetShadowColor(0, 0, 0, 0.3) + SVUI_MinimapZonetext.Text:SetShadowOffset(-2, 2) - MOD:UpdateMinimapTexts() + UpdateMinimapTexts() Minimap:EnableMouseWheel(true) Minimap:SetScript("OnMouseWheel", MiniMap_MouseWheel) Minimap:SetScript("OnMouseUp", MiniMap_MouseUp) - local info = UIPanelWindows['PetJournalParent']; + local info = UIPanelWindows["PetJournalParent"]; for name, value in pairs(info) do PetJournalParent:SetAttribute("UIPanelLayout-"..name, value); end PetJournalParent:SetAttribute("UIPanelLayout-defined", true); - SuperVillain:SetSVMovable(SVUI_MinimapFrame, 'Minimap_MOVE', L['Minimap']) + SuperVillain:SetSVMovable(SVUI_MinimapFrame, L["Minimap"]) +end + +local function LoadWorldMap() + setfenv(WorldMapFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G })) + + WorldMapShowDropDown:Point('BOTTOMRIGHT',WorldMapPositioningGuide,'BOTTOMRIGHT',-2,-4) + WorldMapZoomOutButton:Point("LEFT",WorldMapZoneDropDown,"RIGHT",0,4) + WorldMapLevelUpButton:Point("TOPLEFT",WorldMapLevelDropDown,"TOPRIGHT",-2,8) + WorldMapLevelDownButton:Point("BOTTOMLEFT",WorldMapLevelDropDown,"BOTTOMRIGHT",-2,2) + + WorldMapFrame:SetParent(SuperVillain.UIParent) + WorldMapFrame:SetFrameLevel(4) + WorldMapFrame:SetFrameStrata('HIGH') + WorldMapDetailFrame:SetFrameLevel(6) + + WorldMapFrame:HookScript('OnShow', WorldMapFrameOnShow_Hook) + WorldMapZoneDropDownButton:HookScript('OnClick', ResetDropDownList_Hook) + + MOD:RegisterEvent('PLAYER_REGEN_ENABLED') + MOD:RegisterEvent('PLAYER_REGEN_DISABLED') + + local CoordsHolder = CreateFrame('Frame', 'SVUI_WorldMapCoords', WorldMapFrame) + CoordsHolder:SetFrameLevel(WorldMapDetailFrame:GetFrameLevel()+1) + CoordsHolder:SetFrameStrata(WorldMapDetailFrame:GetFrameStrata()) + CoordsHolder.playerCoords=CoordsHolder:CreateFontString(nil,'OVERLAY') + CoordsHolder.mouseCoords=CoordsHolder:CreateFontString(nil,'OVERLAY') + CoordsHolder.playerCoords:SetTextColor(1,1,0) + CoordsHolder.mouseCoords:SetTextColor(1,1,0) + CoordsHolder.playerCoords:SetFontObject(NumberFontNormal) + CoordsHolder.mouseCoords:SetFontObject(NumberFontNormal) + CoordsHolder.playerCoords:SetPoint("BOTTOMLEFT",WorldMapDetailFrame,"BOTTOMLEFT",5,5) + CoordsHolder.playerCoords:SetText(PLAYER..": 0, 0") + CoordsHolder.mouseCoords:SetPoint("BOTTOMLEFT",CoordsHolder.playerCoords,"TOPLEFT",0,5) + CoordsHolder.mouseCoords:SetText(MOUSE_LABEL..": 0, 0") + + MOD.CoordsTimer = SuperVillain:ExecuteLoop(UpdateWorldMapCoords, 0.05) + DropDownList1:HookScript('OnShow',function(self) + if(DropDownList1:GetScale() ~= UIParent:GetScale() and SuperVillain.db.SVMap.tinyWorldMap) then + DropDownList1:SetScale(UIParent:GetScale()) + end + end) end --[[ ########################################################## @@ -432,36 +795,61 @@ function MOD:ADDON_LOADED(event, addon) if addon == "Blizzard_FeedbackUI" then FeedbackUIButton:MUNG() end - if(MOD.db.minimapbar.enable) then - SuperVillain:ExecuteTimer(MOD.StyleMinimapButtons, 5) - end; -end; + self:UpdateMinimapButtonSettings() +end + +function MOD:PLAYER_REGEN_ENABLED() + self:UnregisterEvent('PLAYER_REGEN_ENABLED') + WorldMapFrameSizeDownButton:Enable() + WorldMapFrameSizeUpButton:Enable() +end + +function MOD:PLAYER_REGEN_DISABLED() + WorldMapFrameSizeDownButton:Disable() + WorldMapFrameSizeUpButton:Disable() +end --[[ ########################################################## BUILD FUNCTION / UPDATE ########################################################## ]]-- function MOD:ReLoad() - if(not SuperVillain.db.SVMap.enable) then return; end + if(not self.db.enable) then return; end self:RefreshMiniMap() end function MOD:Load() - if(not SuperVillain.db.SVMap.enable) then + if(not self.db.enable) then Minimap:SetMaskTexture('Textures\\MinimapMask') - return; + return end self:Protect("RefreshMiniMap") - self:CreateMiniMapElements(); + + CreateMiniMapElements() + self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateMinimapLocation) self:RegisterEvent("ZONE_CHANGED_NEW_AREA", UpdateMinimapLocation) self:RegisterEvent("ZONE_CHANGED", UpdateMinimapLocation) self:RegisterEvent("ZONE_CHANGED_INDOORS", UpdateMinimapLocation) self:RegisterEvent('ADDON_LOADED') - self:LoadMinimapButtons() - self:LoadWorldMap() - self:SetMiniMapCoords() - self:ReLoad() + + if(self.db.minimapbar.enable == true) then + MMBHolder = CreateFrame("Frame", "SVUI_MiniMapButtonHolder", SVUI_MinimapFrame) + MMBHolder:Point("TOPRIGHT", SVUI_MinimapFrame, "BOTTOMRIGHT", 2, -20) + MMBHolder:Size(SVUI_MinimapFrame:GetWidth(), 32) + MMBHolder:SetFrameStrata("BACKGROUND") + MMBBar = CreateFrame("Frame", "SVUI_MiniMapButtonBar", MMBHolder) + MMBBar:SetFrameStrata("LOW") + MMBBar:ClearAllPoints() + MMBBar:SetPoint("CENTER", MMBHolder, "CENTER", 0, 0) + MMBBar:SetScript("OnEnter", MMB_OnEnter) + MMBBar:SetScript("OnLeave", MMB_OnLeave) + SuperVillain:SetSVMovable(MMBHolder, L["Minimap Button Bar"]) + self:UpdateMinimapButtonSettings() + end + + LoadWorldMap() SuperVillain:AddToDisplayAudit(SVUI_MinimapFrame) + self:ReLoad() end SuperVillain.Registry:NewPackage(MOD, "SVMap", "pre") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.xml b/Interface/AddOns/SVUI/packages/map/SVMap.xml index 99b34ee..29163e9 100644 --- a/Interface/AddOns/SVUI/packages/map/SVMap.xml +++ b/Interface/AddOns/SVUI/packages/map/SVMap.xml @@ -1,4 +1,3 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVMap.lua'/> - <Include file='common\_load.xml'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/common/_load.xml b/Interface/AddOns/SVUI/packages/map/common/_load.xml deleted file mode 100644 index a88689b..0000000 --- a/Interface/AddOns/SVUI/packages/map/common/_load.xml +++ /dev/null @@ -1,4 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='mmbar.lua'/> - <Script file='worldmap.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/common/mmbar.lua b/Interface/AddOns/SVUI/packages/map/common/mmbar.lua deleted file mode 100644 index 59f5bcd..0000000 --- a/Interface/AddOns/SVUI/packages/map/common/mmbar.lua +++ /dev/null @@ -1,214 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVMap'); -local sub,len,find = string.sub,string.len,string.find; -local reservedFrame = { - ["SVUI_ConsolidatedBuffs"] = true, - ["GameTimeframe"] = true, - ["HelpOpenTicketButton"] = true, - ["SVUI_MinimapFrame"] = true, - ["SVUI_EnhancedMinimap"] = true, - ["QueueStatusMinimapButton"] = true, - ["TimeManagerClockButton"] = true -} -local reservedString = {"Archy","GatherMatePin","GatherNote","GuildInstance","HandyNotesPin","MinimMap","Spy_MapNoteList_mini","ZGVMarker"} -local reservedType = {"Node","Tab","Pin"} -local MMBButtons = {} -local MMBHolder,MMBBar; - -local function MMB_OnEnter(this) - if not MOD.db.minimapbar.mouseover or MOD.db.minimapbar.styleType=='NOANCHOR' then return end; - UIFrameFadeIn(SVUI_MiniMapButtonBar, 0.2, SVUI_MiniMapButtonBar:GetAlpha(), 1) - if this:GetName() ~= 'SVUI_MiniMapButtonBar' then - this:SetBackdropBorderColor(.7,.7,0) - end -end; - -local function MMB_OnLeave(this) - if not MOD.db.minimapbar.mouseover or MOD.db.minimapbar.styleType=='NOANCHOR' then return end; - UIFrameFadeOut(SVUI_MiniMapButtonBar, 0.2, SVUI_MiniMapButtonBar:GetAlpha(), 0) - if this:GetName() ~= 'SVUI_MiniMapButtonBar' then - this:SetBackdropBorderColor(0,0,0) - end -end; - -function MOD:MMBarSetButton(btn) - if btn==nil or btn:GetName()==nil or btn:GetObjectType()~="Button" or not btn:IsVisible() then return end; - local name=btn:GetName() - local isLib=false; - if sub(name,1,len("LibDBIcon")) == "LibDBIcon" then isLib=true end - if not isLib then - if reservedFrame[name] then return end - for i=1,#reservedString do - if sub(name,1,len(reservedString[i])) == reservedString[i] then return end - end; - for i=1,#reservedType do - if find(name,reservedType[i]) ~= nil then return end - end - end; - btn:SetPushedTexture(nil) - btn:SetHighlightTexture(nil) - btn:SetDisabledTexture(nil) - if name == "DBMMinimapButton" then - btn:SetNormalTexture("Interface\\Icons\\INV_Helmet_87") - end; - if name == "SmartBuff_MiniMapButton" then - btn:SetNormalTexture(select(3,GetSpellInfo(12051))) - end; - if not btn.isStyled then - btn:HookScript('OnEnter',MMB_OnEnter) - btn:HookScript('OnLeave',MMB_OnLeave) - btn:HookScript('OnClick',MOD.UpdateMMBarLayout) - for i=1,btn:GetNumRegions() do - local frame = select(i,btn:GetRegions()) - btn.preset={} - btn.preset.Width,btn.preset.Height=btn:GetSize() - btn.preset.Point,btn.preset.relativeTo,btn.preset.relativePoint,btn.preset.xOfs,btn.preset.yOfs=btn:GetPoint() - btn.preset.Parent=btn:GetParent() - btn.preset.FrameStrata=btn:GetFrameStrata() - btn.preset.FrameLevel=btn:GetFrameLevel() - btn.preset.Scale=btn:GetScale() - if btn:HasScript("OnDragStart") then - btn.preset.DragStart=btn:GetScript("OnDragStart") - end; - if btn:HasScript("OnDragEnd") then - btn.preset.DragEnd=btn:GetScript("OnDragEnd") - end; - if frame:GetObjectType()=="Texture" then - local icon = frame:GetTexture() - if icon and icon ~= nil and icon:find("Border") or icon:find("Background") or icon:find("AlphaMask") then - frame:SetTexture(nil) - else - frame:ClearAllPoints() - frame:Point("TOPLEFT",btn,"TOPLEFT",4,-4) - frame:Point("BOTTOMRIGHT",btn,"BOTTOMRIGHT",-4,4) - frame:SetTexCoord(0.1,0.9,0.1,0.9 ) - frame:SetDrawLayer("ARTWORK") - if name=="PS_MinimapButton" then - frame.SetPoint=function()end - end - end - end - end; - btn:SetButtonTemplate() - tinsert(MMBButtons,name) - btn.isStyled=true - end -end; - -function MOD:UpdateMMBarLayout() - if(not MOD.db.minimapbar.enable) then return end; - MMBBar:SetPoint("CENTER",MMBHolder,"CENTER",0,0) - MMBBar:Height(MOD.db.minimapbar.buttonSize + 4) - MMBBar:Width(MOD.db.minimapbar.buttonSize + 4) - local lastButton,anchor,relative,xPos,yPos; - for i=1,#MMBButtons do - local btn=_G[MMBButtons[i]] - local preset = btn.preset; - if MOD.db.minimapbar.styleType=='NOANCHOR'then - btn:SetParent(preset.Parent) - if preset.DragStart then - btn:SetScript("OnDragStart",preset.DragStart) - end; - if preset.DragEnd then - btn:SetScript("OnDragStop",preset.DragEnd) - end; - btn:ClearAllPoints() - btn:SetSize(preset.Width,preset.Height) - btn:SetPoint(preset.Point,preset.relativeTo,preset.relativePoint,preset.xOfs,preset.yOfs) - btn:SetFrameStrata(preset.FrameStrata) - btn:SetFrameLevel(preset.FrameLevel) - btn:SetScale(preset.Scale) - btn:SetMovable(true) - else - btn:SetParent(MMBBar) - btn:SetMovable(false) - btn:SetScript("OnDragStart",nil) - btn:SetScript("OnDragStop",nil) - btn:ClearAllPoints() - btn:SetFrameStrata("LOW") - btn:SetFrameLevel(20) - btn:Size(MOD.db.minimapbar.buttonSize) - if MOD.db.minimapbar.styleType=='HORIZONTAL'then - anchor = 'RIGHT' - relative = 'LEFT' - xPos = -2; - yPos = 0 - else - anchor = 'TOP' - relative = 'BOTTOM' - xPos = 0; - yPos = -2 - end; - if not lastButton then - btn:SetPoint(anchor,MMBBar,anchor,xPos,yPos) - else - btn:SetPoint(anchor,lastButton,relative,xPos,yPos) - end - end; - lastButton=btn - end; - if (MOD.db.minimapbar.styleType~='NOANCHOR' and (#MMBButtons > 0)) then - if MOD.db.minimapbar.styleType=="HORIZONTAL" then - MMBBar:Width((MOD.db.minimapbar.buttonSize * #MMBButtons) + #MMBButtons * 2) - else - MMBBar:Height((MOD.db.minimapbar.buttonSize * #MMBButtons) + #MMBButtons * 2) - end; - MMBHolder:SetSize(MMBBar:GetSize()) - MMBBar:Show() - else - MMBBar:Hide() - end; -end; - -function MOD:ChangeMouseOverSetting() - if MOD.db.minimapbar.mouseover then - MMBBar:SetAlpha(0) - else - MMBBar:SetAlpha(1) - end -end; - -function MOD:StyleMinimapButtons() - for i=1,Minimap:GetNumChildren()do - MOD:MMBarSetButton(select(i,Minimap:GetChildren())) - end; - MOD:UpdateMMBarLayout() - MOD:ChangeMouseOverSetting() -end; - -function MOD:UpdateMinimapButtonSettings() - if(not MOD.db.minimapbar.enable) then return end; - SuperVillain:ExecuteTimer(MOD.StyleMinimapButtons, 5) -end; - -function MOD:LoadMinimapButtons() - if(not SuperVillain.db.SVMap.enable or not self.db.minimapbar.enable) then return end; - MMBHolder=CreateFrame("Frame","SVUI_MiniMapButtonHolder",SVUI_MinimapFrame) - MMBHolder:Point("TOPRIGHT",SVUI_MinimapFrame,"BOTTOMRIGHT",2,-20) - MMBHolder:Size(SVUI_MinimapFrame:GetWidth(),32) - MMBHolder:SetFrameStrata("BACKGROUND") - --SuperVillain:AddToDisplayAudit(MMBHolder) - SuperVillain:SetSVMovable(MMBHolder,"SVUI_MiniMapButtonHolder_MOVE",L["Minimap Button Bar"]) - MMBBar=CreateFrame("Frame","SVUI_MiniMapButtonBar",MMBHolder) - MMBBar:SetFrameStrata('LOW') - MMBBar:ClearAllPoints() - MMBBar:SetPoint("CENTER",MMBHolder,"CENTER",0,0) - MMBBar:SetScript("OnEnter",MMB_OnEnter) - MMBBar:SetScript("OnLeave",MMB_OnLeave) - self:UpdateMinimapButtonSettings() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/common/worldmap.lua b/Interface/AddOns/SVUI/packages/map/common/worldmap.lua deleted file mode 100644 index d4b6059..0000000 --- a/Interface/AddOns/SVUI/packages/map/common/worldmap.lua +++ /dev/null @@ -1,240 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local match, gsub = string.match, string.gsub; ---[[ MATH METHODS ]]-- -local parsefloat = math.parsefloat; -- Uncommon ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVMap'); -local NewHook = hooksecurefunc -local Initialized = false -local function SetLargeWorldMap() - if InCombatLockdown() then return end - if SuperVillain.db.SVMap.tinyWorldMap == true then - WorldMapFrame:SetParent(SuperVillain.UIParent) - WorldMapFrame:EnableMouse(false) - WorldMapFrame:EnableKeyboard(false) - WorldMapFrame:SetScale(1) - if WorldMapFrame:GetAttribute('UIPanelLayout-area') ~= 'center'then - SetUIPanelAttribute(WorldMapFrame, "area", "center") - end - if WorldMapFrame:GetAttribute('UIPanelLayout-allowOtherPanels') ~= true then - SetUIPanelAttribute(WorldMapFrame, "allowOtherPanels", true) - end - end - WorldMapFrameSizeUpButton:Hide() - WorldMapFrameSizeDownButton:Show() -end - -local function SetQuestWorldMap() - if InCombatLockdown() then return end - if SuperVillain.db.SVMap.tinyWorldMap == true then - WorldMapFrame:SetParent(SuperVillain.UIParent) - WorldMapFrame:EnableMouse(false) - WorldMapFrame:EnableKeyboard(false) - if WorldMapFrame:GetAttribute('UIPanelLayout-area') ~= 'center'then - SetUIPanelAttribute(WorldMapFrame, "area", "center") - end - if WorldMapFrame:GetAttribute('UIPanelLayout-allowOtherPanels') ~= true then - SetUIPanelAttribute(WorldMapFrame, "allowOtherPanels", true) - end - end - WorldMapFrameSizeUpButton:Hide() - WorldMapFrameSizeDownButton:Show() -end - -local function SetSmallWorldMap() - if InCombatLockdown() then return end - WorldMapLevelDropDown:ClearAllPoints() - WorldMapLevelDropDown:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -10, -4) - WorldMapFrameSizeUpButton:Show() - WorldMapFrameSizeDownButton:Hide() -end - -local function AdjustMapLevel() - if InCombatLockdown()then return end - WorldMapFrame:SetFrameLevel(2) - WorldMapDetailFrame:SetFrameLevel(4) - WorldMapFrame:SetFrameStrata('HIGH') - WorldMapArchaeologyDigSites:SetFrameLevel(6) - WorldMapArchaeologyDigSites:SetFrameStrata('DIALOG') -end - -local function AdjustMapSize() - if InCombatLockdown() then return end - if SuperVillain.db.SVMap.tinyWorldMap == true then - if WORLDMAP_SETTINGS.size == WORLDMAP_FULLMAP_SIZE then - SetLargeWorldMap() - elseif WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then - SetSmallWorldMap() - elseif WORLDMAP_SETTINGS.size == WORLDMAP_QUESTLIST_SIZE then - SetQuestWorldMap() - end - BlackoutWorld:SetTexture(nil) - else - if WORLDMAP_SETTINGS.size == WORLDMAP_FULLMAP_SIZE then - WorldMapFrame_SetFullMapView() - elseif WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then - WorldMap_ToggleSizeDown() - elseif WORLDMAP_SETTINGS.size == WORLDMAP_QUESTLIST_SIZE then - WorldMapFrame_SetQuestMapView() - end - BlackoutWorld:SetTexture(0, 0, 0, 1) - end - AdjustMapLevel() -end - -local function CheckMovement() - if(not WorldMapFrame:IsShown()) then return end - if GetUnitSpeed("player") ~= 0 then - WorldMapFrame:SetAlpha(MOD.db.mapAlpha) - else - WorldMapFrame:SetAlpha(1) - end -end - -function MOD:PLAYER_REGEN_ENABLED() - self:UnregisterEvent('PLAYER_REGEN_ENABLED') - WorldMapFrameSizeDownButton:Enable() - WorldMapFrameSizeUpButton:Enable() -end - -function MOD:PLAYER_REGEN_DISABLED() - WorldMapFrameSizeDownButton:Disable() - WorldMapFrameSizeUpButton:Disable() -end - -local function UpdateWorldMapCoords() - if(not WorldMapFrame:IsShown() or not SVUI_WorldMapCoords) then return end - local a, b = IsInInstance() - local c, d = GetPlayerMapPosition("player") - c = parsefloat(100 * c, 2) - d = parsefloat(100 * d, 2) - if c ~= 0 and d ~= 0 then - SVUI_WorldMapCoords.playerCoords:SetText(PLAYER..": "..c..", "..d) - else - SVUI_WorldMapCoords.playerCoords:SetText("") - end - local e = WorldMapDetailFrame:GetEffectiveScale() - local f = WorldMapDetailFrame:GetWidth() - local g = WorldMapDetailFrame:GetHeight() - local h, i = WorldMapDetailFrame:GetCenter() - local c, d = GetCursorPosition() - local j = (c / e - (h - (f / 2))) / f; - local k = (i + (g / 2)-d / e) / g; - if j >= 0 and k >= 0 and j <= 1 and k <= 1 then - j = parsefloat(100 * j, 2) - k = parsefloat(100 * k, 2) - SVUI_WorldMapCoords.mouseCoords:SetText(MOUSE_LABEL..": "..j..", "..k) - else - SVUI_WorldMapCoords.mouseCoords:SetText("") - end -end - -function MOD:UpdateWorldMapConfig() - if InCombatLockdown()then return end - if(not MOD.WorldMapHooked) then - NewHook("WorldMap_ToggleSizeUp", AdjustMapSize) - NewHook("WorldMap_ToggleSizeDown", SetSmallWorldMap) - NewHook("WorldMapFrame_SetFullMapView", SetLargeWorldMap) - NewHook("WorldMapFrame_SetQuestMapView", SetQuestWorldMap) - MOD.WorldMapHooked = true - end - if(MOD.db.mapAlpha == 100) then - if MOD.MovingTimer then - SuperVillain:RemoveLoop(MOD.MovingTimer) - MOD.MovingTimer = nil - end - elseif(not MOD.MovingTimer) then - MOD.MovingTimer = SuperVillain:ExecuteLoop(CheckMovement, 0.2) - end - AdjustMapSize() -end - -local ResetDropDownList_Hook = function(self) - DropDownList1:ClearAllPoints() - DropDownList1:Point("TOPRIGHT",self,"BOTTOMRIGHT",-17,-4) -end - -local WorldMapFrameOnShow_Hook = function() - if InCombatLockdown()then return end - if(not SuperVillain.db.SVMap.tinyWorldMap and not Initialized) then - WorldMap_ToggleSizeUp() - Initialized = true - end - AdjustMapLevel() -end - -function MOD:LoadWorldMap() - setfenv(WorldMapFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G })) - - WorldMapShowDropDown:Point('BOTTOMRIGHT',WorldMapPositioningGuide,'BOTTOMRIGHT',-2,-4) - WorldMapZoomOutButton:Point("LEFT",WorldMapZoneDropDown,"RIGHT",0,4) - WorldMapLevelUpButton:Point("TOPLEFT",WorldMapLevelDropDown,"TOPRIGHT",-2,8) - WorldMapLevelDownButton:Point("BOTTOMLEFT",WorldMapLevelDropDown,"BOTTOMRIGHT",-2,2) - - WorldMapFrame:SetParent(SuperVillain.UIParent) - WorldMapFrame:SetFrameLevel(4) - WorldMapFrame:SetFrameStrata('HIGH') - WorldMapDetailFrame:SetFrameLevel(6) - - WorldMapFrame:HookScript('OnShow', WorldMapFrameOnShow_Hook) - WorldMapZoneDropDownButton:HookScript('OnClick', ResetDropDownList_Hook) - - self:RegisterEvent('PLAYER_REGEN_ENABLED') - self:RegisterEvent('PLAYER_REGEN_DISABLED') - - local CoordsHolder = CreateFrame('Frame', 'SVUI_WorldMapCoords', WorldMapFrame) - CoordsHolder:SetFrameLevel(WorldMapDetailFrame:GetFrameLevel()+1) - CoordsHolder:SetFrameStrata(WorldMapDetailFrame:GetFrameStrata()) - CoordsHolder.playerCoords=CoordsHolder:CreateFontString(nil,'OVERLAY') - CoordsHolder.mouseCoords=CoordsHolder:CreateFontString(nil,'OVERLAY') - CoordsHolder.playerCoords:SetTextColor(1,1,0) - CoordsHolder.mouseCoords:SetTextColor(1,1,0) - CoordsHolder.playerCoords:SetFontObject(NumberFontNormal) - CoordsHolder.mouseCoords:SetFontObject(NumberFontNormal) - CoordsHolder.playerCoords:SetPoint("BOTTOMLEFT",WorldMapDetailFrame,"BOTTOMLEFT",5,5) - CoordsHolder.playerCoords:SetText(PLAYER..": 0, 0") - CoordsHolder.mouseCoords:SetPoint("BOTTOMLEFT",CoordsHolder.playerCoords,"TOPLEFT",0,5) - CoordsHolder.mouseCoords:SetText(MOUSE_LABEL..": 0, 0") - - self.CoordsTimer = SuperVillain:ExecuteLoop(UpdateWorldMapCoords, 0.05) - self:UpdateWorldMapConfig() - DropDownList1:HookScript('OnShow',function(self) - if(DropDownList1:GetScale() ~= UIParent:GetScale() and SuperVillain.db.SVMap.tinyWorldMap) then - DropDownList1:SetScale(UIParent:GetScale()) - end - end) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/override/SVOverride.lua b/Interface/AddOns/SVUI/packages/override/SVOverride.lua index 54a817c..e34e96b 100644 --- a/Interface/AddOns/SVUI/packages/override/SVOverride.lua +++ b/Interface/AddOns/SVUI/packages/override/SVOverride.lua @@ -87,11 +87,11 @@ end local Vehicle_OnSetPoint = function(self,_,parent) if(parent == "MinimapCluster" or parent == _G["MinimapCluster"]) then VehicleSeatIndicator:ClearAllPoints() - if SVUI_VehicleFrame_MOVE then + if _G.SVUI_VehicleFrame_MOVE then VehicleSeatIndicator:Point("BOTTOM", SVUI_VehicleFrame_MOVE, "BOTTOM", 0, 0) else VehicleSeatIndicator:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 22, -45) - SuperVillain:SetSVMovable(VehicleSeatIndicator, "SVUI_VehicleFrame_MOVE", L["Vehicle Seat Frame"]) + SuperVillain:SetSVMovable(VehicleSeatIndicator, L["Vehicle Seat Frame"]) end; VehicleSeatIndicator:SetScale(0.8) end @@ -137,7 +137,7 @@ function MOD:Load() TicketStatusFrame:ClearAllPoints() TicketStatusFrame:SetPoint("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 250, -5) - SuperVillain:SetSVMovable(TicketStatusFrame, "GM_MOVE", L["GM Ticket Frame"]) + SuperVillain:SetSVMovable(TicketStatusFrame, L["GM Ticket Frame"], nil, nil, nil, nil, "GM") HelpOpenTicketButton:SetParent(Minimap) HelpOpenTicketButton:ClearAllPoints() HelpOpenTicketButton:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT") @@ -151,7 +151,9 @@ function MOD:Load() self:RegisterEvent('PLAYER_REGEN_DISABLED', ErrorFrameHandler) self:RegisterEvent('PLAYER_REGEN_ENABLED', ErrorFrameHandler) - SuperVillain.Registry:RunTemp("SVOverride"); + self:OverrideAlerts() + self:OverrideLootFrame() + self:OverrideMirrorBars() local exit = CreateFrame("Button", "SVUI_BailOut", SuperVillain.UIParent, "SecureHandlerClickTemplate") exit:Size(40, 40) @@ -164,24 +166,24 @@ function MOD:Load() exit:SetScript("OnClick", VehicleExit) RegisterStateDriver(exit, "visibility", "[vehicleui] show;hide") - SuperVillain:SetSVMovable(exit, "SVUI_BailOut_MOVE", L["Bail Out"]) + SuperVillain:SetSVMovable(exit, L["Bail Out"]) - local altPower = CreateFrame("Frame", "AltPowerBarHolder", UIParent) + local altPower = CreateFrame("Frame", "SVUI_AltPowerBar", UIParent) altPower:SetPoint("TOP", SuperVillain.UIParent, "TOP", 0, -18) altPower:Size(128, 50) PlayerPowerBarAlt:ClearAllPoints() PlayerPowerBarAlt:SetPoint("CENTER", altPower, "CENTER") PlayerPowerBarAlt:SetParent(altPower) PlayerPowerBarAlt.ignoreFramePositionManager = true; - SuperVillain:SetSVMovable(altPower, "AltPowerBar_MOVE", L["Alternative Power"]) + SuperVillain:SetSVMovable(altPower, L["Alternative Power"]) local wsc = CreateFrame("Frame", "SVUI_WorldStateHolder", SuperVillain.UIParent) wsc:SetSize(200, 45) wsc:SetPoint("TOP", SuperVillain.UIParent, "TOP", 0, -100) - SuperVillain:SetSVMovable(wsc, "SVUI_WorldStateHolder_MOVE", L["Capture Bars"]) + SuperVillain:SetSVMovable(wsc, L["Capture Bars"]) NewHook("UIParent_ManageFramePositions", CaptureBarHandler) - SuperVillain:SetSVMovable(LossOfControlFrame, "LossOfControlFrame_MOVE", L["Loss Control Icon"]) + SuperVillain:SetSVMovable(LossOfControlFrame, L["Loss Control Icon"], nil, nil, nil, nil, "LoC") end SuperVillain.Registry:NewPackage(MOD, "SVOverride"); \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/override/common/alert.lua b/Interface/AddOns/SVUI/packages/override/common/alert.lua index 884e010..eea635c 100644 --- a/Interface/AddOns/SVUI/packages/override/common/alert.lua +++ b/Interface/AddOns/SVUI/packages/override/common/alert.lua @@ -211,10 +211,10 @@ local AlertFramePostMove_Hook = function(forced) end end; -local OverrideAlerts = function(self) +function MOD:OverrideAlerts() SVUI_AlertFrame:SetParent(SuperVillain.UIParent) SVUI_AlertFrame:SetPoint("TOP", SuperVillain.UIParent, "TOP", 0, -18); - SuperVillain:SetSVMovable(SVUI_AlertFrame, "SVUI_AlertFrame_MOVE", L["Loot / Alert Frames"], nil, nil, AlertFramePostMove_Hook) + SuperVillain:SetSVMovable(SVUI_AlertFrame, L["Loot / Alert Frames"], nil, nil, AlertFramePostMove_Hook) NewHook('AlertFrame_FixAnchors', AlertFramePostMove_Hook) NewHook('AlertFrame_SetLootAnchors', _hook_AlertFrame_SetLootAnchors) @@ -227,6 +227,4 @@ local OverrideAlerts = function(self) NewHook('AlertFrame_SetScenarioAnchors', _hook_AlertFrame_SetScenarioAnchors) NewHook('AlertFrame_SetGuildChallengeAnchors', _hook_AlertFrame_SetGuildChallengeAnchors) NewHook('AlertFrame_SetStorePurchaseAnchors', _hook_AlertFrame_SetStorePurchaseAnchors) -end - -SuperVillain.Registry:Temp("SVOverride", OverrideAlerts) \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/override/common/looting.lua b/Interface/AddOns/SVUI/packages/override/common/looting.lua index 4ee19d7..fdcdcc6 100644 --- a/Interface/AddOns/SVUI/packages/override/common/looting.lua +++ b/Interface/AddOns/SVUI/packages/override/common/looting.lua @@ -618,11 +618,11 @@ local GroupLootDropDown_GiveLoot = function(self) SuperVillain.SystemAlert["CONFIRM_LOOT_DISTRIBUTION"].OnAccept = function(self,index) GiveMasterLoot(lastID,index) end end -local OverrideLootFrame = function(self) +function MOD:OverrideLootFrame() LootFrame:UnregisterAllEvents(); SVUI_LootFrame:SetFixedPanelTemplate('Transparent'); SVUI_LootFrame.title:SetFont(SuperVillain.Shared:Fetch("font", "SVUI Number Font"),18,"OUTLINE") - SuperVillain:SetSVMovable(SVUI_LootFrameHolder, "SVUI_LootFrame_MOVE", L["Loot Frame"]); + SuperVillain:SetSVMovable(SVUI_LootFrameHolder, L["Loot Frame"], nil, nil, nil, nil, "SVUI_LootFrame"); tinsert(UISpecialFrames, "SVUI_LootFrame"); UIParent:UnregisterEvent("LOOT_BIND_CONFIRM") @@ -644,6 +644,4 @@ local OverrideLootFrame = function(self) end _G.GroupLootDropDown_GiveLoot = GroupLootDropDown_GiveLoot -end - -SuperVillain.Registry:Temp("SVOverride", OverrideLootFrame) \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/override/common/mirror.lua b/Interface/AddOns/SVUI/packages/override/common/mirror.lua index d80d0ab..76d6a17 100644 --- a/Interface/AddOns/SVUI/packages/override/common/mirror.lua +++ b/Interface/AddOns/SVUI/packages/override/common/mirror.lua @@ -169,7 +169,7 @@ local MirrorBarUpdateHandler = function(_, event) end end -local OverrideMirrorBars = function(self) +function MOD:OverrideMirrorBars() UIParent:UnregisterEvent("MIRROR_TIMER_START") self:RegisterEvent("CVAR_UPDATE", MirrorBarUpdateHandler) self:RegisterEvent("PLAYER_ENTERING_WORLD", MirrorBarUpdateHandler) @@ -177,6 +177,4 @@ local OverrideMirrorBars = function(self) self:RegisterEvent("MIRROR_TIMER_STOP", MirrorBarToggleHandler) self:RegisterEvent("MIRROR_TIMER_PAUSE", MirrorBarToggleHandler) self:RegisterEvent("START_TIMER", MirrorBarToggleHandler) -end - -SuperVillain.Registry:Temp("SVOverride", OverrideMirrorBars) \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.lua b/Interface/AddOns/SVUI/packages/stats/SVStats.lua index 063d1f1..3ec2b7a 100644 --- a/Interface/AddOns/SVUI/packages/stats/SVStats.lua +++ b/Interface/AddOns/SVUI/packages/stats/SVStats.lua @@ -567,14 +567,17 @@ function MOD:Load() SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] or {}; SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] or 738; - SuperVillain.Registry:RunTemp("SVStats") + self:LoadServerGold() + self:CacheRepData() + self:CacheTokenData() StatMenuFrame:SetParent(SuperVillain.UIParent); StatMenuFrame:SetPanelTemplate("Transparent"); StatMenuFrame:Hide() - MOD.tooltip:SetParent(SuperVillain.UIParent) - MOD.tooltip:SetFrameStrata("DIALOG") - MOD.tooltip:HookScript("OnShow", _hook_TooltipOnShow) + + self.tooltip:SetParent(SuperVillain.UIParent) + self.tooltip:SetFrameStrata("DIALOG") + self.tooltip:HookScript("OnShow", _hook_TooltipOnShow) self:Generate() self:RegisterEvent("PLAYER_ENTERING_WORLD", "Generate") diff --git a/Interface/AddOns/SVUI/packages/stats/common/broker.lua b/Interface/AddOns/SVUI/packages/stats/common/broker.lua deleted file mode 100644 index 9fdb0e3..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/broker.lua +++ /dev/null @@ -1,82 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local LDB = LibStub:GetLibrary("LibDataBroker-1.1"); ---[[ -########################################################## -GOLD STATS -########################################################## -]]-- -local LoadStatBroker = function(MOD) - local OnEnter, OnLeave, lastObj; - for dataName, dataObj in LDB:DataObjectIterator()do - OnEnter = nil; - OnLeave = nil; - lastObj = nil; - if dataObj.OnEnter then - OnEnter = function(self) - MOD:Tip(self) - dataObj.OnTooltipShow(MOD.tooltip) - MOD:ShowTip() - end - elseif dataObj.OnTooltipShow then - OnEnter = function(self) - MOD:Tip(self) - dataObj.OnTooltipShow(MOD.tooltip) - MOD:ShowTip() - end - end; - if dataObj.OnLeave then - OnLeave = function(self) - dataObj.OnLeave(self) - MOD.tooltip:Hide() - end - end; - local OnClick = function(self, e) - dataObj.OnClick(self, e) - end; - local CallBack = function(_, name, _, value, _) - if(value == nil or len(value) > 5 or value == "n / a" or name == value) then - lastObj.text:SetText(value ~= "n / a" and value or name) - else - lastObj.text:SetText(name..": "..hexString..value.."|r") - end - end; - local OnEvent = function(self) - lastObj = self; - LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..dataName.."_text", CallBack) - LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..dataName.."_value", CallBack) - LDB.callbacks:Fire("LibDataBroker_AttributeChanged_"..dataName.."_text", dataName, nil, dataObj.text, dataObj) - end; - MOD:Extend(dataName, {"PLAYER_ENTER_WORLD"}, OnEvent, nil, OnClick, OnEnter, OnLeave) - end -end -SuperVillain.Registry:Temp("SVStats", LoadStatBroker) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/gold.lua b/Interface/AddOns/SVUI/packages/stats/common/gold.lua index e3037f8..3c6730e 100644 --- a/Interface/AddOns/SVUI/packages/stats/common/gold.lua +++ b/Interface/AddOns/SVUI/packages/stats/common/gold.lua @@ -63,22 +63,36 @@ local recorded = 0; local copperFormat = join("","%d",L.copperabbrev) local silverFormat = join("","%d",L.silverabbrev," %.2d",L.copperabbrev) local goldFormat = join("","%s",L.goldabbrev," %.2d",L.silverabbrev," %.2d",L.copperabbrev) + +local silverShortFormat = join("","%d",L.silverabbrev) +local goldShortFormat = join("","%s",L.goldabbrev) + local tiptext = join("","|cffaaaaaa",L["Reset Data: Hold Left Ctrl + Shift then Click"],"|r") local serverGold = {}; -local function FormatCurrency(amount) +local function FormatCurrency(amount, short) if not amount then return end; local gold, silver, copper = floor(abs(amount/10000)), abs(mod(amount/100,100)), abs(mod(amount,100)) - if gold ~= 0 then - return format(goldFormat, BreakUpLargeNumbers(gold), silver, copper) - elseif silver ~= 0 then - return format(silverFormat, silver, copper) - else - return format(copperFormat, copper) - end + if(short) then + if gold ~= 0 then + return format(goldShortFormat, BreakUpLargeNumbers(gold)) + elseif silver ~= 0 then + return format(silverShortFormat, silver) + else + return format(copperFormat, copper) + end + else + if gold ~= 0 then + return format(goldFormat, BreakUpLargeNumbers(gold), silver, copper) + elseif silver ~= 0 then + return format(silverFormat, silver, copper) + else + return format(copperFormat, copper) + end + end end; -local function GoldEventHandler(self, event,...) +local function Gold_OnEvent(self, event,...) if not IsLoggedIn() then return end; local current = GetMoney() recorded = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] or GetMoney(); @@ -88,7 +102,7 @@ local function GoldEventHandler(self, event,...) else gains = gains + adjusted end; - self.text:SetText(FormatCurrency(current)) + self.text:SetText(FormatCurrency(current, true)) SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney() end; @@ -96,7 +110,7 @@ local function Gold_OnClick(self, button) if IsLeftControlKeyDown() and IsShiftKeyDown() then SVUI_Global["Accountant"][SuperVillain.realm]["gold"] = {}; SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney(); - GoldEventHandler(self) + Gold_OnEvent(self) MOD.tooltip:Hide() else ToggleAllBags() @@ -134,9 +148,9 @@ local function Gold_OnEnter(self) MOD:ShowTip() end; -MOD:Extend('Gold', StatEvents, GoldEventHandler, nil, Gold_OnClick, Gold_OnEnter); +MOD:Extend('Gold', StatEvents, Gold_OnEvent, nil, Gold_OnClick, Gold_OnEnter); -local LoadServerGold = function(self) +function MOD:LoadServerGold() local totalGold = 0; for name,amount in pairs(SVUI_Global["Accountant"][SuperVillain.realm]["gold"])do if SVUI_Global["Accountant"][SuperVillain.realm]["gold"][name] then @@ -145,6 +159,4 @@ local LoadServerGold = function(self) end end; serverGold['total'] = totalGold; -end; - -SuperVillain.Registry:Temp("SVStats", LoadServerGold) \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/reputation.lua b/Interface/AddOns/SVUI/packages/stats/common/reputation.lua index 61278e2..5d797c3 100644 --- a/Interface/AddOns/SVUI/packages/stats/common/reputation.lua +++ b/Interface/AddOns/SVUI/packages/stats/common/reputation.lua @@ -65,7 +65,7 @@ local function TruncateString(value) end end -local function CacheRepData() +function MOD:CacheRepData() twipe(RepMenuList) for factionIndex = 1, GetNumFactions() do local factionName = GetFactionInfo(factionIndex) @@ -153,11 +153,9 @@ local function Reputation_OnEnter(self) end; local function Reputation_OnClick(self, button) - CacheRepData() + MOD:CacheRepData() MOD:SetStatMenu(self, RepMenuList) end; MOD:Extend("Reputation", StatEvents, Reputation_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) -MOD:Extend("Reputation Bar", StatEvents, ReputationBar_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) - -SuperVillain.Registry:Temp("SVStats", CacheRepData) \ No newline at end of file +MOD:Extend("Reputation Bar", StatEvents, ReputationBar_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/tokens.lua b/Interface/AddOns/SVUI/packages/stats/common/tokens.lua index 991a288..da42b76 100644 --- a/Interface/AddOns/SVUI/packages/stats/common/tokens.lua +++ b/Interface/AddOns/SVUI/packages/stats/common/tokens.lua @@ -88,7 +88,7 @@ local function AddToTokenMenu(id) tinsert(TokenMenuList, {text = itemName, func = fn}); end -local function CacheTokenData() +function MOD:CacheTokenData() twipe(TokenMenuList) local prof1, prof2, archaeology, _, cooking = GetProfessions() if archaeology then @@ -192,10 +192,8 @@ end; local function Tokens_OnClick(self, button) TokenParent = self; - CacheTokenData(); + MOD:CacheTokenData() MOD:SetStatMenu(self, TokenMenuList) end; -MOD:Extend('Tokens', TokenEvents, TokensEventHandler, nil, Tokens_OnClick, Tokens_OnEnter); - -SuperVillain.Registry:Temp("SVStats", CacheTokenData) \ No newline at end of file +MOD:Extend('Tokens', TokenEvents, TokensEventHandler, nil, Tokens_OnClick, Tokens_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua index 206ceea..1e50af4 100644 --- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua +++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua @@ -360,6 +360,7 @@ local function tiplevel(this, start) end local _hook_GameTooltip_OnTooltipSetUnit = function(self) + self.SuperBorder:ClearMaskColors() local unit = select(2, self:GetUnit()) local TamablePet; if self:GetOwner() ~= UIParent and MOD.db.visibility.unitFrames ~= "NONE" then @@ -547,7 +548,13 @@ end local _hook_GameTooltip_OnTooltipSetItem = function(self) if not self.itemCleared then + self.SuperBorder:ClearMaskColors() local key,itemID = self:GetItem() + local quality = select(3, GetItemInfo(key)) + if(quality) then + local r,g,b = GetItemQualityColor(quality) + self.SuperBorder:SetToneColor(r,g,b) + end local left = ""; local right = ""; if itemID ~= nil and MOD.db.spellID then @@ -563,7 +570,9 @@ local _hook_GameTooltip_OnTooltipSetItem = function(self) end local _hook_GameTooltip_ShowStatusBar = function(self, ...) - local bar = _G[self:GetName() .. "StatusBar" .. self.shownStatusBars] + local name = self:GetName() + local barName = ("%sStatusBar%d"):format(name, self.shownStatusBars) + local bar = _G[barName] if bar and not bar.styled then bar:Formula409() bar:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) @@ -587,6 +596,7 @@ end local _hook_OnSetUnitAura = function(self, unit, index, filter) local _, _, _, _, _, _, _, caster, _, _, spellID = UnitAura(unit, index, filter) if spellID and MOD.db.spellID then + self.SuperBorder:ClearMaskColors() if caster then local name = UnitName(caster) local _, class = UnitClass(caster) @@ -603,9 +613,10 @@ local _hook_OnSetUnitAura = function(self, unit, index, filter) end local _hook_OnSetHyperUnitAura = function(self, unit, index, filter) - if unit ~= "player" then return end + if unit ~= "player" then return end local auraName, _, _, _, _, _, _, caster, _, shouldConsolidate, spellID = UnitAura(unit, index, filter) - if shouldConsolidate then + if shouldConsolidate then + self.SuperBorder:ClearMaskColors() if caster then local name = UnitName(caster) local _, class = UnitClass(caster) @@ -634,7 +645,8 @@ local _hook_GameTooltip_OnTooltipSetSpell = function(self) break end end - if not check then + if not check then + self.SuperBorder:ClearMaskColors() self:AddLine(text) self:Show() end @@ -764,15 +776,15 @@ end function MOD:Load() BNToastFrame:Point("TOPRIGHT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, -10) - SuperVillain:SetSVMovable(BNToastFrame, "BNET_MOVE", L["BNet Frame"]) + SuperVillain:SetSVMovable(BNToastFrame, L["BNet Frame"], nil, nil, nil, nil, "BNET") NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) if not SuperVillain.db.SVTip.enable then return end - local anchor = CreateFrame("Frame", "GameTooltipAnchor", SuperVillain.UIParent) + local anchor = CreateFrame("Frame", "SVUI_ToolTip", SuperVillain.UIParent) anchor:Point("BOTTOMRIGHT", RightSuperDock, "TOPRIGHT", 0, 60) anchor:Size(130, 20) anchor:SetFrameLevel(anchor:GetFrameLevel() + 50) - SuperVillain:SetSVMovable(anchor, "SVUI_ToolTip_MOVE", L["Tooltip"]) + SuperVillain:SetSVMovable(anchor, L["Tooltip"]) local barHeight = self.db.healthBar.height diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index b8bce93..d6220dd 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -26,9 +26,12 @@ local type = _G.type; local tostring = _G.tostring; local tinsert = _G.tinsert; local string = _G.string; +local math = _G.math; --[[ STRING METHODS ]]-- local find, format, upper = string.find, string.format, string.upper; local match, gsub = string.match, string.gsub; +--[[ MATH METHODS ]]-- +local min, random = math.min, math.random; --[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- local assert = enforce; --[[ LOCALIZED BLIZZ FUNCTIONS ]]-- @@ -1049,7 +1052,176 @@ function MOD:RefreshUnitLayout(frame, template) end end end -end +end +--[[ +########################################################## +LOCAL VARIABLES +########################################################## +]]-- +local definedEnvs,tags = {}, {}; +local CharacterSelect = {"Munglunch", "Elv", "Tukz", "Azilroka", "Sortokk", "AlleyKat", "Quokka", "Haleth", "P3lim", "Haste", "Totalpackage", "Kryso", "Thepilli", "Doonga", "Judicate", "Cazart506", "Movster", "MuffinMonster", "Joelsoul", "Trendkill09", "Luamar", "Zharooz", "Lyn3x5", "Madh4tt3r", "Xarioth", "Sinnisterr", "Melonmaniac", "Hojowameeat", "Xandeca", "Bkan", "Daigan", "AtomicKiller", "Meljen", "Moondoggy", "Stormblade", "Schreibstift", "Anj", "Risien", "", ""}; +local _PROXY; +local _ENV = { + UnitPower = function(unit, g) + if unit:find('target') or unit:find('focus') then + return UnitPower(unit, g) + end + return random(1, UnitPowerMax(unit, g)or 1) + end, + UnitHealth = function(unit) + if unit:find('target') or unit:find('focus') then + return UnitHealth(unit) + end + return random(1, UnitHealthMax(unit)) + end, + UnitName = function(unit) + if unit:find('target') or unit:find('focus') then + return UnitName(unit) + end + local randomSelect = random(1, 40) + local name = CharacterSelect[randomSelect]; + return name + end, + UnitClass = function(unit) + if unit:find('target') or unit:find('focus') then + return UnitClass(unit) + end + local token = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))] + return LOCALIZED_CLASS_NAMES_MALE[token], token + end, + Hex = function(r, g, b) + if type(r) == "table" then + if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end + end + return format("|cff%02x%02x%02x", r*255, g*255, b*255) + end, + ColorGradient = oUF_SuperVillain.ColorGradient, +}; +--[[ +########################################################## +GROUP CONFIG VISIBILITY +########################################################## +]]-- +local function SetProxyEnv() + if(_PROXY ~= nil) then return end + _PROXY = setmetatable(_ENV, {__index = _G, __newindex = function(_,key,value) _G[key]=value end}); + tags['name:color'] = oUF_SuperVillain.Tags.Methods['name:color'] + for i=1, 30 do + tags['name:'..i] = oUF_SuperVillain.Tags.Methods['name:'..i] + end + tags['health:color'] = oUF_SuperVillain.Tags.Methods['health:color'] + tags['health:current'] = oUF_SuperVillain.Tags.Methods['health:current'] + tags['health:deficit'] = oUF_SuperVillain.Tags.Methods['health:deficit'] + tags['health:curpercent'] = oUF_SuperVillain.Tags.Methods['health:curpercent'] + tags['health:curmax'] = oUF_SuperVillain.Tags.Methods['health:curmax'] + tags['health:curmax-percent'] = oUF_SuperVillain.Tags.Methods['health:curmax-percent'] + tags['health:max'] = oUF_SuperVillain.Tags.Methods['health:max'] + tags['health:percent'] = oUF_SuperVillain.Tags.Methods['health:percent'] + tags['power:color'] = oUF_SuperVillain.Tags.Methods['power:color'] + tags['power:current'] = oUF_SuperVillain.Tags.Methods['power:current'] + tags['power:deficit'] = oUF_SuperVillain.Tags.Methods['power:deficit'] + tags['power:curpercent'] = oUF_SuperVillain.Tags.Methods['power:curpercent'] + tags['power:curmax'] = oUF_SuperVillain.Tags.Methods['power:curmax'] + tags['power:curmax-percent'] = oUF_SuperVillain.Tags.Methods['power:curmax-percent'] + tags['power:max'] = oUF_SuperVillain.Tags.Methods['power:max'] + tags['power:percent'] = oUF_SuperVillain.Tags.Methods['power:percent'] +end + +local function ChangeGroupIndex(self) + if not self:GetParent().forceShow and not self.forceShow then return end + if not self:IsShown() then return end + + local max = MAX_RAID_MEMBERS; + local key = self.___groupkey + local db = MOD.db[key] + + local newIndex = db.customSorting and -(min(db.groupCount * (db.gRowCol * 5), max) + 1 ) or -4; + if self:GetAttribute("startingIndex") ~= newIndex then + self:SetAttribute("startingIndex", newIndex) + self.isForced = true; + MOD:AllowChildren(self, self:GetChildren()) + end +end + +function MOD:SwapElement(unit, numGroup) + if InCombatLockdown()then return end + for i=1, numGroup do + local unitName = unit..i + local frame = self.Units[unitName] + if(frame) then + if(not frame.isForced) then + self:AllowElement(frame) + else + self:RestrictElement(frame) + end + end + end +end + +local attrOverride = { + ["showRaid"] = true, + ["showParty"] = true, + ["showSolo"] = true +} + +function MOD:UpdateGroupConfig(headerFrame, setForced) + if InCombatLockdown()then return end + + SetProxyEnv() + local key = headerFrame.___groupkey + local db = MOD.db[key] + headerFrame.forceShow = setForced; + headerFrame.forceShowAuras = setForced; + headerFrame.isForced = setForced; + + if setForced then + for _, func in pairs(tags) do + if type(func) == "function" then + if not definedEnvs[func] then + definedEnvs[func] = getfenv(func) + setfenv(func, _PROXY) + end + end + end + RegisterStateDriver(headerFrame, "visibility", "show") + else + for func, fenv in pairs(definedEnvs)do + setfenv(func, fenv) + definedEnvs[func] = nil + end + RegisterStateDriver(headerFrame, "visibility", db.visibility) + headerFrame:GetScript("OnEvent")(headerFrame, "PLAYER_ENTERING_WORLD") + end + + for i = 1, #headerFrame.groups do + local groupFrame = headerFrame.groups[i] + + if groupFrame:IsShown()then + groupFrame.forceShow = headerFrame.forceShow; + groupFrame.forceShowAuras = headerFrame.forceShowAuras; + groupFrame:HookScript("OnAttributeChanged", ChangeGroupIndex) + if setForced then + for attr in pairs(attrOverride)do + groupFrame:SetAttribute(attr, nil) + end + + ChangeGroupIndex(groupFrame) + groupFrame:Update() + else + for attr in pairs(attrOverride)do + groupFrame:SetAttribute(attr, true) + end + + MOD:RestrictChildren(groupFrame, groupFrame:GetChildren()) + groupFrame:SetAttribute("startingIndex", 1) + groupFrame:Update() + end + end + end + + headerFrame:SetActiveState() + collectgarbage("collect") +end --[[ ########################################################## EVENTS AND INITIALIZE @@ -1116,10 +1288,6 @@ end function MOD:PLAYER_ENTERING_WORLD() self:RefreshUnitFrames() - if SuperVillain.class == 'WARLOCK' and not self.QualifiedShards then - self:QualifyWarlockShards() - self.QualifiedShards = true - end end local UnitFrameThreatIndicator_Hook = function(unit, unitFrame) diff --git a/Interface/AddOns/SVUI/packages/unit/class/_load.xml b/Interface/AddOns/SVUI/packages/unit/class/_load.xml index 4cfacd3..a20e1ac 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/_load.xml +++ b/Interface/AddOns/SVUI/packages/unit/class/_load.xml @@ -1,5 +1,4 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='classbar.lua'/> <Script file='deathknight.lua'/> <Script file='druid.lua'/> <Script file='hunter.lua'/> diff --git a/Interface/AddOns/SVUI/packages/unit/class/classbar.lua b/Interface/AddOns/SVUI/packages/unit/class/classbar.lua deleted file mode 100644 index add8782..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/classbar.lua +++ /dev/null @@ -1,87 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local classBarConstruct = { - ["PALADIN"] = function(frame) - frame.HolyPower = MOD:CreatePaladinResourceBar(frame) - frame.ClassBar = 'HolyPower' - end, - ["WARLOCK"] = function(frame) - frame.WarlockShards = MOD:CreateWarlockResourceBar(frame) - frame.ClassBar = 'WarlockShards' - end, - ["DEATHKNIGHT"] = function(frame) - frame.Runes = MOD:CreateDeathKnightResourceBar(frame) - frame.ClassBar = 'Runes' - end, - ["DRUID"] = function(frame) - frame.EclipseBar = MOD:CreateDruidResourceBar(frame) - frame.ClassBar = 'EclipseBar' - end, - ["MONK"] = function(frame) - frame.MonkHarmony = MOD:CreateMonkResourceBar(frame) - frame.ClassBar = 'MonkHarmony' - end, - ["PRIEST"] = function(frame) - frame.PriestOrbs = MOD:CreatePriestResourceBar(frame) - frame.ClassBar = 'PriestOrbs'; - end, - ['MAGE'] = function(frame) - frame.ArcaneChargeBar = MOD:CreateMageResourceBar(frame) - frame.ClassBar = 'ArcaneChargeBar' - end, - ["SHAMAN"] = function(frame) - frame.TotemBars = MOD:CreateShamanResourceBar(frame) - frame.ClassBar='TotemBars' - end, - ["ROGUE"] = function(frame) - frame.HyperCombo = MOD:CreateRoguePointTracker(frame) - end, - ["HUNTER"] = function(frame) return end, - ['WARRIOR'] = function(frame) return end, -}; ---[[ -########################################################## -CORE FUNCTION -########################################################## -]]-- -function MOD:GetClassResources(frame) - classBarConstruct[SuperVillain.class](frame) -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua b/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua index f130c15..46590bd 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "DEATHKNIGHT") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -65,23 +66,27 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.Runes; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) for i = 1, max do bar[i]:ClearAllPoints() bar[i]:SetHeight(size) bar[i]:SetWidth(size) bar[i]:GetStatusBarTexture():SetHorizTile(false) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) elseif i == 2 then bar[i]:Point("LEFT", bar[1], "RIGHT", -6, 0) else @@ -91,13 +96,13 @@ local Reposition = function(self) if bar.UpdateAllRuneTypes then bar.UpdateAllRuneTypes(self) end -end; +end --[[ ########################################################## DEATHKNIGHT ########################################################## ]]-- -function MOD:CreateDeathKnightResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 6 local bar = CreateFrame("Frame", nil, playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -114,7 +119,15 @@ function MOD:CreateDeathKnightResourceBar(playerFrame) bar[i].bg:SetAlpha(0.5) bar[i].bg.multiplier = 0.1 end; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max; playerFrame.ClassBarRefresh = Reposition; - return bar + playerFrame.Runes = bar + return 'Runes' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/druid.lua b/Interface/AddOns/SVUI/packages/unit/class/druid.lua index 38fa8d1..c33147b 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/druid.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/druid.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "DRUID") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -104,14 +105,18 @@ local Reposition = function(self) local adjustedAnim = (height * 1.25) local scaled = (height * 0.8) local width = db.width * 0.4; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", offset, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + bar.Holder:Size(width, height) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) bar.LunarBar:Size(width, adjustedBar) bar.LunarBar:SetMinMaxValues(0,0) @@ -175,22 +180,15 @@ local TrackerCallback = function(energy, direction, virtual_energy, virtual_dire end end -function MOD:CreateDruidResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local bar = CreateFrame('Frame', nil, playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - --bar:SetPanelTemplate("Transparent", false, 2, 2, 2) bar:Size(100,40) - local lunar = CreateFrame('StatusBar', nil, bar) - lunar:SetPoint('LEFT', bar) - lunar:Size(100,40) - lunar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) - lunar.noupdate = true; - local moon = CreateFrame('Frame', nil, bar) moon:SetFrameLevel(bar:GetFrameLevel() + 2) moon:Size(40, 40) - moon:SetPoint("RIGHT", lunar, "LEFT", 10, 0) + moon:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) moon[1] = moon:CreateTexture(nil, "BACKGROUND", nil, 1) moon[1]:Size(40, 40) @@ -205,6 +203,13 @@ function MOD:CreateDruidResourceBar(playerFrame) moon[2]:SetPoint("CENTER") moon[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\DRUID-MOON") moon[1]:Hide() + + local lunar = CreateFrame('StatusBar', nil, bar) + lunar:SetPoint("LEFT", moon, "RIGHT", -10, 0) + lunar:Size(100,40) + lunar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) + lunar.noupdate = true; + bar.Moon = moon; bar.LunarBar = lunar; @@ -264,9 +269,15 @@ function MOD:CreateDruidResourceBar(playerFrame) bar.callbackid = LibBalancePowerTracker:RegisterCallback(TrackerCallback) + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.ClassBarRefresh = Reposition; - - return bar + playerFrame.EclipseBar = bar + return 'EclipseBar' end --[[ ########################################################## diff --git a/Interface/AddOns/SVUI/packages/unit/class/hunter.lua b/Interface/AddOns/SVUI/packages/unit/class/hunter.lua index 0f93fd8..709dde0 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/hunter.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/hunter.lua @@ -26,6 +26,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "HUNTER") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -35,18 +36,9 @@ local assert = enforce; assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") --[[ ########################################################## -LOCAL FUNCTIONS +PLACEHOLDER ########################################################## ]]-- - ---[[ -########################################################## -POSITIONING -########################################################## -]]-- - ---[[ -########################################################## -HUNTER -########################################################## -]]-- \ No newline at end of file +function MOD:CreateClassBar(playerFrame) + return +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/mage.lua b/Interface/AddOns/SVUI/packages/unit/class/mage.lua index 01f431c..589a846 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/mage.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/mage.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "MAGE") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -52,23 +53,26 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.ArcaneChargeBar; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) for i = 1, max do bar[i]:ClearAllPoints() bar[i]:SetHeight(size) bar[i]:SetWidth(size) bar[i]:SetStatusBarColor(0,0.6,0.9) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) else bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) end @@ -143,7 +147,7 @@ local Update = function(self, event) end end -function MOD:CreateMageResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 4 local bar = CreateFrame("Frame",nil,playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -181,9 +185,15 @@ function MOD:CreateMageResourceBar(playerFrame) bar[i].bg = under.bg; end; - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; bar.Override = Update; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - return bar + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.ArcaneChargeBar = bar + return 'ArcaneChargeBar' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/monk.lua b/Interface/AddOns/SVUI/packages/unit/class/monk.lua index 5d1ca24..1a71955 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/monk.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/monk.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "MONK") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -52,16 +53,19 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.MonkHarmony; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) local tmp = 0.67 for i = 1, max do local chi = tmp - (i * 0.1) @@ -70,7 +74,7 @@ local Reposition = function(self) bar[i]:SetWidth(size) bar[i]:SetStatusBarColor(chi,0.87,0.35) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) else bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) end @@ -118,7 +122,7 @@ local CHI_DATA = { [4] = {0.5,1,0.5,1}, [5] = {0.5,1,0,0.5} }; -function MOD:CreateMonkResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 5 local bar = CreateFrame("Frame",nil,playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -144,9 +148,16 @@ function MOD:CreateMonkResourceBar(playerFrame) bar[i]:SetScript("OnHide", StopFlash) end; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max playerFrame.DrunkenMaster = CreateDrunkenMasterBar(playerFrame) playerFrame.ClassBarRefresh = Reposition - return bar + playerFrame.MonkHarmony = bar + return 'MonkHarmony' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua b/Interface/AddOns/SVUI/packages/unit/class/paladin.lua index e87bb55..a5faeb7 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/paladin.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "PALADIN") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -58,23 +59,26 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.HolyPower; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) for i = 1, max do bar[i]:ClearAllPoints() bar[i]:SetHeight(size) bar[i]:SetWidth(size) bar[i]:GetStatusBarTexture():SetHorizTile(false) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) else bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) end @@ -119,7 +123,7 @@ end PALADIN ########################################################## ]]-- -function MOD:CreatePaladinResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 5 local bar = CreateFrame("Frame", nil, playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -160,8 +164,16 @@ function MOD:CreatePaladinResourceBar(playerFrame) bar[i].swirl = barAnimation; hooksecurefunc(bar[i], "SetAlpha", AlphaHook) end; + bar.Override = Update; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max; playerFrame.ClassBarRefresh = Reposition; - bar.Override = Update; - return bar + playerFrame.HolyPower = bar + return 'HolyPower' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/priest.lua b/Interface/AddOns/SVUI/packages/unit/class/priest.lua index 7e46197..99c9b0a 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/priest.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/priest.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "PRIEST") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -53,22 +54,27 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.PriestOrbs; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + for i = 1, max do bar[i]:ClearAllPoints() bar[i]:SetHeight(size) bar[i]:SetWidth(size) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) else bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) end @@ -92,9 +98,9 @@ local PreUpdate = function(self, spec) end end; -function MOD:CreatePriestResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 5 - local bar = CreateFrame("Frame",nil,playerFrame) + local bar = CreateFrame("Frame", nil, playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) for i=1, max do @@ -141,8 +147,16 @@ function MOD:CreatePriestResourceBar(playerFrame) end; bar.PreUpdate = PreUpdate + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max; playerFrame.ClassBarRefresh = Reposition; - return bar + playerFrame.PriestOrbs = bar + return 'PriestOrbs' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua b/Interface/AddOns/SVUI/packages/unit/class/rogue.lua index 8856c36..673ccb4 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/rogue.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "ROGUE") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -171,29 +172,32 @@ local RepositionTracker = function(self) local db = MOD.db.player local bar = self.HyperCombo; if not db then return end - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * 3; - local textwidth = height * 1.25; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * 3; + local textwidth = size * 1.25; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) if(bar.Tracking) then bar.Tracking:ClearAllPoints() - bar.Tracking:SetHeight(height) + bar.Tracking:SetHeight(size) bar.Tracking:SetWidth(textwidth) - bar.Tracking:SetPoint("LEFT", bar) + bar.Tracking:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) bar.Tracking.Text:ClearAllPoints() bar.Tracking.Text:SetAllPoints(bar.Tracking) bar.Tracking.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') end if(bar.Anticipation) then bar.Anticipation:ClearAllPoints() - bar.Anticipation:SetHeight(height) + bar.Anticipation:SetHeight(size) bar.Anticipation:SetWidth(textwidth) bar.Anticipation:SetPoint("LEFT", bar.Tracking, "RIGHT", -2, 0) bar.Anticipation.Text:ClearAllPoints() @@ -202,7 +206,7 @@ local RepositionTracker = function(self) end if(bar.Guile) then bar.Guile:ClearAllPoints() - bar.Guile:SetHeight(height) + bar.Guile:SetHeight(size) bar.Guile:SetWidth(textwidth) bar.Guile:SetPoint("LEFT", bar.Anticipation, "RIGHT", -2, 0) bar.Guile.Text:ClearAllPoints() @@ -211,7 +215,7 @@ local RepositionTracker = function(self) end end; -function MOD:CreateRoguePointTracker(playerFrame) +function MOD:CreateClassBar(playerFrame) local bar = CreateFrame("Frame",nil,playerFrame) bar:SetFrameStrata("DIALOG") bar:Size(150, 30) @@ -248,7 +252,14 @@ function MOD:CreateRoguePointTracker(playerFrame) bar.Guile = guile; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = 5; playerFrame.ClassBarRefresh = RepositionTracker; - return bar + playerFrame.HyperCombo = bar + return 'HyperCombo' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua b/Interface/AddOns/SVUI/packages/unit/class/shaman.lua index 5963433..7e0a388 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/shaman.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "SHAMAN") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -63,23 +64,26 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.TotemBars; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) for i = 1, max do bar[i]:ClearAllPoints() bar[i]:SetHeight(size) bar[i]:SetWidth(size) bar[i]:GetStatusBarTexture():SetHorizTile(false) if i==1 then - bar[i]:SetPoint("LEFT", bar) + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) else bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) end @@ -90,7 +94,7 @@ end; SHAMAN ########################################################## ]]-- -function MOD:CreateShamanResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 4 local bar = CreateFrame("Frame",nil,playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -107,8 +111,14 @@ function MOD:CreateShamanResourceBar(playerFrame) bar[i].backdrop:SetVertexColor(0.2,0.2,0.2,0.7) end; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max; playerFrame.ClassBarRefresh = Reposition; - - return bar + playerFrame.TotemBars = bar + return 'TotemBars' end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua b/Interface/AddOns/SVUI/packages/unit/class/warlock.lua index f7613f9..8065fb5 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/warlock.lua @@ -36,6 +36,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "WARLOCK") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -80,20 +81,23 @@ local Reposition = function(self) local db = MOD.db.player local bar = self.WarlockShards; local max = self.MaxClassPower; - local height = db.classbar.height - local size = (height - 4) - local width = (size + 2) * max; - local dbOffset = (height * 0.15) - bar:ClearAllPoints() - bar:Size(width, height) - if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then - bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) - else - bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) - end + local size = db.classbar.height + local width = size * max; + local dbOffset = (size * 0.15) + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) bar.DemonBar:ClearAllPoints() - bar.DemonBar:Size(width, (height * 1.25)) + bar.DemonBar:Size(width, (size * 1.25)) bar.DemonBar:SetPoint("LEFT", bar, "LEFT", 4, dbOffset) for i = 1, max do bar[i]:ClearAllPoints() @@ -274,7 +278,7 @@ end; WARLOCK ########################################################## ]]-- -function MOD:CreateWarlockResourceBar(playerFrame) +function MOD:CreateClassBar(playerFrame) local max = 4 local bar = CreateFrame("Frame",nil,playerFrame) bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) @@ -351,15 +355,26 @@ function MOD:CreateWarlockResourceBar(playerFrame) bar.CurrentSpec = 0; bar.Override = Update; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + playerFrame.MaxClassPower = max; playerFrame.ClassBarRefresh = Reposition; - bar.Override = Update; - - return bar -end; + playerFrame.WarlockShards = bar + return 'WarlockShards' +end -function MOD:QualifyWarlockShards() - local frame = _G['SVUI_Player']; - if not frame or not frame.WarlockShards then return end; - Update(frame, nil, 'player'); -end \ No newline at end of file +local preLoader = CreateFrame("Frame", nil) +preLoader:SetScript("OnEvent", function(self, event, ...) + if(event == "PLAYER_ENTERING_WORLD") then + local frame = _G['SVUI_Player'] + if not frame or not frame.WarlockShards then return end + Update(frame, nil, 'player') + self:UnregisterEvent("PLAYER_ENTERING_WORLD") + self:SetScript("OnEvent", nil) + end +end) +preLoader:RegisterEvent("PLAYER_ENTERING_WORLD") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/warrior.lua b/Interface/AddOns/SVUI/packages/unit/class/warrior.lua index 0f93fd8..889673d 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/warrior.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/warrior.lua @@ -26,6 +26,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "WARRIOR") then return end; local MOD = SuperVillain.Registry:Expose('SVUnit') if(not MOD) then return end; local _, ns = ... @@ -35,18 +36,9 @@ local assert = enforce; assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") --[[ ########################################################## -LOCAL FUNCTIONS +PLACEHOLDER ########################################################## ]]-- - ---[[ -########################################################## -POSITIONING -########################################################## -]]-- - ---[[ -########################################################## -HUNTER -########################################################## -]]-- \ No newline at end of file +function MOD:CreateClassBar(playerFrame) + return +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/_load.xml b/Interface/AddOns/SVUI/packages/unit/common/_load.xml index e367914..08b2731 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/_load.xml +++ b/Interface/AddOns/SVUI/packages/unit/common/_load.xml @@ -1,14 +1,7 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='tags.lua'/> - <Script file='secure.lua'/> - <Script file='actionpanel.lua'/> - <Script file='misc.lua'/> - <Script file='prediction.lua'/> - <Script file='health.lua'/> - <Script file='power.lua'/> - <Script file='portrait.lua'/> + <Script file='essentials.lua'/> <Script file='castbar.lua'/> <Script file='auras.lua'/> - <Script file='aurabars.lua'/> - <Script file='unique.lua'/> + <Script file='misc.lua'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua b/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua deleted file mode 100644 index ec26a23..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua +++ /dev/null @@ -1,357 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); - -local ELITE_TOP = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-TOP]] -local ELITE_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-BOTTOM]] -local ELITE_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-RIGHT]] -local STUNNED_ANIM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-STUNNED]] ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local UpdateThreat = function(self, event, unit) - if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end - local threat = self.Threat - local status = UnitThreatSituation(unit) - local r, g, b - if(status and status > 0) then - r, g, b = GetThreatStatusColor(status) - - threat:SetBackdropBorderColor(r, g, b) - else - threat:SetBackdropBorderColor(0, 0, 0, 0.5) - end -end - -local UpdatePlayerThreat = function(self, event, unit) - if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end - local threat = self.Threat - local status = UnitThreatSituation(unit) - local r, g, b - if(status and status > 0) then - r, g, b = GetThreatStatusColor(status) - threat:SetBackdropBorderColor(r, g, b) - if(status > 1) then - threat.OhShit:Show() - end - else - threat:SetBackdropBorderColor(0, 0, 0, 0.5) - threat.OhShit:Hide() - end -end - -local OhShit_OnShow = function(self) - if not self.anim:IsPlaying() then self.anim:Play() end -end - -local function CreateThreat(frame, unit) - local threat = CreateFrame('Frame', nil, frame) - threat:Point('TOPLEFT', frame, 'TOPLEFT', -3, 3) - threat:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 3, -3) - threat:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = 3, - insets = { - left = 2, - right = 2, - top = 2, - bottom = 2 - } - }); - threat:SetBackdropBorderColor(0,0,0,0.5) - - if(unit == "player") then - local aggro = CreateFrame("Frame", nil, threat) - aggro:SetFrameStrata("HIGH") - aggro:SetFrameLevel(30) - aggro:Size(52,52) - aggro:Point("TOPRIGHT",frame,16,16) - aggro.bg = aggro:CreateTexture(nil, "BORDER") - aggro.bg:FillInner(aggro) - aggro.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AGGRO") - SuperVillain.Animate:Pulse(aggro) - aggro:Hide() - aggro:SetScript("OnShow", OhShit_OnShow) - - threat.OhShit = aggro - threat.Override = UpdatePlayerThreat - else - threat.Override = UpdateThreat - end - - return threat -end - -local function CreateActionPanel(frame, offset) - if(frame.ActionPanel) then return; end - offset = offset or 2 - - local panel = CreateFrame('Frame', nil, frame) - panel:Point('TOPLEFT', frame, 'TOPLEFT', -1, 1) - panel:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 1, -1) - - --[[ UNDERLAY BORDER ]]-- - local borderLeft = panel:CreateTexture(nil, "BORDER") - borderLeft:SetTexture(0, 0, 0) - borderLeft:SetPoint("TOPLEFT") - borderLeft:SetPoint("BOTTOMLEFT") - borderLeft:SetWidth(offset) - - local borderRight = panel:CreateTexture(nil, "BORDER") - borderRight:SetTexture(0, 0, 0) - borderRight:SetPoint("TOPRIGHT") - borderRight:SetPoint("BOTTOMRIGHT") - borderRight:SetWidth(offset) - - local borderTop = panel:CreateTexture(nil, "BORDER") - borderTop:SetTexture(0, 0, 0) - borderTop:SetPoint("TOPLEFT") - borderTop:SetPoint("TOPRIGHT") - borderTop:SetHeight(offset) - - local borderBottom = panel:CreateTexture(nil, "BORDER") - borderBottom:SetTexture(0, 0, 0) - borderBottom:SetPoint("BOTTOMLEFT") - borderBottom:SetPoint("BOTTOMRIGHT") - borderBottom:SetHeight(offset) - - --[[ OVERLAY BORDER ]]-- - panel.border = {} - panel.border[1] = panel:CreateTexture(nil, "OVERLAY") - panel.border[1]:SetTexture(0, 0, 0) - panel.border[1]:SetPoint("TOPLEFT") - panel.border[1]:SetPoint("TOPRIGHT") - panel.border[1]:SetHeight(2) - - panel.border[2] = panel:CreateTexture(nil, "OVERLAY") - panel.border[2]:SetTexture(0, 0, 0) - panel.border[2]:SetPoint("BOTTOMLEFT") - panel.border[2]:SetPoint("BOTTOMRIGHT") - panel.border[2]:SetHeight(2) - - panel.border[3] = panel:CreateTexture(nil, "OVERLAY") - panel.border[3]:SetTexture(0, 0, 0) - panel.border[3]:SetPoint("TOPRIGHT") - panel.border[3]:SetPoint("BOTTOMRIGHT") - panel.border[3]:SetWidth(2) - - panel.border[4] = panel:CreateTexture(nil, "OVERLAY") - panel.border[4]:SetTexture(0, 0, 0) - panel.border[4]:SetPoint("TOPLEFT") - panel.border[4]:SetPoint("BOTTOMLEFT") - panel.border[4]:SetWidth(2) - - panel:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeSize = 1, - insets = - { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - }) - panel:SetBackdropColor(0,0,0) - panel:SetBackdropBorderColor(0,0,0) - - panel:SetFrameStrata("BACKGROUND") - panel:SetFrameLevel(0) - return panel -end; ---[[ -########################################################## -NAME -########################################################## -]]-- -local function CreateNameText(frame, unitName) - local db = MOD.db - if(MOD.db[unitName] and MOD.db[unitName].name) then - db = MOD.db[unitName].name - end - local name = frame:CreateFontString(nil, "OVERLAY") - name:SetFont(SuperVillain.Shared:Fetch("font", db.font), db.fontSize, db.fontOutline) - name:SetShadowOffset(2, -2) - name:SetShadowColor(0, 0, 0, 1) - if unitNmae == "target" then - name:SetPoint("RIGHT", frame) - else - name:SetPoint("CENTER", frame) - end - return name; -end ---[[ -########################################################## -ACTIONPANEL / INFOPANEL -########################################################## -]]-- -function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) - if(unit and (unit == "target" or unit == "player")) then - frame.ActionPanel = CreateActionPanel(frame, 3) - frame.Threat = CreateThreat(frame.ActionPanel, unit) - - local info = CreateFrame("Frame", nil, frame) - info:SetFrameStrata("BACKGROUND") - info:SetFrameLevel(0) - info:Point("TOPLEFT", frame.ActionPanel, "BOTTOMLEFT", -1, 1) - info:Point("TOPRIGHT", frame.ActionPanel, "BOTTOMRIGHT", 1, 1) - info:SetHeight(30) - - local bg = info:CreateTexture(nil, "BACKGROUND") - bg:FillInner(info) - bg:SetTexture(1, 1, 1, 1) - bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.7) - - frame.InfoPanel = CreateFrame("Frame", nil, info) - frame.InfoPanel:SetFrameStrata("MEDIUM") - frame.InfoPanel:SetAllPoints(info) - - if(unit == "target") then - frame.ActionPanel:SetFrameLevel(1) - frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) - frame.ActionPanel.special:SetAllPoints(frame) - frame.ActionPanel.special:SetFrameStrata("BACKGROUND") - frame.ActionPanel.special:SetFrameLevel(0) - frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[1]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "TOPLEFT", 0, 0) - frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) - frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[1]:SetBlendMode("BLEND") - frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[2]:SetPoint("TOPLEFT", frame.ActionPanel.special, "BOTTOMLEFT", 0, 0) - frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) - frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[2]:SetBlendMode("BLEND") - frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[3]:SetPoint("TOPLEFT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 2.25) - frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) - frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[3]:SetBlendMode("BLEND") - frame.ActionPanel.special:SetAlpha(0.7) - frame.ActionPanel.special:Hide() - else - frame.LossOfControl = CreateFrame("Frame", nil, frame.InfoPanel) - frame.LossOfControl:SetAllPoints(frame) - frame.LossOfControl:SetFrameStrata("DIALOG") - frame.LossOfControl:SetFrameLevel(99) - - local stunned = frame.LossOfControl:CreateTexture(nil, "OVERLAY", nil, 1) - stunned:SetPoint("CENTER", frame, "CENTER", 0, 0) - stunned:SetSize(96, 96) - stunned:SetTexture(STUNNED_ANIM) - stunned:SetBlendMode("ADD") - SuperVillain.Animate:Sprite(stunned, 0.12, false, true) - stunned:Hide() - frame.LossOfControl.stunned = stunned - - LossOfControlFrame:HookScript("OnShow", function() - if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then - _G["SVUI_Player"].LossOfControl:Show() - end - end) - LossOfControlFrame:HookScript("OnHide", function() - if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then - _G["SVUI_Player"].LossOfControl:Hide() - end - end) - end - else - frame.ActionPanel = CreateActionPanel(frame, 2) - frame.InfoPanel = CreateFrame("Frame", nil, frame) - frame.InfoPanel:SetFrameStrata("MEDIUM") - frame.InfoPanel:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", 2, -2) - frame.InfoPanel:Point("BOTTOMRIGHT", frame.ActionPanel, "BOTTOMRIGHT", -2, 2) - frame.InfoPanel:SetFrameLevel(frame.InfoPanel:GetFrameLevel() + 30) - end - - frame.InfoPanel.Name = CreateNameText(frame.InfoPanel, unit) - - local reverse = unit and (unit == "target" or unit == "focus" or unit == "boss" or unit == "arena") or false; - local offset, direction - - if(not noHealthText) then - frame.InfoPanel.Health = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Health:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - offset = reverse and 2 or -2; - direction = reverse and "LEFT" or "RIGHT"; - frame.InfoPanel.Health:Point(direction, frame.InfoPanel, direction, offset, 0) - end - - if(not noPowerText) then - frame.InfoPanel.Power = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Power:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - offset = reverse and -2 or 2; - direction = reverse and "RIGHT" or "LEFT"; - frame.InfoPanel.Power:Point(direction, frame.InfoPanel, direction, offset, 0) - end - - if(not noMiscText) then - frame.InfoPanel.Misc = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Misc:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - frame.InfoPanel.Misc:Point("CENTER", frame, "CENTER", 0, 0) - end - - frame.HealthPanel = CreateFrame("Frame", nil, frame) - frame.HealthPanel:SetAllPoints(frame) - - frame.StatusPanel = CreateFrame("Frame", nil, frame.HealthPanel) - frame.StatusPanel:EnableMouse(false) - - if(unit and (unit == "player" or unit == "pet" or unit == "target" or unit == "targettarget" or unit == "focus" or unit == "focustarget")) then - frame.StatusPanel:SetAllPoints(frame.HealthPanel) - frame.StatusPanel.media = { - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DC]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DEAD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-TAPPED]] - } - else - frame.StatusPanel:SetSize(50, 50) - frame.StatusPanel:SetPoint("CENTER", frame.HealthPanel, "CENTER", 0, 0) - frame.StatusPanel.media = { - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DC]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DEAD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-TAPPED]] - } - end - - frame.StatusPanel.texture = frame.StatusPanel:CreateTexture(nil, "OVERLAY") - frame.StatusPanel.texture:SetAllPoints() - frame.StatusPanel.texture:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - frame.StatusPanel.texture:SetBlendMode("ADD") - frame.StatusPanel.texture:SetGradient("VERTICAL",1,1,0,1,0,0) - frame.StatusPanel.texture:SetAlpha(0) - - frame.StatusPanel:SetFrameStrata("LOW") - frame.StatusPanel:SetFrameLevel(20) -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua b/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua deleted file mode 100644 index 1c745b9..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua +++ /dev/null @@ -1,178 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local tsort,floor,sub = table.sort, math.floor, string.sub; -local CustomBarFilter; ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -local AuraRemover_OnClick = function(self) - if not IsShiftKeyDown() then return end - local name = self:GetParent().aura.name - if name then - SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) - SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0} - MOD:RefreshUnitFrames() - end -end - -local function PostCreateAuraBars(self) - self.iconHolder:RegisterForClicks("RightButtonUp") - self.iconHolder:SetScript("OnClick", AuraRemover_OnClick) -end - -local function ColorizeAuraBars(self) - local bars = self.bars; - for i = 1, #bars do - local auraBar = bars[i] - if not auraBar:IsVisible()then break end - local color - local spellName = auraBar.statusBar.aura.name; - local spellID = auraBar.statusBar.aura.spellID; - if(SuperVillain.Filters["Shield"][spellName]) then - color = oUF_SuperVillain.colors.shield_bars - elseif(SuperVillain.db.media.unitframes.spellcolor[spellName]) then - color = SuperVillain.db.media.unitframes.spellcolor[spellName] - end - if color then - auraBar.statusBar:SetStatusBarColor(unpack(color)) - auraBar:SetBackdropColor(color[1] * 0.25, color[2] * 0.25, color[3] * 0.25, 0.25) - else - local r, g, b = auraBar.statusBar:GetStatusBarColor() - auraBar:SetBackdropColor(r * 0.25, g * 0.25, b * 0.25, 0.25) - end - end -end - -do - local function _test(setting, helpful) - local friend, enemy = false, false - if type(setting) == "boolean" then - friend = setting; - enemy = setting - elseif setting and type(setting) ~= "string" then - friend = setting.friendly; - enemy = setting.enemy - end - if (friend and helpful) or (enemy and not helpful) then - return true; - end - return false - end - - CustomBarFilter = function(self, unit, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID) - local key = self.___key - local db = MOD.db[key] - if((not db) or (db and not db.aurabar) or (spellID == 65148)) then - return false; - end - local barDB = db.aurabar - local isPlayer = caster == "player" or caster == "vehicle" - local filtered = true - local fromPlayer = true - local pass = false; - local friendly = UnitIsFriend("player", unit) == 1 and true or false; - - if _test(barDB.filterPlayer, friendly) then - if isPlayer then - filtered = true - else - filtered = false - end - fromPlayer = filtered; - pass = true - end - if _test(barDB.filterDispellable, friendly) then - if (debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then - filtered = false - end - pass = true - end - if _test(barDB.filterRaid, friendly) then - if shouldConsolidate == 1 then filtered = false end - pass = true - end - if _test(barDB.filterInfinite, friendly) then - if duration == 0 or not duration then - filtered = false - end - pass = true - end - if _test(barDB.filterBlocked, friendly) then - local blackList = SuperVillain.Filters["Blocked"][name] - if blackList and blackList.enable then filtered = false end - pass = true - end - if _test(barDB.filterAllowed, friendly) then - local whiteList = SuperVillain.Filters["Allowed"][name] - if whiteList and whiteList.enable then - filtered = true - elseif not pass then - filtered = false - end - pass = true - end - local active = barDB.useFilter - if active and active ~= "" and SuperVillain.Filters[active] then - local spellsDB = SuperVillain.Filters[active]; - if active ~= "Blocked" then - if spellsDB[name] and spellsDB[name].enable and fromPlayer then - filtered = true - elseif not pass then - filtered = false - end - elseif spellsDB[name] and spellsDB[name].enable then - filtered = false - end - end - return filtered - end -end ---[[ -########################################################## -UTILITY -########################################################## -]]-- -function MOD:CreateAuraBarHeader(frame, unitName) - local auraBarParent = CreateFrame("Frame", nil, frame) - auraBarParent.parent = frame; - auraBarParent.PostCreateBar = PostCreateAuraBars; - auraBarParent.gap = 2; - auraBarParent.spacing = 1; - auraBarParent.spark = true; - auraBarParent.filter = CustomBarFilter; - auraBarParent.PostUpdate = ColorizeAuraBars; - auraBarParent.barTexture = SuperVillain.Shared:Fetch("statusbar", MOD.db.auraBarStatusbar) - auraBarParent.timeFont = SuperVillain.Shared:Fetch("font", "Roboto") - auraBarParent.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) - auraBarParent.textSize = MOD.db.auraFontSize - auraBarParent.textOutline = MOD.db.auraFontOutline - return auraBarParent -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/auras.lua b/Interface/AddOns/SVUI/packages/unit/common/auras.lua index 5e33af4..33b4aae 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/auras.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/auras.lua @@ -31,8 +31,6 @@ local tinsert = _G.tinsert; local string = _G.string; local math = _G.math; local table = _G.table; ---[[ STRING METHODS ]]-- -local format = string.format; --[[ MATH METHODS ]]-- local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; --[[ TABLE METHODS ]]-- @@ -51,7 +49,7 @@ local oUF_SuperVillain = ns.oUF local assert = enforce; assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); -local CustomAuraFilter; +local CustomAuraFilter,CustomBarFilter; local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]]; local AURA_FONTSIZE = 11; local AURA_OUTLINE = "OUTLINE"; @@ -85,12 +83,27 @@ local AuraRemover_OnClick = function(self) if not IsShiftKeyDown() then return end local name = self.name; if name then - SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) + SuperVillain:AddonMessage((L["The spell '%s' has been added to the Blocked unitframe aura filter."]):format(name)) SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0}; MOD:RefreshUnitFrames() end end +local AuraBarRemover_OnClick = function(self) + if not IsShiftKeyDown() then return end + local name = self:GetParent().aura.name + if name then + SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) + SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0} + MOD:RefreshUnitFrames() + end +end + +local PostCreateAuraBars = function(self) + self.iconHolder:RegisterForClicks("RightButtonUp") + self.iconHolder:SetScript("OnClick", AuraBarRemover_OnClick) +end + local PostCreateAuraIcon = function(self, aura) aura.cd.noOCC = true; aura.cd.noCooldownCount = true; @@ -124,6 +137,29 @@ local PostCreateAuraIcon = function(self, aura) aura.styled = true end +local ColorizeAuraBars = function(self) + local bars = self.bars; + for i = 1, #bars do + local auraBar = bars[i] + if not auraBar:IsVisible()then break end + local color + local spellName = auraBar.statusBar.aura.name; + local spellID = auraBar.statusBar.aura.spellID; + if(SuperVillain.Filters["Shield"][spellName]) then + color = oUF_SuperVillain.colors.shield_bars + elseif(SuperVillain.db.media.unitframes.spellcolor[spellName]) then + color = SuperVillain.db.media.unitframes.spellcolor[spellName] + end + if color then + auraBar.statusBar:SetStatusBarColor(unpack(color)) + auraBar:SetBackdropColor(color[1] * 0.25, color[2] * 0.25, color[3] * 0.25, 0.25) + else + local r, g, b = auraBar.statusBar:GetStatusBarColor() + auraBar:SetBackdropColor(r * 0.25, g * 0.25, b * 0.25, 0.25) + end + end +end + local UpdateAuraTimer = function(self, elapsed) self.expiration = self.expiration - elapsed; if(self.nextUpdate > 0) then @@ -328,6 +364,74 @@ do end return filtered end + + CustomBarFilter = function(self, unit, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID) + local key = self.___key + local db = MOD.db[key] + if((not db) or (db and not db.aurabar) or (spellID == 65148)) then + return false; + end + local barDB = db.aurabar + local isPlayer = caster == "player" or caster == "vehicle" + local filtered = true + local fromPlayer = true + local pass = false; + local friendly = UnitIsFriend("player", unit) == 1 and true or false; + + if _test(barDB.filterPlayer, friendly) then + if isPlayer then + filtered = true + else + filtered = false + end + fromPlayer = filtered; + pass = true + end + if _test(barDB.filterDispellable, friendly) then + if (debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then + filtered = false + end + pass = true + end + if _test(barDB.filterRaid, friendly) then + if shouldConsolidate == 1 then filtered = false end + pass = true + end + if _test(barDB.filterInfinite, friendly) then + if duration == 0 or not duration then + filtered = false + end + pass = true + end + if _test(barDB.filterBlocked, friendly) then + local blackList = SuperVillain.Filters["Blocked"][name] + if blackList and blackList.enable then filtered = false end + pass = true + end + if _test(barDB.filterAllowed, friendly) then + local whiteList = SuperVillain.Filters["Allowed"][name] + if whiteList and whiteList.enable then + filtered = true + elseif not pass then + filtered = false + end + pass = true + end + local active = barDB.useFilter + if active and active ~= "" and SuperVillain.Filters[active] then + local spellsDB = SuperVillain.Filters[active]; + if active ~= "Blocked" then + if spellsDB[name] and spellsDB[name].enable and fromPlayer then + filtered = true + elseif not pass then + filtered = false + end + elseif spellsDB[name] and spellsDB[name].enable then + filtered = false + end + end + return filtered + end end --[[ ########################################################## @@ -374,7 +478,24 @@ function MOD:CreateAuraWatch(frame, unit) aWatch.strictMatching = true; aWatch.icons = {} return aWatch -end +end + +function MOD:CreateAuraBarHeader(frame, unitName) + local auraBarParent = CreateFrame("Frame", nil, frame) + auraBarParent.parent = frame; + auraBarParent.PostCreateBar = PostCreateAuraBars; + auraBarParent.gap = 2; + auraBarParent.spacing = 1; + auraBarParent.spark = true; + auraBarParent.filter = CustomBarFilter; + auraBarParent.PostUpdate = ColorizeAuraBars; + auraBarParent.barTexture = SuperVillain.Shared:Fetch("statusbar", MOD.db.auraBarStatusbar) + auraBarParent.timeFont = SuperVillain.Shared:Fetch("font", "Roboto") + auraBarParent.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) + auraBarParent.textSize = MOD.db.auraFontSize + auraBarParent.textOutline = MOD.db.auraFontOutline + return auraBarParent +end function MOD:SmartAuraDisplay() local unit = self.unit; @@ -610,4 +731,4 @@ function MOD:UpdateGroupAuraWatch(header, override) local frame = select(i, group:GetChildren()) if frame and frame.Health then MOD:UpdateAuraWatch(frame, header, override) end end -end \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua b/Interface/AddOns/SVUI/packages/unit/common/castbar.lua index 19f665c..6641765 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/castbar.lua @@ -481,8 +481,8 @@ function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) castbar:SetFrameLevel(2) castbar.LatencyTexture = castbar:CreateTexture(nil, "OVERLAY") - - local castbarHolder = CreateFrame("Frame", nil, castbar) + local cbName = frame:GetName().."Castbar" + local castbarHolder = CreateFrame("Frame", cbName, castbar) local iconHolder = CreateFrame("Frame", nil, castbar) iconHolder:SetFixedPanelTemplate("Inset", false) @@ -677,7 +677,7 @@ function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) castbar.SparkColor = oUF_SuperVillain.colors.spark if moverName then - SuperVillain:SetSVMovable(castbar.Holder, frame:GetName().."Castbar_MOVE", moverName, nil, -6, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(castbar.Holder, moverName, nil, -6, nil, "ALL, SOLO") end if useFader then diff --git a/Interface/AddOns/SVUI/packages/unit/common/essentials.lua b/Interface/AddOns/SVUI/packages/unit/common/essentials.lua new file mode 100644 index 0000000..b7d0590 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/common/essentials.lua @@ -0,0 +1,898 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local math = _G.math; +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.Registry:Expose('SVUnit') +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); +--[[ +########################################################## +LOCALS +########################################################## +]]-- +-- local MISSING_MODEL_FILE = [[Spells\Blackmagic_precast_base.m2]]; +-- local MISSING_MODEL_FILE = [[Spells\Crow_baked.m2]]; +-- local MISSING_MODEL_FILE = [[Spells\monsterlure01.m2]]; +-- local MISSING_MODEL_FILE = [[interface\buttons\talktome_gears.m2]]; +-- local MISSING_MODEL_FILE = [[creature\Ghostlyskullpet\ghostlyskullpet.m2]]; +-- local MISSING_MODEL_FILE = [[creature\ghost\ghost.m2]]; +local MISSING_MODEL_FILE = [[Spells\Monk_travelingmist_missile.m2]]; +local HEALTH_ANIM_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-HEALTH-ANIMATION]]; +local ELITE_TOP = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-TOP]] +local ELITE_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-BOTTOM]] +local ELITE_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-RIGHT]] +local STUNNED_ANIM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-STUNNED]] +local token = {[0] = "MANA", [1] = "RAGE", [2] = "FOCUS", [3] = "ENERGY", [6] = "RUNIC_POWER"} + +local Anim_OnUpdate = function(self) + local parent = self.parent + local coord = self._coords; + parent:SetTexCoord(coord[1],coord[2],coord[3],coord[4]) +end + +local Anim_OnPlay = function(self) + local parent = self.parent + parent:SetAlpha(1) + if not parent:IsShown() then + parent:Show() + end +end + +local Anim_OnStop = function(self) + local parent = self.parent + parent:SetAlpha(0) + if parent:IsShown() then + parent:Hide() + end +end + +local function SetNewAnimation(frame, animType, parent) + local anim = frame:CreateAnimation(animType, subType) + anim.parent = parent + return anim +end + +local function SetAnim(frame, parent) + local speed = 0.08 + frame.anim = frame:CreateAnimationGroup("Sprite") + frame.anim.parent = parent; + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnStop) + frame.anim:SetScript("OnStop", Anim_OnStop) + + frame.anim[1] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]._coords = {0,0.5,0,0.25} + frame.anim[1]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]._coords = {0.5,1,0,0.25} + frame.anim[2]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]._coords = {0,0.5,0.25,0.5} + frame.anim[3]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]._coords = {0.5,1,0.25,0.5} + frame.anim[4]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[5] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(speed) + frame.anim[5]._coords = {0,0.5,0.5,0.75} + frame.anim[5]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[6] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[6]:SetOrder(6) + frame.anim[6]:SetDuration(speed) + frame.anim[6]._coords = {0.5,1,0.5,0.75} + frame.anim[6]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[7] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[7]:SetOrder(7) + frame.anim[7]:SetDuration(speed) + frame.anim[7]._coords = {0,0.5,0.75,1} + frame.anim[7]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[8] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[8]:SetOrder(8) + frame.anim[8]:SetDuration(speed) + frame.anim[8]._coords = {0.5,1,0.75,1} + frame.anim[8]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim:SetLooping("REPEAT") +end +--[[ +########################################################## +ACTIONPANEL +########################################################## +]]-- +local UpdateThreat = function(self, event, unit) + if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end + local threat = self.Threat + local status = UnitThreatSituation(unit) + local r, g, b + if(status and status > 0) then + r, g, b = GetThreatStatusColor(status) + + threat:SetBackdropBorderColor(r, g, b) + else + threat:SetBackdropBorderColor(0, 0, 0, 0.5) + end +end + +local UpdatePlayerThreat = function(self, event, unit) + if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end + local threat = self.Threat + local status = UnitThreatSituation(unit) + local r, g, b + if(status and status > 0) then + r, g, b = GetThreatStatusColor(status) + threat:SetBackdropBorderColor(r, g, b) + if(status > 1) then + threat.OhShit:Show() + end + else + threat:SetBackdropBorderColor(0, 0, 0, 0.5) + threat.OhShit:Hide() + end +end + +local OhShit_OnShow = function(self) + if not self.anim:IsPlaying() then self.anim:Play() end +end + +local function CreateThreat(frame, unit) + local threat = CreateFrame('Frame', nil, frame) + threat:Point('TOPLEFT', frame, 'TOPLEFT', -3, 3) + threat:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 3, -3) + threat:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = 3, + insets = { + left = 2, + right = 2, + top = 2, + bottom = 2 + } + }); + threat:SetBackdropBorderColor(0,0,0,0.5) + + if(unit == "player") then + local aggro = CreateFrame("Frame", nil, threat) + aggro:SetFrameStrata("HIGH") + aggro:SetFrameLevel(30) + aggro:Size(52,52) + aggro:Point("TOPRIGHT",frame,16,16) + aggro.bg = aggro:CreateTexture(nil, "BORDER") + aggro.bg:FillInner(aggro) + aggro.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AGGRO") + SuperVillain.Animate:Pulse(aggro) + aggro:Hide() + aggro:SetScript("OnShow", OhShit_OnShow) + + threat.OhShit = aggro + threat.Override = UpdatePlayerThreat + else + threat.Override = UpdateThreat + end + + return threat +end + +local function CreateActionPanel(frame, offset) + if(frame.ActionPanel) then return; end + offset = offset or 2 + + local panel = CreateFrame('Frame', nil, frame) + panel:Point('TOPLEFT', frame, 'TOPLEFT', -1, 1) + panel:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 1, -1) + + --[[ UNDERLAY BORDER ]]-- + local borderLeft = panel:CreateTexture(nil, "BORDER") + borderLeft:SetTexture(0, 0, 0) + borderLeft:SetPoint("TOPLEFT") + borderLeft:SetPoint("BOTTOMLEFT") + borderLeft:SetWidth(offset) + + local borderRight = panel:CreateTexture(nil, "BORDER") + borderRight:SetTexture(0, 0, 0) + borderRight:SetPoint("TOPRIGHT") + borderRight:SetPoint("BOTTOMRIGHT") + borderRight:SetWidth(offset) + + local borderTop = panel:CreateTexture(nil, "BORDER") + borderTop:SetTexture(0, 0, 0) + borderTop:SetPoint("TOPLEFT") + borderTop:SetPoint("TOPRIGHT") + borderTop:SetHeight(offset) + + local borderBottom = panel:CreateTexture(nil, "BORDER") + borderBottom:SetTexture(0, 0, 0) + borderBottom:SetPoint("BOTTOMLEFT") + borderBottom:SetPoint("BOTTOMRIGHT") + borderBottom:SetHeight(offset) + + --[[ OVERLAY BORDER ]]-- + panel.border = {} + panel.border[1] = panel:CreateTexture(nil, "OVERLAY") + panel.border[1]:SetTexture(0, 0, 0) + panel.border[1]:SetPoint("TOPLEFT") + panel.border[1]:SetPoint("TOPRIGHT") + panel.border[1]:SetHeight(2) + + panel.border[2] = panel:CreateTexture(nil, "OVERLAY") + panel.border[2]:SetTexture(0, 0, 0) + panel.border[2]:SetPoint("BOTTOMLEFT") + panel.border[2]:SetPoint("BOTTOMRIGHT") + panel.border[2]:SetHeight(2) + + panel.border[3] = panel:CreateTexture(nil, "OVERLAY") + panel.border[3]:SetTexture(0, 0, 0) + panel.border[3]:SetPoint("TOPRIGHT") + panel.border[3]:SetPoint("BOTTOMRIGHT") + panel.border[3]:SetWidth(2) + + panel.border[4] = panel:CreateTexture(nil, "OVERLAY") + panel.border[4]:SetTexture(0, 0, 0) + panel.border[4]:SetPoint("TOPLEFT") + panel.border[4]:SetPoint("BOTTOMLEFT") + panel.border[4]:SetWidth(2) + + panel:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = + { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + }) + panel:SetBackdropColor(0,0,0) + panel:SetBackdropBorderColor(0,0,0) + + panel:SetFrameStrata("BACKGROUND") + panel:SetFrameLevel(0) + return panel +end + +local function CreateNameText(frame, unitName) + local db = MOD.db + if(MOD.db[unitName] and MOD.db[unitName].name) then + db = MOD.db[unitName].name + end + local name = frame:CreateFontString(nil, "OVERLAY") + name:SetFont(SuperVillain.Shared:Fetch("font", db.font), db.fontSize, db.fontOutline) + name:SetShadowOffset(2, -2) + name:SetShadowColor(0, 0, 0, 1) + if unitNmae == "target" then + name:SetPoint("RIGHT", frame) + else + name:SetPoint("CENTER", frame) + end + return name; +end + +function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) + if(unit and (unit == "target" or unit == "player")) then + frame.ActionPanel = CreateActionPanel(frame, 3) + frame.Threat = CreateThreat(frame.ActionPanel, unit) + + local info = CreateFrame("Frame", nil, frame) + info:SetFrameStrata("BACKGROUND") + info:SetFrameLevel(0) + info:Point("TOPLEFT", frame.ActionPanel, "BOTTOMLEFT", -1, 1) + info:Point("TOPRIGHT", frame.ActionPanel, "BOTTOMRIGHT", 1, 1) + info:SetHeight(30) + + local bg = info:CreateTexture(nil, "BACKGROUND") + bg:FillInner(info) + bg:SetTexture(1, 1, 1, 1) + bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.7) + + frame.InfoPanel = CreateFrame("Frame", nil, info) + frame.InfoPanel:SetFrameStrata("MEDIUM") + frame.InfoPanel:SetAllPoints(info) + + if(unit == "target") then + frame.ActionPanel:SetFrameLevel(1) + frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) + frame.ActionPanel.special:SetAllPoints(frame) + frame.ActionPanel.special:SetFrameStrata("BACKGROUND") + frame.ActionPanel.special:SetFrameLevel(0) + frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[1]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "TOPLEFT", 0, 0) + frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) + frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) + frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) + frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[1]:SetBlendMode("BLEND") + frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[2]:SetPoint("TOPLEFT", frame.ActionPanel.special, "BOTTOMLEFT", 0, 0) + frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) + frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) + frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) + frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[2]:SetBlendMode("BLEND") + frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[3]:SetPoint("TOPLEFT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) + frame.ActionPanel.special[3]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) + frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 2.25) + frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) + frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[3]:SetBlendMode("BLEND") + frame.ActionPanel.special:SetAlpha(0.7) + frame.ActionPanel.special:Hide() + else + frame.LossOfControl = CreateFrame("Frame", nil, frame.InfoPanel) + frame.LossOfControl:SetAllPoints(frame) + frame.LossOfControl:SetFrameStrata("DIALOG") + frame.LossOfControl:SetFrameLevel(99) + + local stunned = frame.LossOfControl:CreateTexture(nil, "OVERLAY", nil, 1) + stunned:SetPoint("CENTER", frame, "CENTER", 0, 0) + stunned:SetSize(96, 96) + stunned:SetTexture(STUNNED_ANIM) + stunned:SetBlendMode("ADD") + SuperVillain.Animate:Sprite(stunned, 0.12, false, true) + stunned:Hide() + frame.LossOfControl.stunned = stunned + + LossOfControlFrame:HookScript("OnShow", function() + if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then + _G["SVUI_Player"].LossOfControl:Show() + end + end) + LossOfControlFrame:HookScript("OnHide", function() + if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then + _G["SVUI_Player"].LossOfControl:Hide() + end + end) + end + else + frame.ActionPanel = CreateActionPanel(frame, 2) + frame.InfoPanel = CreateFrame("Frame", nil, frame) + frame.InfoPanel:SetFrameStrata("MEDIUM") + frame.InfoPanel:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", 2, -2) + frame.InfoPanel:Point("BOTTOMRIGHT", frame.ActionPanel, "BOTTOMRIGHT", -2, 2) + frame.InfoPanel:SetFrameLevel(frame.InfoPanel:GetFrameLevel() + 30) + end + + frame.InfoPanel.Name = CreateNameText(frame.InfoPanel, unit) + + local reverse = unit and (unit == "target" or unit == "focus" or unit == "boss" or unit == "arena") or false; + local offset, direction + + if(not noHealthText) then + frame.InfoPanel.Health = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Health:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + offset = reverse and 2 or -2; + direction = reverse and "LEFT" or "RIGHT"; + frame.InfoPanel.Health:Point(direction, frame.InfoPanel, direction, offset, 0) + end + + if(not noPowerText) then + frame.InfoPanel.Power = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Power:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + offset = reverse and -2 or 2; + direction = reverse and "RIGHT" or "LEFT"; + frame.InfoPanel.Power:Point(direction, frame.InfoPanel, direction, offset, 0) + end + + if(not noMiscText) then + frame.InfoPanel.Misc = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Misc:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + frame.InfoPanel.Misc:Point("CENTER", frame, "CENTER", 0, 0) + end + + frame.HealthPanel = CreateFrame("Frame", nil, frame) + frame.HealthPanel:SetAllPoints(frame) + + frame.StatusPanel = CreateFrame("Frame", nil, frame.HealthPanel) + frame.StatusPanel:EnableMouse(false) + + if(unit and (unit == "player" or unit == "pet" or unit == "target" or unit == "targettarget" or unit == "focus" or unit == "focustarget")) then + frame.StatusPanel:SetAllPoints(frame.HealthPanel) + frame.StatusPanel.media = { + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DC]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DEAD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-TAPPED]] + } + else + frame.StatusPanel:SetSize(50, 50) + frame.StatusPanel:SetPoint("CENTER", frame.HealthPanel, "CENTER", 0, 0) + frame.StatusPanel.media = { + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DC]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DEAD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-TAPPED]] + } + end + + frame.StatusPanel.texture = frame.StatusPanel:CreateTexture(nil, "OVERLAY") + frame.StatusPanel.texture:SetAllPoints() + frame.StatusPanel.texture:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + frame.StatusPanel.texture:SetBlendMode("ADD") + frame.StatusPanel.texture:SetGradient("VERTICAL",1,1,0,1,0,0) + frame.StatusPanel.texture:SetAlpha(0) + + frame.StatusPanel:SetFrameStrata("LOW") + frame.StatusPanel:SetFrameLevel(20) +end +--[[ +########################################################## +HEALTH +########################################################## +]]-- +local function updateFrequentUpdates(self) + local health = self.Health + if health.frequentUpdates and not self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then + if GetCVarBool("predictedHealth") ~= 1 then + SetCVar("predictedHealth", 1) + end + + self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path) + + if self:IsEventRegistered("UNIT_HEALTH") then + self:UnregisterEvent("UNIT_HEALTH", Path) + end + elseif not self:IsEventRegistered("UNIT_HEALTH") then + self:RegisterEvent('UNIT_HEALTH', Path) + + if self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then + self:UnregisterEvent("UNIT_HEALTH_FREQUENT", Path) + end + end +end + +local CustomUpdate = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + local health = self.Health + + local min, max = UnitHealth(unit), UnitHealthMax(unit) + local disconnected = not UnitIsConnected(unit) + local invisible = ((min == max) or UnitIsDeadOrGhost(unit) or disconnected); + local tapped = (UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))); + + if health.fillInverted then + health:SetReverseFill(true) + end + + health:SetMinMaxValues(-max, 0) + health:SetValue(-min) + + health.disconnected = disconnected + + if health.frequentUpdates ~= health.__frequentUpdates then + health.__frequentUpdates = health.frequentUpdates + updateFrequentUpdates(self) + end + + local bg = health.bg; + local mu = (min / max); + + if(invisible or not health.overlayAnimation) then + health.animation[1].anim:Stop() + health.animation[1]:SetAlpha(0) + end + + if(invisible) then + health:SetStatusBarColor(0.6,0.4,1,0.5) + health.animation[1]:SetVertexColor(0.8,0.3,1,0.4) + elseif(health.colorOverlay) then + local t = oUF_SuperVillain.colors.health + health:SetStatusBarColor(t[1], t[2], t[3], 0.9) + else + health:SetStatusBarColor(1, 0.25 * mu, 0, 0.85) + health.animation[1]:SetVertexColor(1, 0.1 * mu, 0, 0.5) + end + + if(bg) then + bg:SetVertexColor(0,0,0,0) + end + + if(health.overlayAnimation and not invisible) then + if(mu <= 0.25) then + health.animation[1]:SetAlpha(1) + health.animation[1].anim:Play() + else + health.animation[1].anim:Stop() + health.animation[1]:SetAlpha(0) + end + end + + if self.ResurrectIcon then + self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) + end + if self.isForced then + local current = random(1,max) + health:SetValue(-current) + end +end + +local Update = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + local health = self.Health + local min, max = UnitHealth(unit), UnitHealthMax(unit) + local disconnected = not UnitIsConnected(unit) + if health.fillInverted then + health:SetReverseFill(true) + end + health:SetMinMaxValues(0, max) + + if(disconnected) then + health:SetValue(max) + else + health:SetValue(min) + end + + health.disconnected = disconnected + + if health.frequentUpdates ~= health.__frequentUpdates then + health.__frequentUpdates = health.frequentUpdates + updateFrequentUpdates(self) + end + + local bg = health.bg; + local db = MOD.db or SuperVillain.db.SVUnit; + local r, g, b, t, t2; + + if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then + t = oUF_SuperVillain.colors.tapped + elseif(health.colorDisconnected and not UnitIsConnected(unit)) then + t = oUF_SuperVillain.colors.disconnected + elseif(health.colorClass and UnitIsPlayer(unit)) or + (health.colorClassNPC and not UnitIsPlayer(unit)) or + (health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then + local _, class = UnitClass(unit) + local tmp = oUF_SuperVillain.colors.class[class] or oUF_SuperVillain.colors.health + t = {(tmp[1] * 0.75),(tmp[2] * 0.75),(tmp[3] * 0.75)} + if(bg and db.classbackdrop and UnitIsPlayer(unit)) then + t2 = t + end + elseif(health.colorReaction and UnitReaction(unit, 'player')) then + t = oUF_SuperVillain.colors.reaction[UnitReaction(unit, "player")] + if(bg and db.classbackdrop and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then + t2 = t + end + elseif(health.colorSmooth) then + r, g, b = oUF_SuperVillain.ColorGradient(min, max, unpack(health.smoothGradient or oUF_SuperVillain.colors.smooth)) + elseif(health.colorHealth) then + t = oUF_SuperVillain.colors.health + end + + if(t) then + r, g, b = t[1], t[2], t[3] + end + + if(b) then + if(db.healthclass == true and db.colorhealthbyvalue == true or db.colorhealthbyvalue and self.isForced and not(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then + r, g, b = oUF_SuperVillain.ColorGradient(min,max,1,0,0,1,1,0,r,g,b) + end + health:SetStatusBarColor(r, g, b) + if(bg) then + local mu = bg.multiplier or 1 + if(t2) then + r, g, b = t2[1], t2[2], t2[3] + end + bg:SetVertexColor(r * mu, g * mu, b * mu) + end + end + + if self.ResurrectIcon then + self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) + end + if self.isForced then + min = random(1,max) + health:SetValue(min) + end + if(db.gridMode) then + health:SetOrientation("VERTICAL") + end +end + +function MOD:CreateHealthBar(frame, hasbg, reverse) + local healthBar = CreateFrame("StatusBar", nil, frame) + healthBar:SetFrameStrata("LOW") + healthBar:SetFrameLevel(4) + healthBar:SetStatusBarTexture(SuperVillain.Media.bar.default) + if hasbg then + healthBar.bg = healthBar:CreateTexture(nil, "BORDER") + healthBar.bg:SetAllPoints() + healthBar.bg:SetTexture(SuperVillain.Media.bar.gradient) + healthBar.bg:SetVertexColor(0.4, 0.1, 0.1) + healthBar.bg.multiplier = 0.25 + end + + local flasher = CreateFrame("Frame", nil, frame) + flasher:SetFrameLevel(3) + flasher:SetAllPoints(healthBar) + + flasher[1] = flasher:CreateTexture(nil, "OVERLAY", nil, 1) + flasher[1]:SetTexture(HEALTH_ANIM_FILE) + flasher[1]:SetTexCoord(0, 0.5, 0, 0.25) + flasher[1]:SetVertexColor(1, 0.3, 0.1, 0.5) + flasher[1]:SetBlendMode("ADD") + flasher[1]:SetAllPoints(flasher) + SetAnim(flasher[1], flasher) + flasher:Hide() + + healthBar.animation = flasher + healthBar.noupdate = false; + healthBar.fillInverted = reverse; + healthBar.colorTapping = true; + healthBar.colorDisconnected = true + healthBar.Override = Update; + return healthBar +end + +function MOD:RefreshHealthBar(frame, overlay) + if(overlay) then + frame.Health.Override = CustomUpdate; + else + frame.Health.Override = Update; + end +end +--[[ +########################################################## +POWER +########################################################## +]]-- +local PostUpdateAltPower = function(self, min, current, max) + local remaining = floor(current / max * 100) + local parent = self:GetParent() + if remaining < 35 then + self:SetStatusBarColor(0, 1, 0) + elseif remaining < 70 then + self:SetStatusBarColor(1, 1, 0) + else + self:SetStatusBarColor(1, 0, 0) + end + local unit = parent.unit; + if(unit == "player" and self.text) then + local apInfo = select(10, UnitAlternatePowerInfo(unit)) + if remaining > 0 then + self.text:SetText(apInfo..": "..format("%d%%", remaining)) + else + self.text:SetText(apInfo..": 0%") + end + elseif(unit and unit:find("boss%d") and self.text) then + self.text:SetTextColor(self:GetStatusBarColor()) + if not parent.InfoPanel.Power:GetText() or parent.InfoPanel.Power:GetText() == "" then + self.text:Point("BOTTOMRIGHT", parent.Health, "BOTTOMRIGHT") + else + self.text:Point("RIGHT", parent.InfoPanel.Power, "LEFT", 2, 0) + end + if remaining > 0 then + self.text:SetText("|cffD7BEA5[|r"..format("%d%%", remaining).."|cffD7BEA5]|r") + else + self.text:SetText(nil) + end + end +end + +function MOD:CreatePowerBar(frame, bg) + local power = CreateFrame("StatusBar", nil, frame) + power:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + power:SetPanelTemplate("Bar") + if bg then + power.bg = power:CreateTexture(nil, "BORDER") + power.bg:SetAllPoints() + power.bg:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + power.bg.multiplier = 0.2 + end + power.colorDisconnected = false; + power.colorTapping = false; + power.PostUpdate = MOD.PostUpdatePower; + return power +end + +function MOD:CreateAltPowerBar(frame) + local altPower = CreateFrame("StatusBar", nil, frame) + altPower:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + altPower:SetPanelTemplate("Bar") + altPower:GetStatusBarTexture():SetHorizTile(false) + altPower:SetFrameStrata("MEDIUM") + altPower.text = altPower:CreateFontString(nil, "OVERLAY") + altPower.text:SetPoint("CENTER") + altPower.text:SetJustifyH("CENTER") + altPower.text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + altPower.PostUpdate = PostUpdateAltPower; + return altPower +end + +local function PowerUpdateNamePosition(frame, unit) + local panel = frame.InfoPanel + if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end + local db = MOD.db[unit] + local parent = panel.Name:GetParent() + if UnitIsPlayer(unit)then + local point = db.name.position; + panel.Power:SetAlpha(1) + panel.Name:ClearAllPoints() + SuperVillain:ReversePoint(panel.Name, point, parent, db.name.xOffset, db.name.yOffset) + else + panel.Power:SetAlpha(db.power.hideonnpc and 0 or 1) + panel.Name:ClearAllPoints() + panel.Name:SetPoint(panel.Power:GetPoint()) + end +end + +function MOD:PostUpdatePower(unit, value, max) + local db = MOD.db[unit] + local powerType, _, _, _, _ = UnitPowerType(unit) + local parent = self:GetParent() + if parent.isForced then + value = random(1, max) + powerType = random(0, 4) + self:SetValue(value) + end + local colors = oUF_SuperVillain.colors.power[token[powerType]] + local mult = self.bg.multiplier or 1; + local isPlayer = UnitPlayerControlled(unit) + if isPlayer and self.colorClass then + local _, class = UnitClassBase(unit); + colors = oUF_SuperVillain["colors"].class[class] + elseif not isPlayer then + local react = UnitReaction("player", unit) + colors = oUF_SuperVillain["colors"].reaction[react] + end + if not colors then return end + self:SetStatusBarColor(colors[1], colors[2], colors[3]) + self.bg:SetVertexColor(colors[1] * mult, colors[2] * mult, colors[3] * mult) + if db and db.power and db.power.hideonnpc then + PowerUpdateNamePosition(parent, unit) + end +end +--[[ +########################################################## +PORTRAIT +########################################################## +]]-- +local Update2DPortrait = function(self, event, unit) + if(not unit or not UnitIsUnit(self.unit, unit)) then return end + local portrait = self.Portrait + SetPortraitTexture(portrait, unit) +end + +local Update3DPortrait = function(self, event, unit) + if(not unit or not UnitIsUnit(self.unit, unit)) then return end + local portrait = self.Portrait + if(not portrait:IsObjectType'Model') then return; end + local guid = UnitGUID(unit) + local camera = portrait.UserCamDistance or 1 + local rotate = portrait.UserRotation + if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then + portrait:SetCamDistanceScale(1) + portrait:SetPortraitZoom(0) + portrait:SetPosition(4,-1,1) + portrait:ClearModel() + portrait:SetModel(MISSING_MODEL_FILE) + portrait.guid = nil + portrait:SetBackdropColor(0.25,0.25,0.25) + if portrait.UpdateColor then + portrait:UpdateColor(0.25,0.25,0.25) + end + elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then + portrait:SetCamDistanceScale(camera) + portrait:SetPortraitZoom(1) + portrait:SetPosition(0,0,0) + portrait:ClearModel() + portrait:SetUnit(unit) + portrait.guid = guid + + if(rotate and portrait:GetFacing() ~= rotate / 60) then + portrait:SetFacing(rotate / 60) + end + + local r, g, b, color = 0.25, 0.25, 0.25 + if not UnitIsPlayer(unit)then + color = oUF_SuperVillain.colors.reaction[UnitReaction(unit,"player")] + if(color ~= nil) then + r,g,b = color[1], color[2], color[3] + end; + else + local _,unitClass = UnitClass(unit) + if unitClass then + color = oUF_SuperVillain.colors.class[unitClass] + r,g,b = color[1], color[2], color[3] + end + end + portrait:SetBackdropColor(r,g,b) + if portrait.UpdateColor then + portrait:UpdateColor(r,g,b) + end + end +end + +function MOD:CreatePortrait(frame,smallUnit,isPlayer) + -- 3D Portrait + local portrait3D = CreateFrame("PlayerModel",nil,frame) + portrait3D:SetFrameStrata("LOW") + portrait3D:SetFrameLevel(2) + + if smallUnit then + portrait3D:SetPanelTemplate("UnitSmall") + else + portrait3D:SetPanelTemplate("UnitLarge") + end; + + local overlay = CreateFrame("Frame",nil,portrait3D) + overlay:SetAllPoints(portrait3D.Panel) + overlay:SetFrameLevel(3) + portrait3D.overlay = overlay; + portrait3D.UserRotation = 0; + portrait3D.UserCamDistance = 1.3; + + -- 2D Portrait + local portrait2Danchor = CreateFrame('Frame',nil,frame) + portrait2Danchor:SetFrameStrata("LOW") + portrait2Danchor:SetFrameLevel(2) + + local portrait2D = portrait2Danchor:CreateTexture(nil,'OVERLAY') + portrait2D:SetTexCoord(0.15,0.85,0.15,0.85) + portrait2D:SetAllPoints(portrait2Danchor) + portrait2D.anchor = portrait2Danchor; + if smallUnit then + portrait2Danchor:SetFixedPanelTemplate("UnitSmall") + else + portrait2Danchor:SetFixedPanelTemplate("UnitLarge") + end; + portrait2D.Panel = portrait2Danchor.Panel; + + local overlay = CreateFrame("Frame",nil,portrait2Danchor) + overlay:SetAllPoints(portrait2D.Panel) + overlay:SetFrameLevel(3) + portrait2D.overlay = overlay; + + -- Set Updates + portrait2D.Override = Update2DPortrait + portrait3D.Override = Update3DPortrait + + -- Assign To Frame + frame.PortraitModel = portrait3D; + frame.PortraitTexture = portrait2D; +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/glow.lua b/Interface/AddOns/SVUI/packages/unit/common/glow.lua deleted file mode 100644 index 4a8da84..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/glow.lua +++ /dev/null @@ -1,136 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local find, gsub, split, format, min, abs, tremove, tinsert, twipe = string.find, string.gsub, string.split, string.format, math.min, math.abs, table.remove, table.insert, table.wipe; -local GetNumGroupMembers, GetNumSubgroupMembers = GetNumGroupMembers, GetNumSubgroupMembers -local IsInRaid, IsInGroup, GetTime = IsInRaid, IsInGroup, GetTime; -local playerId, healGlowFrame, healGlowTime; -local spells, groupUnits, frameBuffers, frameGroups = {}, {}, {}, {5, 10, 25, 40}; -local glowingSpells = {102792, 130654, 124040, 115464, 116670, 114852, 114871, 82327, 85222, 121148, 34861, 64844, 110745, 122128, 120692, 120696, 23455, 596, 1064}; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local ShowHealGlows = function(self, elapsed) - self.elapsed = (self.elapsed or 0) + elapsed; - if(self.elapsed < .1) then return end; - self.elapsed = 0; - local current = GetTime(); - local expireTime = 0; - for _, u in pairs(groupUnits)do - expireTime = u[2] + healGlowTime; - for _, group in ipairs(frameGroups)do - for _, frame in pairs(frameBuffers[group])do - if(frame.unit == u[1]) then - frame.HealGlow:SetShown(current < expireTime) - end - end - end - end -end; - -function MOD:InitHealGlow() - playerId = UnitGUID("player") - for _, spellID in ipairs(glowingSpells) do - local name, rank, icon, _, _, _, _, _, _ = GetSpellInfo(spellID) - if name then - spells[name] = {spellID, icon} - end - end - twipe(frameBuffers) - for _, mark in ipairs(frameGroups) do - frameBuffers[mark] = {} - local x = mark / 5 - for i = 1, x do - for k = 1, 5 do - frame = mark == 5 and _G[("SVUI_PartyGroup%dUnitButton%i"):format(i, k)] or _G[("SVUI_Raid%dGroup%dUnitButton%i"):format(mark, i, k)] - if frame then - frame.HealGlow = MOD:CreateHealGlow(frame, ((mark == 5 and "party%d" or "raid%d")):format(i)) - tinsert(frameBuffers[mark], frame) - end - end - end - end - healGlowFrame = CreateFrame("Frame") - healGlowFrame:SetScript("OnEvent", function(self, event, ...) - if event == "COMBAT_LOG_EVENT_UNFILTERED"then - local _, subevent, _, source, _, _, _, dest, _, _, _, _, name = select(1, ...) - if not(source == playerId and subevent == "SPELL_HEAL" and spells[name]) then return end; - if groupUnits[dest] then - groupUnits[dest][2] = GetTime() - end - end - end) - MOD:UpdateGlowSettings() -end; - -function MOD:UpdateGlowSettings() - local color = self.db.glowcolor; - for _, group in ipairs(frameGroups)do - for _, frame in ipairs(frameBuffers[group])do - frame.HealGlow:SetBackdropBorderColor(color[1], color[2], color[3]) - end - end; - healGlowTime = self.db.glowtime; - if self.db.healglow then - healGlowFrame:SetScript("OnUpdate", ShowHealGlows) - healGlowFrame:RegisterUnitEvent("COMBAT_LOG_EVENT_UNFILTERED", playerId) - else - healGlowFrame:SetScript("OnUpdate", nil) - healGlowFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") - end -end; - -function MOD:UpdateGlowRoster() - twipe(groupUnits) - local count = IsInRaid() and GetNumGroupMembers() or IsInGroup() and GetNumSubgroupMembers() or 0; - local str = IsInRaid() and "raid%d" or IsInGroup() and "party%d" or "solo"; - local result; - for i = 1, count do - result = (str):format(i) - if not UnitIsUnit(result, "player") then - groupUnits[UnitGUID(result)] = {result, 0} - end - end; - if str == "solo" then - groupUnits[UnitGUID("player")] = {"player", 0} - end -end; - -function MOD:CreateHealGlow(frame) - local shadow = CreateFrame("Frame", nil, frame) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(frame:GetFrameStrata()) - shadow:WrapOuter(frame, 3, 3) - shadow:SetBackdrop({edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], edgeSize = 3}); - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - return shadow -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/health.lua b/Interface/AddOns/SVUI/packages/unit/common/health.lua deleted file mode 100644 index d60ee72..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/health.lua +++ /dev/null @@ -1,343 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local assert = _G.assert; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local HEALTH_ANIM_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-HEALTH-ANIMATION]]; - -local Anim_OnUpdate = function(self) - local parent = self.parent - local coord = self._coords; - parent:SetTexCoord(coord[1],coord[2],coord[3],coord[4]) -end - -local Anim_OnPlay = function(self) - local parent = self.parent - parent:SetAlpha(1) - if not parent:IsShown() then - parent:Show() - end -end - -local Anim_OnStop = function(self) - local parent = self.parent - parent:SetAlpha(0) - if parent:IsShown() then - parent:Hide() - end -end - -local function SetNewAnimation(frame, animType, parent) - local anim = frame:CreateAnimation(animType, subType) - anim.parent = parent - return anim -end - -local function SetAnim(frame, parent) - local speed = 0.08 - frame.anim = frame:CreateAnimationGroup("Sprite") - frame.anim.parent = parent; - frame.anim:SetScript("OnPlay", Anim_OnPlay) - frame.anim:SetScript("OnFinished", Anim_OnStop) - frame.anim:SetScript("OnStop", Anim_OnStop) - - frame.anim[1] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetDuration(speed) - frame.anim[1]._coords = {0,0.5,0,0.25} - frame.anim[1]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetDuration(speed) - frame.anim[2]._coords = {0.5,1,0,0.25} - frame.anim[2]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[3] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[3]:SetOrder(3) - frame.anim[3]:SetDuration(speed) - frame.anim[3]._coords = {0,0.5,0.25,0.5} - frame.anim[3]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[4] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[4]:SetOrder(4) - frame.anim[4]:SetDuration(speed) - frame.anim[4]._coords = {0.5,1,0.25,0.5} - frame.anim[4]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[5] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[5]:SetOrder(5) - frame.anim[5]:SetDuration(speed) - frame.anim[5]._coords = {0,0.5,0.5,0.75} - frame.anim[5]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[6] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[6]:SetOrder(6) - frame.anim[6]:SetDuration(speed) - frame.anim[6]._coords = {0.5,1,0.5,0.75} - frame.anim[6]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[7] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[7]:SetOrder(7) - frame.anim[7]:SetDuration(speed) - frame.anim[7]._coords = {0,0.5,0.75,1} - frame.anim[7]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[8] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[8]:SetOrder(8) - frame.anim[8]:SetDuration(speed) - frame.anim[8]._coords = {0.5,1,0.75,1} - frame.anim[8]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim:SetLooping("REPEAT") -end - -local function updateFrequentUpdates(self) - local health = self.Health - if health.frequentUpdates and not self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then - if GetCVarBool("predictedHealth") ~= 1 then - SetCVar("predictedHealth", 1) - end - - self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path) - - if self:IsEventRegistered("UNIT_HEALTH") then - self:UnregisterEvent("UNIT_HEALTH", Path) - end - elseif not self:IsEventRegistered("UNIT_HEALTH") then - self:RegisterEvent('UNIT_HEALTH', Path) - - if self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then - self:UnregisterEvent("UNIT_HEALTH_FREQUENT", Path) - end - end -end - -local CustomUpdate = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - local health = self.Health - - local min, max = UnitHealth(unit), UnitHealthMax(unit) - local disconnected = not UnitIsConnected(unit) - local invisible = ((min == max) or UnitIsDeadOrGhost(unit) or disconnected); - local tapped = (UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))); - - if health.fillInverted then - health:SetReverseFill(true) - end - - health:SetMinMaxValues(-max, 0) - health:SetValue(-min) - - health.disconnected = disconnected - - if health.frequentUpdates ~= health.__frequentUpdates then - health.__frequentUpdates = health.frequentUpdates - updateFrequentUpdates(self) - end - - local bg = health.bg; - local mu = (min / max); - - if(invisible or not health.overlayAnimation) then - health.animation[1].anim:Stop() - health.animation[1]:SetAlpha(0) - end - - if(invisible) then - health:SetStatusBarColor(0.6,0.4,1,0.5) - health.animation[1]:SetVertexColor(0.8,0.3,1,0.4) - elseif(health.colorOverlay) then - local t = oUF_SuperVillain.colors.health - health:SetStatusBarColor(t[1], t[2], t[3], 0.9) - else - health:SetStatusBarColor(1, 0.25 * mu, 0, 0.85) - health.animation[1]:SetVertexColor(1, 0.1 * mu, 0, 0.5) - end - - if(bg) then - bg:SetVertexColor(0,0,0,0) - end - - if(health.overlayAnimation and not invisible) then - if(mu <= 0.25) then - health.animation[1]:SetAlpha(1) - health.animation[1].anim:Play() - else - health.animation[1].anim:Stop() - health.animation[1]:SetAlpha(0) - end - end - - if self.ResurrectIcon then - self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) - end - if self.isForced then - local current = random(1,max) - health:SetValue(-current) - end -end - -local Update = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - local health = self.Health - local min, max = UnitHealth(unit), UnitHealthMax(unit) - local disconnected = not UnitIsConnected(unit) - if health.fillInverted then - health:SetReverseFill(true) - end - health:SetMinMaxValues(0, max) - - if(disconnected) then - health:SetValue(max) - else - health:SetValue(min) - end - - health.disconnected = disconnected - - if health.frequentUpdates ~= health.__frequentUpdates then - health.__frequentUpdates = health.frequentUpdates - updateFrequentUpdates(self) - end - - local bg = health.bg; - local db = MOD.db or SuperVillain.db.SVUnit; - local r, g, b, t, t2; - - if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then - t = oUF_SuperVillain.colors.tapped - elseif(health.colorDisconnected and not UnitIsConnected(unit)) then - t = oUF_SuperVillain.colors.disconnected - elseif(health.colorClass and UnitIsPlayer(unit)) or - (health.colorClassNPC and not UnitIsPlayer(unit)) or - (health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - local tmp = oUF_SuperVillain.colors.class[class] or oUF_SuperVillain.colors.health - t = {(tmp[1] * 0.75),(tmp[2] * 0.75),(tmp[3] * 0.75)} - if(bg and db.classbackdrop and UnitIsPlayer(unit)) then - t2 = t - end - elseif(health.colorReaction and UnitReaction(unit, 'player')) then - t = oUF_SuperVillain.colors.reaction[UnitReaction(unit, "player")] - if(bg and db.classbackdrop and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then - t2 = t - end - elseif(health.colorSmooth) then - r, g, b = oUF_SuperVillain.ColorGradient(min, max, unpack(health.smoothGradient or oUF_SuperVillain.colors.smooth)) - elseif(health.colorHealth) then - t = oUF_SuperVillain.colors.health - end - - if(t) then - r, g, b = t[1], t[2], t[3] - end - - if(b) then - if(db.healthclass == true and db.colorhealthbyvalue == true or db.colorhealthbyvalue and self.isForced and not(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then - r, g, b = oUF_SuperVillain.ColorGradient(min,max,1,0,0,1,1,0,r,g,b) - end - health:SetStatusBarColor(r, g, b) - if(bg) then - local mu = bg.multiplier or 1 - if(t2) then - r, g, b = t2[1], t2[2], t2[3] - end - bg:SetVertexColor(r * mu, g * mu, b * mu) - end - end - - if self.ResurrectIcon then - self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) - end - if self.isForced then - min = random(1,max) - health:SetValue(min) - end - if(db.gridMode) then - health:SetOrientation("VERTICAL") - end -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:CreateHealthBar(frame, hasbg, reverse) - local healthBar = CreateFrame("StatusBar", nil, frame) - healthBar:SetFrameStrata("LOW") - healthBar:SetFrameLevel(4) - healthBar:SetStatusBarTexture(SuperVillain.Media.bar.default) - if hasbg then - healthBar.bg = healthBar:CreateTexture(nil, "BORDER") - healthBar.bg:SetAllPoints() - healthBar.bg:SetTexture(SuperVillain.Media.bar.gradient) - healthBar.bg:SetVertexColor(0.4, 0.1, 0.1) - healthBar.bg.multiplier = 0.25 - end - - local flasher = CreateFrame("Frame", nil, frame) - flasher:SetFrameLevel(3) - flasher:SetAllPoints(healthBar) - - flasher[1] = flasher:CreateTexture(nil, "OVERLAY", nil, 1) - flasher[1]:SetTexture(HEALTH_ANIM_FILE) - flasher[1]:SetTexCoord(0, 0.5, 0, 0.25) - flasher[1]:SetVertexColor(1, 0.3, 0.1, 0.5) - flasher[1]:SetBlendMode("ADD") - flasher[1]:SetAllPoints(flasher) - SetAnim(flasher[1], flasher) - flasher:Hide() - - healthBar.animation = flasher - healthBar.noupdate = false; - healthBar.fillInverted = reverse; - healthBar.colorTapping = true; - healthBar.colorDisconnected = true - healthBar.Override = Update; - return healthBar -end - -function MOD:RefreshHealthBar(frame, overlay) - if(overlay) then - frame.Health.Override = CustomUpdate; - else - frame.Health.Override = Update; - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/misc.lua b/Interface/AddOns/SVUI/packages/unit/common/misc.lua index 4daa09b..9fe7385 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/misc.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/misc.lua @@ -26,13 +26,13 @@ assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); LOCAL VARIABLES ########################################################## ]]-- +local STATE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-PLAYER-STATE]] local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]] local AURA_FONTSIZE = 10 local AURA_OUTLINE = "OUTLINE" local LML_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-LML]] local ROLE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-ROLES]] local BUDDY_ICON = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-FRIENDSHIP]] - local ROLE_ICON_DATA = { ["TANK"] = {0,0.5,0,0.5, 0.5,0.75,0.5,0.75}, ["HEALER"] = {0,0.5,0.5,1, 0.5,0.75,0.75,1}, @@ -263,4 +263,387 @@ function MOD:RaidRoleUpdate() looterIcon:Point("RIGHT", frame, "RIGHT") end end -end \ No newline at end of file +end +--[[ +########################################################## +PLAYER ONLY COMPONENTS +########################################################## +]]-- +function MOD:CreateRestingIndicator(frame) + local resting = CreateFrame("Frame",nil,frame) + resting:SetFrameStrata("MEDIUM") + resting:SetFrameLevel(20) + resting:Size(26,26) + resting:Point("TOPRIGHT",frame,3,3) + resting.bg = resting:CreateTexture(nil,"OVERLAY",nil,1) + resting.bg:SetAllPoints(resting) + resting.bg:SetTexture(STATE_ICON_FILE) + resting.bg:SetTexCoord(0.5,1,0,0.5) + return resting +end + +function MOD:CreateCombatIndicator(frame) + local combat = CreateFrame("Frame",nil,frame) + combat:SetFrameStrata("MEDIUM") + combat:SetFrameLevel(30) + combat:Size(26,26) + combat:Point("TOPRIGHT",frame,3,3) + combat.bg = combat:CreateTexture(nil,"OVERLAY",nil,5) + combat.bg:SetAllPoints(combat) + combat.bg:SetTexture(STATE_ICON_FILE) + combat.bg:SetTexCoord(0,0.5,0,0.5) + SuperVillain.Animate:Pulse(combat) + combat:SetScript("OnShow", function(this) + if not this.anim:IsPlaying() then this.anim:Play() end + end) + + combat:Hide() + return combat +end + +local ExRep_OnEnter = function(self)if self:IsShown() then UIFrameFadeIn(self,.1,0,1) end end +local ExRep_OnLeave = function(self)if self:IsShown() then UIFrameFadeOut(self,.2,1,0) end end + +function MOD:CreateExperienceRepBar(frame) + local db = MOD.db.player; + + if db.playerExpBar then + local xp = CreateFrame("StatusBar", "PlayerFrameExperienceBar", frame.Power) + xp:FillInner(frame.Power, 0, 0) + xp:SetPanelTemplate() + xp:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + xp:SetStatusBarColor(0, 0.1, 0.6) + --xp:SetBackdropColor(1, 1, 1, 0.8) + xp:SetFrameLevel(xp:GetFrameLevel() + 2) + xp.Tooltip = true; + xp.Rested = CreateFrame("StatusBar", nil, xp) + xp.Rested:SetAllPoints(xp) + xp.Rested:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + xp.Rested:SetStatusBarColor(1, 0, 1, 0.6) + xp.Value = xp:CreateFontString(nil, "TOOLTIP") + xp.Value:SetAllPoints(xp) + xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + xp.Value:SetTextColor(0.2, 0.75, 1) + xp.Value:SetShadowColor(0, 0, 0, 0) + xp.Value:SetShadowOffset(0, 0) + frame:Tag(xp.Value, "[curxp] / [maxxp]") + xp.Rested:SetBackdrop({bgFile = [[Interface\BUTTONS\WHITE8X8]]}) + xp.Rested:SetBackdropColor(unpack(SuperVillain.Media.color.default)) + xp:SetScript("OnEnter", ExRep_OnEnter) + xp:SetScript("OnLeave", ExRep_OnLeave) + xp:SetAlpha(0) + frame.Experience = xp + end + + if db.playerRepBar then + local rep = CreateFrame("StatusBar", "PlayerFrameReputationBar", frame.Power) + rep:FillInner(frame.Power, 0, 0) + rep:SetPanelTemplate() + rep:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + rep:SetStatusBarColor(0, 0.6, 0) + --rep:SetBackdropColor(1, 1, 1, 0.8) + rep:SetFrameLevel(rep:GetFrameLevel() + 2) + rep.Tooltip = true; + rep.Value = rep:CreateFontString(nil, "TOOLTIP") + rep.Value:SetAllPoints(rep) + rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + rep.Value:SetTextColor(0.1, 1, 0.2) + rep.Value:SetShadowColor(0, 0, 0, 0) + rep.Value:SetShadowOffset(0, 0) + frame:Tag(rep.Value, "[standing]: [currep] / [maxrep]") + rep:SetScript("OnEnter", ExRep_OnEnter) + rep:SetScript("OnLeave", ExRep_OnLeave) + rep:SetAlpha(0) + frame.Reputation = rep + end +end +--[[ +########################################################## +TARGET ONLY COMPONENTS +########################################################## +]]-- +local function GPS_OnEnter(self) + self:SetAlpha(1) + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0.5, 0) + GameTooltip:ClearLines() + GameTooltip:AddLine("Can not track this unit", 1, 1, 1) + else + self.Icon:SetVertexColor(0.1, 1, 0.5) + GameTooltip:ClearLines() + GameTooltip:AddLine("Start tracking your target", 1, 1, 1) + end + GameTooltip:Show() +end + +local function GPS_OnLeave(self) + self:SetAlpha(0.25) + self.Icon:SetVertexColor(0.1, 0.1, 0.1) + GameTooltip:Hide() +end + +local function GPS_OnMouseDown(self) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0, 0) + end +end + +local function GPS_OnMouseUp(self) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0.5, 0) + else + self.Icon:SetVertexColor(0.1, 1, 0.5) + self:GetParent().Tracker:Show() + end +end + +function MOD:CreateGPS(frame) + if not frame then return end + + local gps = CreateFrame("Frame", nil, frame) + gps:Size(50, 50) + gps:Point("BOTTOMLEFT", frame, "BOTTOMRIGHT", 6, 0) + gps:EnableMouse(false) + + local tracker = CreateFrame("Frame", nil, gps) + tracker:SetAllPoints(gps) + tracker:SetFrameLevel(gps:GetFrameLevel() + 2) + + local border = tracker:CreateTexture(nil, "BORDER") + border:SetAllPoints(tracker) + border:SetTexture([[Interface\Addons\SVUI\assets\artwork\Doodads\GPS-BORDER]]) + border:SetGradient(unpack(SuperVillain.Media.gradient.dark)) + + tracker.Arrow = tracker:CreateTexture(nil, "OVERLAY", nil, -2) + tracker.Arrow:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ARROW]]) + tracker.Arrow:Size(50, 50) + tracker.Arrow:SetPoint("CENTER", tracker, "CENTER", 0, 0) + tracker.Arrow:SetVertexColor(0.1, 0.8, 0.8) + + tracker.Text = tracker:CreateFontString(nil, "OVERLAY") + tracker.Text:SetAllPoints(tracker) + tracker.Text:SetFont(SuperVillain.Media.font.roboto, 14, "OUTLINE") + tracker.Text:SetTextColor(1, 1, 1, 0.75) + + tracker.Spinner = tracker:CreateTexture(nil, "ARTWORK", nil, 2) + tracker.Spinner:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ANIMATION]]) + tracker.Spinner:Size(50, 50) + tracker.Spinner:SetPoint("CENTER", tracker, "CENTER", 0, 0) + + SuperVillain.Animate:Orbit(tracker.Spinner, 8, true) + + local switch = CreateFrame("Frame", nil, gps) + switch:SetAllPoints(gps) + switch:EnableMouse(true) + + switch.Icon = switch:CreateTexture(nil, "BACKGROUND") + switch.Icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-OPEN]]) + switch.Icon:Size(32, 32) + switch.Icon:SetPoint("BOTTOMLEFT", switch, "BOTTOMLEFT", 0, 0) + switch.Icon:SetVertexColor(0.1, 0.1, 0.1) + + switch.Trackable = false; + + switch:SetScript("OnEnter", GPS_OnEnter) + switch:SetScript("OnLeave", GPS_OnLeave) + switch:SetScript("OnMouseDown", GPS_OnMouseDown) + switch:SetScript("OnMouseUp", GPS_OnMouseUp) + + switch:SetAlpha(0.25) + + gps.Tracker = tracker + gps.Switch = switch + + gps.Tracker:Hide() + gps:Hide() + + return gps +end + +function MOD:CreateXRay(frame) + local xray=CreateFrame("BUTTON","XRayFocus",frame,"SecureActionButtonTemplate") + xray:EnableMouse(true) + xray:RegisterForClicks("AnyUp") + xray:SetAttribute("type","macro") + xray:SetAttribute("macrotext","/focus") + xray:Size(64,64) + xray:SetFrameStrata("DIALOG") + xray.icon=xray:CreateTexture(nil,"ARTWORK") + xray.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY") + xray.icon:SetAllPoints(xray) + xray.icon:SetAlpha(0) + xray:SetScript("OnLeave",function()GameTooltip:Hide()xray.icon:SetAlpha(0)end) + xray:SetScript("OnEnter",function(self) + xray.icon:SetAlpha(1) + local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() + local t,u,v="RIGHT","TOP","BOTTOM" + if (b < (r / 2)) then t="LEFT" end + if (m < (s / 2)) then u,v=v,u end + GameTooltip:SetOwner(self,"ANCHOR_NONE") + GameTooltip:SetPoint(u..t,self,v..t) + GameTooltip:SetText(FOCUSTARGET.."\n") + end) + return xray +end + +function MOD:CreateXRay_Closer(frame) + local close=CreateFrame("BUTTON","ClearXRay",frame,"SecureActionButtonTemplate") + close:EnableMouse(true) + close:RegisterForClicks("AnyUp") + close:SetAttribute("type","macro") + close:SetAttribute("macrotext","/clearfocus") + close:Size(64,64) + close:SetFrameStrata("DIALOG") + close.icon=close:CreateTexture(nil,"ARTWORK") + close.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY-CLOSE") + close.icon:SetAllPoints(close) + close.icon:SetVertexColor(1,0.2,0.1) + close:SetScript("OnLeave",function()GameTooltip:Hide()close.icon:SetVertexColor(1,0.2,0.1)end) + close:SetScript("OnEnter",function(self) + close.icon:SetVertexColor(1,1,0.2) + local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() + local t,u,v="RIGHT","TOP","BOTTOM" + if b<r/2 then t="LEFT"end + if m<s/2 then u,v=v,u end + GameTooltip:SetOwner(self,"ANCHOR_NONE") + GameTooltip:SetPoint(u..t,self,v..t) + GameTooltip:SetText(CLEAR_FOCUS.."\n") + end) + return close +end +--[[ +########################################################## +HEAL PREDICTION +########################################################## +]]-- +local OverrideUpdate = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + + local hp = self.HealPrediction + hp.parent = self + local hbar = self.Health; + local anchor, relative, relative2 = 'TOPLEFT', 'BOTTOMRIGHT', 'BOTTOMLEFT'; + local reversed = true + hp.reversed = hbar.fillInverted or false + if(hp.reversed == true) then + anchor, relative, relative2 = 'TOPRIGHT', 'BOTTOMLEFT', 'BOTTOMRIGHT'; + reversed = false + end + + local myIncomingHeal = UnitGetIncomingHeals(unit, 'player') or 0 + local allIncomingHeal = UnitGetIncomingHeals(unit) or 0 + local totalAbsorb = UnitGetTotalAbsorbs(unit) or 0 + local myCurrentHealAbsorb = UnitGetTotalHealAbsorbs(unit) or 0 + local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit) + + local overHealAbsorb = false + if(health < myCurrentHealAbsorb) then + overHealAbsorb = true + myCurrentHealAbsorb = health + end + + if(health - myCurrentHealAbsorb + allIncomingHeal > maxHealth * hp.maxOverflow) then + allIncomingHeal = maxHealth * hp.maxOverflow - health + myCurrentHealAbsorb + end + + local otherIncomingHeal = 0 + if(allIncomingHeal < myIncomingHeal) then + myIncomingHeal = allIncomingHeal + else + otherIncomingHeal = allIncomingHeal - myIncomingHeal + end + + local overAbsorb = false + if(health - myCurrentHealAbsorb + allIncomingHeal + totalAbsorb >= maxHealth or health + totalAbsorb >= maxHealth) then + if(totalAbsorb > 0) then + overAbsorb = true + end + + if(allIncomingHeal > myCurrentHealAbsorb) then + totalAbsorb = max(0, maxHealth - (health - myCurrentHealAbsorb + allIncomingHeal)) + else + totalAbsorb = max(0, maxHealth - health) + end + end + + if(myCurrentHealAbsorb > allIncomingHeal) then + myCurrentHealAbsorb = myCurrentHealAbsorb - allIncomingHeal + else + myCurrentHealAbsorb = 0 + end + + local barMin, barMax, barMod = 0, maxHealth, 1; + + local previous = hbar:GetStatusBarTexture() + if(hp.myBar) then + hp.myBar:SetMinMaxValues(barMin, barMax) + if(not hp.otherBar) then + hp.myBar:SetValue(allIncomingHeal) + else + hp.myBar:SetValue(myIncomingHeal) + end + hp.myBar:SetPoint(anchor, hbar, anchor, 0, 0) + hp.myBar:SetPoint(relative, previous, relative, 0, 0) + hp.myBar:SetReverseFill(reversed) + previous = hp.myBar + hp.myBar:Show() + end + + if(hp.absorbBar) then + hp.absorbBar:SetMinMaxValues(barMin, barMax * 0.5) + hp.absorbBar:SetValue(totalAbsorb) + hp.absorbBar:SetAllPoints(hbar) + hp.absorbBar:SetReverseFill(not reversed) + hp.absorbBar:Show() + end + + if(hp.healAbsorbBar) then + hp.healAbsorbBar:SetMinMaxValues(barMin, barMax) + hp.healAbsorbBar:SetValue(myCurrentHealAbsorb) + hp.healAbsorbBar:SetPoint(anchor, hbar, anchor, 0, 0) + hp.healAbsorbBar:SetPoint(relative, previous, relative, 0, 0) + hp.healAbsorbBar:SetReverseFill(reversed) + previous = hp.healAbsorbBar + hp.healAbsorbBar:Show() + end +end + +function MOD:CreateHealPrediction(frame, fullSet) + local health = frame.Health; + local isReversed = false + if(health.fillInverted and health.fillInverted == true) then + isReversed = true + end + local hTex = health:GetStatusBarTexture() + local myBar = CreateFrame('StatusBar', nil, health) + myBar:SetFrameStrata("LOW") + myBar:SetFrameLevel(6) + myBar:SetStatusBarTexture([[Interface\BUTTONS\WHITE8X8]]) + myBar:SetStatusBarColor(0.15, 0.7, 0.05, 0.9) + + local absorbBar = CreateFrame('StatusBar', nil, health) + absorbBar:SetFrameStrata("LOW") + absorbBar:SetFrameLevel(7) + absorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) + absorbBar:SetStatusBarColor(1, 1, 0, 0.5) + + local healPrediction = { + myBar = myBar, + absorbBar = absorbBar, + maxOverflow = 1, + reversed = isReversed, + Override = OverrideUpdate + } + + if(fullSet) then + local healAbsorbBar = CreateFrame('StatusBar', nil, health) + healAbsorbBar:SetFrameStrata("LOW") + healAbsorbBar:SetFrameLevel(9) + healAbsorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) + healAbsorbBar:SetStatusBarColor(0.5, 0.2, 1, 0.9) + healPrediction["healAbsorbBar"] = healAbsorbBar; + end + + return healPrediction +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/portrait.lua b/Interface/AddOns/SVUI/packages/unit/common/portrait.lua deleted file mode 100644 index 639622f..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/portrait.lua +++ /dev/null @@ -1,148 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- --- local MISSING_MODEL_FILE = [[Spells\Blackmagic_precast_base.m2]]; --- local MISSING_MODEL_FILE = [[Spells\Crow_baked.m2]]; --- local MISSING_MODEL_FILE = [[Spells\monsterlure01.m2]]; --- local MISSING_MODEL_FILE = [[interface\buttons\talktome_gears.m2]]; --- local MISSING_MODEL_FILE = [[creature\Ghostlyskullpet\ghostlyskullpet.m2]]; --- local MISSING_MODEL_FILE = [[creature\ghost\ghost.m2]]; -local MISSING_MODEL_FILE = [[Spells\Monk_travelingmist_missile.m2]]; ---[[ -########################################################## -UPDATE -########################################################## -]]-- -local Update2DPortrait = function(self, event, unit) - if(not unit or not UnitIsUnit(self.unit, unit)) then return end - local portrait = self.Portrait - SetPortraitTexture(portrait, unit) -end - -local Update3DPortrait = function(self, event, unit) - if(not unit or not UnitIsUnit(self.unit, unit)) then return end - local portrait = self.Portrait - if(not portrait:IsObjectType'Model') then return; end - local guid = UnitGUID(unit) - local camera = portrait.UserCamDistance or 1 - local rotate = portrait.UserRotation - if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then - portrait:SetCamDistanceScale(1) - portrait:SetPortraitZoom(0) - portrait:SetPosition(4,-1,1) - portrait:ClearModel() - portrait:SetModel(MISSING_MODEL_FILE) - portrait.guid = nil - portrait:SetBackdropColor(0.25,0.25,0.25) - if portrait.UpdateColor then - portrait:UpdateColor(0.25,0.25,0.25) - end - elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then - portrait:SetCamDistanceScale(camera) - portrait:SetPortraitZoom(1) - portrait:SetPosition(0,0,0) - portrait:ClearModel() - portrait:SetUnit(unit) - portrait.guid = guid - - if(rotate and portrait:GetFacing() ~= rotate / 60) then - portrait:SetFacing(rotate / 60) - end - - local r, g, b, color = 0.25, 0.25, 0.25 - if not UnitIsPlayer(unit)then - color = oUF_SuperVillain.colors.reaction[UnitReaction(unit,"player")] - if(color ~= nil) then - r,g,b = color[1], color[2], color[3] - end; - else - local _,unitClass = UnitClass(unit) - if unitClass then - color = oUF_SuperVillain.colors.class[unitClass] - r,g,b = color[1], color[2], color[3] - end - end - portrait:SetBackdropColor(r,g,b) - if portrait.UpdateColor then - portrait:UpdateColor(r,g,b) - end - end -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:CreatePortrait(frame,smallUnit,isPlayer) - -- 3D Portrait - local portrait3D = CreateFrame("PlayerModel",nil,frame) - portrait3D:SetFrameStrata("LOW") - portrait3D:SetFrameLevel(2) - - if smallUnit then - portrait3D:SetPanelTemplate("UnitSmall") - else - portrait3D:SetPanelTemplate("UnitLarge") - end; - - local overlay = CreateFrame("Frame",nil,portrait3D) - overlay:SetAllPoints(portrait3D.Panel) - overlay:SetFrameLevel(3) - portrait3D.overlay = overlay; - portrait3D.UserRotation = 0; - portrait3D.UserCamDistance = 1.3; - - -- 2D Portrait - local portrait2Danchor = CreateFrame('Frame',nil,frame) - portrait2Danchor:SetFrameStrata("LOW") - portrait2Danchor:SetFrameLevel(2) - - local portrait2D = portrait2Danchor:CreateTexture(nil,'OVERLAY') - portrait2D:SetTexCoord(0.15,0.85,0.15,0.85) - portrait2D:SetAllPoints(portrait2Danchor) - portrait2D.anchor = portrait2Danchor; - if smallUnit then - portrait2Danchor:SetFixedPanelTemplate("UnitSmall") - else - portrait2Danchor:SetFixedPanelTemplate("UnitLarge") - end; - portrait2D.Panel = portrait2Danchor.Panel; - - local overlay = CreateFrame("Frame",nil,portrait2Danchor) - overlay:SetAllPoints(portrait2D.Panel) - overlay:SetFrameLevel(3) - portrait2D.overlay = overlay; - - -- Set Updates - portrait2D.Override = Update2DPortrait - portrait3D.Override = Update3DPortrait - - -- Assign To Frame - frame.PortraitModel = portrait3D; - frame.PortraitTexture = portrait2D; -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/power.lua b/Interface/AddOns/SVUI/packages/unit/common/power.lua deleted file mode 100644 index 5c8b003..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/power.lua +++ /dev/null @@ -1,149 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local random = math.random; -local token = {[0] = "MANA", [1] = "RAGE", [2] = "FOCUS", [3] = "ENERGY", [6] = "RUNIC_POWER"} ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local PostUpdateAltPower = function(self, min, current, max) - local remaining = floor(current / max * 100) - local parent = self:GetParent() - if remaining < 35 then - self:SetStatusBarColor(0, 1, 0) - elseif remaining < 70 then - self:SetStatusBarColor(1, 1, 0) - else - self:SetStatusBarColor(1, 0, 0) - end - local unit = parent.unit; - if(unit == "player" and self.text) then - local apInfo = select(10, UnitAlternatePowerInfo(unit)) - if remaining > 0 then - self.text:SetText(apInfo..": "..format("%d%%", remaining)) - else - self.text:SetText(apInfo..": 0%") - end - elseif(unit and unit:find("boss%d") and self.text) then - self.text:SetTextColor(self:GetStatusBarColor()) - if not parent.InfoPanel.Power:GetText() or parent.InfoPanel.Power:GetText() == "" then - self.text:Point("BOTTOMRIGHT", parent.Health, "BOTTOMRIGHT") - else - self.text:Point("RIGHT", parent.InfoPanel.Power, "LEFT", 2, 0) - end - if remaining > 0 then - self.text:SetText("|cffD7BEA5[|r"..format("%d%%", remaining).."|cffD7BEA5]|r") - else - self.text:SetText(nil) - end - end -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:CreatePowerBar(frame, bg) - local power = CreateFrame("StatusBar", nil, frame) - power:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - power:SetPanelTemplate("Bar") - if bg then - power.bg = power:CreateTexture(nil, "BORDER") - power.bg:SetAllPoints() - power.bg:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - power.bg.multiplier = 0.2 - end - power.colorDisconnected = false; - power.colorTapping = false; - power.PostUpdate = MOD.PostUpdatePower; - return power -end - -function MOD:CreateAltPowerBar(frame) - local altPower = CreateFrame("StatusBar", nil, frame) - altPower:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - altPower:SetPanelTemplate("Bar") - altPower:GetStatusBarTexture():SetHorizTile(false) - altPower:SetFrameStrata("MEDIUM") - altPower.text = altPower:CreateFontString(nil, "OVERLAY") - altPower.text:SetPoint("CENTER") - altPower.text:SetJustifyH("CENTER") - altPower.text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - altPower.PostUpdate = PostUpdateAltPower; - return altPower -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -local function PowerUpdateNamePosition(frame, unit) - local panel = frame.InfoPanel - if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end - local db = MOD.db[unit] - local parent = panel.Name:GetParent() - if UnitIsPlayer(unit)then - local point = db.name.position; - panel.Power:SetAlpha(1) - panel.Name:ClearAllPoints() - SuperVillain:ReversePoint(panel.Name, point, parent, db.name.xOffset, db.name.yOffset) - else - panel.Power:SetAlpha(db.power.hideonnpc and 0 or 1) - panel.Name:ClearAllPoints() - panel.Name:SetPoint(panel.Power:GetPoint()) - end -end - -function MOD:PostUpdatePower(unit, value, max) - local db = MOD.db[unit] - local powerType, _, _, _, _ = UnitPowerType(unit) - local parent = self:GetParent() - if parent.isForced then - value = random(1, max) - powerType = random(0, 4) - self:SetValue(value) - end - local colors = oUF_SuperVillain.colors.power[token[powerType]] - local mult = self.bg.multiplier or 1; - local isPlayer = UnitPlayerControlled(unit) - if isPlayer and self.colorClass then - local _, class = UnitClassBase(unit); - colors = oUF_SuperVillain["colors"].class[class] - elseif not isPlayer then - local react = UnitReaction("player", unit) - colors = oUF_SuperVillain["colors"].reaction[react] - end - if not colors then return end - self:SetStatusBarColor(colors[1], colors[2], colors[3]) - self.bg:SetVertexColor(colors[1] * mult, colors[2] * mult, colors[3] * mult) - if db and db.power and db.power.hideonnpc then - PowerUpdateNamePosition(parent, unit) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/prediction.lua b/Interface/AddOns/SVUI/packages/unit/common/prediction.lua deleted file mode 100644 index 4a3fd9a..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/prediction.lua +++ /dev/null @@ -1,176 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -HEAL PREDICTION -########################################################## -]]-- -local OverrideUpdate = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - - local hp = self.HealPrediction - hp.parent = self - local hbar = self.Health; - local anchor, relative, relative2 = 'TOPLEFT', 'BOTTOMRIGHT', 'BOTTOMLEFT'; - local reversed = true - hp.reversed = hbar.fillInverted or false - if(hp.reversed == true) then - anchor, relative, relative2 = 'TOPRIGHT', 'BOTTOMLEFT', 'BOTTOMRIGHT'; - reversed = false - end - - local myIncomingHeal = UnitGetIncomingHeals(unit, 'player') or 0 - local allIncomingHeal = UnitGetIncomingHeals(unit) or 0 - local totalAbsorb = UnitGetTotalAbsorbs(unit) or 0 - local myCurrentHealAbsorb = UnitGetTotalHealAbsorbs(unit) or 0 - local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit) - - local overHealAbsorb = false - if(health < myCurrentHealAbsorb) then - overHealAbsorb = true - myCurrentHealAbsorb = health - end - - if(health - myCurrentHealAbsorb + allIncomingHeal > maxHealth * hp.maxOverflow) then - allIncomingHeal = maxHealth * hp.maxOverflow - health + myCurrentHealAbsorb - end - - local otherIncomingHeal = 0 - if(allIncomingHeal < myIncomingHeal) then - myIncomingHeal = allIncomingHeal - else - otherIncomingHeal = allIncomingHeal - myIncomingHeal - end - - local overAbsorb = false - if(health - myCurrentHealAbsorb + allIncomingHeal + totalAbsorb >= maxHealth or health + totalAbsorb >= maxHealth) then - if(totalAbsorb > 0) then - overAbsorb = true - end - - if(allIncomingHeal > myCurrentHealAbsorb) then - totalAbsorb = max(0, maxHealth - (health - myCurrentHealAbsorb + allIncomingHeal)) - else - totalAbsorb = max(0, maxHealth - health) - end - end - - if(myCurrentHealAbsorb > allIncomingHeal) then - myCurrentHealAbsorb = myCurrentHealAbsorb - allIncomingHeal - else - myCurrentHealAbsorb = 0 - end - - local barMin, barMax, barMod = 0, maxHealth, 1; - - local previous = hbar:GetStatusBarTexture() - if(hp.myBar) then - hp.myBar:SetMinMaxValues(barMin, barMax) - if(not hp.otherBar) then - hp.myBar:SetValue(allIncomingHeal) - else - hp.myBar:SetValue(myIncomingHeal) - end - hp.myBar:SetPoint(anchor, hbar, anchor, 0, 0) - hp.myBar:SetPoint(relative, previous, relative, 0, 0) - hp.myBar:SetReverseFill(reversed) - previous = hp.myBar - hp.myBar:Show() - end - - -- if(hp.otherBar) then - -- hp.otherBar:SetMinMaxValues(barMin, barMax) - -- hp.otherBar:SetValue(otherIncomingHeal) - -- hp.otherBar:SetPoint(anchor, hbar, anchor, 0, 0) - -- hp.otherBar:SetPoint(relative, previous, relative, 0, 0) - -- hp.otherBar:SetReverseFill(reversed) - -- previous = hp.otherBar - -- hp.otherBar:Show() - -- end - - if(hp.absorbBar) then - hp.absorbBar:SetMinMaxValues(barMin, barMax * 0.5) - hp.absorbBar:SetValue(totalAbsorb) - hp.absorbBar:SetAllPoints(hbar) - --hp.absorbBar:SetPoint(relative, previous, relative, 0, 0) - hp.absorbBar:SetReverseFill(not reversed) - --previous = hp.absorbBar - hp.absorbBar:Show() - end - - if(hp.healAbsorbBar) then - hp.healAbsorbBar:SetMinMaxValues(barMin, barMax) - hp.healAbsorbBar:SetValue(myCurrentHealAbsorb) - hp.healAbsorbBar:SetPoint(anchor, hbar, anchor, 0, 0) - hp.healAbsorbBar:SetPoint(relative, previous, relative, 0, 0) - hp.healAbsorbBar:SetReverseFill(reversed) - previous = hp.healAbsorbBar - hp.healAbsorbBar:Show() - end -end - -function MOD:CreateHealPrediction(frame, fullSet) - local health = frame.Health; - local isReversed = false - if(health.fillInverted and health.fillInverted == true) then - isReversed = true - end - local hTex = health:GetStatusBarTexture() - local myBar = CreateFrame('StatusBar', nil, health) - myBar:SetFrameStrata("LOW") - myBar:SetFrameLevel(6) - myBar:SetStatusBarTexture([[Interface\BUTTONS\WHITE8X8]]) - myBar:SetStatusBarColor(0.15, 0.7, 0.05, 0.9) - - local absorbBar = CreateFrame('StatusBar', nil, health) - absorbBar:SetFrameStrata("LOW") - absorbBar:SetFrameLevel(7) - absorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) - absorbBar:SetStatusBarColor(1, 1, 0, 0.5) - - -- local otherBar = CreateFrame('StatusBar', nil, health) - -- otherBar:SetFrameStrata("LOW") - -- otherBar:SetFrameLevel(7) - -- otherBar:SetStatusBarTexture([[Interface\BUTTONS\WHITE8X8]]) - -- otherBar:SetStatusBarColor(0.15, 0.9, 0.05, 0.9) - - local healPrediction = { - myBar = myBar, - absorbBar = absorbBar, - maxOverflow = 1, - reversed = isReversed, - Override = OverrideUpdate - } - - if(fullSet) then - local healAbsorbBar = CreateFrame('StatusBar', nil, health) - healAbsorbBar:SetFrameStrata("LOW") - healAbsorbBar:SetFrameLevel(9) - healAbsorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) - healAbsorbBar:SetStatusBarColor(0.5, 0.2, 1, 0.9) - healPrediction["healAbsorbBar"] = healAbsorbBar; - end - - return healPrediction -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/secure.lua b/Interface/AddOns/SVUI/packages/unit/common/secure.lua deleted file mode 100644 index c95cc13..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/secure.lua +++ /dev/null @@ -1,216 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local tostring = _G.tostring; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; ---[[ STRING METHODS ]]-- -local find, format, upper = string.find, string.format, string.upper; -local match, gsub = string.match, string.gsub; -local min, random = math.min, math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local definedEnvs,tags = {}, {}; -local CharacterSelect = {"Munglunch", "Elv", "Tukz", "Azilroka", "Sortokk", "AlleyKat", "Quokka", "Haleth", "P3lim", "Haste", "Totalpackage", "Kryso", "Thepilli", "Doonga", "Judicate", "Cazart506", "Movster", "MuffinMonster", "Joelsoul", "Trendkill09", "Luamar", "Zharooz", "Lyn3x5", "Madh4tt3r", "Xarioth", "Sinnisterr", "Melonmaniac", "Hojowameeat", "Xandeca", "Bkan", "Daigan", "AtomicKiller", "Meljen", "Moondoggy", "Stormblade", "Schreibstift", "Anj", "Risien", "", ""}; -local _PROXY; -local _ENV = { - UnitPower = function(unit, g) - if unit:find('target') or unit:find('focus') then - return UnitPower(unit, g) - end - return random(1, UnitPowerMax(unit, g)or 1) - end, - UnitHealth = function(unit) - if unit:find('target') or unit:find('focus') then - return UnitHealth(unit) - end - return random(1, UnitHealthMax(unit)) - end, - UnitName = function(unit) - if unit:find('target') or unit:find('focus') then - return UnitName(unit) - end - local randomSelect = random(1, 40) - local name = CharacterSelect[randomSelect]; - return name - end, - UnitClass = function(unit) - if unit:find('target') or unit:find('focus') then - return UnitClass(unit) - end - local token = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))] - return LOCALIZED_CLASS_NAMES_MALE[token], token - end, - Hex = function(r, g, b) - if type(r) == "table" then - if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end - end - return format("|cff%02x%02x%02x", r*255, g*255, b*255) - end, - ColorGradient = oUF_SuperVillain.ColorGradient, -}; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function SetProxyEnv() - if(_PROXY ~= nil) then return end - _PROXY = setmetatable(_ENV, {__index = _G, __newindex = function(_,key,value) _G[key]=value end}); - tags['name:color'] = oUF_SuperVillain.Tags.Methods['name:color'] - for i=1, 30 do - tags['name:'..i] = oUF_SuperVillain.Tags.Methods['name:'..i] - end - tags['health:color'] = oUF_SuperVillain.Tags.Methods['health:color'] - tags['health:current'] = oUF_SuperVillain.Tags.Methods['health:current'] - tags['health:deficit'] = oUF_SuperVillain.Tags.Methods['health:deficit'] - tags['health:curpercent'] = oUF_SuperVillain.Tags.Methods['health:curpercent'] - tags['health:curmax'] = oUF_SuperVillain.Tags.Methods['health:curmax'] - tags['health:curmax-percent'] = oUF_SuperVillain.Tags.Methods['health:curmax-percent'] - tags['health:max'] = oUF_SuperVillain.Tags.Methods['health:max'] - tags['health:percent'] = oUF_SuperVillain.Tags.Methods['health:percent'] - tags['power:color'] = oUF_SuperVillain.Tags.Methods['power:color'] - tags['power:current'] = oUF_SuperVillain.Tags.Methods['power:current'] - tags['power:deficit'] = oUF_SuperVillain.Tags.Methods['power:deficit'] - tags['power:curpercent'] = oUF_SuperVillain.Tags.Methods['power:curpercent'] - tags['power:curmax'] = oUF_SuperVillain.Tags.Methods['power:curmax'] - tags['power:curmax-percent'] = oUF_SuperVillain.Tags.Methods['power:curmax-percent'] - tags['power:max'] = oUF_SuperVillain.Tags.Methods['power:max'] - tags['power:percent'] = oUF_SuperVillain.Tags.Methods['power:percent'] -end - -local function ChangeGroupIndex(self) - if not self:GetParent().forceShow and not self.forceShow then return end - if not self:IsShown() then return end - - local max = MAX_RAID_MEMBERS; - local key = self.___groupkey - local db = MOD.db[key] - - local newIndex = db.customSorting and -(min(db.groupCount * (db.gRowCol * 5), max) + 1 ) or -4; - if self:GetAttribute("startingIndex") ~= newIndex then - self:SetAttribute("startingIndex", newIndex) - self.isForced = true; - MOD:AllowChildren(self, self:GetChildren()) - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:SwapElement(unit, numGroup) - if InCombatLockdown()then return end - for i=1, numGroup do - local unitName = unit..i - local frame = self.Units[unitName] - if(frame) then - if(not frame.isForced) then - self:AllowElement(frame) - else - self:RestrictElement(frame) - end - end - end -end - -local attrOverride = { - ["showRaid"] = true, - ["showParty"] = true, - ["showSolo"] = true -} - -function MOD:UpdateGroupConfig(headerFrame, setForced) - if InCombatLockdown()then return end - - SetProxyEnv() - local key = headerFrame.___groupkey - local db = MOD.db[key] - headerFrame.forceShow = setForced; - headerFrame.forceShowAuras = setForced; - headerFrame.isForced = setForced; - - if setForced then - for _, func in pairs(tags) do - if type(func) == "function" then - if not definedEnvs[func] then - definedEnvs[func] = getfenv(func) - setfenv(func, _PROXY) - end - end - end - RegisterStateDriver(headerFrame, "visibility", "show") - else - for func, fenv in pairs(definedEnvs)do - setfenv(func, fenv) - definedEnvs[func] = nil - end - RegisterStateDriver(headerFrame, "visibility", db.visibility) - headerFrame:GetScript("OnEvent")(headerFrame, "PLAYER_ENTERING_WORLD") - end - - for i = 1, #headerFrame.groups do - local groupFrame = headerFrame.groups[i] - - if groupFrame:IsShown()then - groupFrame.forceShow = headerFrame.forceShow; - groupFrame.forceShowAuras = headerFrame.forceShowAuras; - groupFrame:HookScript("OnAttributeChanged", ChangeGroupIndex) - if setForced then - for attr in pairs(attrOverride)do - groupFrame:SetAttribute(attr, nil) - end - - ChangeGroupIndex(groupFrame) - groupFrame:Update() - else - for attr in pairs(attrOverride)do - groupFrame:SetAttribute(attr, true) - end - - MOD:RestrictChildren(groupFrame, groupFrame:GetChildren()) - groupFrame:SetAttribute("startingIndex", 1) - groupFrame:Update() - end - end - end - - headerFrame:SetActiveState() - collectgarbage("collect") -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/unique.lua b/Interface/AddOns/SVUI/packages/unit/common/unique.lua deleted file mode 100644 index d992816..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/unique.lua +++ /dev/null @@ -1,266 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local format = string.format -local cos, sin, sqrt2, random, floor, ceil = math.cos, math.sin, math.sqrt(2), math.random, math.floor, math.ceil; -local GetPlayerMapPosition = GetPlayerMapPosition; -local STATE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-PLAYER-STATE]] ---[[ -########################################################## -PLAYER ONLY COMPONENTS -########################################################## -]]-- -function MOD:CreateRestingIndicator(frame) - local resting = CreateFrame("Frame",nil,frame) - resting:SetFrameStrata("MEDIUM") - resting:SetFrameLevel(20) - resting:Size(26,26) - resting:Point("TOPRIGHT",frame,3,3) - resting.bg = resting:CreateTexture(nil,"OVERLAY",nil,1) - resting.bg:SetAllPoints(resting) - resting.bg:SetTexture(STATE_ICON_FILE) - resting.bg:SetTexCoord(0.5,1,0,0.5) - return resting -end; - -function MOD:CreateCombatIndicator(frame) - local combat = CreateFrame("Frame",nil,frame) - combat:SetFrameStrata("MEDIUM") - combat:SetFrameLevel(30) - combat:Size(26,26) - combat:Point("TOPRIGHT",frame,3,3) - combat.bg = combat:CreateTexture(nil,"OVERLAY",nil,5) - combat.bg:SetAllPoints(combat) - combat.bg:SetTexture(STATE_ICON_FILE) - combat.bg:SetTexCoord(0,0.5,0,0.5) - SuperVillain.Animate:Pulse(combat) - combat:SetScript("OnShow", function(this) - if not this.anim:IsPlaying() then this.anim:Play() end - end) - - combat:Hide() - return combat -end; - -local ExRep_OnEnter = function(self)if self:IsShown() then UIFrameFadeIn(self,.1,0,1) end end; -local ExRep_OnLeave = function(self)if self:IsShown() then UIFrameFadeOut(self,.2,1,0) end end; - -function MOD:CreateExperienceRepBar(frame) - local db = MOD.db.player; - - if db.playerExpBar then - local xp = CreateFrame("StatusBar", "PlayerFrameExperienceBar", frame.Power) - xp:FillInner(frame.Power, 0, 0) - xp:SetPanelTemplate() - xp:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp:SetStatusBarColor(0, 0.1, 0.6) - --xp:SetBackdropColor(1, 1, 1, 0.8) - xp:SetFrameLevel(xp:GetFrameLevel() + 2) - xp.Tooltip = true; - xp.Rested = CreateFrame("StatusBar", nil, xp) - xp.Rested:SetAllPoints(xp) - xp.Rested:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp.Rested:SetStatusBarColor(1, 0, 1, 0.6) - xp.Value = xp:CreateFontString(nil, "TOOLTIP") - xp.Value:SetAllPoints(xp) - xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") - xp.Value:SetTextColor(0.2, 0.75, 1) - xp.Value:SetShadowColor(0, 0, 0, 0) - xp.Value:SetShadowOffset(0, 0) - frame:Tag(xp.Value, "[curxp] / [maxxp]") - xp.Rested:SetBackdrop({bgFile = [[Interface\BUTTONS\WHITE8X8]]}) - xp.Rested:SetBackdropColor(unpack(SuperVillain.Media.color.default)) - xp:SetScript("OnEnter", ExRep_OnEnter) - xp:SetScript("OnLeave", ExRep_OnLeave) - xp:SetAlpha(0) - frame.Experience = xp - end; - - if db.playerRepBar then - local rep = CreateFrame("StatusBar", "PlayerFrameReputationBar", frame.Power) - rep:FillInner(frame.Power, 0, 0) - rep:SetPanelTemplate() - rep:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - rep:SetStatusBarColor(0, 0.6, 0) - --rep:SetBackdropColor(1, 1, 1, 0.8) - rep:SetFrameLevel(rep:GetFrameLevel() + 2) - rep.Tooltip = true; - rep.Value = rep:CreateFontString(nil, "TOOLTIP") - rep.Value:SetAllPoints(rep) - rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") - rep.Value:SetTextColor(0.1, 1, 0.2) - rep.Value:SetShadowColor(0, 0, 0, 0) - rep.Value:SetShadowOffset(0, 0) - frame:Tag(rep.Value, "[standing]: [currep] / [maxrep]") - rep:SetScript("OnEnter", ExRep_OnEnter) - rep:SetScript("OnLeave", ExRep_OnLeave) - rep:SetAlpha(0) - frame.Reputation = rep - end -end; ---[[ -########################################################## -TARGET ONLY COMPONENTS -########################################################## -]]-- -local function GPS_OnEnter(self) - self:SetAlpha(1) - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0.5, 0) - GameTooltip:ClearLines() - GameTooltip:AddLine("Can not track this unit", 1, 1, 1) - else - self.Icon:SetVertexColor(0.1, 1, 0.5) - GameTooltip:ClearLines() - GameTooltip:AddLine("Start tracking your target", 1, 1, 1) - end - GameTooltip:Show() -end; - -local function GPS_OnLeave(self) - self:SetAlpha(0.25) - self.Icon:SetVertexColor(0.1, 0.1, 0.1) - GameTooltip:Hide() -end; - -local function GPS_OnMouseDown(self) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0, 0) - end -end; - -local function GPS_OnMouseUp(self) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0.5, 0) - else - self.Icon:SetVertexColor(0.1, 1, 0.5) - self:GetParent().Tracker:Show() - end -end; - -function MOD:CreateGPS(frame) - if not frame then return end; - - local gps = CreateFrame("Frame", nil, frame) - gps:Size(50, 50) - gps:Point("BOTTOMLEFT", frame, "BOTTOMRIGHT", 6, 0) - gps:EnableMouse(false) - - local tracker = CreateFrame("Frame", nil, gps) - tracker:SetAllPoints(gps) - tracker:SetFrameLevel(gps:GetFrameLevel() + 2) - - local border = tracker:CreateTexture(nil, "BORDER") - border:SetAllPoints(tracker) - border:SetTexture([[Interface\Addons\SVUI\assets\artwork\Doodads\GPS-BORDER]]) - border:SetGradient(unpack(SuperVillain.Media.gradient.dark)) - - tracker.Arrow = tracker:CreateTexture(nil, "OVERLAY", nil, -2) - tracker.Arrow:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ARROW]]) - tracker.Arrow:Size(50, 50) - tracker.Arrow:SetPoint("CENTER", tracker, "CENTER", 0, 0) - tracker.Arrow:SetVertexColor(0.1, 0.8, 0.8) - - tracker.Text = tracker:CreateFontString(nil, "OVERLAY") - tracker.Text:SetAllPoints(tracker) - tracker.Text:SetFont(SuperVillain.Media.font.roboto, 14, "OUTLINE") - tracker.Text:SetTextColor(1, 1, 1, 0.75) - - tracker.Spinner = tracker:CreateTexture(nil, "ARTWORK", nil, 2) - tracker.Spinner:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ANIMATION]]) - tracker.Spinner:Size(50, 50) - tracker.Spinner:SetPoint("CENTER", tracker, "CENTER", 0, 0) - - SuperVillain.Animate:Orbit(tracker.Spinner, 8, true) - - local switch = CreateFrame("Frame", nil, gps) - switch:SetAllPoints(gps) - switch:EnableMouse(true) - - switch.Icon = switch:CreateTexture(nil, "BACKGROUND") - switch.Icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-OPEN]]) - switch.Icon:Size(32, 32) - switch.Icon:SetPoint("BOTTOMLEFT", switch, "BOTTOMLEFT", 0, 0) - switch.Icon:SetVertexColor(0.1, 0.1, 0.1) - - switch.Trackable = false; - - switch:SetScript("OnEnter", GPS_OnEnter) - switch:SetScript("OnLeave", GPS_OnLeave) - switch:SetScript("OnMouseDown", GPS_OnMouseDown) - switch:SetScript("OnMouseUp", GPS_OnMouseUp) - - switch:SetAlpha(0.25) - - gps.Tracker = tracker - gps.Switch = switch - - gps.Tracker:Hide() - gps:Hide() - - return gps -end; - -function MOD:CreateXRay(frame) - local xray=CreateFrame("BUTTON","XRayFocus",frame,"SecureActionButtonTemplate") - xray:EnableMouse(true) - xray:RegisterForClicks("AnyUp") - xray:SetAttribute("type","macro") - xray:SetAttribute("macrotext","/focus") - xray:Size(64,64) - xray:SetFrameStrata("DIALOG") - xray.icon=xray:CreateTexture(nil,"ARTWORK") - xray.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY") - xray.icon:SetAllPoints(xray) - xray.icon:SetAlpha(0) - xray:SetScript("OnLeave",function()GameTooltip:Hide()xray.icon:SetAlpha(0)end) - xray:SetScript("OnEnter",function(self) - xray.icon:SetAlpha(1) - local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() - local t,u,v="RIGHT","TOP","BOTTOM" - if (b < (r / 2)) then t="LEFT" end; - if (m < (s / 2)) then u,v=v,u end; - GameTooltip:SetOwner(self,"ANCHOR_NONE") - GameTooltip:SetPoint(u..t,self,v..t) - GameTooltip:SetText(FOCUSTARGET.."\n") - end) - return xray -end; - -function MOD:CreateXRay_Closer(frame) - local close=CreateFrame("BUTTON","ClearXRay",frame,"SecureActionButtonTemplate") - close:EnableMouse(true) - close:RegisterForClicks("AnyUp") - close:SetAttribute("type","macro") - close:SetAttribute("macrotext","/clearfocus") - close:Size(64,64) - close:SetFrameStrata("DIALOG") - close.icon=close:CreateTexture(nil,"ARTWORK") - close.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY-CLOSE") - close.icon:SetAllPoints(close) - close.icon:SetVertexColor(1,0.2,0.1) - close:SetScript("OnLeave",function()GameTooltip:Hide()close.icon:SetVertexColor(1,0.2,0.1)end) - close:SetScript("OnEnter",function(self)close.icon:SetVertexColor(1,1,0.2)local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter()local t,u,v="RIGHT","TOP","BOTTOM"if b<r/2 then t="LEFT"end;if m<s/2 then u,v=v,u end;GameTooltip:SetOwner(self,"ANCHOR_NONE")GameTooltip:SetPoint(u..t,self,v..t)GameTooltip:SetText(CLEAR_FOCUS.."\n")end) - return close -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/groups.lua b/Interface/AddOns/SVUI/packages/unit/frames/groups.lua index b938a50..fdbfd8a 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/groups.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/groups.lua @@ -266,7 +266,7 @@ local Raid10Update = function(self) if not frame.positioned then frame:ClearAllPoints() frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, frame:GetName().."_MOVE", L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) + SuperVillain:SetSVMovable(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid10Visibility) @@ -296,7 +296,7 @@ local Raid25Update = function(self) if not frame.positioned then frame:ClearAllPoints() frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, frame:GetName().."_MOVE", L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) + SuperVillain:SetSVMovable(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid25Visibility) @@ -326,7 +326,7 @@ local Raid40Update = function(self) if not frame.positioned then frame:ClearAllPoints() frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, frame:GetName().."_MOVE", L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) + SuperVillain:SetSVMovable(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid40Visibility) @@ -460,7 +460,7 @@ local UpdateRaidPetFrame = function(self) if not raidPets.positioned then raidPets:ClearAllPoints() raidPets:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", 4, 433) - SuperVillain:SetSVMovable(raidPets, raidPets:GetName().."_MOVE", L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + SuperVillain:SetSVMovable(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") raidPets.positioned = true; raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") @@ -602,7 +602,7 @@ local UpdatePartyFrame = function(self) if not group.positioned then group:ClearAllPoints() group:Point("LEFT",SuperVillain.UIParent,"LEFT",40,0) - SuperVillain:SetSVMovable(group, group:GetName()..'_MOVE', L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); + SuperVillain:SetSVMovable(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); group.positioned = true; group:RegisterEvent("PLAYER_ENTERING_WORLD") group:RegisterEvent("ZONE_CHANGED_NEW_AREA") @@ -743,7 +743,7 @@ local UpdateTankFrame = function(self) if not self.positioned then self:ClearAllPoints() self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -40) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + SuperVillain:SetSVMovable(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") self.Avatar.positionOverride = "TOPLEFT" self:SetAttribute("minHeight", self.dirtyHeight) self:SetAttribute("minWidth", self.dirtyWidth) @@ -837,7 +837,7 @@ local UpdateAssistFrame = function(self) if not self.positioned then self:ClearAllPoints() self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -140) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + SuperVillain:SetSVMovable(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") self.Avatar.positionOverride = "TOPLEFT" self:SetAttribute("minHeight", self.dirtyHeight) self:SetAttribute("minWidth", self.dirtyWidth) diff --git a/Interface/AddOns/SVUI/packages/unit/frames/units.lua b/Interface/AddOns/SVUI/packages/unit/frames/units.lua index ed7cdfa..11c73be 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/units.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/units.lua @@ -181,28 +181,12 @@ local UpdatePlayerFrame = function(self) end if(self.ClassBar or self.HyperCombo) then - if self.ClassBarRefresh then + if USE_CLASSBAR and self.ClassBarRefresh then self.ClassBarRefresh(self) end if(self.ClassBar) then local classBar = self[self.ClassBar]; - if USE_CLASSBAR then - if not db.classbar.detachFromFrame then - if classBar.Avatar then - classBar.Avatar:SetScale(0.000001) - classBar.Avatar:SetAlpha(0) - end - else - classBarWidth = db.classbar.detachedWidth; - if not classBar.Avatar then - classBar:Point("TOPLEFT", self, "BOTTOMLEFT", 0, -2) - SuperVillain:SetSVMovable(classBar, "ClassBar_MOVE", L["Classbar"], nil, nil, nil, "ALL, SOLO") - else - classBar.Avatar:SetScale(1) - classBar.Avatar:SetAlpha(1) - end - end if(not self:IsElementEnabled(self.ClassBar)) then self:EnableElement(self.ClassBar) end @@ -226,7 +210,7 @@ local UpdatePlayerFrame = function(self) end self.HyperCombo:Hide() end - end + end end end do @@ -260,7 +244,7 @@ local ConstructPlayer = function(self, unit) self.Debuffs = MOD:CreateDebuffs(self, key) self.Castbar = MOD:CreateCastbar(self, false, L["Player Castbar"], true, true) MOD:CreateExperienceRepBar(self) - MOD:GetClassResources(self) + self.ClassBar = MOD:CreateClassBar(self) self.RaidIcon = MOD:CreateRaidIcon(self) self.Resting = MOD:CreateRestingIndicator(self) self.Combat = MOD:CreateCombatIndicator(self) @@ -271,7 +255,7 @@ local ConstructPlayer = function(self, unit) self.AuraBars = MOD:CreateAuraBarHeader(self, key) self.CombatFade = true; self:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOM", -413, 182) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Player Frame"], nil, nil, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["Player Frame"], nil, nil, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePlayerFrame @@ -395,7 +379,7 @@ CONSTRUCTORS["target"] = function(self, unit) self.XRay = MOD:CreateXRay(self) self.XRay:SetPoint("TOPRIGHT", 12, 12) self:Point("BOTTOMRIGHT", SuperVillain.UIParent, "BOTTOM", 413, 182) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Target Frame"], nil, nil, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["Target Frame"], nil, nil, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateTargetFrame @@ -438,7 +422,7 @@ CONSTRUCTORS["targettarget"] = function(self, unit) self.RaidIcon = MOD:CreateRaidIcon(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 213) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["TargetTarget Frame"], nil, nil, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["TargetTarget Frame"], nil, nil, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateTargetTargetFrame @@ -490,7 +474,7 @@ CONSTRUCTORS["pet"] = function(self, unit) self.RaidIcon = MOD:CreateRaidIcon(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 182) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Pet Frame"], nil, nil, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["Pet Frame"], nil, nil, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePetFrame return self @@ -535,7 +519,7 @@ CONSTRUCTORS["pettarget"] = function(self, unit) self.Debuffs = MOD:CreateDebuffs(self, key) self.Range = { insideAlpha = 1, outsideAlpha = 1 } self:Point("BOTTOM", SVUI_Pet, "TOP", 0, 7) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["PetTarget Frame"], nil, -7, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["PetTarget Frame"], nil, -7, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdatePetTargetFrame @@ -600,7 +584,7 @@ CONSTRUCTORS["focus"] = function(self, unit) self.XRay = MOD:CreateXRay_Closer(self) self.XRay:SetPoint("BOTTOMRIGHT", 20, -10) self:Point("BOTTOMRIGHT", SVUI_Target, "TOPRIGHT", 0, 220) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["Focus Frame"], nil, nil, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["Focus Frame"], nil, nil, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateFocusFrame @@ -642,7 +626,7 @@ CONSTRUCTORS["focustarget"] = function(self, unit) self.RaidIcon = MOD:CreateRaidIcon(self) self.Range = { insideAlpha = 1, outsideAlpha = 1 } self:Point("BOTTOM", SVUI_Focus, "TOP", 0, 7) - SuperVillain:SetSVMovable(self, self:GetName().."_MOVE", L["FocusTarget Frame"], nil, -7, nil, "ALL, SOLO") + SuperVillain:SetSVMovable(self, L["FocusTarget Frame"], nil, -7, nil, "ALL, SOLO") self.MediaUpdate = MOD.RefreshUnitMedia self.Update = UpdateFocusTargetFrame @@ -713,7 +697,7 @@ CONSTRUCTORS["boss"] = function(self, unit) if(not _G["SVUI_Boss_MOVE"]) then self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(self, "SVUI_Boss_MOVE", L["Boss Frames"], nil, nil, nil, "ALL, PARTY, RAID10, RAID25, RAID40") + SuperVillain:SetSVMovable(self, L["Boss Frames"], nil, nil, nil, "ALL, PARTY, RAID10, RAID25, RAID40", "SVUI_Boss") else self:Point("TOPRIGHT", lastBossFrame, "BOTTOMRIGHT", 0, -20) end @@ -881,7 +865,7 @@ CONSTRUCTORS["arena"] = function(self, unit) if(not _G["SVUI_Arena_MOVE"]) then self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(self, "SVUI_Arena_MOVE", L["Arena Frames"], nil, nil, nil, "ALL, ARENA") + SuperVillain:SetSVMovable(self, L["Arena Frames"], nil, nil, nil, "ALL, ARENA", "SVUI_Arena") else self:Point("TOPRIGHT", lastArenaFrame, "BOTTOMRIGHT", 0, -20) end diff --git a/Interface/AddOns/SVUI/scripts/pvp.lua b/Interface/AddOns/SVUI/scripts/pvp.lua index 9eb63b7..3276dd8 100644 --- a/Interface/AddOns/SVUI/scripts/pvp.lua +++ b/Interface/AddOns/SVUI/scripts/pvp.lua @@ -196,10 +196,9 @@ LOADER ########################################################## ]]-- local function LoadPVPComm() - local DOCK = SuperVillain.Registry:Expose("SVDock") local holder = CreateFrame("Frame", "SVUI_PVPComm", SuperDockWindowRight) holder:SetFrameStrata("BACKGROUND") - DOCK:RegisterDocklet("SVUI_PVPComm", "PVP ToolKit", ICON_FILE) + SuperVillain:RegisterDocklet("SVUI_PVPComm", "PVP ToolKit", ICON_FILE) local width = holder:GetWidth() local height = holder:GetHeight() @@ -258,8 +257,8 @@ local function LoadPVPComm() holder:Hide() local docklet = _G["SVUI_PVPComm_ToolBarButton"] - docklet.Enable = DOCK.AddTool - docklet.Disable = DOCK.RemoveTool + docklet.Enable = SuperVillain.AddTool + docklet.Disable = SuperVillain.RemoveTool docklet.EnteringBattleGround = EnteringBattleGround docklet.ExitingBattleGround = ExitingBattleGround docklet:RegisterEvent("PLAYER_ENTERING_WORLD") diff --git a/Interface/AddOns/SVUI/scripts/questwatch.lua b/Interface/AddOns/SVUI/scripts/questwatch.lua index 78689a3..caa85c1 100644 --- a/Interface/AddOns/SVUI/scripts/questwatch.lua +++ b/Interface/AddOns/SVUI/scripts/questwatch.lua @@ -310,7 +310,7 @@ local QuestDocklet_OnEvent = function(self, event) if not SuperDockWindowRight:IsShown()then SuperDockWindowRight:Show() end - SuperVillain.Registry:Expose("SVDock"):DockletHide() + SuperVillain:CycleDocklets() QuestDockletFrame:Show() if button then button.IsOpen = true; @@ -338,13 +338,13 @@ local function CreateQuestDocklet() WatchFrameLines.ClearAllPoints = function()return end; WatchFrameLines.SetPoint = function()return end; WatchFrameLines.SetAllPoints = function()return end; - SuperVillain:SetSVMovable(frame, "SVUI_QuestFrame_MOVE", "Quest Watch"); + SuperVillain:SetSVMovable(frame, "Quest Watch"); else local bgTex = [[Interface\BUTTONS\WHITE8X8]] local bdTex = SuperVillain.Media.bar.glow QuestDockletFrame = CreateFrame("Frame", "QuestDockletFrame", SuperDockWindowRight); QuestDockletFrame:SetFrameStrata("BACKGROUND"); - SuperVillain.Registry:Expose("SVDock"):RegisterDocklet("QuestDockletFrame", "Quest Watch", ICON_FILE, false, true) + SuperVillain:RegisterDocklet("QuestDockletFrame", "Quest Watch", ICON_FILE, false, true) QuestDockletFrameList = CreateFrame("ScrollFrame", nil, QuestDockletFrame); QuestDockletFrameList:SetPoint("TOPLEFT", QuestDockletFrame, -62, 0); diff --git a/Interface/AddOns/SVUI/scripts/threat.lua b/Interface/AddOns/SVUI/scripts/threat.lua index 995a829..e7e550d 100644 --- a/Interface/AddOns/SVUI/scripts/threat.lua +++ b/Interface/AddOns/SVUI/scripts/threat.lua @@ -125,7 +125,7 @@ local function LoadThreatBar() ThreatBar:RegisterEvent('GROUP_ROSTER_UPDATE') ThreatBar:RegisterEvent('UNIT_PET') ThreatBar:SetScript("OnEvent", ThreatBar_OnEvent) - SuperVillain:SetSVMovable(ThreatBar,"SVUI_ThreatBar_MOVE","Threat Bar"); + SuperVillain:SetSVMovable(ThreatBar, "Threat Bar"); end end diff --git a/Interface/AddOns/SVUI/scripts/totems.lua b/Interface/AddOns/SVUI/scripts/totems.lua index 657b47c..2439e1b 100644 --- a/Interface/AddOns/SVUI/scripts/totems.lua +++ b/Interface/AddOns/SVUI/scripts/totems.lua @@ -94,7 +94,7 @@ end local function CreateTotemBar() if(not SuperVillain.db.system.totems.enable) then return; end local xOffset = SuperVillain.db.SVDock.dockLeftWidth + 12 - TotemBar = CreateFrame("Frame", nil, SuperVillain.UIParent) + TotemBar = CreateFrame("Frame", "SVUI_TotemBar", SuperVillain.UIParent) TotemBar:SetPoint("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", xOffset, 40) for i = 1, MAX_TOTEMS do local totem = CreateFrame("Button", "TotemBarTotem"..i, TotemBar) @@ -127,7 +127,7 @@ local function CreateTotemBar() else frame_name = L["Totem Bar"] end - SuperVillain:SetSVMovable(TotemBar, "TotemBar_MOVE", frame_name) + SuperVillain:SetSVMovable(TotemBar, frame_name) end SuperVillain.Registry:NewScript(CreateTotemBar); \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Database.lua b/Interface/AddOns/SVUI/system/classes/Database.lua index b508d3d..2642b9f 100644 --- a/Interface/AddOns/SVUI/system/classes/Database.lua +++ b/Interface/AddOns/SVUI/system/classes/Database.lua @@ -1014,9 +1014,8 @@ local DatabaseDefaults = { ["enable"] = true, ["slideLeft"] = true, ["inset"] = "inset", - ["height"] = 30, - ["detachFromFrame"] = false, - ["detachedWidth"] = 250, + ["height"] = 25, + ["detachFromFrame"] = false, }, ["icons"] = { diff --git a/Interface/AddOns/SVUI/system/classes/Registry.lua b/Interface/AddOns/SVUI/system/classes/Registry.lua index b50dabd..ef96b78 100644 --- a/Interface/AddOns/SVUI/system/classes/Registry.lua +++ b/Interface/AddOns/SVUI/system/classes/Registry.lua @@ -43,16 +43,16 @@ local SuperVillain, L = unpack(select(2, ...)); local MAJOR = "SuperVillain Plugins"; local MINOR = GetAddOnMetadata(..., "Version"); -local INFO_BY = "by"; -local INFO_VERSION = "Version:"; -local INFO_NEW = "Newest:"; +local INFO_BY = "%s by %s"; +local INFO_VERSION = "%s%s - Version: %d"; +local INFO_NEW = "%s (Newest: %d)"; local INFO_NAME = "Plugins"; local INFO_HEADER = "SuperVillain UI (version %.3f): Plugins"; if GetLocale() == "ruRU" then - INFO_BY = "от"; - INFO_VERSION = "Версия:"; - INFO_NEW = "Последняя:"; + INFO_BY = "%s от %s"; + INFO_VERSION = "%s%s - Версия: %d"; + INFO_NEW = "%s (Последняя: %d)"; INFO_NAME = "Плагины"; INFO_HEADER = "SuperVillain UI (устарела %.3f): Плагины"; end @@ -112,26 +112,30 @@ end REGISTRY MASTER METATABLE ########################################################## ]]-- +local metapackage = { + __index = function(t, k) + return SuperVillain.db[t.dbKey][k] + end, +} +local addontostring = function(t) + return t._name +end +local _queue = {{},{},{},{}} local METAREGISTRY = function() - local _nameindex = {} - local _queue = {[1] = {}, [2] = {}, [3] = {}} - local tempScripts, tempMethods = {}, {} - local _addontostring = function(t) - return t._name - end local methods = { - _packages = {}, - _plugins = {}, - _callbacks = {}, + _model = {plugin = {}, callback = {}}, + _loadDB = function(_, name) + return setmetatable( {dbKey = name}, metapackage ) + end, _loadPkg = function(_, priority) if not _queue[priority] then return end; local pkgList = _queue[priority] for i=1,#pkgList do local name = pkgList[i] - local obj = _._packages[name] + local obj = _._model[name] if obj and not obj._loaded then if SuperVillain.db[name] then - obj.db = SuperVillain.db[name] + obj.db = _:_loadDB(name) end if obj.Load then obj:Load() @@ -140,24 +144,23 @@ local METAREGISTRY = function() obj._loaded = true; end end - _queue[priority] = nil end, Expose = function(_, name) - --assert(_._packages[name], "Expose: The package " .. name .. " does not exist"); - return _._packages[name] or false + return _._model[name] or false end, SetCallback = function(_, fn) if(fn and type(fn) == "function") then - _._callbacks[#_._callbacks + 1] = fn + _._model.callback[#_._model.callback + 1] = fn end end, NewScript = function(_, fn) if(fn and type(fn) == "function") then - tempScripts[#tempScripts + 1] = fn + local i = #_queue[4] + _queue[4][i + 1] = fn end end, NewPackage = function(_, obj, name, priority) - if _._packages[name] then return end + if _._model[name] then return end obj._name = name if(priority == "pre") then tinsert(_queue[1], name) @@ -172,39 +175,39 @@ local METAREGISTRY = function() if oldmeta then for k, v in pairs(oldmeta) do addonmeta[k] = v end end - addonmeta.__tostring = _addontostring + addonmeta.__tostring = addontostring setmetatable( obj, addonmeta ) - _._packages[name] = SetPrototype(obj) + _._model[name] = SetPrototype(obj) if(SuperVillain.CoreEnabled) then - if(_._packages[name].Load) then - _._packages[name]:Load() + if(_._model[name].Load) then + _._model[name]:Load() end end end, FetchPlugins = function(_) local list = ""; - for _, plugin in pairs(_._plugins) do + for _, plugin in pairs(_._model.plugin) do if plugin.name ~= MAJOR then local author = GetAddOnMetadata(plugin.name, "Author") local Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name local color = plugin.old and SuperVillain:HexColor(1,0,0) or SuperVillain:HexColor(0,1,0) list = list .. Pname if author then - list = list .. " ".. INFO_BY .." " .. author + list = INFO_BY:format(list, author) end - list = list .. color .. " - " .. INFO_VERSION .." " .. plugin.version + list = INFO_VERSION:format(list, color, plugin.version) if plugin.old then - list = list .. INFO_NEW .. plugin.newversion .. ")" + list = INFO_NEW:format(list, plugin.newversion) end - list = list .. "|r\n" + list = ("%s|r\n"):format(list) end end return list end, NewPlugin = function(_, name, func) - local plugin = _._plugins[name] or {} + local plugin = _._model.plugin[name] or {} plugin.name = name plugin.version = name == MAJOR and MINOR or GetAddOnMetadata(name, "Version") plugin.callback = func @@ -216,7 +219,7 @@ local METAREGISTRY = function() tempframe:RegisterEvent("ADDON_LOADED") tempframe:SetScript("OnEvent", function(self, event, addon) if addon == "SVUI_ConfigOMatic" then - for i, plugin in pairs(_._plugins) do + for i, plugin in pairs(_._model.plugin) do if(plugin.callback) then plugin.callback() end @@ -233,55 +236,29 @@ local METAREGISTRY = function() func() end end - _._plugins[name] = plugin - end, - RunTemp = function(_, name) - local t = _._packages[name] - for i,fn in pairs(tempMethods[name]) do - if(fn and type(fn) == "function") then - fn(t) - end - end - tempMethods[name] = nil + _._model.plugin[name] = plugin end, RunCallbacks = function(_) - for i=1, #_._callbacks do - local fn = _._callbacks[i] + for i=1, #_._model.callback do + local fn = _._model.callback[i] if(fn and type(fn) == "function") then fn() end end end, - Temp = function(_, name, func) - --assert(_._packages[name], "Temp: The package " .. name .. " does not exist"); - if(not tempMethods[name]) then - tempMethods[name] = {} - end - local t = tempMethods[name] - t[#t + 1] = func - end, Update = function(_, name, dataOnly) - --assert(_._packages[name], "Update: The package " .. name .. " does not exist"); - local obj = _._packages[name] + local obj = _._model[name] if obj then - if SuperVillain.db[name] then - obj.db = SuperVillain.db[name] - end if obj.ReLoad and not dataOnly then obj:ReLoad() end end end, UpdateAll = function(_) - print("Registry: Updating") - local pkgList = _._packages + local pkgList = _._model for name,obj in pairs(pkgList) do - print(name) local name = obj._name if obj and obj.ReLoad then - if SuperVillain.db[name] then - obj.db = SuperVillain.db[name] - end obj:ReLoad() end end @@ -297,23 +274,18 @@ local METAREGISTRY = function() _:_loadPkg(3) end, Action = function(_) - local count = #tempScripts + local count = #_queue[4] for i=1, count do - local fn = tempScripts[i] + local fn = _queue[4][i] if(fn and type(fn) == "function") then fn() end end + _queue = nil end, }; - local mt ={ - __index = function(t, k) - v = rawget(_nameindex, k) - if v then - return v - end - end, - __tostring = function(t) return "SuperVillain.Registry >>> [" .. tdump(_nameindex) .. "]" end, + local mt = { + __tostring = function(t) return "SuperVillain.Registry >>> ACCESS DENIED" end, }; setmetatable(methods, mt) return methods diff --git a/Interface/AddOns/SVUI/system/installer.lua b/Interface/AddOns/SVUI/system/installer.lua index d709b3f..b0a193a 100644 --- a/Interface/AddOns/SVUI/system/installer.lua +++ b/Interface/AddOns/SVUI/system/installer.lua @@ -160,15 +160,15 @@ local function UFMoveTopQuadrant(toggle) if not SuperVillain.db.framelocations then SuperVillain.db.framelocations = {} end if not toggle then SuperVillain.db.framelocations.GM_MOVE = "TOPLEFTSVUIParentTOPLEFT250-25" - SuperVillain.db.framelocations.LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0350" - SuperVillain.db.framelocations.AltPowerBar_MOVE = "TOPSVUIParentTOP0-40" - SuperVillain.db.framelocations.LossOfControlFrame_MOVE = "BOTTOMSVUIParentBOTTOM0350" + SuperVillain.db.framelocations.SVUI_LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0350" + SuperVillain.db.framelocations.SVUI_AltPowerBar_MOVE = "TOPSVUIParentTOP0-40" + SuperVillain.db.framelocations.LoC_MOVE = "BOTTOMSVUIParentBOTTOM0350" SuperVillain.db.framelocations.BNET_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-250" else SuperVillain.db.framelocations.GM_MOVE = "TOPLEFTSVUIParentTOPLEFT344-25" - SuperVillain.db.framelocations.LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0254" - SuperVillain.db.framelocations.AltPowerBar_MOVE = "TOPSVUIParentTOP0-39" - SuperVillain.db.framelocations.LossOfControlFrame_MOVE = "BOTTOMSVUIParentBOTTOM0443" + SuperVillain.db.framelocations.SVUI_LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0254" + SuperVillain.db.framelocations.SVUI_AltPowerBar_MOVE = "TOPSVUIParentTOP0-39" + SuperVillain.db.framelocations.LoC_MOVE = "BOTTOMSVUIParentBOTTOM0443" SuperVillain.db.framelocations.BNET_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-248" end end @@ -637,7 +637,7 @@ local function SetPage(newPage) SVUI_InstallOption2Button:Show() SVUI_InstallOption2Button:SetScript("OnClick", function() SuperVillain:SetUserScreen("low") - SVUI_SetupHolder.Desc1:SetText(L["|cffFF9F00"..LOW" "..RESOLUTION.."|r"]) + SVUI_SetupHolder.Desc1:SetText(L["|cffFF9F00"..LOW.." "..RESOLUTION.."|r"]) SVUI_SetupHolder.Desc2:SetText(L["Why are you playing this on what I would assume is a calculator display?"]) SVUI_SetupHolder.Desc3:SetText(L["Enjoy the ONE incredible pixel that fits on this screen."]) end) diff --git a/Interface/AddOns/SVUI/system/mentalo.lua b/Interface/AddOns/SVUI/system/mentalo.lua index c2b7b9b..f22bae0 100644 --- a/Interface/AddOns/SVUI/system/mentalo.lua +++ b/Interface/AddOns/SVUI/system/mentalo.lua @@ -375,10 +375,15 @@ end local function FindLoc(frame) if not frame then return end local anchor1, parent, anchor2, x, y = frame:GetPoint() + local parentName if not parent then - parent = SVUIParent - end - return format("%s\031%s\031%s\031%d\031%d", anchor1, parent:GetName(), anchor2, parsefloat(x), parsefloat(y)) + parentName = "SVUIParent" + elseif not parent:GetName() then + parentName = "SVUI_Player" + else + parentName = parent:GetName() + end + return ("%s\031%s\031%s\031%d\031%d"):format(anchor1, parentName, anchor2, parsefloat(x), parsefloat(y)) end local function ghost(list, alpha) @@ -392,11 +397,11 @@ local function ghost(list, alpha) end local function SetSVMovable(frame, moveName, title, raised, snap, dragStopFunc) - if not frame then return end + if(not frame) then return end if SuperVillain.MentaloFrames[moveName].Created then return end if raised == nil then raised = true end local movable = CreateFrame("Button", moveName, SuperVillain.UIParent) - movable:SetFrameLevel(frame:GetFrameLevel() + 1) + movable:SetFrameLevel(frame:GetFrameLevel() + 1) movable:SetClampedToScreen(true) movable:SetWidth(frame:GetWidth()) movable:SetHeight(frame:GetHeight()) @@ -584,7 +589,10 @@ function SuperVillain:SaveMovableOrigin(frame) SuperVillain.MentaloFrames[frame]["postdrag"](_G[frame], Pinpoint(_G[frame])) end -function SuperVillain:SetSVMovable(frame, moveName, title, raised, snapOffset, dragStopFunc, movableGroup) +function SuperVillain:SetSVMovable(frame, title, raised, snapOffset, dragStopFunc, movableGroup, overrideName) + if(not frame or (not overrideName and not frame:GetName())) then return end + local frameName = overrideName or frame:GetName() + local moveName = ("%s_MOVE"):format(frameName) if not movableGroup then movableGroup = "ALL, GENERAL" end if SuperVillain.MentaloFrames[moveName] == nil then SuperVillain.MentaloFrames[moveName] = {} @@ -711,10 +719,7 @@ function SuperVillain:LoadMovables() end self:SetMentaloAlphas() SetSVMovable(parent, name, text, overlay, snapoffset, postdrag) - end - -- for _, name in pairs(MentaloUIFrames) do - -- self:SetSVMovable(_G[name], name .. "_MOVE", name) - -- end + end end function SuperVillain:UseMentalo(isConfigMode, configType) diff --git a/Interface/AddOns/SVUI_ConfigOMatic/libs/AceGUI-3.0/AceGUI-3.0.lua b/Interface/AddOns/SVUI_ConfigOMatic/libs/AceGUI-3.0/AceGUI-3.0.lua index 9853644..1430aca 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/libs/AceGUI-3.0/AceGUI-3.0.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/libs/AceGUI-3.0/AceGUI-3.0.lua @@ -57,6 +57,327 @@ local WidgetRegistry = AceGUI.WidgetRegistry local LayoutRegistry = AceGUI.LayoutRegistry local WidgetVersions = AceGUI.WidgetVersions +--[[ SUPERVILLAIN MOD ]]-- +local function Ace3_OnEnter(b) + b:SetBackdropBorderColor(0,1,1) +end + +local function Ace3_OnLeave(b) + b:SetBackdropBorderColor(0,0,0,1) +end + +local function Ace3_PaginationStyle(button, isVertical) + if(not button or not button:GetName() or (button and button.appliedStyle)) then return end + local c,d,e; + local leftDown = (button:GetName() and (button:GetName():lower()):find('left')) or (button:GetName():lower()):find('prev') or (button:GetName():lower()):find('decrement') + button:Formula409() + button:SetNormalTexture(nil) + button:SetPushedTexture(nil) + button:SetHighlightTexture(nil) + button:SetDisabledTexture(nil) + if not button.icon then + button.icon=button:CreateTexture(nil,'ARTWORK') + button.icon:Size(13) + button.icon:SetPoint('CENTER') + button.icon:SetTexture([[Interface\Buttons\SquareButtonTextures]]) + button.icon:SetTexCoord(0.01562500,0.20312500,0.01562500,0.20312500) + button:SetScript('OnMouseDown',function(g) + if g:IsEnabled()then + g.icon:SetPoint("CENTER",-1,-1) + end + end) + button:SetScript('OnMouseUp',function(g) + g.icon:SetPoint("CENTER",0,0) + end) + button:SetScript('OnDisable',function(g) + SetDesaturation(g.icon,true) + g.icon:SetAlpha(0.5) + end) + button:SetScript('OnEnable',function(g) + SetDesaturation(g.icon,false) + g.icon:SetAlpha(1.0) + end) + if not button:IsEnabled()then + button:GetScript('OnDisable')(button) + end + end + if isVertical then + if leftDown then SquareButton_SetIcon(button,'UP')else SquareButton_SetIcon(button,'DOWN')end + else + if leftDown then SquareButton_SetIcon(button,'LEFT')else SquareButton_SetIcon(button,'RIGHT')end + end + button:SetButtonTemplate() + button:Size((button:GetWidth() - 7),(button:GetHeight() - 7)) + button.appliedStyle = true +end + +local function Ace3_ScrollStyle(e, f) + if _G[e:GetName().."BG"]then + _G[e:GetName().."BG"]:SetTexture(nil) + end + if _G[e:GetName().."Track"]then + _G[e:GetName().."Track"]:SetTexture(nil) + end + if _G[e:GetName().."Top"]then + _G[e:GetName().."Top"]:SetTexture(nil) + _G[e:GetName().."Bottom"]:SetTexture(nil) + _G[e:GetName().."Middle"]:SetTexture(nil) + end + if _G[e:GetName().."ScrollUpButton"] and _G[e:GetName().."ScrollDownButton"] then + _G[e:GetName().."ScrollUpButton"]:Formula409() + if not _G[e:GetName().."ScrollUpButton"].icon then + Ace3_PaginationStyle(_G[e:GetName().."ScrollUpButton"]) + SquareButton_SetIcon(_G[e:GetName().."ScrollUpButton"], "UP") + _G[e:GetName().."ScrollUpButton"]:Size(_G[e:GetName().."ScrollUpButton"]:GetWidth()+7, _G[e:GetName().."ScrollUpButton"]:GetHeight()+7) + end + _G[e:GetName().."ScrollDownButton"]:Formula409() + if not _G[e:GetName().."ScrollDownButton"].icon then + Ace3_PaginationStyle(_G[e:GetName().."ScrollDownButton"]) + SquareButton_SetIcon(_G[e:GetName().."ScrollDownButton"], "DOWN") + _G[e:GetName().."ScrollDownButton"]:Size(_G[e:GetName().."ScrollDownButton"]:GetWidth()+7, _G[e:GetName().."ScrollDownButton"]:GetHeight()+7) + end + if not e.styledBackground then + e.styledBackground = CreateFrame("Frame", nil, e) + e.styledBackground:Point("TOPLEFT", _G[e:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1) + e.styledBackground:Point("BOTTOMRIGHT", _G[e:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1) + e.styledBackground:SetPanelTemplate("Inset", true) + end + if e:GetThumbTexture()then + if not f then + f = 3 + end + e:GetThumbTexture():SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") + end + end +end + +local function Ace3_ButtonStyle(h, i, j) + if h.Left then h.Left:SetAlpha(0)end + if h.Middle then h.Middle:SetAlpha(0)end + if h.Right then h.Right:SetAlpha(0)end + if h.SetNormalTexture then h:SetNormalTexture("")end + if h.SetHighlightTexture then h:SetHighlightTexture("")end + if h.SetPushedTexture then h:SetPushedTexture("")end + if h.SetDisabledTexture then h:SetDisabledTexture("")end + if i then h:Formula409()end + if not h.template and not j then h:SetFixedPanelTemplate("Button")end + h:HookScript("OnEnter", Ace3_OnEnter)h:HookScript("OnLeave", Ace3_OnLeave) +end + +local preWidget = function(self, widget) + local n = widget.type; + if n == "MultiLineEditBox"then + local e = widget.frame; + e:SetFixedPanelTemplate("Pattern") + if not widget.scrollBG.template then + widget.scrollBG:SetFixedPanelTemplate("Inset") + end + Ace3_ButtonStyle(widget.button) + Ace3_ScrollStyle(widget.scrollBar) + widget.scrollBar:SetPoint("RIGHT", e, "RIGHT", 0-4) + widget.scrollBG:SetPoint("TOPRIGHT", widget.scrollBar, "TOPLEFT", -2, 19) + widget.scrollBG:SetPoint("BOTTOMLEFT", widget.button, "TOPLEFT") + widget.scrollFrame:SetPoint("BOTTOMRIGHT", widget.scrollBG, "BOTTOMRIGHT", -4, 8) + elseif n == "CheckBox"then + widget.checkbg:MUNG() + widget.highlight:MUNG() + if not widget.styledCheckBG then + widget.styledCheckBG = CreateFrame("Frame", nil, widget.frame) + widget.styledCheckBG:FillInner(widget.check) + widget.styledCheckBG:SetFixedPanelTemplate("Inset") + end + widget.check:SetParent(widget.styledCheckBG) + elseif n == "Dropdown"then + local e = widget.dropdown; + local o = widget.button; + local p = widget.text; + e:Formula409() + o:ClearAllPoints() + o:Point("RIGHT", e, "RIGHT", -20, 0) + o:SetFrameLevel(o:GetFrameLevel() + 1) + Ace3_PaginationStyle(o, true) + if not e.Panel then + e:SetPanelTemplate("Inset") + e.Panel:Point("TOPLEFT", e, "TOPLEFT", 20, -2) + e.Panel:Point("BOTTOMRIGHT", e, "BOTTOMRIGHT", -20, 2) + local level = e:GetFrameLevel() + if(level > 0) then + e.Panel:SetFrameLevel(level - 1) + else + e.Panel:SetFrameLevel(0) + end + end + o:SetParent(e.Panel) + p:SetParent(e.Panel) + o:HookScript("OnClick", function(s) + local self = s.obj; + self.pullout.frame:SetFixedPanelTemplate("Default") + end) + elseif n == "LSM30_Font" or n == "LSM30_Sound" or n == "LSM30_Border" or n == "LSM30_Background" or n == "LSM30_Statusbar" then + local e = widget.frame; + local o = e.dropButton; + local p = e.text; + e:Formula409() + Ace3_PaginationStyle(o, true) + e.text:ClearAllPoints() + e.text:Point("RIGHT", o, "LEFT", -2, 0) + o:ClearAllPoints() + o:Point("RIGHT", e, "RIGHT", -10, -6) + if not e.Panel then + e:SetFixedPanelTemplate("Inset") + if n == "LSM30_Font"then + e.Panel:Point("TOPLEFT", 20, -17) + elseif n == "LSM30_Sound"then + e.Panel:Point("TOPLEFT", 20, -17) + widget.soundbutton:SetParent(e.Panel) + widget.soundbutton:ClearAllPoints() + widget.soundbutton:Point("LEFT", e.Panel, "LEFT", 2, 0) + elseif n == "LSM30_Statusbar"then + e.Panel:Point("TOPLEFT", 20, -17) + widget.bar:SetParent(e.Panel) + widget.bar:FillInner() + elseif n == "LSM30_Border"or n == "LSM30_Background"then + e.Panel:Point("TOPLEFT", 42, -16) + end + e.Panel:Point("BOTTOMRIGHT", o, "BOTTOMRIGHT", 2, -2) + end + o:SetParent(e.Panel) + p:SetParent(e.Panel) + o:HookScript("OnClick", function(s, o) + local self = s.obj; + if(self.dropdown and not self.dropdown.Panel) then + local e = self.dropdown + e:SetPanelTemplate("Inset") + e.Panel:Point("TOPLEFT", e, "TOPLEFT", 20, -2) + e.Panel:Point("BOTTOMRIGHT", e, "BOTTOMRIGHT", -20, 2) + local level = e:GetFrameLevel() + if(level > 0) then + e.Panel:SetFrameLevel(level - 1) + else + e.Panel:SetFrameLevel(0) + end + end + end) + elseif n == "EditBox" then + local e = widget.editbox; + local o = widget.button; + _G[e:GetName().."Left"]:MUNG() + _G[e:GetName().."Middle"]:MUNG() + _G[e:GetName().."Right"]:MUNG() + e:Height(17) + e:SetFixedPanelTemplate("Inset") + local level = e:GetFrameLevel() + if(level > 0) then + e.Panel:SetFrameLevel(level - 1) + else + e.Panel:SetFrameLevel(0) + end + Ace3_ButtonStyle(o) + elseif n == "Button"then + local e = widget.frame; + Ace3_ButtonStyle(e, nil, true) + e:Formula409() + e:SetFixedPanelTemplate("Button", true) + e.Panel:FillInner() + widget.text:SetParent(e.Panel) + elseif n == "Slider"then + local e = widget.slider; + local t = widget.editbox; + local u = widget.lowtext; + local v = widget.hightext; + local w = 20; + e:Formula409() + e:SetFixedPanelTemplate("Inset") + e:Height(w) + e:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") + e:GetThumbTexture():SetVertexColor(0.8, 0.8, 0.8) + t:SetFixedPanelTemplate("Inset") + t:Height(15) + t:Point("TOP", e, "BOTTOM", 0, -1) + u:SetPoint("TOPLEFT", e, "BOTTOMLEFT", 2, -2) + v:SetPoint("TOPRIGHT", e, "BOTTOMRIGHT", -2, -2) + end + return widget +end + +local externaltest = false; +local preContainer = function(self, widget) + local n = widget.type; + if n == "ScrollFrame" then + local e = widget.scrollbar; + Ace3_ScrollStyle(e) + elseif n == "Window" then + local e = widget.content:GetParent() + e:SetPanelTemplate("Halftone") + elseif n == "InlineGroup" or n == "TreeGroup" or n == "TabGroup" or n == "SimpleGroup" or n == "Frame" or n == "DropdownGroup" then + local e = widget.content:GetParent() + if n == "Frame" then + e:Formula409() + for z = 1, e:GetNumChildren()do + local A = select(z, e:GetChildren()) + if A:GetObjectType() == "Button"and A:GetText() then + Ace3_ButtonStyle(A) + else + A:Formula409() + end + end + end + if not widget.treeframe then + if not externaltest then + e:SetPanelTemplate("Halftone") + e.Panel:SetFrameLevel(0) + externaltest = true + else + e:SetFixedPanelTemplate("Default") + end + end + if widget.treeframe then + widget.treeframe:SetFixedPanelTemplate("Inset") + e:Point("TOPLEFT", widget.treeframe, "TOPRIGHT", 1, 0) + local B = widget.CreateButton; + widget.CreateButton = function(self) + local o = B(self) + o.toggle:Formula409() + o.toggle.SetNormalTexture = NOOP; + o.toggle.SetPushedTexture = NOOP; + o.toggleText = o.toggle:CreateFontString(nil, "OVERLAY") + o.toggleText:SetFontTemplate(nil, 19) + o.toggleText:SetPoint("CENTER") + o.toggleText:SetText("+") + return o + end + local C = widget.RefreshTree; + widget.RefreshTree = function(self, D) + C(self, D) + if not self.tree then return end + local E = self.status or self.localstatus; + local F = E.groups; + local G = self.lines; + local H = self.buttons; + for z, I in pairs(G)do + local o = H[z] + if F[I.uniquevalue]and o then + o.toggleText:SetText("-") + elseif o then + o.toggleText:SetText("+") + end + end + end + end + if n == "TabGroup" then + local createTab = widget.CreateTab; + widget.CreateTab = function(self, arg) + local tab = createTab(self, arg) + tab:Formula409() + return tab + end + end + if widget.scrollbar then Ace3_ScrollStyle(widget.scrollbar) end + end + return widget +end +--[[ END MOD ]]-- + --[[ xpcall safecall implementation ]] @@ -519,6 +840,7 @@ do --- Register a widget-class as a container for newly created widgets. -- @param widget The widget class function AceGUI:RegisterAsContainer(widget) + widget = preContainer(self, widget) widget.children = {} widget.userdata = {} widget.events = {} @@ -535,6 +857,7 @@ do --- Register a widget-class as a widget. -- @param widget The widget class function AceGUI:RegisterAsWidget(widget) + widget = preWidget(self, widget) widget.userdata = {} widget.events = {} widget.base = WidgetBase diff --git a/Interface/AddOns/SVUI_ConfigOMatic/libs/_load.xml b/Interface/AddOns/SVUI_ConfigOMatic/libs/_load.xml index 13d8073..9f7c4e1 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/libs/_load.xml +++ b/Interface/AddOns/SVUI_ConfigOMatic/libs/_load.xml @@ -1 +1 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Include file="AceGUI-3.0\AceGUI-3.0.xml"/> <Include file="AceConfig-3.0\AceConfig-3.0.xml"/> <Include file="AceGUI-3.0-SharedMediaWidgets\widget.xml"/> </Ui> \ No newline at end of file +<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Include file="AceGUI-3.0\AceGUI-3.0.xml"/> <Include file="AceConfig-3.0\AceConfig-3.0.xml"/> <Include file="AceGUI-3.0-SharedMediaWidgets\widget.xml"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua index efd88ab..3d32541 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local MOD = SuperVillain.Registry:Expose('SVChat'); -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua index eb639a4..0169298 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local MOD = SuperVillain.Registry:Expose('SVHenchmen'); -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua index 1005cb3..204da5c 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua @@ -134,14 +134,14 @@ SuperVillain.Options.args.SVMap = { type = "select", name = L["Location Text"], values = textSelect, - set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:UpdateMinimapTexts()end + set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:ReLoad()end }, playercoords = { order = 2, type = "select", name = L["Player Coords"], values = textSelect, - set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:SetMiniMapCoords()end + set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:ReLoad()end } } }, @@ -219,7 +219,7 @@ SuperVillain.Options.args.SVMap = { type = "toggle", name = L["Tiny Map"], desc = L["Don't scale the large world map to block out sides of the screen."], - set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:UpdateWorldMapConfig()end + set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:ReLoad()end }, mapAlpha = { order = 2, @@ -230,7 +230,7 @@ SuperVillain.Options.args.SVMap = { min = 0, max = 1, step = 0.01, - set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:UpdateWorldMapConfig()end + set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:ReLoad()end }, } }, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua index a72a12c..c3b9a96 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua @@ -282,20 +282,10 @@ SuperVillain.Options.args.SVUnit.args.player={ type = "range", order = 4, width = "full", - name = L["Height"], + name = L["Size"], min = 15, max = 45, step = 1 - }, - detachedWidth = { - type = "range", - order = 5, - width = "full", - name = L["Detached Width"], - disabled = function()return not SuperVillain.db.SVUnit["player"]["classbar"].detachFromFrame end, - min = 15, - max = 450, - step = 1 } } } diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index ffaa82c..5bfdbec 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -45,7 +45,6 @@ SVUIAddOn = StyleVillain; _G["StyleVillain"] = SVUIAddOn; -local DOCK = SuperVillain.Registry:Expose('SVDock'); local SuperDockWindow = _G["SuperDockWindow"]; local SuperDockletMain = _G["SuperDockletMain"]; local SuperDockletExtra = _G["SuperDockletExtra"]; @@ -557,84 +556,88 @@ end; local RegisterAddonDocklets = function() local main = SuperVillain.db.SVDock.docklets.DockletMain; local alternate = SuperVillain.db.SVDock.docklets.enableExtra and SuperVillain.db.SVDock.docklets.DockletExtra or ""; - + local tipLeft, tipRight = "", ""; if main == nil or main == "None" then return end; if find(main, "Skada") or find(alternate, "Skada") then - if DOCK:IsDockletReady("Skada") then + if SuperVillain:IsDockletReady("Skada") then StyleVillain:Docklet_Skada() if find(alternate, "Skada") and SuperDockletExtra.FrameName ~= "SkadaHolder2" then - DOCK.ExtraToolTip = "Skada"; - DOCK:RegisterExtraDocklet("SkadaHolder2") + tipRight = "and Skada"; + SuperVillain:RegisterExtraDocklet("SkadaHolder2") --StyleVillain.DockedParent["Skada"] = SuperDockletExtra end if find(main, "Skada") and SuperDockletMain.FrameName ~= "SkadaHolder" then - DOCK.MainToolTip = "Skada"; - DOCK:RegisterMainDocklet("SkadaHolder") + tipLeft = "Skada"; + SuperVillain:RegisterMainDocklet("SkadaHolder") --StyleVillain.DockedParent["Skada"] = SuperDockletMain end end; end; if main == "Omen" or alternate == "Omen" then - if DOCK:IsDockletReady("Omen") then + if SuperVillain:IsDockletReady("Omen") then if alternate == "Omen" and SuperDockletExtra.FrameName ~= "OmenAnchor" then - DOCK.ExtraToolTip = "Omen"; - DOCK:RegisterExtraDocklet("OmenAnchor") + tipRight = "and Omen"; + SuperVillain:RegisterExtraDocklet("OmenAnchor") StyleVillain:Docklet_Omen(SuperDockletExtra) StyleVillain.DockedParent["Omen"] = SuperDockletExtra elseif SuperDockletMain.FrameName ~= "OmenAnchor" then - DOCK.MainToolTip = "Omen"; - DOCK:RegisterMainDocklet("OmenAnchor") + tipLeft = "Omen"; + SuperVillain:RegisterMainDocklet("OmenAnchor") StyleVillain:Docklet_Omen(SuperDockletMain) StyleVillain.DockedParent["Omen"] = SuperDockletMain end end; end; if main == "Recount" or alternate == "Recount" then - if DOCK:IsDockletReady("Recount") then + if SuperVillain:IsDockletReady("Recount") then if alternate == "Recount" and SuperDockletExtra.FrameName ~= "Recount_MainWindow" then - DOCK.ExtraToolTip = "Recount"; - DOCK:RegisterExtraDocklet("Recount_MainWindow") + tipRight = "and Recount"; + SuperVillain:RegisterExtraDocklet("Recount_MainWindow") StyleVillain:Docklet_Recount(SuperDockletExtra) StyleVillain.DockedParent["Recount"] = SuperDockletExtra elseif SuperDockletMain.FrameName ~= "Recount_MainWindow" then - DOCK.MainToolTip = "Recount"; - DOCK:RegisterMainDocklet("Recount_MainWindow") + tipLeft = "Recount"; + SuperVillain:RegisterMainDocklet("Recount_MainWindow") StyleVillain:Docklet_Recount(SuperDockletMain) StyleVillain.DockedParent["Recount"] = SuperDockletMain end end; end; if main == "TinyDPS" or alternate == "TinyDPS" then - if DOCK:IsDockletReady("TinyDPS") then + if SuperVillain:IsDockletReady("TinyDPS") then if alternate == "TinyDPS" and SuperDockletExtra.FrameName ~= "tdpsFrame" then - DOCK.ExtraToolTip = "TinyDPS"; - DOCK:RegisterExtraDocklet("tdpsFrame") + tipRight = "and TinyDPS"; + SuperVillain:RegisterExtraDocklet("tdpsFrame") StyleVillain:Docklet_TinyDPS(SuperDockletExtra) StyleVillain.DockedParent["TinyDPS"] = SuperDockletExtra elseif SuperDockletMain.FrameName ~= "tdpsFrame" then - DOCK.MainToolTip = "TinyDPS"; - DOCK:RegisterMainDocklet("tdpsFrame") + tipLeft = "TinyDPS"; + SuperVillain:RegisterMainDocklet("tdpsFrame") StyleVillain:Docklet_TinyDPS(SuperDockletMain) StyleVillain.DockedParent["TinyDPS"] = SuperDockletMain end end; end; if main == "alDamageMeter" or alternate == "alDamageMeter" then - if DOCK:IsDockletReady("alDamageMeter") then + if SuperVillain:IsDockletReady("alDamageMeter") then if alternate == "alDamageMeter" and SuperDockletExtra.FrameName ~= "alDamagerMeterFrame" then - DOCK.ExtraToolTip = "alDamageMeter"; - DOCK:RegisterExtraDocklet("alDamagerMeterFrame") + tipRight = "and alDamageMeter"; + SuperVillain:RegisterExtraDocklet("alDamagerMeterFrame") StyleVillain:Docklet_alDamageMeter(SuperDockletExtra) StyleVillain.DockedParent["alDamageMeter"] = SuperDockletExtra elseif SuperDockletMain.FrameName ~= "alDamagerMeterFrame" then - DOCK.MainToolTip = "alDamageMeter"; - DOCK:RegisterMainDocklet("alDamagerMeterFrame") + tipLeft = "alDamageMeter"; + SuperVillain:RegisterMainDocklet("alDamagerMeterFrame") StyleVillain:Docklet_alDamageMeter(SuperDockletMain) StyleVillain.DockedParent["alDamageMeter"] = SuperDockletMain end end; end; + + if(_G["SVUI_AddonDocklet"]) then + _G["SVUI_AddonDocklet"].TText = ("%s%s"):format(tipLeft, tipRight) + end end; --[[ ########################################################## @@ -671,8 +674,10 @@ local function LoadStyleOMatic() StyleVillain.Alert = alert; StyleVillain:LoadStyles(); - NewHook(DOCK, "ReloadDocklets", RegisterAddonDocklets); - DOCK:ReloadDocklets(); + + NewHook(SuperVillain, "ReloadDocklets", RegisterAddonDocklets); + SuperVillain:ReloadDocklets(); + SuperVillain.DynamicOptions["SVStyle"] = {key = "addons", data = StyleVillain.OptionsCache}; SVUIAddonEventHandler:RegisterEvent('ADDON_LOADED'); end @@ -681,10 +686,6 @@ SuperVillain.Registry:NewScript(LoadStyleOMatic) SuperVillain.Registry:NewPlugin(SVUIAddOnName, StyleVillain.SetConfigOptions) local Registry_OnEvent = function(self, event, ...) - -- print("--------------------------------------") - -- print("Registered Event Fired: ") - -- print(event) - -- print("--------------------------------------") if(event == "ADDON_LOADED") then local addon = select(1, ...) if StyleVillain.PassiveAddons[addon] then diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/archeology.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/archeology.lua index bee6a37..63e6c84 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/archeology.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/archeology.lua @@ -21,10 +21,10 @@ ARCHEOLOGYFRAME STYLER ########################################################## ]]-- --240 24 -local progressBarHolder = CreateFrame("Frame", nil) +local progressBarHolder = CreateFrame("Frame", "SVUI_ArcheologyProgressBar", nil) progressBarHolder:SetSize(240, 24) progressBarHolder:SetPoint("BOTTOM", CastingBarFrame, "TOP", 0, 10) -SuperVillain:SetSVMovable(progressBarHolder, "ArcheologyProgressBar_MOVE", "Archeology Progress Bar") +SuperVillain:SetSVMovable(progressBarHolder, "Archeology Progress Bar") local function ArchaeologyStyle() if SuperVillain.db.SVStyle.blizzard.enable ~= true or SuperVillain.db.SVStyle.blizzard.archaeology ~= true then return end ArchaeologyFrame:Formula409() diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua index f55d97b..d2c3661 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua @@ -15,7 +15,6 @@ S U P E R - V I L L A I N - U I By: Munglunch # --]] local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local AceGUI = LibStub("AceGUI-3.0", true); local NOOP = function() end --[[ ########################################################## @@ -45,285 +44,4 @@ end STYLE LOADING ########################################################## ]]-- -STYLE:SaveCustomStyle(SVUICoreStyle) ---[[ -########################################################## -CONFIG STYLER -########################################################## -]]-- -local function Ace3_OnEnter(b) - b:SetBackdropBorderColor(unpack(SuperVillain.Media.color.highlight)) -end -local function Ace3_OnLeave(b) - b:SetBackdropBorderColor(0,0,0,1) -end -local function Ace3_ScrollStyle(e, f) - if _G[e:GetName().."BG"]then - _G[e:GetName().."BG"]:SetTexture(nil) - end - if _G[e:GetName().."Track"]then - _G[e:GetName().."Track"]:SetTexture(nil) - end - if _G[e:GetName().."Top"]then - _G[e:GetName().."Top"]:SetTexture(nil) - _G[e:GetName().."Bottom"]:SetTexture(nil) - _G[e:GetName().."Middle"]:SetTexture(nil) - end - if _G[e:GetName().."ScrollUpButton"] and _G[e:GetName().."ScrollDownButton"] then - _G[e:GetName().."ScrollUpButton"]:Formula409() - if not _G[e:GetName().."ScrollUpButton"].icon then - STYLE:ApplyPaginationStyle(_G[e:GetName().."ScrollUpButton"]) - SquareButton_SetIcon(_G[e:GetName().."ScrollUpButton"], "UP") - _G[e:GetName().."ScrollUpButton"]:Size(_G[e:GetName().."ScrollUpButton"]:GetWidth()+7, _G[e:GetName().."ScrollUpButton"]:GetHeight()+7) - end - _G[e:GetName().."ScrollDownButton"]:Formula409() - if not _G[e:GetName().."ScrollDownButton"].icon then - STYLE:ApplyPaginationStyle(_G[e:GetName().."ScrollDownButton"]) - SquareButton_SetIcon(_G[e:GetName().."ScrollDownButton"], "DOWN") - _G[e:GetName().."ScrollDownButton"]:Size(_G[e:GetName().."ScrollDownButton"]:GetWidth()+7, _G[e:GetName().."ScrollDownButton"]:GetHeight()+7) - end - if not e.styledBackground then - e.styledBackground = CreateFrame("Frame", nil, e) - e.styledBackground:Point("TOPLEFT", _G[e:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1) - e.styledBackground:Point("BOTTOMRIGHT", _G[e:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1) - e.styledBackground:SetPanelTemplate("Inset", true) - end - if e:GetThumbTexture()then - if not f then - f = 3 - end - e:GetThumbTexture():SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") - end - end -end - -local function Ace3_ButtonStyle(h, i, j) - if h.Left then h.Left:SetAlpha(0)end - if h.Middle then h.Middle:SetAlpha(0)end - if h.Right then h.Right:SetAlpha(0)end - if h.SetNormalTexture then h:SetNormalTexture("")end - if h.SetHighlightTexture then h:SetHighlightTexture("")end - if h.SetPushedTexture then h:SetPushedTexture("")end - if h.SetDisabledTexture then h:SetDisabledTexture("")end - if i then h:Formula409()end - if not h.template and not j then h:SetFixedPanelTemplate("Button")end - h:HookScript("OnEnter", Ace3_OnEnter)h:HookScript("OnLeave", Ace3_OnLeave) -end - -local function Ace3_PaginationStyle(...) - STYLE:ApplyPaginationStyle(...) -end - -local function StyleAce3() - if not AceGUI then return end - local savedFn = AceGUI.RegisterAsWidget; - AceGUI.RegisterAsWidget = function(b, m) - local n = m.type; - if n == "MultiLineEditBox"then - local e = m.frame; - e:SetFixedPanelTemplate("Pattern") - if not m.scrollBG.template then - m.scrollBG:SetFixedPanelTemplate("Inset") - end - Ace3_ButtonStyle(m.button) - Ace3_ScrollStyle(m.scrollBar) - m.scrollBar:SetPoint("RIGHT", e, "RIGHT", 0-4) - m.scrollBG:SetPoint("TOPRIGHT", m.scrollBar, "TOPLEFT", -2, 19) - m.scrollBG:SetPoint("BOTTOMLEFT", m.button, "TOPLEFT") - m.scrollFrame:SetPoint("BOTTOMRIGHT", m.scrollBG, "BOTTOMRIGHT", -4, 8) - elseif n == "CheckBox"then - m.checkbg:MUNG()m.highlight:MUNG() - if not m.styledCheckBG then - m.styledCheckBG = CreateFrame("Frame", nil, m.frame) - m.styledCheckBG:FillInner(m.check) - m.styledCheckBG:SetFixedPanelTemplate("Inset") - end - m.check:SetParent(m.styledCheckBG) - elseif n == "Dropdown"then - local e = m.dropdown; - local o = m.button; - local p = m.text; - e:Formula409() - o:ClearAllPoints() - o:Point("RIGHT", e, "RIGHT", -20, 0) - o:SetFrameLevel(o:GetFrameLevel() + 1) - Ace3_PaginationStyle(o, true) - if not e.Panel then - e:SetPanelTemplate("Inset") - e.Panel:Point("TOPLEFT", e, "TOPLEFT", 20, -2) - e.Panel:Point("BOTTOMRIGHT", e, "BOTTOMRIGHT", -20, 2) - local level = e:GetFrameLevel() - if(level > 0) then - e.Panel:SetFrameLevel(level - 1) - else - e.Panel:SetFrameLevel(0) - end - end - o:SetParent(e.Panel) - p:SetParent(e.Panel) - o:HookScript("OnClick", function(s) - local b = s.obj; - b.pullout.frame:SetFixedPanelTemplate("Default") - end) - elseif n == "LSM30_Font" or n == "LSM30_Sound" or n == "LSM30_Border" or n == "LSM30_Background" or n == "LSM30_Statusbar" then - local e = m.frame; - local o = e.dropButton; - local p = e.text; - e:Formula409() - Ace3_PaginationStyle(o, true) - e.text:ClearAllPoints() - e.text:Point("RIGHT", o, "LEFT", -2, 0) - o:ClearAllPoints() - o:Point("RIGHT", e, "RIGHT", -10, -6) - if not e.Panel then - e:SetFixedPanelTemplate("Inset") - if n == "LSM30_Font"then - e.Panel:Point("TOPLEFT", 20, -17) - elseif n == "LSM30_Sound"then - e.Panel:Point("TOPLEFT", 20, -17) - m.soundbutton:SetParent(e.Panel) - m.soundbutton:ClearAllPoints() - m.soundbutton:Point("LEFT", e.Panel, "LEFT", 2, 0) - elseif n == "LSM30_Statusbar"then - e.Panel:Point("TOPLEFT", 20, -17) - m.bar:SetParent(e.Panel) - m.bar:FillInner() - elseif n == "LSM30_Border"or n == "LSM30_Background"then - e.Panel:Point("TOPLEFT", 42, -16) - end - e.Panel:Point("BOTTOMRIGHT", o, "BOTTOMRIGHT", 2, -2) - end - o:SetParent(e.Panel) - p:SetParent(e.Panel) - o:HookScript("OnClick", function(s, o)local b = s.obj; - if(b.dropdown and not b.dropdown.Panel) then - local e = b.dropdown - e:SetPanelTemplate("Inset") - e.Panel:Point("TOPLEFT", e, "TOPLEFT", 20, -2) - e.Panel:Point("BOTTOMRIGHT", e, "BOTTOMRIGHT", -20, 2) - local level = e:GetFrameLevel() - if(level > 0) then - e.Panel:SetFrameLevel(level - 1) - else - e.Panel:SetFrameLevel(0) - end - end - end) - elseif n == "EditBox" then - local e = m.editbox; - local o = m.button; - _G[e:GetName().."Left"]:MUNG() - _G[e:GetName().."Middle"]:MUNG() - _G[e:GetName().."Right"]:MUNG() - e:Height(17) - e:SetFixedPanelTemplate("Inset") - local level = e:GetFrameLevel() - if(level > 0) then - e.Panel:SetFrameLevel(level - 1) - else - e.Panel:SetFrameLevel(0) - end - Ace3_ButtonStyle(o) - elseif n == "Button"then - local e = m.frame;Ace3_ButtonStyle(e, nil, true) - e:Formula409() - e:SetFixedPanelTemplate("Button", true) - e.Panel:FillInner() - m.text:SetParent(e.Panel) - elseif n == "Slider"then - local e = m.slider; - local t = m.editbox; - local u = m.lowtext; - local v = m.hightext; - local w = 20; - e:Formula409() - e:SetFixedPanelTemplate("Inset") - e:Height(w) - e:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") - e:GetThumbTexture():SetVertexColor(0.8, 0.8, 0.8) - t:SetFixedPanelTemplate("Inset") - t:Height(15) - t:Point("TOP", e, "BOTTOM", 0, -1) - u:SetPoint("TOPLEFT", e, "BOTTOMLEFT", 2, -2) - v:SetPoint("TOPRIGHT", e, "BOTTOMRIGHT", -2, -2) - end - return savedFn(b, m) - end - local x = AceGUI.RegisterAsContainer; - local y = false; - AceGUI.RegisterAsContainer = function(b, m) - local n = m.type; - if n == "ScrollFrame" then - local e = m.scrollbar; - Ace3_ScrollStyle(e) - elseif n == "Window" then - local e = m.content:GetParent() - e:SetPanelTemplate("Halftone") - elseif n == "InlineGroup" or n == "TreeGroup" or n == "TabGroup" or n == "SimpleGroup" or n == "Frame" or n == "DropdownGroup" then - local e = m.content:GetParent() - if n == "Frame" then - e:Formula409() - for z = 1, e:GetNumChildren()do - local A = select(z, e:GetChildren()) - if A:GetObjectType() == "Button"and A:GetText() then - Ace3_ButtonStyle(A) - else - A:Formula409() - end - end - end - if not m.treeframe then - if not y then - e:SetPanelTemplate("Halftone") - e.Panel:SetFrameLevel(0) - y = true - else - e:SetFixedPanelTemplate("Default") - end - end - if m.treeframe then - m.treeframe:SetFixedPanelTemplate("Inset") - e:Point("TOPLEFT", m.treeframe, "TOPRIGHT", 1, 0) - local B = m.CreateButton;m.CreateButton = function(b) - local o = B(b)o.toggle:Formula409() - o.toggle.SetNormalTexture = NOOP; - o.toggle.SetPushedTexture = NOOP; - o.toggleText = o.toggle:CreateFontString(nil, "OVERLAY") - o.toggleText:SetFontTemplate(nil, 19) - o.toggleText:SetPoint("CENTER") - o.toggleText:SetText("+") - return o - end - local C = m.RefreshTree;m.RefreshTree = function(b, D)C(b, D) - if not b.tree then return end - local E = b.status or b.localstatus; - local F = E.groups; - local G = b.lines; - local H = b.buttons; - for z, I in pairs(G)do - local o = H[z] - if F[I.uniquevalue]and o then - o.toggleText:SetText("-") - elseif o then - o.toggleText:SetText("+") - end - end - end - end - if n == "TabGroup" then - local J = m.CreateTab;m.CreateTab = function(b, K) - local L = J(b, K)L:Formula409() - return L - end - end - if m.scrollbar then Ace3_ScrollStyle(m.scrollbar) end - end - return x(b, m) - end -end ---[[ -########################################################## -STYLE LOADING -########################################################## -]]-- -STYLE:SaveBlizzardStyle("SVUI_ConfigOMatic", StyleAce3) \ No newline at end of file +STYLE:SaveCustomStyle(SVUICoreStyle) \ No newline at end of file diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Omen.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Omen.lua index cd2801c..e14bf1b 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Omen.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Omen.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## OMEN @@ -45,7 +44,7 @@ local function StyleOmen() Omen.db.profile.TitleBar.UseSameBG = true hooksecurefunc(Omen, 'UpdateBackdrop', function(self) - if not DOCK.CurrentlyDocked["OmenAnchor"] then + if not SuperVillain.CurrentlyDocked["OmenAnchor"] then STYLE:ApplyFrameStyle(self.BarList, 'Transparent') self.Title:Formula409() self.Title:SetPanelTemplate("Default") @@ -56,7 +55,7 @@ local function StyleOmen() hooksecurefunc(Omen, 'Toggle', function(self) if InCombatLockdown() then return end; - if not DOCK.CurrentlyDocked["OmenAnchor"] then return end + if not SuperVillain.CurrentlyDocked["OmenAnchor"] then return end if self.Anchor:IsShown() then SuperDockWindow:Show() else diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Recount.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Recount.lua index a661858..44e69f5 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Recount.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Recount.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## RECOUNT @@ -104,7 +103,7 @@ local function StyleRecount() STYLE:ApplyScrollStyle(Recount_MainWindow_ScrollBarScrollBar) - Recount_MainWindow:HookScript('OnShow', function(self) if InCombatLockdown() then return end;if DOCK.CurrentlyDocked["Recount_MainWindow"] then SuperDockWindowRight:Show() end end) + Recount_MainWindow:HookScript('OnShow', function(self) if InCombatLockdown() then return end;if SuperVillain.CurrentlyDocked["Recount_MainWindow"] then SuperDockWindowRight:Show() end end) Recount.MainWindow.FileButton:HookScript('OnClick', function(self) if LibDropdownFrame0 then STYLE:ApplyFrameStyle(LibDropdownFrame0) end end) hooksecurefunc(Recount, 'ShowScrollbarElements', function(self, name) Recount_MainWindow_ScrollBarScrollBar:Show() end) diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Skada.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Skada.lua index 10e8df3..0e79ee4 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Skada.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Skada.lua @@ -32,7 +32,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local DOCK = SuperVillain.Registry:Expose('SVDock'); local activePanels = {}; --[[ ########################################################## @@ -81,7 +80,7 @@ local function StyleSkada() hooksecurefunc(Skada, 'ToggleWindow', function() if InCombatLockdown() then return end; - if not DOCK.CurrentlyDocked["SkadaHolder"] or not DOCK.CurrentlyDocked["SkadaHolder2"] then return end + if not SuperVillain.CurrentlyDocked["SkadaHolder"] or not SuperVillain.CurrentlyDocked["SkadaHolder2"] then return end for index, window in ipairs(Skada:GetWindows()) do if window:IsShown() then SuperDockWindow:Show() @@ -92,17 +91,17 @@ local function StyleSkada() end) hooksecurefunc(Skada, 'CreateWindow', function() - if DOCK.CurrentlyDocked["SkadaHolder"] or DOCK.CurrentlyDocked["SkadaHolder2"] then + if SuperVillain.CurrentlyDocked["SkadaHolder"] or SuperVillain.CurrentlyDocked["SkadaHolder2"] then STYLE:Docklet_Skada() end end) hooksecurefunc(Skada, 'DeleteWindow', function() - if DOCK.CurrentlyDocked["SkadaHolder"] or DOCK.CurrentlyDocked["SkadaHolder2"] then + if SuperVillain.CurrentlyDocked["SkadaHolder"] or SuperVillain.CurrentlyDocked["SkadaHolder2"] then STYLE:Docklet_Skada() end end) hooksecurefunc(Skada, 'UpdateDisplay', function() - if DOCK.CurrentlyDocked["SkadaHolder"] or DOCK.CurrentlyDocked["SkadaHolder2"] then + if SuperVillain.CurrentlyDocked["SkadaHolder"] or SuperVillain.CurrentlyDocked["SkadaHolder2"] then STYLE:Docklet_Skada() end end) diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/TinyDPS.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/TinyDPS.lua index 1341ba1..2d7a62d 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/TinyDPS.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/TinyDPS.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## TINYDPS @@ -41,7 +40,7 @@ local function StyleTinyDPS() STYLE:ApplyFrameStyle(tdpsFrame) tdpsFrame:HookScript("OnShow", function() if InCombatLockdown() then return end; - if DOCK.CurrentlyDocked["tdpsFrame"] then + if SuperVillain.CurrentlyDocked["tdpsFrame"] then SuperDockWindowRight:Show() end end) diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/alDamageMeter.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/alDamageMeter.lua index 5a16e81..c56c14b 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/alDamageMeter.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/alDamageMeter.lua @@ -31,7 +31,6 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local STYLE = _G.StyleVillain; -local DOCK = SuperVillain.Registry:Expose('SVDock'); --[[ ########################################################## ALDAMAGEMETER @@ -42,7 +41,7 @@ local function StyleALDamageMeter() STYLE:ApplyFrameStyle(alDamageMeterFrame) alDamageMeterFrame:HookScript('OnShow', function() if InCombatLockdown() then return end; - if DOCK.CurrentlyDocked["alDamagerMeterFrame"] then + if SuperVillain.CurrentlyDocked["alDamagerMeterFrame"] then SuperDockWindow:Show() end end)