diff --git a/Interface/AddOns/SVUI/AddOns - Shortcut.lnk b/Interface/AddOns/SVUI/AddOns - Shortcut.lnk deleted file mode 100644 index cacefdf..0000000 Binary files a/Interface/AddOns/SVUI/AddOns - Shortcut.lnk and /dev/null differ diff --git a/Interface/AddOns/SVUI/SVUI.lua b/Interface/AddOns/SVUI/SVUI.lua index 40b39ba..15393ec 100644 --- a/Interface/AddOns/SVUI/SVUI.lua +++ b/Interface/AddOns/SVUI/SVUI.lua @@ -41,7 +41,7 @@ local tsort, tconcat = table.sort, table.concat; CONSTANTS ########################################################## ]]-- -SVUI_LOCALE = {} +SVUI_LIB, SVUI_LOCALE = {}, {} BINDING_HEADER_SVUI = GetAddOnMetadata(..., "Title"); SLASH_RELOADUI1="/rl" SLASH_RELOADUI2="/reloadui" @@ -73,6 +73,25 @@ end local assert = enforce; --[[ ########################################################## +OBJECT CONSTRUCTOR GLOBAL +########################################################## +]]-- +local rootstring = function(self) return self.name end + +function SVUI_LIB:SetObject(globalName) + local r = {} + r.name = globalName + local mt = {} + local old = getmetatable(r) + if old then + for k, v in pairs(old) do mt[k] = v end + end + mt.__tostring = rootstring + setmetatable(r, mt) + return r +end +--[[ +########################################################## LOCALIZATION GLOBAL ########################################################## ]]-- diff --git a/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-BOTTOM.blp b/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-BOTTOM.blp index 51331f3..bd9a901 100644 Binary files a/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-BOTTOM.blp and b/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-BOTTOM.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-TOP.blp b/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-TOP.blp index 8ce4798..f703b72 100644 Binary files a/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-TOP.blp and b/Interface/AddOns/SVUI/assets/artwork/Template/Plate/PLATE-TOP.blp differ diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua index 670122e..3c2ce9a 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua @@ -823,6 +823,11 @@ do if db.enable then bar:SetScale(1) bar:SetAlpha(db.alpha) + if(db.mouseover == true) then + bar:SetAlpha(0) + else + bar:SetAlpha(db.alpha) + end RegisterStateDriver(bar, "visibility", barVisibility) else bar:SetScale(0.000001) @@ -1080,11 +1085,11 @@ end; BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:RefreshActionBars(); end; -function MOD:ConstructThisPackage() +function MOD:Load() if not SuperVillain.db.SVBar.enable then return end; RemoveDefaults(); self:Protect("RefreshActionBars"); diff --git a/Interface/AddOns/SVUI/packages/aura/SVAura.lua b/Interface/AddOns/SVUI/packages/aura/SVAura.lua index 4b3f33d..8d9eece 100644 --- a/Interface/AddOns/SVUI/packages/aura/SVAura.lua +++ b/Interface/AddOns/SVUI/packages/aura/SVAura.lua @@ -503,7 +503,7 @@ local function CreateAuraHeader(filter) return auraHeader end -function MOD:UpdateThisPackage() +function MOD:ReLoad() CB_HEIGHT = Minimap:GetHeight() CB_WIDTH = (CB_HEIGHT / 5) + 4 SVUI_AurasAnchor:SetSize(CB_WIDTH, CB_HEIGHT) @@ -512,7 +512,7 @@ function MOD:UpdateThisPackage() MOD:UpdateAuraHeader(SVUI_PlayerDebuffs); end -function MOD:ConstructThisPackage() +function MOD:Load() CB_HEIGHT = Minimap:GetHeight() CB_WIDTH = (CB_HEIGHT / 5) + 4 if not SuperVillain.db.SVAura.enable then return end diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index 79fa812..395c48b 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -1312,14 +1312,14 @@ end; BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:Layout(); self:Layout(true); self:ModifyBags(); self:ModifyBagBar(); end; -function MOD:ConstructThisPackage() +function MOD:Load() if not SuperVillain.db.SVBag.enable then return end; self:ModifyBagBar() SuperVillain.bags = self; diff --git a/Interface/AddOns/SVUI/packages/chat/SVChat.lua b/Interface/AddOns/SVUI/packages/chat/SVChat.lua index 1a56306..2e6b37a 100644 --- a/Interface/AddOns/SVUI/packages/chat/SVChat.lua +++ b/Interface/AddOns/SVUI/packages/chat/SVChat.lua @@ -871,11 +871,11 @@ do end end; -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:RefreshChatFrames(true) end; -function MOD:ConstructThisPackage() +function MOD:Load() if(not SuperVillain.db.SVChat.enable) then return end; self:RegisterEvent('UPDATE_CHAT_WINDOWS', 'RefreshChatFrames') self:RegisterEvent('UPDATE_FLOATING_CHAT_WINDOWS', 'RefreshChatFrames') diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua index 8f5955f..f718f9b 100644 --- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua +++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua @@ -27,12 +27,6 @@ local format, gsub, strfind, strmatch, tonumber = format, gsub, strfind, strmatc PRE VARS/FUNCTIONS ########################################################## ]]-- -local FadeUpdate = function() - if InCombatLockdown()then return end - LeftSuperDock:Hide() - RightSuperDock:Hide() -end - local function SetSuperDockStyle(dock) if dock.backdrop then return end local backdrop = CreateFrame("Frame", nil, dock) @@ -66,19 +60,17 @@ local function SetSuperDockStyle(dock) backdrop.top:SetAlpha(0) backdrop.top:Height(1) return backdrop -end +end local function Dock_OnEnter(self, ...) if InCombatLockdown() then return end self:SetPanelColor("highlight") - if SVUI_Cache["Dock"].LeftSuperDockFaded == true then + if MOD.SuperDockFaded then LeftSuperDock:Show() - UIFrameFadeIn(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 1) - end - if SVUI_Cache["Dock"].RightSuperDockFaded == true then + SuperVillain:SecureFadeIn(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 1) RightSuperDock:Show() - UIFrameFadeIn(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 1) - end + SuperVillain:SecureFadeIn(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 1) + end GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) GameTooltip:ClearLines() GameTooltip:AddLine(L["Toggle Docks"], 1, 1, 1) @@ -88,35 +80,25 @@ end local function Dock_OnLeave(self, ...) if InCombatLockdown() then return end self:SetPanelColor("special") - if SVUI_Cache["Dock"].LeftSuperDockFaded == true then - UIFrameFadeOut(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 0) - LeftSuperDock.fadeInfo.finishedFunc = LeftSuperDock.fadeFunc - end - if SVUI_Cache["Dock"].RightSuperDockFaded == true then - UIFrameFadeOut(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 0) - RightSuperDock.fadeInfo.finishedFunc = RightSuperDock.fadeFunc - end + if MOD.SuperDockFaded then + SuperVillain:SecureFadeOut(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 0, true) + SuperVillain:SecureFadeOut(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 0, true) + end GameTooltip:Hide() end local function Dock_OnClick(self) GameTooltip:Hide() - if SVUI_Cache["Dock"].LeftSuperDockFaded then - SVUI_Cache["Dock"].LeftSuperDockFaded = false; - UIFrameFadeIn(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 1) + if MOD.SuperDockFaded then + MOD.SuperDockFaded = nil; + SuperVillain:SecureFadeIn(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 1) + SuperVillain:SecureFadeIn(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 1) else - SVUI_Cache["Dock"].LeftSuperDockFaded = true; - UIFrameFadeOut(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 0) - LeftSuperDock.fadeInfo.finishedFunc = LeftSuperDock.fadeFunc - end - if SVUI_Cache["Dock"].RightSuperDockFaded then - SVUI_Cache["Dock"].RightSuperDockFaded = false; - UIFrameFadeIn(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 1) - else - SVUI_Cache["Dock"].RightSuperDockFaded = true; - UIFrameFadeOut(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 0) - RightSuperDock.fadeInfo.finishedFunc = RightSuperDock.fadeFunc + MOD.SuperDockFaded = true; + SuperVillain:SecureFadeOut(LeftSuperDock, 0.2, LeftSuperDock:GetAlpha(), 0, true) + SuperVillain:SecureFadeOut(RightSuperDock, 0.2, RightSuperDock:GetAlpha(), 0, true) end + SVUI_Cache["Dock"].SuperDockFaded = MOD.SuperDockFaded end local function Button_OnEnter(self, ...) @@ -247,6 +229,7 @@ function MOD:CreateSuperBorders() end function MOD:CreateDockPanels() + MOD.SuperDockFaded = SVUI_Cache["Dock"].SuperDockFaded local leftWidth = MOD.db.dockLeftWidth or 350; local leftHeight = MOD.db.dockLeftHeight or 180; local rightWidth = MOD.db.dockRightWidth or 350; @@ -302,8 +285,6 @@ function MOD:CreateDockPanels() leftwindow:Size(leftWidth, leftHeight) leftdock.backdrop = SetSuperDockStyle(leftwindow) - LeftSuperDock.fadeFunc = FadeUpdate; - -- [[ CORNER BUTTON ]] -- local rightbutton = CreateFrame("Button", "RightSuperDockToggleButton", SuperVillain.UIParent) @@ -350,9 +331,7 @@ function MOD:CreateDockPanels() rightwindow:Size(rightWidth, rightHeight) rightdock.backdrop = SetSuperDockStyle(rightwindow) - RightSuperDock.fadeFunc = FadeUpdate; - if SVUI_Cache["Dock"].LeftSuperDockFaded == true then LeftSuperDock:Hide() end - if SVUI_Cache["Dock"].RightSuperDockFaded == true then RightSuperDock:Hide() end + if MOD.SuperDockFaded then LeftSuperDock:Hide()RightSuperDock:Hide() end local toolbarTop = CreateFrame("Button", "SuperDockToolBarTop", SuperVillain.UIParent) toolbarTop:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -2) @@ -392,11 +371,11 @@ function MOD:CreateDockPanels() STATS:NewAnchor(bottomrightdata, 3, "ANCHOR_CURSOR", 17, 4) end -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:UpdateSuperDock(); end -function MOD:ConstructThisPackage() +function MOD:Load() self:CreateSuperBorders() self:CreateDockPanels() self:CreateDockWindow() diff --git a/Interface/AddOns/SVUI/packages/gear/SVGear.lua b/Interface/AddOns/SVUI/packages/gear/SVGear.lua index 48a0ef2..8994757 100644 --- a/Interface/AddOns/SVUI/packages/gear/SVGear.lua +++ b/Interface/AddOns/SVUI/packages/gear/SVGear.lua @@ -272,11 +272,11 @@ local GearSwapComplete = function() end end; -function MOD:UpdateThisPackage() +function MOD:ReLoad() RefreshGear() end; -function MOD:ConstructThisPackage() +function MOD:Load() self.PreBuildComplete = false self:RegisterEvent("UPDATE_INVENTORY_DURABILITY", RefreshGear) self:RegisterEvent("PLAYER_EQUIPMENT_CHANGED", RefreshGear) diff --git a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua index 38d77c2..4022a2f 100644 --- a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua +++ b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua @@ -549,7 +549,7 @@ end; BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:ConstructThisPackage() +function MOD:Load() --self:CreateHenchmenFrame() self:CreateHenchmanSpeech() self:LoadAllMinions() diff --git a/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml b/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml index 300d126..b7e0939 100644 --- a/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml +++ b/Interface/AddOns/SVUI/packages/henchmen/common/_load.xml @@ -1,5 +1,3 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='dialogs.lua'/> - <Script file='operators.lua'/> <Script file='minions.lua'/> </Ui> \ 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 d2bc93b..6fc0695 100644 --- a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua +++ b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.lua @@ -391,7 +391,7 @@ local ModeButton_OnMouseDown = function(self) MOD:SetJobMode(name) end -function MOD:ConstructThisPackage() +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(); diff --git a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml index 5015c27..bf934d5 100644 --- a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml +++ b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml @@ -2,9 +2,9 @@ <Script file='SVLaborer.lua'/> <Include file='common\_load.xml'/> - <Frame name="SVUI_ModesHandler" hidden="true" frameStrata="LOW"> + <Frame name="SVUI_ModesHandler" hidden="true" frameStrata="LOW" parent="UIParent"> <Anchors> - <Anchor point="LEFT" relativeTo="$parent" relativePoint="RIGHT"> + <Anchor point="LEFT" relativeTo="UIParent" relativePoint="RIGHT"> <Offset x="10000" y="0"/> </Anchor> </Anchors> diff --git a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua b/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua index 97c82c9..bb6f237 100644 --- a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua +++ b/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua @@ -40,6 +40,7 @@ local MOD = SuperVillain.Registry:Expose('SVLaborer'); LOCAL VARS ########################################################## ]]-- +local playerRace = select(2,UnitRace("player")) local archSpell, survey, surveyIsKnown, skillRank, skillModifier; local EnableListener, DisableListener; local CanScanResearchSite = CanScanResearchSite @@ -308,7 +309,7 @@ do --ArchEventHandler:RegisterEvent("ARCHAEOLOGY_SURVEY_CAST") ArchEventHandler:SetScript("OnEvent", Arch_OnEvent) - if(SuperVillain.race ~= "Dwarf") then + if(playerRace ~= "Dwarf") then SurveyCooldown:RegisterEvent("UNIT_SPELLCAST_STOP") SurveyCooldown:SetScript("OnEvent", Survey_OnEvent) end @@ -317,7 +318,7 @@ do function DisableListener() ArchEventHandler:UnregisterAllEvents() ArchEventHandler:SetScript("OnEvent", nil) - if(SuperVillain.race ~= "Dwarf") then + if(playerRace ~= "Dwarf") then SurveyCooldown:UnregisterAllEvents() SurveyCooldown:SetScript("OnEvent", nil) end diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.lua b/Interface/AddOns/SVUI/packages/map/SVMap.lua index ad304a0..564c2ec 100644 --- a/Interface/AddOns/SVUI/packages/map/SVMap.lua +++ b/Interface/AddOns/SVUI/packages/map/SVMap.lua @@ -442,12 +442,12 @@ end; BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:UpdateThisPackage() +function MOD:ReLoad() if(not SuperVillain.db.SVMap.enable) then return; end self:RefreshMiniMap() end -function MOD:ConstructThisPackage() +function MOD:Load() if(not SuperVillain.db.SVMap.enable) then Minimap:SetMaskTexture('Textures\\MinimapMask') return; @@ -462,7 +462,7 @@ function MOD:ConstructThisPackage() self:LoadMinimapButtons() self:LoadWorldMap() self:SetMiniMapCoords() - self:UpdateThisPackage() + self:ReLoad() SuperVillain:AddToDisplayAudit(SVUI_MinimapFrame) end SuperVillain.Registry:NewPackage(MOD, "SVMap", "pre") \ 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 5777c4c..4c5d5d9 100644 --- a/Interface/AddOns/SVUI/packages/override/SVOverride.lua +++ b/Interface/AddOns/SVUI/packages/override/SVOverride.lua @@ -124,7 +124,7 @@ function MOD:DisbandRaidGroup() LeaveParty() end -function MOD:ConstructThisPackage() +function MOD:Load() HelpOpenTicketButtonTutorial:MUNG() TalentMicroButtonAlert:MUNG() HelpPlate:MUNG() diff --git a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua index 8fb3e52..c906693 100644 --- a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua +++ b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua @@ -257,18 +257,18 @@ local function SetEliteBorder(point) point.eliteborder:SetFrameStrata("BACKGROUND") point.eliteborder:SetFrameLevel(0) - -- point.eliteborder.top = point.eliteborder:CreateTexture(nil, "BACKGROUND") - -- point.eliteborder.top:SetPoint("BOTTOMLEFT", point.eliteborder, "TOPLEFT", 0, 0) - -- point.eliteborder.top:SetPoint("BOTTOMRIGHT", point.eliteborder, "TOPRIGHT", 0, 0) - -- point.eliteborder.top:SetHeight(point:GetWidth() * 0.25) - -- point.eliteborder.top:SetTexture(PLATE_TOP) - -- point.eliteborder.top:SetVertexColor(1, 1, 0) - -- point.eliteborder.top:SetBlendMode("BLEND") + point.eliteborder.top = point.eliteborder:CreateTexture(nil, "BACKGROUND") + point.eliteborder.top:SetPoint("BOTTOMLEFT", point.eliteborder, "TOPLEFT", 0, 0) + point.eliteborder.top:SetPoint("BOTTOMRIGHT", point.eliteborder, "TOPRIGHT", 0, 0) + point.eliteborder.top:SetHeight(22) + point.eliteborder.top:SetTexture(PLATE_TOP) + point.eliteborder.top:SetVertexColor(1, 1, 0) + point.eliteborder.top:SetBlendMode("BLEND") point.eliteborder.bottom = point.eliteborder:CreateTexture(nil, "BACKGROUND") point.eliteborder.bottom:SetPoint("TOPLEFT", point.eliteborder, "BOTTOMLEFT", 0, 0) point.eliteborder.bottom:SetPoint("TOPRIGHT", point.eliteborder, "BOTTOMRIGHT", 0, 0) - point.eliteborder.bottom:SetHeight(16) + point.eliteborder.bottom:SetHeight(32) point.eliteborder.bottom:SetTexture(PLATE_BOTTOM) point.eliteborder.bottom:SetVertexColor(1, 1, 0) point.eliteborder.bottom:SetBlendMode("BLEND") @@ -281,15 +281,15 @@ local function SetEliteBorder(point) -- point.eliteborder.right:SetVertexColor(1, 1, 0) -- point.eliteborder.right:SetBlendMode("BLEND") - point.eliteborder.left = point.eliteborder:CreateTexture(nil, "BACKGROUND") - point.eliteborder.left:SetPoint("TOPRIGHT", point.eliteborder, "TOPLEFT", 0, 0) - point.eliteborder.left:SetPoint("BOTTOMRIGHT", point.eliteborder, "BOTTOMLEFT", 0, 0) - point.eliteborder.left:SetWidth(point:GetHeight() * 4) - point.eliteborder.left:SetTexture(PLATE_LEFT) - point.eliteborder.left:SetVertexColor(1, 1, 0) - point.eliteborder.left:SetBlendMode("BLEND") + -- point.eliteborder.left = point.eliteborder:CreateTexture(nil, "BACKGROUND") + -- point.eliteborder.left:SetPoint("TOPRIGHT", point.eliteborder, "TOPLEFT", 0, 0) + -- point.eliteborder.left:SetPoint("BOTTOMRIGHT", point.eliteborder, "BOTTOMLEFT", 0, 0) + -- point.eliteborder.left:SetWidth(point:GetHeight() * 4) + -- point.eliteborder.left:SetTexture(PLATE_LEFT) + -- point.eliteborder.left:SetVertexColor(1, 1, 0) + -- point.eliteborder.left:SetBlendMode("BLEND") - point.eliteborder:SetAlpha(0.7) + point.eliteborder:SetAlpha(0.35) point.eliteborder:Hide() end @@ -1175,7 +1175,7 @@ function MOD:CombatToggle(noToggle) end end -function MOD:UpdateThisPackage() +function MOD:ReLoad() if SuperVillain.db["SVPlate"].enable ~= true then self:DisableTracking() return @@ -1183,7 +1183,7 @@ function MOD:UpdateThisPackage() self:UpdateAllPlates(); end; -function MOD:ConstructThisPackage() +function MOD:Load() if SuperVillain.db["SVPlate"].enable ~= true then return end self.UseCombo = false; self:UpdateDataLocals() diff --git a/Interface/AddOns/SVUI/packages/plates/SVPlate.xml b/Interface/AddOns/SVUI/packages/plates/SVPlate.xml index 8a09b7f..3cfdddb 100644 --- a/Interface/AddOns/SVUI/packages/plates/SVPlate.xml +++ b/Interface/AddOns/SVUI/packages/plates/SVPlate.xml @@ -1,5 +1,5 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Frame name="SVUI_PlateParentFrame" frameStrata="BACKGROUND" frameLevel="0" hidden="true"> + <Frame name="SVUI_PlateParentFrame" frameStrata="BACKGROUND" hidden="true"> <Scripts> <OnLoad> self:SetParent(_G['WorldFrame']) @@ -7,7 +7,7 @@ </Scripts> </Frame> - <Frame name="SVUI_PlateGlowFrame" frameStrata="BACKGROUND" frameLevel="0" hidden="true"> + <Frame name="SVUI_PlateGlowFrame" frameStrata="BACKGROUND" hidden="true"> <Scripts> <OnLoad> self:SetParent(_G['WorldFrame']) diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.lua b/Interface/AddOns/SVUI/packages/stats/SVStats.lua index 3d2789d..8902f1e 100644 --- a/Interface/AddOns/SVUI/packages/stats/SVStats.lua +++ b/Interface/AddOns/SVUI/packages/stats/SVStats.lua @@ -514,11 +514,11 @@ end; BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:Generate() end; -function MOD:ConstructThisPackage() +function MOD:Load() hexString = SuperVillain:HexColor("highlight") or "|cffFFFFFF" SVUI_Global["Accountant"] = SVUI_Global["Accountant"] or {}; SVUI_Global["Accountant"][SuperVillain.realm] = SVUI_Global["Accountant"][SuperVillain.realm] or {}; diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua index 85efd2e..db07595 100644 --- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua +++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua @@ -51,7 +51,7 @@ local targetList, inspectCache = {}, {}; local NIL_COLOR = { r = 1, g = 1, b = 1 }; local TAPPED_COLOR = { r = .6, g = .6, b = .6 }; local SKULL_ICON = "|TInterface\\TARGETINGFRAME\\UI-TargetingFrame-Skull.blp:16:16|t"; -local TAMABLE_INDICATOR = "|TInterface\\PetPaperDollFrame\\PetStable-DietIcon.blp:16:16:0:0:64:64:4:60:4:60|t |cffFFFF00Tamable|r"; +local TAMABLE_INDICATOR = "|cffFFFF00Possibly Tamable|r"; local TT_TOP = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-TOP]] local TT_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-BOTTOM]] local TT_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-RIGHT-OVERLAY]] @@ -310,7 +310,6 @@ local function tiplevel(this, start) end local _hook_GameTooltip_OnTooltipSetUnit = function(self) - GameTooltip.mini.text:SetText("") local unit = select(2, self:GetUnit()) local TamablePet; if self:GetOwner() ~= UIParent and MOD.db.visibility.unitFrames ~= "NONE" then @@ -355,14 +354,8 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) end if(UnitIsAFK(unit)) then - -- GameTooltip.mini.text:SetText(L["AFK"]) - -- GameTooltip.mini.text:SetTextColor(1, 0, 0) - -- GameTooltip:SetMiniColor(1, 1, 0) unitName = unitName .. " " .. L["AFK"] elseif(UnitIsDND(unit)) then - -- GameTooltip.mini.text:SetText(L["DND"]) - -- GameTooltip.mini.text:SetTextColor(1, 0, 0) - -- GameTooltip:SetMiniColor(1, 1, 0) unitName = unitName .. " " .. L["DND"] end @@ -429,7 +422,7 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) local family = UnitCreatureFamily(unit) or creatureType if(SuperVillain.class == "HUNTER" and creatureType == PET_TYPE_SUFFIX[8]) then local hunterLevel = UnitLevel("player") - if(unitLevel <= hunterLevel and IsSpellInRange("Tame Beast", unit)) then + if(unitLevel <= hunterLevel) then TamablePet = true end end @@ -442,9 +435,6 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) end end if(TamablePet) then - -- GameTooltip.mini.text:SetText("Tamable") - -- GameTooltip.mini.text:SetTextColor(0.1, 1, 0.1) - -- GameTooltip:SetMiniColor(0, 0.68, 0) GameTooltip:AddLine(TAMABLE_INDICATOR) end if MOD.db.targetInfo then @@ -656,14 +646,6 @@ local _hook_OnTipCleared = function(self) self.itemCleared = nil end -local _hook_OnTipShow = function(self) - local shown = self.mini:IsShown() - self.mini:Hide() - if(self.mini.text:GetText() ~= "" and not shown) then - self.mini:Show() - end -end - local _hook_OnItemRef = function(link,text,button,chatFrame) if find(link,"^spell:") then local ref = sub(link,7) @@ -678,7 +660,7 @@ local TooltipModifierChangeHandler = function(self, event, mod) end end -function MOD:ConstructThisPackage() +function MOD:Load() BNToastFrame:Point("TOPRIGHT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, -10) SuperVillain:SetSVMovable(BNToastFrame, "BNET_MOVE", L["BNet Frame"]) NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) @@ -730,64 +712,42 @@ function MOD:ConstructThisPackage() local MINI_LEFT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\MINITIP-LEFT]] local MINI_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\MINITIP-RIGHT]] for _, tooltip in pairs(tooltips) do - local mini = CreateFrame("Frame", nil, tooltip) - mini:Size(60,15) - mini:Point("LEFT", tooltip, "TOPLEFT", -7, 0) - mini.text = mini:CreateFontString(nil, "OVERLAY") - mini.text:FillInner(mini, 2, 2) - mini.text:SetFont(SuperVillain.Media.font.alert, 14, "OUTLINE") - mini.text:SetShadowOffset(2, -2) - mini.text:SetShadowColor(0, 0, 0, 1) - mini.bg = mini:CreateTexture(nil, "BORDER") - mini.bg:SetAllPoints(mini) - mini.bg:SetTexture(MINI_BG) - mini.left = mini:CreateTexture(nil, "BORDER") - mini.left:Size(15,15) - mini.left:Point("RIGHT", mini, "LEFT", 0, 0) - mini.left:SetTexture(MINI_LEFT) - mini.right = mini:CreateTexture(nil, "BORDER") - mini.right:Size(15,15) - mini.right:Point("LEFT", mini, "RIGHT", 0, 0) - mini.right:SetTexture(MINI_RIGHT) - tooltip.mini = mini - tooltip.mini:Hide() - - tooltip.topborder = tooltip:CreateTexture(nil, "OVERLAY", nil, 1) - tooltip.topborder:SetPoint("BOTTOMLEFT", tooltip, "TOPLEFT", 0, 0) - tooltip.topborder:SetHeight(tooltip:GetWidth() * 0.25) - tooltip.topborder:SetWidth(tooltip:GetWidth() * 0.25) - tooltip.topborder:SetTexture(TT_TOP) - tooltip.topborder:SetVertexColor(0,0,0) - tooltip.topborder:SetBlendMode("BLEND") - tooltip.topborder:SetAlpha(0.65) - - tooltip.rightborder = tooltip:CreateTexture(nil, "OVERLAY", nil, 1) - tooltip.rightborder:SetPoint("TOPLEFT", tooltip, "TOPRIGHT", 0, 0) - tooltip.rightborder:SetPoint("BOTTOMLEFT", tooltip, "BOTTOMRIGHT", 0, 0) - tooltip.rightborder:SetWidth(tooltip:GetHeight() * 2.25) - tooltip.rightborder:SetTexture(TT_RIGHT) - tooltip.rightborder:SetVertexColor(0,0,0) - tooltip.rightborder:SetBlendMode("BLEND") - tooltip.rightborder:SetAlpha(0.75) - - tooltip.leftborder = tooltip:CreateTexture(nil, "OVERLAY", nil, 1) - tooltip.leftborder:SetPoint("TOPRIGHT", tooltip, "TOPLEFT", 0, 0) - tooltip.leftborder:SetPoint("BOTTOMRIGHT", tooltip, "BOTTOMLEFT", 0, 0) - tooltip.leftborder:SetWidth(tooltip:GetHeight() * 2.25) - tooltip.leftborder:SetTexture(TT_LEFT) - tooltip.leftborder:SetVertexColor(0,0,0) - tooltip.leftborder:SetBlendMode("BLEND") - tooltip.leftborder:SetAlpha(0.75) - - tooltip.bottomborder = tooltip:CreateTexture(nil, "OVERLAY", nil, 1) - tooltip.bottomborder:SetPoint("TOPRIGHT", tooltip, "BOTTOMRIGHT", 0, 0) - tooltip.bottomborder:SetHeight(tooltip:GetWidth() * 0.25) - tooltip.bottomborder:SetWidth(tooltip:GetWidth() * 0.25) - tooltip.bottomborder:SetTexture(TT_BOTTOM) - tooltip.bottomborder:SetVertexColor(0,0,0) - tooltip.bottomborder:SetBlendMode("BLEND") - tooltip.bottomborder:SetAlpha(0.5) - + if(tooltip.SuperBorder) then return end + local mask = CreateFrame("Frame", nil, tooltip) + mask:SetAllPoints() + mask[1] = mask:CreateTexture(nil, "BACKGROUND") + mask[1]:SetPoint("BOTTOMLEFT", mask, "TOPLEFT", 0, 0) + mask[1]:SetHeight(mask:GetWidth() * 0.25) + mask[1]:SetWidth(mask:GetWidth() * 0.25) + mask[1]:SetTexture(TT_TOP) + mask[1]:SetVertexColor(0,0,0) + mask[1]:SetBlendMode("BLEND") + mask[1]:SetAlpha(0.65) + mask[2] = mask:CreateTexture(nil, "BACKGROUND") + mask[2]:SetPoint("TOPLEFT", mask, "TOPRIGHT", 0, 0) + mask[2]:SetPoint("BOTTOMLEFT", mask, "BOTTOMRIGHT", 0, 0) + mask[2]:SetWidth(mask:GetHeight() * 2.25) + mask[2]:SetTexture(TT_RIGHT) + mask[2]:SetVertexColor(0,0,0) + mask[2]:SetBlendMode("BLEND") + mask[2]:SetAlpha(0.75) + mask[3] = mask:CreateTexture(nil, "BACKGROUND") + mask[3]:SetPoint("TOPRIGHT", mask, "TOPLEFT", 0, 0) + mask[3]:SetPoint("BOTTOMRIGHT", mask, "BOTTOMLEFT", 0, 0) + mask[3]:SetWidth(mask:GetHeight() * 2.25) + mask[3]:SetTexture(TT_LEFT) + mask[3]:SetVertexColor(0,0,0) + mask[3]:SetBlendMode("BLEND") + mask[3]:SetAlpha(0.75) + mask[4] = mask:CreateTexture(nil, "BACKGROUND") + mask[4]:SetPoint("TOPRIGHT", mask, "BOTTOMRIGHT", 0, 0) + mask[4]:SetHeight(mask:GetWidth() * 0.25) + mask[4]:SetWidth(mask:GetWidth() * 0.25) + mask[4]:SetTexture(TT_BOTTOM) + mask[4]:SetVertexColor(0,0,0) + mask[4]:SetBlendMode("BLEND") + mask[4]:SetAlpha(0.5) + tooltip.SuperBorder = mask tooltip:SetBackdrop({ bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\Tooltip\TOOLTIP]], edgeFile = [[Interface\BUTTONS\WHITE8X8]], @@ -799,13 +759,6 @@ function MOD:ConstructThisPackage() tooltip.SetBackdrop = function() end tooltip.SetBackdropColor = function() end tooltip.SetBackdropBorderColor = function() end - tooltip.SetMiniColor = function(self, r, g, b) - self.mini.bg:SetVertexColor(r,g,b) - self.mini.left:SetVertexColor(r,g,b) - self.mini.right:SetVertexColor(r,g,b) - end - - --tooltip:HookScript("OnShow", _hook_OnTipShow) end end SuperVillain.Registry:NewPackage(MOD, "SVTip") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index a8d4fbc..c018339 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -50,15 +50,82 @@ MODULE AND INNER CLASSES local MOD = {} MOD.Units = {} MOD.Headers = {} -MOD.Construct = {} -MOD.FrameUpdate = {} -MOD.HeaderUpdate = {} --[[ ########################################################## LOCALS ########################################################## ]]-- local LoadedUnitFrames, LoadedGroupHeaders; +local SortAuraBars; +local ReversedUnit = { + ["target"] = true, + ["targettarget"] = true, + ["pettarget"] = true, + ["focustarget"] = true, + ["boss"] = true, + ["arena"] = true, +} + +do + local hugeMath = math.huge + + local TRRSort = function(a, b) + local compA = a.noTime and hugeMath or a.expirationTime + local compB = b.noTime and hugeMath or b.expirationTime + return compA < compB + end + + local TDSort = function(a, b) + local compA = a.noTime and hugeMath or a.duration + local compB = b.noTime and hugeMath or b.duration + return compA > compB + end + + local TDRSort = function(a, b) + local compA = a.noTime and hugeMath or a.duration + local compB = b.noTime and hugeMath or b.duration + return compA < compB + end + + local NSort = function(a, b) + return a.name > b.name + end + + SortAuraBars = function(parent, sorting) + if not parent then return end + if sorting == "TIME_REMAINING" then + parent.sort = true; + elseif sorting == "TIME_REMAINING_REVERSE" then + parent.sort = TRRSort + elseif sorting == "TIME_DURATION" then + parent.sort = TDSort + elseif sorting == "TIME_DURATION_REVERSE" then + parent.sort = TDRSort + elseif sorting == "NAME" then + parent.sort = NSort + else + parent.sort = nil; + end + end +end + +local function FindAnchorFrame(frame, anchor, badPoint) + if badPoint or anchor == 'FRAME' then + return frame + elseif(anchor == 'TRINKET') then + if select(2,IsInInstance())=="arena" then + return frame.Trinket + else + return frame.PVPSpecIcon + end + elseif(anchor == 'BUFFS' and frame.Buffs and frame.Buffs:IsShown()) then + return frame.Buffs + elseif(anchor == 'DEBUFFS' and frame.Debuffs and frame.Debuffs:IsShown()) then + return frame.Debuffs + else + return frame + end +end --[[ ########################################################## CORE FUNCTIONS @@ -141,38 +208,6 @@ do end end -local StandardUnitStyle = function(self, unit) - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - self.unit = unit - local key = unit:gsub("%d", "") - self.___key = key - MOD.Construct[key](self); - return self -end - -local EnemyUnitStyle = function(self, unit) - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - self.unit = unit - local index = unit:match("(%d)") - self.index = index - self:SetID(index) - local key = unit:gsub("%d", "") - self.___key = key - MOD.Construct[key](self); - return self -end - -function MOD:DetachSubFrames(...) - for i = 1, select("#", ...) do - local frame = select(i,...) - frame:ClearAllPoints() - end -end - function MOD:AllowElement(unitFrame) if InCombatLockdown() then return; end if not unitFrame.isForced then @@ -214,17 +249,6 @@ function MOD:RestrictElement(unitFrame) end end -function MOD:RestrictChildren(parentFrame, ...) - parentFrame.isForced = nil; - - for i=1,select("#",...) do - local childFrame = select(i,...) - childFrame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') - childFrame.TargetGlow:SetAlpha(1) - self:RestrictElement(childFrame) - end -end - function MOD:AllowChildren(parentFrame, ...) parentFrame.isForced = true; @@ -237,6 +261,17 @@ function MOD:AllowChildren(parentFrame, ...) end end +function MOD:RestrictChildren(parentFrame, ...) + parentFrame.isForced = nil; + + for i=1,select("#",...) do + local childFrame = select(i,...) + childFrame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') + childFrame.TargetGlow:SetAlpha(1) + self:RestrictElement(childFrame) + end +end + function MOD:ResetUnitOptions(unit) SuperVillain.db:SetDefault("SVUnit", unit) self:RefreshUnitFrames() @@ -265,66 +300,6 @@ function MOD:RefreshUnitColors() oUF_SuperVillain.colors.smooth = {1, 0, 0, 1, 1, 0, r, g, b} end -local RefreshUnitMedia = function(self, unitName) - local db = MOD.db - local key = unitName or self.___key - if(not (db and db.enable) or not self) then return end - local CURRENT_BAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.statusbar) - local CURRENT_AURABAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.auraBarStatusbar); - local CURRENT_FONT = SuperVillain.Shared:Fetch("font", db.font) - local CURRENT_AURABAR_FONT = SuperVillain.Shared:Fetch("font", db.auraFont); - local CURRENT_AURABAR_FONTSIZE = db.auraFontSize - local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline - local unitDB = db[key] - if(unitDB and unitDB.enable) then - local panel = self.InfoPanel - if(panel) then - if(panel.Name and unitDB.name) then - panel.Name:SetFont(SuperVillain.Shared:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) - end - if(panel.Health) then - panel.Health:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - if(panel.Power) then - panel.Power:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - if(panel.Misc) then - panel.Misc:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - end - if(self.Health and (unitDB.health and unitDB.health.enable)) then - self.Health:SetStatusBarTexture(CURRENT_BAR_TEXTURE) - end - if(self.Power and (unitDB.power and unitDB.power.enable)) then - self.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) - end - if(self.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then - local ab = self.AuraBars - ab.auraBarTexture = CURRENT_AURABAR_TEXTURE - ab.textFont = CURRENT_AURABAR_FONT - ab.textSize = db.auraFontSize - ab.textOutline = db.auraFontOutline - end - if(self.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then - local buffs = self.Buffs - buffs.textFont = CURRENT_AURABAR_FONT - buffs.textSize = db.auraFontSize - buffs.textOutline = db.auraFontOutline - end - if(self.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then - local debuffs = self.Debuffs - debuffs.textFont = CURRENT_AURABAR_FONT - debuffs.textSize = db.auraFontSize - debuffs.textOutline = db.auraFontOutline - end - if(self.RaidDebuffs and (unitDB.rdebuffs and unitDB.rdebuffs.enable)) then - local rdebuffs = self.RaidDebuffs; - rdebuffs.count:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) - rdebuffs.time:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) - end - end -end - function MOD:RefreshAllUnitMedia() if(not self.db or (self.db and self.db.enable ~= true)) then return end self:RefreshUnitColors() @@ -372,435 +347,699 @@ function MOD:RefreshUnitFrames() collectgarbage("collect") end -function MOD:SetUnitFrame(unitKey) - if InCombatLockdown() then self:FrameForge() return end - local unit = unitKey - local realName = unit:gsub("(.)", upper, 1) - realName = realName:gsub("t(arget)", "T%1") - local frame = self.Units[unit] - if not frame then - oUF_SuperVillain:SetActiveStyle("SVUI_UnitFrame") - frame = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) - frame.Update = self.FrameUpdate[unitKey] - frame.MediaUpdate = RefreshUnitMedia - self.Units[unit] = frame - end - if frame:GetParent() ~= SVUI_UnitFrameParent then - frame:SetParent(SVUI_UnitFrameParent) - end - if self.db[unitKey].enable then - frame:Enable() - frame:MediaUpdate() - frame:Update() - else - frame:Disable() - end +function MOD:RefreshUnitMedia(unitName) + local db = MOD.db + local key = unitName or self.___key + if(not (db and db.enable) or not self) then return end + local CURRENT_BAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.statusbar) + local CURRENT_AURABAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.auraBarStatusbar); + local CURRENT_FONT = SuperVillain.Shared:Fetch("font", db.font) + local CURRENT_AURABAR_FONT = SuperVillain.Shared:Fetch("font", db.auraFont); + local CURRENT_AURABAR_FONTSIZE = db.auraFontSize + local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline + local unitDB = db[key] + if(unitDB and unitDB.enable) then + local panel = self.InfoPanel + if(panel) then + if(panel.Name and unitDB.name) then + panel.Name:SetFont(SuperVillain.Shared:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) + end + if(panel.Health) then + panel.Health:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + if(panel.Power) then + panel.Power:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + if(panel.Misc) then + panel.Misc:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + end + if(self.Health and (unitDB.health and unitDB.health.enable)) then + self.Health:SetStatusBarTexture(CURRENT_BAR_TEXTURE) + end + if(self.Power and (unitDB.power and unitDB.power.enable)) then + self.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) + end + if(self.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then + local ab = self.AuraBars + ab.auraBarTexture = CURRENT_AURABAR_TEXTURE + ab.textFont = CURRENT_AURABAR_FONT + ab.textSize = db.auraFontSize + ab.textOutline = db.auraFontOutline + end + if(self.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then + local buffs = self.Buffs + buffs.textFont = CURRENT_AURABAR_FONT + buffs.textSize = db.auraFontSize + buffs.textOutline = db.auraFontOutline + end + if(self.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then + local debuffs = self.Debuffs + debuffs.textFont = CURRENT_AURABAR_FONT + debuffs.textSize = db.auraFontSize + debuffs.textOutline = db.auraFontOutline + end + if(self.RaidDebuffs and (unitDB.rdebuffs and unitDB.rdebuffs.enable)) then + local rdebuffs = self.RaidDebuffs; + rdebuffs.count:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) + rdebuffs.time:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) + end + end end -function MOD:SetEnemyFrames(unitKey, maxCount) - if InCombatLockdown() then self:FrameForge() return end - for i = 1, maxCount do - local unit = unitKey..i - local realName = unit:gsub("(.)", upper, 1) - realName = realName:gsub("t(arget)", "T%1") - local frame = self.Units[unit] - if not frame then - oUF_SuperVillain:SetActiveStyle("SVUI_EnemyFrame") - frame = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) - frame.___key = unitKey - frame.Update = self.FrameUpdate[unitKey] - frame.MediaUpdate = RefreshUnitMedia - frame.i = i; - frame:SetID(i) - self.Units[unit] = frame - end - if frame:GetParent() ~= SVUI_UnitFrameParent then - frame:SetParent(SVUI_UnitFrameParent) - end - if frame.isForced then - self:AllowElement(frame) - end - if self.db[unitKey].enable then - frame:Enable() - frame:MediaUpdate() - frame:Update() - else - frame:Disable() +function MOD:RefreshUnitLayout(frame, template) + local db = self.db[template] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + local BEST_SIZE = min(UNIT_WIDTH,UNIT_HEIGHT); + local AURA_HOLDER = db.width + local powerHeight = (db.power and db.power.enable) and (db.power.height - 1) or 1; + + local TOP_ANCHOR1, TOP_ANCHOR2, TOP_MODIFIER = "TOPRIGHT", "TOPLEFT", 1; + local BOTTOM_ANCHOR1, BOTTOM_ANCHOR2, BOTTOM_MODIFIER = "BOTTOMLEFT", "BOTTOMRIGHT", -1; + if(ReversedUnit[template]) then + TOP_ANCHOR1 = "TOPLEFT" + TOP_ANCHOR2 = "TOPRIGHT" + TOP_MODIFIER = -1 + BOTTOM_ANCHOR1 = "BOTTOMRIGHT" + BOTTOM_ANCHOR2 = "BOTTOMLEFT" + BOTTOM_MODIFIER = 1 + end + + local portraitOverlay = false; + local overlayAnimation = false; + local portraitWidth = (1 * TOP_MODIFIER); + local healthPanel = frame.HealthPanel + local infoPanel = frame.InfoPanel + local calculatedHeight = db.height; + + if(template:find("raid")) then + AURA_HOLDER = 100 + end + + if(db.portrait and db.portrait.enable) then + if(not db.portrait.overlay) then + portraitWidth = ((db.portrait.width * TOP_MODIFIER) + (1 * TOP_MODIFIER)) + else + portraitOverlay = true + overlayAnimation = self.db.overlayAnimation end end -end + if(frame.PVPSpecIcon and db.pvpSpecIcon) then + portraitWidth = portraitWidth - UNIT_HEIGHT + end -do - local _POINTMAP = { - ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false}, - ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=1,[7]=-1,[8]=false}, - ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=1,[8]=false}, - ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=-1,[7]=1,[8]=false}, - ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=1,[7]=-1,[8]=true}, - ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=1,[7]=1,[8]=true}, - ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=-1,[7]=-1,[8]=true}, - ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=-1,[7]=1,[8]=true}, - ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]="TOP",[5]="TOP",[6]=1,[7]=1,[8]=false}, - ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]="BOTTOM",[5]="BOTTOM",[6]=1,[7]=1,[8]=false}, - ["CUSTOM1"] = { - ['TOPTOP'] = 'UP_RIGHT', - ['BOTTOMBOTTOM'] = 'TOP_RIGHT', - ['LEFTLEFT'] = 'RIGHT_UP', - ['RIGHTRIGHT'] = 'LEFT_UP', - ['RIGHTTOP'] = 'LEFT_DOWN', - ['LEFTTOP'] = 'RIGHT_DOWN', - ['LEFTBOTTOM'] = 'RIGHT_UP', - ['RIGHTBOTTOM'] = 'LEFT_UP', - ['BOTTOMRIGHT'] = 'UP_LEFT', - ['BOTTOMLEFT'] = 'UP_RIGHT', - ['TOPRIGHT'] = 'DOWN_LEFT', - ['TOPLEFT'] = 'DOWN_RIGHT' - } - }; - - local _GSORT = { - ['CLASS']=function(self) - self:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'CLASS') - end, - ['MTMA']=function(self) - self:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ROLE') - end, - ['ROLE']=function(self) - self:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_TDH']=function(self) - self:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_HTD']=function(self) - self:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_HDT']=function(self) - self:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['NAME']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",nil) - end, - ['GROUP']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','INDEX') - self:SetAttribute("sortMethod",'GROUP') - end, - ['PETNAME']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",nil) - self:SetAttribute("filterOnPet",true) + if frame.Portrait then + frame.Portrait:Hide() + frame.Portrait:ClearAllPoints() + end + if db.portrait and frame.PortraitTexture and frame.PortraitModel then + if db.portrait.style == '2D' then + frame.Portrait = frame.PortraitTexture + else + frame.PortraitModel.UserRotation = db.portrait.rotation; + frame.PortraitModel.UserCamDistance = db.portrait.camDistanceScale; + frame.Portrait = frame.PortraitModel end - }; + end + + healthPanel:ClearAllPoints() + healthPanel:Point(TOP_ANCHOR1, frame, TOP_ANCHOR1, (1 * BOTTOM_MODIFIER), -1) + healthPanel:Point(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, portraitWidth, powerHeight) - local function dbMapping(self) - local db = MOD.db[self.___key] - if(db.showBy == "UP") then - db.showBy = "UP_RIGHT" + if(frame.StatusPanel) then + if(template ~= "player" and template ~= "pet" and template ~= "target" and template ~= "targettarget" and template ~= "focus" and template ~= "focustarget") then + local size = healthPanel:GetHeight() + frame.StatusPanel:SetSize(size, size) + frame.StatusPanel:SetPoint("CENTER", healthPanel, "CENTER", 0, 0) end - if(db.showBy == "DOWN") then - db.showBy = "DOWN_RIGHT" - end end - local SecureHeaderMediaUpdate = function(self) - local key = self.___key - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - RefreshUnitMedia(childFrame, key) - index = index + 1; - childFrame = self:GetAttribute("child"..index) + --[[ THREAT LAYOUT ]]-- + + if frame.Threat then + local threat = frame.Threat; + if db.threatEnabled then + if not frame:IsElementEnabled('Threat')then + frame:EnableElement('Threat') + end + elseif frame:IsElementEnabled('Threat')then + frame:DisableElement('Threat') end - end + end + + --[[ TARGETGLOW LAYOUT ]]-- - local SecureHeaderUpdate = function(self) - local key = self.___key - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - RefreshUnitMedia(childFrame, key) - MOD.HeaderUpdate[key](self) - index = index + 1; - childFrame = self:GetAttribute("child"..index) + if frame.TargetGlow then + local glow = frame.TargetGlow; + glow:ClearAllPoints() + glow:Point("TOPLEFT", -3, 3) + glow:Point("TOPRIGHT", 3, 3) + glow:Point("BOTTOMLEFT", -3, -3) + glow:Point("BOTTOMRIGHT", 3, -3) + end + + --[[ INFO TEXTS ]]-- + + if(infoPanel.Name and db.name) then + local nametext = infoPanel.Name + if(not db.power or (not db.power.hideonnpc) or db.power.tags == "") then + nametext:ClearAllPoints() + SuperVillain:ReversePoint(nametext, db.name.position, infoPanel, db.name.xOffset, db.name.yOffset) end + frame:Tag(nametext, db.name.tags) end - - local SecureHeaderClear = function(self) - self:Hide() - self:SetAttribute("showPlayer", true) - self:SetAttribute("showSolo", true) - self:SetAttribute("showParty", true) - self:SetAttribute("showRaid", true) - self:SetAttribute("columnSpacing", nil) - self:SetAttribute("columnAnchorPoint", nil) - self:SetAttribute("sortMethod", nil) - self:SetAttribute("groupFilter", nil) - self:SetAttribute("groupingOrder", nil) - self:SetAttribute("maxColumns", nil) - self:SetAttribute("nameList", nil) - self:SetAttribute("point", nil) - self:SetAttribute("sortDir", nil) - self:SetAttribute("sortMethod", "NAME") - self:SetAttribute("startingIndex", nil) - self:SetAttribute("strictFiltering", nil) - self:SetAttribute("unitsPerColumn", nil) - self:SetAttribute("xOffset", nil) - self:SetAttribute("yOffset", nil) - end - - function MOD:SpawnGroupHeader(parentFrame, filter, realName, template1, headerName, template2) - local db = MOD.db[headerName] - local selfName = headerName:gsub("(.)", upper, 1) - oUF_SuperVillain:SetActiveStyle("SVUI_" .. selfName) - local groupUnit = oUF_SuperVillain:SpawnHeader(realName, template2, nil, - "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), - "groupFilter", filter, - "showParty", true, - "showRaid", true, - "showSolo", true, - template1 and "template", template1 - ); - groupUnit.___key = headerName; - groupUnit:SetParent(parentFrame) - groupUnit:Show() - groupUnit.MediaUpdate = SecureHeaderMediaUpdate - groupUnit.Update = SecureHeaderUpdate - groupUnit.ClearAllAttributes = SecureHeaderClear - return groupUnit - end - - local GroupSetConfigEnvironment = function(self) - local db = MOD.db[self.___key] - local anchorPoint; - local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; - local sorting = db.showBy; - local pointMap = _POINTMAP[sorting] - local point1, point2, point3, point4, point5, horizontal, vertical, isHorizontal = pointMap[1], pointMap[2], pointMap[3], pointMap[4], pointMap[5], pointMap[6], pointMap[7], pointMap[8]; - for i = 1, db.groupCount do - local frame = self.subunits[i] --<< - if frame then - dbMapping(frame) - if isHorizontal then - frame:SetAttribute("xOffset", db.wrapXOffset * horizontal) - frame:SetAttribute("yOffset", 0) - frame:SetAttribute("columnSpacing", db.wrapYOffset) - else - frame:SetAttribute("xOffset", 0) - frame:SetAttribute("yOffset", db.wrapYOffset * vertical) - frame:SetAttribute("columnSpacing", db.wrapXOffset) - end - if not frame.isForced then - if not frame.initialized then - frame:SetAttribute("startingIndex", db.customSorting and (-min(db.groupCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) - frame:Show() - frame.initialized = true - end - frame:SetAttribute("startingIndex", 1) - end - frame:ClearAllPoints() - if db.customSorting and db.invertGroupingOrder then - frame:SetAttribute("columnAnchorPoint", point4) + + if(frame.Health and infoPanel.Health and db.health) then + local healthtext = infoPanel.Health + local point = db.health.position + healthtext:ClearAllPoints() + SuperVillain:ReversePoint(healthtext, point, infoPanel, db.health.xOffset, db.health.yOffset) + frame:Tag(healthtext, db.health.tags) + end + + if(frame.Power and infoPanel.Power and db.power) then + local powertext = infoPanel.Power + if db.power.tags ~= nil and db.power.tags ~= '' then + local point = db.power.position + powertext:ClearAllPoints() + SuperVillain:ReversePoint(powertext, point, infoPanel, db.power.xOffset, db.power.yOffset) + frame:Tag(powertext, db.power.tags) + if db.power.attachTextToPower then + powertext:SetParent(frame.Power) + else + powertext:SetParent(infoPanel) + end + powertext:Show() + else + powertext:Hide() + end + end + + if(infoPanel.Misc and db.misc) then + frame:Tag(infoPanel.Misc, db.misc.tags) + end + + --[[ HEALTH LAYOUT ]]-- + + do + local health = frame.Health; + if(db.health and (db.health.reversed ~= nil)) then + health.fillInverted = db.health.reversed; + else + health.fillInverted = false + end + + health.Smooth = self.db.smoothbars; + + health.colorSmooth = nil; + health.colorHealth = nil; + health.colorClass = nil; + health.colorReaction = nil; + health.colorOverlay = nil; + health.overlayAnimation = overlayAnimation; + health.colors.health = oUF_SuperVillain.colors.health + health.colors.tapped = oUF_SuperVillain.colors.tapped + health.colors.disconnected = oUF_SuperVillain.colors.disconnected + if(db.health and (db.health.frequentUpdates ~= nil)) then + end + if(frame.HealPrediction) then + frame.HealPrediction["frequentUpdates"] = health.frequentUpdates + end + if(portraitOverlay and self.db.forceHealthColor) then + health.colorOverlay = true; + else + if(db.colorOverride and db.colorOverride == "FORCE_ON") then + health.colorClass = true; + health.colorReaction = true + elseif(db.colorOverride and db.colorOverride == "FORCE_OFF") then + if self.db.colorhealthbyvalue == true then + health.colorSmooth = true else - frame:SetAttribute("columnAnchorPoint", point3) - end - MOD:DetachSubFrames(frame:GetChildren()) - frame:SetAttribute("point", point1) - if not frame.isForced then - frame:SetAttribute("maxColumns", db.customSorting and db.groupCount or 1) - frame:SetAttribute("unitsPerColumn", db.customSorting and (db.gRowCol * 5) or 5) - _GSORT[db.sortMethod](frame) - frame:SetAttribute("sortDir", db.sortDir) - frame:SetAttribute("showPlayer", db.showPlayer) - end - if i == 1 and db.customSorting then - frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8") + health.colorHealth = true + end + else + if(not self.db.healthclass) then + if self.db.colorhealthbyvalue == true then + health.colorSmooth = true + else + health.colorHealth = true + end else - frame:SetAttribute("groupFilter", tostring(i)) + health.colorClass = true; + health.colorReaction = true end end - local anchorPoint = point2 - if db.customSorting and db.startFromCenter then - anchorPoint = point5 - end - if (i - 1) % db.gRowCol == 0 then - if isHorizontal then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) - end - heightCalc = heightCalc + db.height + db.wrapYOffset; - yCalc = yCalc + 1 + end + health:ClearAllPoints() + health:SetAllPoints(healthPanel) + if db.health and db.health.orientation then + health:SetOrientation(db.health.orientation) + end + + self:RefreshHealthBar(frame, portraitOverlay) + end + + --[[ POWER LAYOUT ]]-- + + do + if frame.Power then + local power = frame.Power; + if db.power.enable then + if not frame:IsElementEnabled('Power')then + frame:EnableElement('Power') + power:Show() + end + + power.Smooth = self.db.smoothbars; + + power.colorClass = nil; + power.colorReaction = nil; + power.colorPower = nil; + if self.db.powerclass then + power.colorClass = true; + power.colorReaction = true else - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) - end - widthCalc = widthCalc + db.width + db.wrapXOffset; - xCalc = xCalc + 1 + power.colorPower = true end + if(db.power.frequentUpdates) then + power.frequentUpdates = db.power.frequentUpdates + end + power:ClearAllPoints() + power:Height(powerHeight - 2) + power:Point(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, (portraitWidth - (1 * BOTTOM_MODIFIER)), 2) + power:Point(BOTTOM_ANCHOR2, frame, BOTTOM_ANCHOR2, (2 * BOTTOM_MODIFIER), 2) + elseif frame:IsElementEnabled('Power')then + frame:DisableElement('Power') + power:Hide() + end + end + + --[[ ALTPOWER LAYOUT ]]-- + + if frame.AltPowerBar then + local altPower = frame.AltPowerBar; + local Alt_OnShow = function() + healthPanel:Point(TOP_ANCHOR2, portraitWidth, -(powerHeight + 1)) + end + local Alt_OnHide = function() + healthPanel:Point(TOP_ANCHOR2, portraitWidth, -1) + altPower.text:SetText("") + end + if db.power.enable then + frame:EnableElement('AltPowerBar') + if(infoPanel.Health) then + altPower.text:SetFont(infoPanel.Health:GetFont()) + end + altPower.text:SetAlpha(1) + altPower:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, portraitWidth, -1) + altPower:Point(TOP_ANCHOR1, frame, TOP_ANCHOR1, (1 * BOTTOM_MODIFIER), -1) + altPower:SetHeight(powerHeight) + altPower.Smooth = self.db.smoothbars; + altPower:HookScript("OnShow", Alt_OnShow) + altPower:HookScript("OnHide", Alt_OnHide) else - if isHorizontal then - if yCalc == 1 then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) - end - widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5; - xCalc = xCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, (((db.width + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((db.height + db.wrapYOffset) * (yCalc - 1)) * vertical) - end + frame:DisableElement('AltPowerBar') + altPower.text:SetAlpha(0) + altPower:Hide() + end + end + end + + --[[ PORTRAIT LAYOUT ]]-- + + if db.portrait and frame.Portrait then + local portrait = frame.Portrait; + + portrait:Show() + + if db.portrait.enable then + if not frame:IsElementEnabled('Portrait')then + frame:EnableElement('Portrait') + end + portrait:ClearAllPoints() + portrait:SetAlpha(1) + + if db.portrait.overlay then + if db.portrait.style == '3D' then + portrait:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) + portrait:SetCamDistanceScale(db.portrait.camDistanceScale) + elseif db.portrait.style == '2D' then + portrait.anchor:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) + end + + portrait:Point(TOP_ANCHOR2, healthPanel, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) + portrait:Point(BOTTOM_ANCHOR2, healthPanel, BOTTOM_ANCHOR2, (1 * BOTTOM_MODIFIER), 1) + + portrait.Panel:Show() + else + portrait.Panel:Show() + if db.portrait.style == '3D' then + portrait:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) + portrait:SetCamDistanceScale(db.portrait.camDistanceScale) + elseif db.portrait.style == '2D' then + portrait.anchor:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) + end + + if not frame.Power or not db.power.enable then + portrait:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) + portrait:Point(BOTTOM_ANCHOR2, healthPanel, BOTTOM_ANCHOR1, (4 * BOTTOM_MODIFIER), 0) else - if xCalc == 1 then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) - end - heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5; - yCalc = yCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, ((db.width + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((db.height + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) - end + portrait:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) + portrait:Point(BOTTOM_ANCHOR2, frame.Power, BOTTOM_ANCHOR1, (4 * BOTTOM_MODIFIER), 0) end end - if heightCalc == 0 then - heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5 - elseif widthCalc == 0 then - widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5 + else + if frame:IsElementEnabled('Portrait')then + frame:DisableElement('Portrait') + portrait:Hide() + portrait.Panel:Hide() end end - self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset) - end - - local GroupUpdate = function(group) --<< - local key = group.___key - if MOD.db[key].enable ~= true then - UnregisterAttributeDriver(group, "state-visibility") - group:Hide() - return + end + + --[[ CASTBAR LAYOUT ]]-- + + if db.castbar and frame.Castbar then + local castbar = frame.Castbar; + local castHeight = db.castbar.height; + local castWidth + if(db.castbar.matchFrameWidth) then + castWidth = UNIT_WIDTH + else + castWidth = db.castbar.width end - for i=1,#group.subunits do - RefreshUnitMedia(group.subunits[i]) - group.subunits[i]:Update() + local sparkSize = castHeight * 4; + local adjustedWidth = castWidth - 2; + local lazerScale = castHeight * 1.8; + + if(db.castbar.format) then castbar.TimeFormat = db.castbar.format end + + if(not castbar.pewpew) then + castbar:SetSize(adjustedWidth, castHeight) + elseif(castbar:GetHeight() ~= lazerScale) then + castbar:SetSize(adjustedWidth, lazerScale) + end + + if castbar.Spark and db.castbar.spark then + castbar.Spark:Show() + castbar.Spark:SetSize(sparkSize, sparkSize) + if castbar.Spark[1] and castbar.Spark[2] then + castbar.Spark[1]:SetAllPoints(castbar.Spark) + castbar.Spark[2]:FillInner(castbar.Spark, 4, 4) + end + castbar.Spark.SetHeight = function()return end end - end + castbar:SetFrameStrata("HIGH") + if castbar.Holder then + castbar.Holder:Width(castWidth + 2) + castbar.Holder:Height(castHeight + 6) + local holderUpdate = castbar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(castbar.Holder) + end + end + castbar:GetStatusBarTexture():SetHorizTile(false) + if db.castbar.latency then + castbar.SafeZone = castbar.LatencyTexture; + castbar.LatencyTexture:Show() + else + castbar.SafeZone = nil; + castbar.LatencyTexture:Hide() + end + if castbar.Icon then + if db.castbar.icon then + castbar.Icon.bg:Width(castHeight + 2) + castbar.Icon.bg:Height(castHeight + 2) + castbar.Icon.bg:Show() + else + castbar.Icon.bg:Hide() + castbar.Icon = nil + end + end + + local cr,cg,cb + if(db.castbar.useCustomColor) then + cr,cg,cb = db.castbar.castingColor[1], db.castbar.castingColor[2], db.castbar.castingColor[3]; + castbar.CastColor = {cr,cg,cb} + cr,cg,cb = db.castbar.sparkColor[1], db.castbar.sparkColor[2], db.castbar.sparkColor[3]; + castbar.SparkColor = {cr,cg,cb} + else + castbar.CastColor = oUF_SuperVillain.colors.casting + castbar.SparkColor = oUF_SuperVillain.colors.spark + end - local GroupMediaUpdate = function(group) - for i=1,#group.subunits do - group.subunits[i]:MediaUpdate() + if db.castbar.enable and not frame:IsElementEnabled('Castbar')then + frame:EnableElement('Castbar') + elseif not db.castbar.enable and frame:IsElementEnabled('Castbar')then + SuperVillain:AddonMessage("No castbar") + frame:DisableElement('Castbar') + end + end + + --[[ AURA LAYOUT ]]-- + + if frame.Buffs and frame.Debuffs then + do + if db.debuffs.enable or db.buffs.enable then + if not frame:IsElementEnabled('Aura')then + frame:EnableElement('Aura') + end + else + if frame:IsElementEnabled('Aura')then + frame:DisableElement('Aura') + end + end + frame.Buffs:ClearAllPoints() + frame.Debuffs:ClearAllPoints() end - end - local GroupSetActiveState = function(self) - if not self.isForced then - local db = MOD.db[self.___key] - if(db) then - for i=1,#self.subunits do - local self = self.subunits[i] - if i <= db.groupCount and db.customSorting and i <= 1 or not db.customSorting then - self:Show() - else - if self.forceShow then - self:Hide() - MOD:RestrictChildren(self, self:GetChildren()) - self:SetAttribute('startingIndex',1) - else - self:ClearAllAttributes() - end - end - end + do + local buffs = frame.Buffs; + local numRows = db.buffs.numrows; + local perRow = db.buffs.perrow; + local buffCount = perRow * numRows; + + buffs.forceShow = frame.forceShowAuras; + buffs.num = buffCount; + + local tempSize = (((UNIT_WIDTH + 2) - (buffs.spacing * (perRow - 1))) / perRow); + local auraSize = min(BEST_SIZE, tempSize) + if(db.buffs.sizeOverride and db.buffs.sizeOverride > 0) then + auraSize = db.buffs.sizeOverride + buffs:SetWidth(perRow * db.buffs.sizeOverride) + end + + buffs.size = auraSize; + + local attachTo = FindAnchorFrame(frame, db.buffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS') + + SuperVillain:ReversePoint(buffs, db.buffs.anchorPoint, attachTo, db.buffs.xOffset + BOTTOM_MODIFIER, db.buffs.yOffset) + buffs:SetWidth((auraSize + buffs.spacing) * perRow) + buffs:Height((auraSize + buffs.spacing) * numRows) + buffs["growth-y"] = db.buffs.verticalGrowth; + buffs["growth-x"] = db.buffs.horizontalGrowth; + + if db.buffs.enable then + buffs:Show() + else + buffs:Hide() end end - end + do + local debuffs = frame.Debuffs; + local numRows = db.debuffs.numrows; + local perRow = db.debuffs.perrow; + local debuffCount = perRow * numRows; + + debuffs.forceShow = frame.forceShowAuras; + debuffs.num = debuffCount; + + local tempSize = (((UNIT_WIDTH + 2) - (debuffs.spacing * (perRow - 1))) / perRow); + local auraSize = min(BEST_SIZE,tempSize) + if(db.debuffs.sizeOverride and db.debuffs.sizeOverride > 0) then + auraSize = db.debuffs.sizeOverride + debuffs:SetWidth(perRow * db.debuffs.sizeOverride) + end + + debuffs.size = auraSize; + + local attachTo = FindAnchorFrame(frame, db.debuffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS') + + SuperVillain:ReversePoint(debuffs, db.debuffs.anchorPoint, attachTo, db.debuffs.xOffset + BOTTOM_MODIFIER, db.debuffs.yOffset) + debuffs:SetWidth((auraSize + debuffs.spacing) * perRow) + debuffs:Height((auraSize + debuffs.spacing) * numRows) + debuffs["growth-y"] = db.debuffs.verticalGrowth; + debuffs["growth-x"] = db.debuffs.horizontalGrowth; + + if db.debuffs.enable then + debuffs:Show() + else + debuffs:Hide() + end + end + end - function MOD:SetGroupFrame(header, filter, template1, forceUpdate, template2) - if not self.db[header] then return end - local db = self.db[header] + --[[ AURABAR LAYOUT ]]-- - local realName = header:gsub("(.)", upper, 1) + if frame.AuraBars then + local auraBar = frame.AuraBars; + if db.aurabar.enable then + if not frame:IsElementEnabled("AuraBars") then frame:EnableElement("AuraBars") end + auraBar:Show() + auraBar.friendlyAuraType = db.aurabar.friendlyAuraType + auraBar.enemyAuraType = db.aurabar.enemyAuraType - local frame = self.Headers[header] - if(not frame) then - oUF_SuperVillain:RegisterStyle("SVUI_"..realName, function(self, unit) - self.unit = unit - self.___key = header - MOD.Construct[header](self) - return self - end) - oUF_SuperVillain:SetActiveStyle("SVUI_"..realName) + local attachTo = frame.ActionPanel; + local preOffset = 1; + if(db.aurabar.attachTo == "BUFFS" and frame.Buffs and frame.Buffs:IsShown()) then + attachTo = frame.Buffs + preOffset = 10 + elseif(db.aurabar.attachTo == "DEBUFFS" and frame.Debuffs and frame.Debuffs:IsShown()) then + attachTo = frame.Debuffs + preOffset = 10 + elseif not isPlayer and SVUI_Player and db.aurabar.attachTo == "PLAYER_AURABARS" then + attachTo = SVUI_Player.AuraBars + preOffset = 10 + end + + auraBar.auraBarHeight = db.aurabar.height; + auraBar:ClearAllPoints() + auraBar:SetSize(UNIT_WIDTH, db.aurabar.height) - if(header == "tank" or header == "assist") then - frame = self:SpawnGroupHeader(SVUI_UnitFrameParent, filter, "SVUI_"..realName, template1, header, template2) - frame.___key = header - frame.Update = self.HeaderUpdate[header] - frame.MediaUpdate = RefreshUnitMedia + if db.aurabar.anchorPoint == "BELOW" then + auraBar:Point("TOPLEFT", attachTo, "BOTTOMLEFT", 1, -preOffset) + auraBar.down = true else - frame = CreateFrame("Frame", "SVUI_"..realName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") - frame.subunits = {} - if db.customSorting then - if not frame.subunits[1] then - frame.subunits[1] = self:SpawnGroupHeader(frame, 1, "SVUI_" .. realName .. "Group1", template1, header, template2) - end - else - for i = 1, db.groupCount do - if(not frame.subunits[i]) then - frame.subunits[i] = self:SpawnGroupHeader(frame, i, "SVUI_" .. realName .. "Group"..i, template1, header, template2) - end - end - end - frame.___key = header; - frame.SetConfigEnvironment = GroupSetConfigEnvironment - frame.Update = GroupUpdate - frame.MediaUpdate = GroupMediaUpdate - frame.SetActiveState = GroupSetActiveState + auraBar:Point("BOTTOMLEFT", attachTo, "TOPLEFT", 1, preOffset) + auraBar.down = false + end + auraBar.buffColor = oUF_SuperVillain.colors.buff_bars + + if self.db.auraBarByType then + auraBar.debuffColor = nil; + auraBar.defaultDebuffColor = oUF_SuperVillain.colors.debuff_bars + else + auraBar.debuffColor = oUF_SuperVillain.colors.debuff_bars + auraBar.defaultDebuffColor = nil end - frame:Show() - self.Headers[header] = frame + + SortAuraBars(auraBar, db.aurabar.sort) + auraBar:SetAnchors() + else + if frame:IsElementEnabled("AuraBars")then frame:DisableElement("AuraBars")auraBar:Hide()end end + end - if(header == "tank" or header == "assist") then - frame:Update() - else - if(db.enable ~= true and header ~= "raidpet") then - UnregisterStateDriver(frame, "visibility") - frame:Hide() - return - end + --[[ ICON LAYOUTS ]]-- + + do + if db.icons then + local ico = db.icons; - if frame.SetActiveState then - frame:SetActiveState() + --[[ RAIDICON ]]-- + + if(ico.raidicon and frame.RaidIcon) then + local raidIcon = frame.RaidIcon; + if ico.raidicon.enable then + raidIcon:Show() + frame:EnableElement('RaidIcon') + local size = ico.raidicon.size; + raidIcon:ClearAllPoints() + raidIcon:Size(size) + SuperVillain:ReversePoint(raidIcon, ico.raidicon.attachTo, healthPanel, ico.raidicon.xOffset, ico.raidicon.yOffset) + else + frame:DisableElement('RaidIcon') + raidIcon:Hide() + end end - if forceUpdate or not frame.Avatar then - frame:SetConfigEnvironment() - if not frame.isForced and not frame.blockVisibilityChanges then - RegisterStateDriver(frame, "visibility", db.visibility) + --[[ ROLEICON ]]-- + + if(ico.roleIcon and frame.LFDRole) then + local lfd = frame.LFDRole; + if ico.roleIcon.enable then + lfd:Show() + frame:EnableElement('LFDRole') + local size = ico.roleIcon.size; + lfd:ClearAllPoints() + lfd:Size(size) + SuperVillain:ReversePoint(lfd, ico.roleIcon.attachTo, healthPanel, ico.roleIcon.xOffset, ico.roleIcon.yOffset) + else + frame:DisableElement('LFDRole') + lfd:Hide() end - else - frame:SetConfigEnvironment() - frame:Update() - end + end + + --[[ RAIDROLEICON ]]-- - if(db.enable ~= true and header == "raidpet") then - UnregisterStateDriver(frame, "visibility") - frame:Hide() - return + if(ico.raidRoleIcons and frame.RaidRoleFramesAnchor) then + local roles = frame.RaidRoleFramesAnchor; + if ico.raidRoleIcons.enable then + roles:Show() + frame:EnableElement('Leader') + frame:EnableElement('MasterLooter') + local size = ico.raidRoleIcons.size; + roles:ClearAllPoints() + roles:Size(size) + SuperVillain:ReversePoint(roles, ico.raidRoleIcons.attachTo, healthPanel, ico.raidRoleIcons.xOffset, ico.raidRoleIcons.yOffset) + else + roles:Hide() + frame:DisableElement('Leader') + frame:DisableElement('MasterLooter') + end end + end end -end + --[[ HEAL PREDICTION LAYOUT ]]-- + + if frame.HealPrediction then + if db.predict then + if not frame:IsElementEnabled('HealPrediction')then + frame:EnableElement('HealPrediction') + end + else + if frame:IsElementEnabled('HealPrediction')then + frame:DisableElement('HealPrediction') + end + end + end + + --[[ DEBUFF HIGHLIGHT LAYOUT ]]-- + + if frame.Afflicted then + if self.db.debuffHighlighting then + if(template ~= "player" and template ~= "target" and template ~= "focus") then + frame.Afflicted:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + end + frame:EnableElement('Afflicted') + else + frame:DisableElement('Afflicted') + end + end + + --[[ RANGE CHECK LAYOUT ]]-- + + if frame.Range then + frame.Range.outsideAlpha = self.db.OORAlpha or 1; + if db.rangeCheck then + if not frame:IsElementEnabled('Range')then + frame:EnableElement('Range') + end + else + if frame:IsElementEnabled('Range')then + frame:DisableElement('Range') + end + end + end +end +--[[ +########################################################## +EVENTS AND INITIALIZE +########################################################## +]]-- function MOD:FrameForge() if not LoadedUnitFrames then self:SetUnitFrame("player") @@ -876,19 +1115,16 @@ end BUILD FUNCTION / UPDATE ########################################################## ]]-- -function MOD:UpdateThisPackage() +function MOD:ReLoad() self:RefreshUnitFrames() end -function MOD:ConstructThisPackage() +function MOD:Load() self:RefreshUnitColors() local SVUI_UnitFrameParent = CreateFrame("Frame", "SVUI_UnitFrameParent", SuperVillain.UIParent, "SecureHandlerStateTemplate") RegisterStateDriver(SVUI_UnitFrameParent, "visibility", "[petbattle] hide; show") - oUF_SuperVillain:RegisterStyle("SVUI_UnitFrame", StandardUnitStyle) - oUF_SuperVillain:RegisterStyle("SVUI_EnemyFrame", EnemyUnitStyle) - self:Protect("FrameForge", true) self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_REGEN_DISABLED") diff --git a/Interface/AddOns/SVUI/packages/unit/class/classbar.lua b/Interface/AddOns/SVUI/packages/unit/class/classbar.lua index c39df3e..fbfa567 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/classbar.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/classbar.lua @@ -73,10 +73,8 @@ local classBarConstruct = { ["ROGUE"] = function(frame) frame.HyperCombo = MOD:CreateRoguePointTracker(frame) end, - ["HUNTER"] = function(frame) - end, - ['WARRIOR'] = function(frame) - end, + ["HUNTER"] = function(frame) return end, + ['WARRIOR'] = function(frame) return end, }; --[[ ########################################################## diff --git a/Interface/AddOns/SVUI/packages/unit/common/_load.xml b/Interface/AddOns/SVUI/packages/unit/common/_load.xml index 3a9df74..e367914 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/_load.xml +++ b/Interface/AddOns/SVUI/packages/unit/common/_load.xml @@ -7,7 +7,6 @@ <Script file='health.lua'/> <Script file='power.lua'/> <Script file='portrait.lua'/> - <Script file='overlay.lua'/> <Script file='castbar.lua'/> <Script file='auras.lua'/> <Script file='aurabars.lua'/> diff --git a/Interface/AddOns/SVUI/packages/unit/common/secure.lua b/Interface/AddOns/SVUI/packages/unit/common/secure.lua index 762b3e3..b00128a 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/secure.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/secure.lua @@ -119,7 +119,7 @@ local function ChangeGroupIndex(self) if not self:IsShown() then return end local max = MAX_RAID_MEMBERS; - local key = self.___key + local key = self.___groupkey local db = MOD.db[key] local newIndex = db.customSorting and -(min(db.groupCount * (db.gRowCol * 5), max) + 1 ) or -4; @@ -159,7 +159,7 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) if InCombatLockdown()then return end SetProxyEnv() - local key = headerFrame.___key + local key = headerFrame.___groupkey local db = MOD.db[key] headerFrame.forceShow = setForced; headerFrame.forceShowAuras = setForced; @@ -184,8 +184,8 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) headerFrame:GetScript("OnEvent")(headerFrame, "PLAYER_ENTERING_WORLD") end - for i = 1, #headerFrame.subunits do - local groupFrame = headerFrame.subunits[i] + for i = 1, #headerFrame.groups do + local groupFrame = headerFrame.groups[i] if groupFrame:IsShown()then groupFrame.forceShow = headerFrame.forceShow; @@ -211,4 +211,5 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) end headerFrame:SetActiveState() + collectgarbage("collect") end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/_load.xml b/Interface/AddOns/SVUI/packages/unit/frames/_load.xml index 41dc39e..abbbea0 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/_load.xml +++ b/Interface/AddOns/SVUI/packages/unit/frames/_load.xml @@ -1,11 +1,4 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='all_units.lua'/> - <Script file='player.lua'/> - <Script file='target.lua'/> - <Script file='focus.lua'/> - <Script file='pet.lua'/> - <Script file='arenaboss.lua'/> - <Script file='party.lua'/> - <Script file='raid.lua'/> - <Script file='tankassist.lua'/> + <Script file='units.lua'/> + <Script file='groups.lua'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua b/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua deleted file mode 100644 index 2e4e426..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua +++ /dev/null @@ -1,822 +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, min = math.abs, math.ceil, math.floor, math.round, math.min; ---[[ TABLE METHODS ]]-- -local twipe = table.wipe; ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit'); -local _, ns = ... -local oUF_SuperVillain = ns.oUF -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCALS -########################################################## -]]-- -local SortAuraBars; -local ReversedUnit = { - ["target"] = true, - ["targettarget"] = true, - ["pettarget"] = true, - ["focustarget"] = true, - ["boss"] = true, - ["arena"] = true, -} - -do - local hugeMath = math.huge - - local TRRSort = function(a, b) - local compA = a.noTime and hugeMath or a.expirationTime - local compB = b.noTime and hugeMath or b.expirationTime - return compA < compB - end - - local TDSort = function(a, b) - local compA = a.noTime and hugeMath or a.duration - local compB = b.noTime and hugeMath or b.duration - return compA > compB - end - - local TDRSort = function(a, b) - local compA = a.noTime and hugeMath or a.duration - local compB = b.noTime and hugeMath or b.duration - return compA < compB - end - - local NSort = function(a, b) - return a.name > b.name - end - - SortAuraBars = function(parent, sorting) - if not parent then return end - if sorting == "TIME_REMAINING" then - parent.sort = true; - elseif sorting == "TIME_REMAINING_REVERSE" then - parent.sort = TRRSort - elseif sorting == "TIME_DURATION" then - parent.sort = TDSort - elseif sorting == "TIME_DURATION_REVERSE" then - parent.sort = TDRSort - elseif sorting == "NAME" then - parent.sort = NSort - else - parent.sort = nil; - end - end -end - -local RefreshUnitMedia = function(self, unitName) - local db = MOD.db - local key = unitName or self.___key - if(not (db and db.enable) or not self) then return end - local CURRENT_BAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.statusbar) - local CURRENT_AURABAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.auraBarStatusbar); - local CURRENT_FONT = SuperVillain.Shared:Fetch("font", db.font) - local CURRENT_AURABAR_FONT = SuperVillain.Shared:Fetch("font", db.auraFont); - local CURRENT_AURABAR_FONTSIZE = db.auraFontSize - local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline - local unitDB = db[key] - if(unitDB and unitDB.enable) then - local panel = self.InfoPanel - if(panel) then - if(panel.Name and unitDB.name) then - panel.Name:SetFont(SuperVillain.Shared:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) - end - if(panel.Health) then - panel.Health:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - if(panel.Power) then - panel.Power:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - if(panel.Misc) then - panel.Misc:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) - end - end - if(self.Health and (unitDB.health and unitDB.health.enable)) then - self.Health:SetStatusBarTexture(CURRENT_BAR_TEXTURE) - end - if(self.Power and (unitDB.power and unitDB.power.enable)) then - self.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) - end - if(self.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then - local ab = self.AuraBars - ab.auraBarTexture = CURRENT_AURABAR_TEXTURE - ab.textFont = CURRENT_AURABAR_FONT - ab.textSize = db.auraFontSize - ab.textOutline = db.auraFontOutline - end - if(self.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then - local buffs = self.Buffs - buffs.textFont = CURRENT_AURABAR_FONT - buffs.textSize = db.auraFontSize - buffs.textOutline = db.auraFontOutline - end - if(self.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then - local debuffs = self.Debuffs - debuffs.textFont = CURRENT_AURABAR_FONT - debuffs.textSize = db.auraFontSize - debuffs.textOutline = db.auraFontOutline - end - if(self.RaidDebuffs and (unitDB.rdebuffs and unitDB.rdebuffs.enable)) then - local rdebuffs = self.RaidDebuffs; - rdebuffs.count:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) - rdebuffs.time:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline) - end - end -end - -local function FindAnchorFrame(frame, anchor, badPoint) - if badPoint or anchor == 'FRAME' then - return frame - elseif(anchor == 'TRINKET') then - if select(2,IsInInstance())=="arena" then - return frame.Trinket - else - return frame.PVPSpecIcon - end - elseif(anchor == 'BUFFS' and frame.Buffs and frame.Buffs:IsShown()) then - return frame.Buffs - elseif(anchor == 'DEBUFFS' and frame.Debuffs and frame.Debuffs:IsShown()) then - return frame.Debuffs - else - return frame - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:RefreshUnitLayout(frame, template) - local db = MOD.db[template] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - local BEST_SIZE = min(UNIT_WIDTH,UNIT_HEIGHT); - local AURA_HOLDER = db.width - local powerHeight = (db.power and db.power.enable) and (db.power.height - 1) or 1; - - local TOP_ANCHOR1, TOP_ANCHOR2, TOP_MODIFIER = "TOPRIGHT", "TOPLEFT", 1; - local BOTTOM_ANCHOR1, BOTTOM_ANCHOR2, BOTTOM_MODIFIER = "BOTTOMLEFT", "BOTTOMRIGHT", -1; - if(ReversedUnit[template]) then - TOP_ANCHOR1 = "TOPLEFT" - TOP_ANCHOR2 = "TOPRIGHT" - TOP_MODIFIER = -1 - BOTTOM_ANCHOR1 = "BOTTOMRIGHT" - BOTTOM_ANCHOR2 = "BOTTOMLEFT" - BOTTOM_MODIFIER = 1 - end - - local portraitOverlay = false; - local overlayAnimation = false; - local portraitWidth = (1 * TOP_MODIFIER); - local healthPanel = frame.HealthPanel - local infoPanel = frame.InfoPanel - local calculatedHeight = db.height; - - if(template:find("raid")) then - AURA_HOLDER = 100 - end - - if(frame.MediaUpdate) then - frame:MediaUpdate(template) - else - RefreshUnitMedia(frame, template) - end - - if(db.portrait and db.portrait.enable) then - if(not db.portrait.overlay) then - portraitWidth = ((db.portrait.width * TOP_MODIFIER) + (1 * TOP_MODIFIER)) - else - portraitOverlay = true - overlayAnimation = self.db.overlayAnimation - end - end - if(frame.PVPSpecIcon and db.pvpSpecIcon) then - portraitWidth = portraitWidth - UNIT_HEIGHT - end - - if frame.Portrait then - frame.Portrait:Hide() - frame.Portrait:ClearAllPoints() - end - if db.portrait and frame.PortraitTexture and frame.PortraitModel then - if db.portrait.style == '2D' then - frame.Portrait = frame.PortraitTexture - else - frame.PortraitModel.UserRotation = db.portrait.rotation; - frame.PortraitModel.UserCamDistance = db.portrait.camDistanceScale; - frame.Portrait = frame.PortraitModel - end - end - - healthPanel:ClearAllPoints() - healthPanel:Point(TOP_ANCHOR1, frame, TOP_ANCHOR1, (1 * BOTTOM_MODIFIER), -1) - healthPanel:Point(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, portraitWidth, powerHeight) - - if(frame.StatusPanel) then - if(template ~= "player" and template ~= "pet" and template ~= "target" and template ~= "targettarget" and template ~= "focus" and template ~= "focustarget") then - local size = healthPanel:GetHeight() - frame.StatusPanel:SetSize(size, size) - frame.StatusPanel:SetPoint("CENTER", healthPanel, "CENTER", 0, 0) - end - end - - --[[ THREAT LAYOUT ]]-- - - if frame.Threat then - local threat = frame.Threat; - if db.threatEnabled then - if not frame:IsElementEnabled('Threat')then - frame:EnableElement('Threat') - end - elseif frame:IsElementEnabled('Threat')then - frame:DisableElement('Threat') - end - end - - --[[ TARGETGLOW LAYOUT ]]-- - - if frame.TargetGlow then - local glow = frame.TargetGlow; - glow:ClearAllPoints() - glow:Point("TOPLEFT", -3, 3) - glow:Point("TOPRIGHT", 3, 3) - glow:Point("BOTTOMLEFT", -3, -3) - glow:Point("BOTTOMRIGHT", 3, -3) - end - - --[[ INFO TEXTS ]]-- - - if(infoPanel.Name and db.name) then - local nametext = infoPanel.Name - if(not db.power or (not db.power.hideonnpc) or db.power.tags == "") then - nametext:ClearAllPoints() - SuperVillain:ReversePoint(nametext, db.name.position, infoPanel, db.name.xOffset, db.name.yOffset) - end - frame:Tag(nametext, db.name.tags) - end - - if(frame.Health and infoPanel.Health and db.health) then - local healthtext = infoPanel.Health - local point = db.health.position - healthtext:ClearAllPoints() - SuperVillain:ReversePoint(healthtext, point, infoPanel, db.health.xOffset, db.health.yOffset) - frame:Tag(healthtext, db.health.tags) - end - - if(frame.Power and infoPanel.Power and db.power) then - local powertext = infoPanel.Power - if db.power.tags and db.power.tags ~= '' then - local point = db.power.position - powertext:ClearAllPoints() - SuperVillain:ReversePoint(powertext, point, infoPanel, db.power.xOffset, db.power.yOffset) - frame:Tag(powertext, db.power.tags) - - if db.power.attachTextToPower then - powertext:SetParent(frame.Power) - else - powertext:SetParent(infoPanel) - end - else - powertext:Hide() - end - end - - if(infoPanel.Misc and db.misc) then - frame:Tag(infoPanel.Misc, db.misc.tags) - end - - --[[ HEALTH LAYOUT ]]-- - - do - local health = frame.Health; - if(db.health and (db.health.reversed ~= nil)) then - health.fillInverted = db.health.reversed; - else - health.fillInverted = false - end - - health.Smooth = self.db.smoothbars; - - health.colorSmooth = nil; - health.colorHealth = nil; - health.colorClass = nil; - health.colorReaction = nil; - health.colorOverlay = nil; - health.overlayAnimation = overlayAnimation; - health.colors.health = oUF_SuperVillain.colors.health - health.colors.tapped = oUF_SuperVillain.colors.tapped - health.colors.disconnected = oUF_SuperVillain.colors.disconnected - if(db.health and (db.health.frequentUpdates ~= nil)) then - end - if(frame.HealPrediction) then - frame.HealPrediction["frequentUpdates"] = health.frequentUpdates - end - if(portraitOverlay and self.db.forceHealthColor) then - health.colorOverlay = true; - else - if(db.colorOverride and db.colorOverride == "FORCE_ON") then - health.colorClass = true; - health.colorReaction = true - elseif(db.colorOverride and db.colorOverride == "FORCE_OFF") then - if self.db.colorhealthbyvalue == true then - health.colorSmooth = true - else - health.colorHealth = true - end - else - if(not self.db.healthclass) then - if self.db.colorhealthbyvalue == true then - health.colorSmooth = true - else - health.colorHealth = true - end - else - health.colorClass = true; - health.colorReaction = true - end - end - end - health:ClearAllPoints() - health:SetAllPoints(healthPanel) - if db.health and db.health.orientation then - health:SetOrientation(db.health.orientation) - end - - self:RefreshHealthBar(frame, portraitOverlay) - end - - --[[ POWER LAYOUT ]]-- - - do - if frame.Power then - local power = frame.Power; - if db.power.enable then - if not frame:IsElementEnabled('Power')then - frame:EnableElement('Power') - power:Show() - end - - power.Smooth = self.db.smoothbars; - - power.colorClass = nil; - power.colorReaction = nil; - power.colorPower = nil; - if self.db.powerclass then - power.colorClass = true; - power.colorReaction = true - else - power.colorPower = true - end - if(db.power.frequentUpdates) then - power.frequentUpdates = db.power.frequentUpdates - end - power:ClearAllPoints() - power:Height(powerHeight - 2) - power:Point(BOTTOM_ANCHOR1, frame, BOTTOM_ANCHOR1, (portraitWidth - (1 * BOTTOM_MODIFIER)), 2) - power:Point(BOTTOM_ANCHOR2, frame, BOTTOM_ANCHOR2, (2 * BOTTOM_MODIFIER), 2) - elseif frame:IsElementEnabled('Power')then - frame:DisableElement('Power') - power:Hide() - end - end - - --[[ ALTPOWER LAYOUT ]]-- - - if frame.AltPowerBar then - local altPower = frame.AltPowerBar; - local Alt_OnShow = function() - healthPanel:Point(TOP_ANCHOR2, portraitWidth, -(powerHeight + 1)) - end - local Alt_OnHide = function() - healthPanel:Point(TOP_ANCHOR2, portraitWidth, -1) - altPower.text:SetText("") - end - if db.power.enable then - frame:EnableElement('AltPowerBar') - if(infoPanel.Health) then - altPower.text:SetFont(infoPanel.Health:GetFont()) - end - altPower.text:SetAlpha(1) - altPower:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, portraitWidth, -1) - altPower:Point(TOP_ANCHOR1, frame, TOP_ANCHOR1, (1 * BOTTOM_MODIFIER), -1) - altPower:SetHeight(powerHeight) - altPower.Smooth = self.db.smoothbars; - altPower:HookScript("OnShow", Alt_OnShow) - altPower:HookScript("OnHide", Alt_OnHide) - else - frame:DisableElement('AltPowerBar') - altPower.text:SetAlpha(0) - altPower:Hide() - end - end - end - - --[[ PORTRAIT LAYOUT ]]-- - - if db.portrait and frame.Portrait then - local portrait = frame.Portrait; - - portrait:Show() - - if db.portrait.enable then - if not frame:IsElementEnabled('Portrait')then - frame:EnableElement('Portrait') - end - portrait:ClearAllPoints() - portrait:SetAlpha(1) - - if db.portrait.overlay then - if db.portrait.style == '3D' then - portrait:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) - portrait:SetCamDistanceScale(db.portrait.camDistanceScale) - elseif db.portrait.style == '2D' then - portrait.anchor:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) - end - - portrait:Point(TOP_ANCHOR2, healthPanel, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) - portrait:Point(BOTTOM_ANCHOR2, healthPanel, BOTTOM_ANCHOR2, (1 * BOTTOM_MODIFIER), 1) - - portrait.Panel:Show() - else - portrait.Panel:Show() - if db.portrait.style == '3D' then - portrait:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) - portrait:SetCamDistanceScale(db.portrait.camDistanceScale) - elseif db.portrait.style == '2D' then - portrait.anchor:SetFrameLevel(frame.ActionPanel:GetFrameLevel()) - end - - if not frame.Power or not db.power.enable then - portrait:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) - portrait:Point(BOTTOM_ANCHOR2, healthPanel, BOTTOM_ANCHOR1, (4 * BOTTOM_MODIFIER), 0) - else - portrait:Point(TOP_ANCHOR2, frame, TOP_ANCHOR2, (1 * TOP_MODIFIER), -1) - portrait:Point(BOTTOM_ANCHOR2, frame.Power, BOTTOM_ANCHOR1, (4 * BOTTOM_MODIFIER), 0) - end - end - else - if frame:IsElementEnabled('Portrait')then - frame:DisableElement('Portrait') - portrait:Hide() - portrait.Panel:Hide() - end - end - end - - --[[ CASTBAR LAYOUT ]]-- - - if db.castbar and frame.Castbar then - local castbar = frame.Castbar; - local castHeight = db.castbar.height; - local castWidth - if(db.castbar.matchFrameWidth) then - castWidth = UNIT_WIDTH - else - castWidth = db.castbar.width - end - local sparkSize = castHeight * 4; - local adjustedWidth = castWidth - 2; - local lazerScale = castHeight * 1.8; - - if(db.castbar.format) then castbar.TimeFormat = db.castbar.format end - - if(not castbar.pewpew) then - castbar:SetSize(adjustedWidth, castHeight) - elseif(castbar:GetHeight() ~= lazerScale) then - castbar:SetSize(adjustedWidth, lazerScale) - end - - if castbar.Spark and db.castbar.spark then - castbar.Spark:Show() - castbar.Spark:SetSize(sparkSize, sparkSize) - if castbar.Spark[1] and castbar.Spark[2] then - castbar.Spark[1]:SetAllPoints(castbar.Spark) - castbar.Spark[2]:FillInner(castbar.Spark, 4, 4) - end - castbar.Spark.SetHeight = function()return end - end - castbar:SetFrameStrata("HIGH") - if castbar.Holder then - castbar.Holder:Width(castWidth + 2) - castbar.Holder:Height(castHeight + 6) - local holderUpdate = castbar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(castbar.Holder) - end - end - castbar:GetStatusBarTexture():SetHorizTile(false) - if db.castbar.latency then - castbar.SafeZone = castbar.LatencyTexture; - castbar.LatencyTexture:Show() - else - castbar.SafeZone = nil; - castbar.LatencyTexture:Hide() - end - if castbar.Icon then - if db.castbar.icon then - castbar.Icon.bg:Width(castHeight + 2) - castbar.Icon.bg:Height(castHeight + 2) - castbar.Icon.bg:Show() - else - castbar.Icon.bg:Hide() - castbar.Icon = nil - end - end - - local cr,cg,cb - if(db.castbar.useCustomColor) then - cr,cg,cb = db.castbar.castingColor[1], db.castbar.castingColor[2], db.castbar.castingColor[3]; - castbar.CastColor = {cr,cg,cb} - cr,cg,cb = db.castbar.sparkColor[1], db.castbar.sparkColor[2], db.castbar.sparkColor[3]; - castbar.SparkColor = {cr,cg,cb} - else - castbar.CastColor = oUF_SuperVillain.colors.casting - castbar.SparkColor = oUF_SuperVillain.colors.spark - end - - if db.castbar.enable and not frame:IsElementEnabled('Castbar')then - frame:EnableElement('Castbar') - elseif not db.castbar.enable and frame:IsElementEnabled('Castbar')then - SuperVillain:AddonMessage("No castbar") - frame:DisableElement('Castbar') - end - end - - --[[ AURA LAYOUT ]]-- - - if frame.Buffs and frame.Debuffs then - do - if db.debuffs.enable or db.buffs.enable then - if not frame:IsElementEnabled('Aura')then - frame:EnableElement('Aura') - end - else - if frame:IsElementEnabled('Aura')then - frame:DisableElement('Aura') - end - end - frame.Buffs:ClearAllPoints() - frame.Debuffs:ClearAllPoints() - end - - do - local buffs = frame.Buffs; - local numRows = db.buffs.numrows; - local perRow = db.buffs.perrow; - local buffCount = perRow * numRows; - - buffs.forceShow = frame.forceShowAuras; - buffs.num = buffCount; - - local tempSize = (((UNIT_WIDTH + 2) - (buffs.spacing * (perRow - 1))) / perRow); - local auraSize = min(BEST_SIZE, tempSize) - if(db.buffs.sizeOverride and db.buffs.sizeOverride > 0) then - auraSize = db.buffs.sizeOverride - buffs:SetWidth(perRow * db.buffs.sizeOverride) - end - - buffs.size = auraSize; - - local attachTo = FindAnchorFrame(frame, db.buffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS') - - SuperVillain:ReversePoint(buffs, db.buffs.anchorPoint, attachTo, db.buffs.xOffset + BOTTOM_MODIFIER, db.buffs.yOffset) - buffs:SetWidth((auraSize + buffs.spacing) * perRow) - buffs:Height((auraSize + buffs.spacing) * numRows) - buffs["growth-y"] = db.buffs.verticalGrowth; - buffs["growth-x"] = db.buffs.horizontalGrowth; - - if db.buffs.enable then - buffs:Show() - else - buffs:Hide() - end - end - do - local debuffs = frame.Debuffs; - local numRows = db.debuffs.numrows; - local perRow = db.debuffs.perrow; - local debuffCount = perRow * numRows; - - debuffs.forceShow = frame.forceShowAuras; - debuffs.num = debuffCount; - - local tempSize = (((UNIT_WIDTH + 2) - (debuffs.spacing * (perRow - 1))) / perRow); - local auraSize = min(BEST_SIZE,tempSize) - if(db.debuffs.sizeOverride and db.debuffs.sizeOverride > 0) then - auraSize = db.debuffs.sizeOverride - debuffs:SetWidth(perRow * db.debuffs.sizeOverride) - end - - debuffs.size = auraSize; - - local attachTo = FindAnchorFrame(frame, db.debuffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS') - - SuperVillain:ReversePoint(debuffs, db.debuffs.anchorPoint, attachTo, db.debuffs.xOffset + BOTTOM_MODIFIER, db.debuffs.yOffset) - debuffs:SetWidth((auraSize + debuffs.spacing) * perRow) - debuffs:Height((auraSize + debuffs.spacing) * numRows) - debuffs["growth-y"] = db.debuffs.verticalGrowth; - debuffs["growth-x"] = db.debuffs.horizontalGrowth; - - if db.debuffs.enable then - debuffs:Show() - else - debuffs:Hide() - end - end - end - - --[[ AURABAR LAYOUT ]]-- - - if frame.AuraBars then - local auraBar = frame.AuraBars; - if db.aurabar.enable then - if not frame:IsElementEnabled("AuraBars") then frame:EnableElement("AuraBars") end - auraBar:Show() - auraBar.friendlyAuraType = db.aurabar.friendlyAuraType - auraBar.enemyAuraType = db.aurabar.enemyAuraType - - local attachTo = frame.ActionPanel; - local preOffset = 1; - if(db.aurabar.attachTo == "BUFFS" and frame.Buffs and frame.Buffs:IsShown()) then - attachTo = frame.Buffs - preOffset = 10 - elseif(db.aurabar.attachTo == "DEBUFFS" and frame.Debuffs and frame.Debuffs:IsShown()) then - attachTo = frame.Debuffs - preOffset = 10 - elseif not isPlayer and SVUI_Player and db.aurabar.attachTo == "PLAYER_AURABARS" then - attachTo = SVUI_Player.AuraBars - preOffset = 10 - end - - auraBar.auraBarHeight = db.aurabar.height; - auraBar:ClearAllPoints() - auraBar:SetSize(UNIT_WIDTH, db.aurabar.height) - - if db.aurabar.anchorPoint == "BELOW" then - auraBar:Point("TOPLEFT", attachTo, "BOTTOMLEFT", 1, -preOffset) - auraBar.down = true - else - auraBar:Point("BOTTOMLEFT", attachTo, "TOPLEFT", 1, preOffset) - auraBar.down = false - end - auraBar.buffColor = oUF_SuperVillain.colors.buff_bars - - if self.db.auraBarByType then - auraBar.debuffColor = nil; - auraBar.defaultDebuffColor = oUF_SuperVillain.colors.debuff_bars - else - auraBar.debuffColor = oUF_SuperVillain.colors.debuff_bars - auraBar.defaultDebuffColor = nil - end - - SortAuraBars(auraBar, db.aurabar.sort) - auraBar:SetAnchors() - else - if frame:IsElementEnabled("AuraBars")then frame:DisableElement("AuraBars")auraBar:Hide()end - end - end - - --[[ ICON LAYOUTS ]]-- - - do - if db.icons then - local ico = db.icons; - - --[[ RAIDICON ]]-- - - if(ico.raidicon and frame.RaidIcon) then - local raidIcon = frame.RaidIcon; - if ico.raidicon.enable then - raidIcon:Show() - frame:EnableElement('RaidIcon') - local size = ico.raidicon.size; - raidIcon:ClearAllPoints() - raidIcon:Size(size) - SuperVillain:ReversePoint(raidIcon, ico.raidicon.attachTo, healthPanel, ico.raidicon.xOffset, ico.raidicon.yOffset) - else - frame:DisableElement('RaidIcon') - raidIcon:Hide() - end - end - - --[[ ROLEICON ]]-- - - if(ico.roleIcon and frame.LFDRole) then - local lfd = frame.LFDRole; - if ico.roleIcon.enable then - lfd:Show() - frame:EnableElement('LFDRole') - local size = ico.roleIcon.size; - lfd:ClearAllPoints() - lfd:Size(size) - SuperVillain:ReversePoint(lfd, ico.roleIcon.attachTo, healthPanel, ico.roleIcon.xOffset, ico.roleIcon.yOffset) - else - frame:DisableElement('LFDRole') - lfd:Hide() - end - end - - --[[ RAIDROLEICON ]]-- - - if(ico.raidRoleIcons and frame.RaidRoleFramesAnchor) then - local roles = frame.RaidRoleFramesAnchor; - if ico.raidRoleIcons.enable then - roles:Show() - frame:EnableElement('Leader') - frame:EnableElement('MasterLooter') - local size = ico.raidRoleIcons.size; - roles:ClearAllPoints() - roles:Size(size) - SuperVillain:ReversePoint(roles, ico.raidRoleIcons.attachTo, healthPanel, ico.raidRoleIcons.xOffset, ico.raidRoleIcons.yOffset) - else - roles:Hide() - frame:DisableElement('Leader') - frame:DisableElement('MasterLooter') - end - end - - end - end - - --[[ HEAL PREDICTION LAYOUT ]]-- - - if frame.HealPrediction then - if db.predict then - if not frame:IsElementEnabled('HealPrediction')then - frame:EnableElement('HealPrediction') - end - else - if frame:IsElementEnabled('HealPrediction')then - frame:DisableElement('HealPrediction') - end - end - end - - --[[ DEBUFF HIGHLIGHT LAYOUT ]]-- - - if frame.Afflicted then - if self.db.debuffHighlighting then - if(template ~= "player" and template ~= "target" and template ~= "focus") then - frame.Afflicted:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - end - frame:EnableElement('Afflicted') - else - frame:DisableElement('Afflicted') - end - end - - --[[ RANGE CHECK LAYOUT ]]-- - - if frame.Range then - frame.Range.outsideAlpha = self.db.OORAlpha or 1; - if db.rangeCheck then - if not frame:IsElementEnabled('Range')then - frame:EnableElement('Range') - end - else - if frame:IsElementEnabled('Range')then - frame:DisableElement('Range') - end - end - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/arenaboss.lua b/Interface/AddOns/SVUI/packages/unit/frames/arenaboss.lua deleted file mode 100644 index 0796033..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/arenaboss.lua +++ /dev/null @@ -1,269 +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'); -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 ceil,tinsert = math.ceil,table.insert -local lastArenaFrame, lastBossFrame ---[[ -########################################################## -BOSS HANDLERS -########################################################## -]]-- -function MOD.Construct:boss() - local frame = self - MOD:SetActionPanel(frame, "boss") - frame.Health = MOD:CreateHealthBar(frame, true, true) - frame.Power = MOD:CreatePowerBar(frame, true, true) - MOD:CreatePortrait(frame) - frame.Buffs = MOD:CreateBuffs(frame, "boss") - frame.Debuffs = MOD:CreateDebuffs(frame, "boss") - frame.Afflicted = MOD:CreateAfflicted(frame) - frame.Castbar = MOD:CreateCastbar(frame, true, nil, true, nil, true) - frame.RaidIcon = MOD:CreateRaidIcon(frame) - frame.AltPowerBar = MOD:CreateAltPowerBar(frame) - frame.Range = { insideAlpha = 1, outsideAlpha = 1 } - frame:SetAttribute("type2", "focus") - - if(not _G["SVUI_Boss_MOVE"]) then - frame:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(frame, "SVUI_Boss_MOVE", L["Boss Frames"], nil, nil, nil, "ALL, PARTY, RAID10, RAID25, RAID40") - else - frame:Point("TOPRIGHT", lastBossFrame, "BOTTOMRIGHT", 0, -20) - end - lastBossFrame = frame -end - -function MOD.FrameUpdate:boss() - local frame = self - local db = MOD.db["boss"] - local INDEX = frame.index; - local holder = _G["SVUI_Boss_MOVE"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - frame.colors = oUF_SuperVillain.colors; - frame:Size(UNIT_WIDTH, UNIT_HEIGHT) - frame:ClearAllPoints() - if(tonumber(INDEX) == 1) then - holder:Width(UNIT_WIDTH) - holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if db.showBy == "UP"then - frame:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else - frame:Point("TOPRIGHT", holder, "TOPRIGHT") - end - else - local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if db.showBy == "UP"then - frame:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else - frame:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end - end - frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD:RefreshUnitLayout(frame, "boss") - frame:UpdateAllElements() -end ---[[ -########################################################## -ARENA HANDLERS -########################################################## -]]-- -function MOD.Construct:arena() - local frame = self - local selfName = frame:GetName() - local prepName = selfName.."PrepFrame"; - local selfID = frame:GetID() - - MOD:SetActionPanel(frame, "arena") - frame.Health = MOD:CreateHealthBar(frame, true, true) - frame.Power = MOD:CreatePowerBar(frame, true) - MOD:CreatePortrait(frame) - frame.Buffs = MOD:CreateBuffs(frame, "arena") - frame.Debuffs = MOD:CreateDebuffs(frame, "arena") - frame.Castbar = MOD:CreateCastbar(frame, true, nil, true, nil, true) - frame.Trinket = MOD:CreateTrinket(frame) - frame.PVPSpecIcon = MOD:CreatePVPSpecIcon(frame) - frame.Range = { insideAlpha = 1, outsideAlpha = 1 } - frame:SetAttribute("type2", "focus") - - if not _G[prepName] then - local prep = CreateFrame("Frame", prepName, UIParent) - prep:SetFrameStrata("MEDIUM") - prep:SetAllPoints(frame) - prep:SetID(selfID) - prep:SetPanelTemplate("Bar", true, 3, 3, 3) - prep.Health = CreateFrame("StatusBar", nil, prep) - prep.Health:SetAllPoints(prep) - prep.Health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - prep.Health:SetPanelTemplate("Bar", true, 3, 3, 3) - prep.Icon = prep:CreateTexture(nil, "OVERLAY") - prep.Icon.bg = CreateFrame("Frame", nil, prep) - prep.Icon.bg:Point("TOPLEFT", prep, "TOPRIGHT", 1, 0) - prep.Icon.bg:Point("BOTTOMRIGHT", prep, "BOTTOMRIGHT", 1, 0) - prep.Icon.bg:SetFixedPanelTemplate("Default", true) - prep.Icon:SetParent(prep.Icon.bg) - prep.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - prep.Icon:FillInner(prep.Icon.bg) - prep.SpecClass = prep.Health:CreateFontString(nil, "OVERLAY") - prep.SpecClass:SetFont(SuperVillain.Media.font.names, 12, "OUTLINE") - prep.SpecClass:SetTextColor(1, 1, 1) - prep.SpecClass:SetPoint("CENTER") - prep:Hide() - end - - if(not _G["SVUI_Arena_MOVE"]) then - frame:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(frame, "SVUI_Arena_MOVE", L["Arena Frames"], nil, nil, nil, "ALL, ARENA") - else - frame:Point("TOPRIGHT", lastArenaFrame, "BOTTOMRIGHT", 0, -20) - end - lastArenaFrame = frame -end - -function MOD.FrameUpdate:arena() - local frame = self - local db = MOD.db["arena"] - local INDEX = frame.index; - local holder = _G["SVUI_Arena_MOVE"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - frame.colors = oUF_SuperVillain.colors; - frame:Size(UNIT_WIDTH, UNIT_HEIGHT) - frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - do - local trinket = frame.Trinket; - trinket.bg:Size(db.pvpTrinket.size) - trinket.bg:ClearAllPoints() - if(db.pvpTrinket.position == "RIGHT") then - trinket.bg:Point("LEFT", frame, "RIGHT", db.pvpTrinket.xOffset, db.pvpTrinket.yOffset) - else - trinket.bg:Point("RIGHT", frame, "LEFT", db.pvpTrinket.xOffset, db.pvpTrinket.yOffset) - end - if db.pvpTrinket.enable and not frame:IsElementEnabled("Trinket")then - frame:EnableElement("Trinket") - elseif not db.pvpTrinket.enable and frame:IsElementEnabled("Trinket")then - frame:DisableElement("Trinket") - end - end - do - local pvp = frame.PVPSpecIcon; - pvp.bg:Point("RIGHT", frame, "RIGHT") - pvp.bg:Size(UNIT_HEIGHT, UNIT_HEIGHT) - if db.pvpSpecIcon then - frame.InfoPanel:Point("TOPLEFT", frame, "TOPLEFT", 0, 0) - frame.InfoPanel:Point("BOTTOMRIGHT", frame.PVPSpecIcon, "BOTTOMLEFT", 0, 0) - if frame:IsElementEnabled("PVPSpecIcon")then - frame:EnableElement("PVPSpecIcon") - end - elseif frame:IsElementEnabled("PVPSpecIcon")then - frame:DisableElement("PVPSpecIcon") - end - end - MOD:RefreshUnitLayout(frame, "arena") - frame:ClearAllPoints() - if(tonumber(INDEX) == 1) then - holder:Width(UNIT_WIDTH) - holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if(db.showBy == "UP") then - frame:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else - frame:Point("TOPRIGHT", holder, "TOPRIGHT") - end - else - local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if(db.showBy == "UP") then - frame:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else - frame:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end - end - frame:UpdateAllElements() -end ---[[ -########################################################## -PREP FRAME HANDLER -########################################################## -]]-- -local ArenaPrepHandler = CreateFrame("Frame") -local ArenaPrepHandler_OnEvent = function(self, event) - local _, instanceType = IsInInstance() - if(not MOD.db.arena.enable or instanceType ~= "arena") then return end - if event == "PLAYER_LOGIN" then - for i = 1, 5 do - local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe) then - prepframe:SetAllPoints(_G["SVUI_Arena"..i]) - end - end - elseif event == "ARENA_OPPONENT_UPDATE" then - for i = 1, 5 do - local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe and prepframe:IsShown()) then - prepframe:Hide() - end - end - else - local numOpps = GetNumArenaOpponentSpecs() - if numOpps > 0 then - for i = 1, 5 do - local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if i <= numOpps then - local s = GetArenaOpponentSpec(i) - local _, spec, class = nil, "UNKNOWN", "UNKNOWN" - if s and s > 0 then - _, spec, _, icon, _, _, class = GetSpecializationInfoByID(s) - end - if class and spec then - prepframe.SpecClass:SetText(spec .. " - " .. LOCALIZED_CLASS_NAMES_MALE[class]) - prepframe.Icon:SetTexture(icon or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) - - local color = RAID_CLASS_COLORS[class] - local textcolor = SVUI_CLASS_COLORS[class] or color - if color then - prepframe.Health:SetStatusBarColor(color.r, color.g, color.b) - prepframe.SpecClass:SetTextColor(color.r, color.g, color.b) - else - prepframe.Health:SetStatusBarColor(0.25, 0.25, 0.25) - prepframe.SpecClass:SetTextColor(1, 1, 1) - end - - prepframe:Show() - end - else - prepframe:Hide() - end - end - else - for i = 1, 5 do - local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe and prepframe:IsShown()) then - prepframe:Hide() - end - end - end - end -end - -ArenaPrepHandler:RegisterEvent("PLAYER_LOGIN") -ArenaPrepHandler:RegisterEvent("PLAYER_ENTERING_WORLD") -ArenaPrepHandler:RegisterEvent("ARENA_OPPONENT_UPDATE") -ArenaPrepHandler:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS") -ArenaPrepHandler:SetScript("OnEvent", ArenaPrepHandler_OnEvent) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/focus.lua b/Interface/AddOns/SVUI/packages/unit/frames/focus.lua deleted file mode 100644 index 2ab9bb6..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/focus.lua +++ /dev/null @@ -1,102 +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'); -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 ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD.Construct:focus() - MOD:SetActionPanel(self, "focus") - - self.Health = MOD:CreateHealthBar(self, true, true) - self.Health.frequentUpdates = true - - self.HealPrediction = MOD:CreateHealPrediction(self, true) - self.Power = MOD:CreatePowerBar(self, true) - - self.Castbar = MOD:CreateCastbar(self, false, L["Focus Castbar"]) - self.Castbar.SafeZone = nil - - self.Castbar.LatencyTexture:Hide() - self.Buffs = MOD:CreateBuffs(self, "focus") - self.Debuffs = MOD:CreateDebuffs(self, "focus") - self.AuraBars = MOD:CreateAuraBarHeader(self, "focus") - tinsert(self.__elements, MOD.SmartAuraDisplay) - self:RegisterEvent("PLAYER_FOCUS_CHANGED", MOD.SmartAuraDisplay) - - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - 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") -end - -function MOD.Construct:focustarget() - MOD:SetActionPanel(self, "focustarget") - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Buffs = MOD:CreateBuffs(self, "focustarget") - self.Debuffs = MOD:CreateDebuffs(self, "focustarget") - 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") -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD.FrameUpdate:focus() - local db = MOD.db["focus"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "focus") - - if(MOD.db.xrayFocus) then - self.XRay:Show() - else - self.XRay:Hide() - end - - MOD:UpdateAuraWatch(self) - self:UpdateAllElements() -end - -function MOD.FrameUpdate:focustarget() - local db = MOD.db["focustarget"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "focustarget") - self:UpdateAllElements() -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 new file mode 100644 index 0000000..d8e9094 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/frames/groups.lua @@ -0,0 +1,1140 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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; +--[[ STRING METHODS ]]-- +local find, format, upper = string.find, string.format, string.upper; +local match, gsub = string.match, string.gsub; + +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.Registry:Expose('SVUnit'); +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 ceil,tinsert = math.ceil,table.insert +--[[ +########################################################## +LOCAL DATA +########################################################## +]]-- +local CONSTRUCTORS, UPDATERS = {}, {} +local _POINTMAP = { + ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false}, + ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=1,[7]=-1,[8]=false}, + ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=1,[8]=false}, + ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=-1,[7]=1,[8]=false}, + ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=1,[7]=-1,[8]=true}, + ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=1,[7]=1,[8]=true}, + ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=-1,[7]=-1,[8]=true}, + ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=-1,[7]=1,[8]=true}, + ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]="TOP",[5]="TOP",[6]=1,[7]=1,[8]=false}, + ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]="BOTTOM",[5]="BOTTOM",[6]=1,[7]=1,[8]=false}, +} + +local _GSORT = { + ['CLASS']=function(self) + self:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'CLASS') + end, + ['MTMA']=function(self) + self:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ROLE') + end, + ['ROLE']=function(self) + self:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_TDH']=function(self) + self:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_HTD']=function(self) + self:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_HDT']=function(self) + self:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['NAME']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",nil) + end, + ['GROUP']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','INDEX') + self:SetAttribute("sortMethod",'GROUP') + end, + ['PETNAME']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",nil) + self:SetAttribute("filterOnPet",true) + end +} +--[[ +########################################################## +ALL UNIT HELPERS +########################################################## +]]-- +local GroupMediaUpdate = function(self) + local key = self.___key + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + MOD.RefreshUnitMedia(childFrame, key) + if(_G[childFrame:GetName().."Pet"]) then + MOD.RefreshUnitMedia(_G[childFrame:GetName().."Pet"], key) + end + if(_G[childFrame:GetName().."Target"]) then + MOD.RefreshUnitMedia(_G[childFrame:GetName().."Target"], key) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end + +local UpdateTargetGlow = function(self) + if not self.unit then return end + local unit = self.unit; + if(UnitIsUnit(unit, "target")) then + self.TargetGlow:Show() + local reaction = UnitReaction(unit, "player") + if(UnitIsPlayer(unit)) then + local _, class = UnitClass(unit) + if class then + local colors = SVUI_CLASS_COLORS[class] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + elseif(reaction) then + local colors = FACTION_BAR_COLORS[reaction] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + else + self.TargetGlow:Hide() + end +end + +local DetachSubFrames = function(...) + for i = 1, select("#", ...) do + local frame = select(i,...) + frame:ClearAllPoints() + end +end +--[[ +########################################################## +RAID 10, 25, 40 +########################################################## +]]-- +local Raid10Visibility = function(self, event) + local db = MOD.db["raid10"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if event == "PLAYER_REGEN_ENABLED"then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 10)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local Raid25Visibility = function(self, event) + local db = MOD.db["raid25"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if event == "PLAYER_REGEN_ENABLED"then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 25)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local Raid40Visibility = function(self, event) + local db = MOD.db["raid40"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if event == "PLAYER_REGEN_ENABLED"then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 40)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local UpdateRaidSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + if not InCombatLockdown() then self:Size(db.width, db.height) end + do + local rdBuffs = self.RaidDebuffs; + if db.rdebuffs.enable then + self:EnableElement("RaidDebuffs") + rdBuffs:Size(db.rdebuffs.size) + rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) + else + self:DisableElement("RaidDebuffs") + rdBuffs:Hide() + end + end + MOD.RefreshUnitMedia(self, key) + MOD:UpdateAuraWatch(self) + MOD:RefreshUnitLayout(self, key) + if(key ~= "raidpet") then + self:EnableElement("ReadyCheck") + end + self:UpdateAllElements() +end + +local Raid10Update = function(self) + local frame = self:GetParent() + 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) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid10Visibility) + frame.positioned = true + end + Raid10Visibility(frame) + local key = "raid10" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid10"] = Raid10Update + +local Raid25Update = function(self) + local frame = self:GetParent() + 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) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid25Visibility) + frame.positioned = true + end + Raid25Visibility(frame) + local key = "raid25" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid25"] = Raid25Update + +local Raid40Update = function(self) + local frame = self:GetParent() + 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) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid40Visibility) + frame.positioned = true + end + Raid40Visibility(frame) + local key = "raid40" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid40"] = Raid40Update + +local function SetRaidFrame(frame) + frame:SetScript("OnEnter", UnitFrame_OnEnter) + frame:SetScript("OnLeave", UnitFrame_OnLeave) + + frame.RaidDebuffs = MOD:CreateRaidDebuffs(frame) + frame.Afflicted = MOD:CreateAfflicted(frame) + frame.ResurrectIcon = MOD:CreateResurectionIcon(frame) + frame.LFDRole = MOD:CreateRoleIcon(frame) + frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame) + frame.RaidIcon = MOD:CreateRaidIcon(frame) + frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame) + frame.HealPrediction = MOD:CreateHealPrediction(frame) + frame.Range = { insideAlpha = 1, outsideAlpha = 1 } + + 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 = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + frame.TargetGlow = shadow + tinsert(frame.__elements, UpdateTargetGlow) + frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + + return frame +end + +CONSTRUCTORS["raid10"] = function(self, unit) + local key = "raid10" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end + +CONSTRUCTORS["raid25"] = function(self, unit) + local key = "raid25" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end + +CONSTRUCTORS["raid40"] = function(self, unit) + local key = "raid40" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end +--[[ +########################################################## +RAID PETS +########################################################## +]]-- +local RaidPetVisibility = function(self, event) + local db = MOD.db["raidpet"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + local inInstance, instanceType = IsInInstance() + if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end + + if not InCombatLockdown() then + if inInstance and instanceType == "raid" then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local UpdateRaidPetFrame = function(self) + local raidPets = self:GetParent() + 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") + raidPets.positioned = true; + raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") + raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") + raidPets:SetScript("OnEvent", RaidPetVisibility) + end + RaidPetVisibility(raidPets) + local key = "raidpet" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raidpet"] = UpdateRaidPetFrame + +CONSTRUCTORS["raidpet"] = function(self, unit) + local key = "raidpet" + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + self.RaidDebuffs = MOD:CreateRaidDebuffs(self) + self.Afflicted = MOD:CreateAfflicted(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + + local shadow = CreateFrame("Frame", nil, self) + shadow:SetFrameLevel(1) + shadow:SetFrameStrata(self:GetFrameStrata()) + shadow:WrapOuter(self, 3, 3) + shadow:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + self.TargetGlow = shadow + tinsert(self.__elements, UpdateTargetGlow) + self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + return self +end +--[[ +########################################################## +PARTY +########################################################## +]]-- +local PartyVisibility = function(self, event) + local db = MOD.db["party"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + local instance, instanceType = IsInInstance() + if(event == "PLAYER_REGEN_ENABLED") then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if(not InCombatLockdown()) then + if(instance and instanceType == "raid") then + UnregisterStateDriver(self,"visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + end +end + +local UpdatePartySubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') + MOD.RefreshUnitMedia(self, key) + if self.isChild then + local altDB = db.petsGroup; + if self == _G[self.originalParent:GetName()..'Target'] then + altDB = db.targetsGroup + end + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if altDB.enable then + self:SetParent(self.originalParent) + self:Size(altDB.width,altDB.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + do + local health = self.Health; + health.Smooth = nil; + health.frequentUpdates = nil; + health.colorSmooth = nil; + health.colorHealth = nil; + health.colorClass = true; + health.colorReaction = true; + health:ClearAllPoints() + health:Point("TOPRIGHT", self, "TOPRIGHT", -1, -1) + health:Point("BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1) + end + do + local nametext = self.InfoPanel.Name + self:Tag(nametext, altDB.tags) + end + else + if not InCombatLockdown() then + self:Size(db.width,db.height) + end + MOD:RefreshUnitLayout(self, key) + MOD:UpdateAuraWatch(self) + end + self:EnableElement('ReadyCheck') + self:UpdateAllElements() +end + +local UpdatePartyFrame = function(self) + local group = self:GetParent() + 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'); + group.positioned = true; + group:RegisterEvent("PLAYER_ENTERING_WORLD") + group:RegisterEvent("ZONE_CHANGED_NEW_AREA") + group:SetScript("OnEvent", PartyVisibility) + end + PartyVisibility(group) + local key = "party" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdatePartySubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdatePartySubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdatePartySubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["party"] = UpdatePartyFrame + +CONSTRUCTORS["party"] = function(self, unit) + local key = "party" + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + + if self.isChild then + self.originalParent = self:GetParent() + else + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + MOD:CreatePortrait(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + self.ResurrectIcon = MOD:CreateResurectionIcon(self) + self.LFDRole = MOD:CreateRoleIcon(self) + self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.ReadyCheck = MOD:CreateReadyCheckIcon(self) + self.HealPrediction = MOD:CreateHealPrediction(self) + + local shadow = CreateFrame("Frame", nil, self) + shadow:SetFrameLevel(1) + shadow:SetFrameStrata(self:GetFrameStrata()) + shadow:WrapOuter(self, 3, 3) + shadow:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + self.TargetGlow = shadow + tinsert(self.__elements, UpdateTargetGlow) + self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + self:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow) + end + + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + return self +end +--[[ +########################################################## +TANK +########################################################## +]]-- +local UpdateTankSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, key) + if self.isChild and self.originalParent then + local targets = db.targetsGroup; + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if targets.enable then + self:SetParent(self.originalParent) + self:Size(targets.width, targets.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + elseif not InCombatLockdown()then + self:Size(db.width, db.height) + end + MOD:RefreshUnitLayout(self, key) + do + local nametext = self.InfoPanel.Name; + if oUF_SuperVillain.colors.healthclass then + self:Tag(nametext, "[name:10]") + else + self:Tag(nametext, "[name:color][name:10]") + end + end + self:UpdateAllElements() +end + +local UpdateTankFrame = function(self) + local key = "tank" + local db = MOD.db[key] + if db.enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + self:Hide() + DetachSubFrames(self:GetChildren()) + self:SetAttribute("startingIndex", -1) + RegisterAttributeDriver(self, "state-visibility", "show") + self.dirtyWidth, self.dirtyHeight = self:GetSize() + RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") + self:SetAttribute("startingIndex", 1) + self:SetAttribute("point", "BOTTOM") + self:SetAttribute("columnAnchorPoint", "LEFT") + DetachSubFrames(self:GetChildren()) + self:SetAttribute("yOffset", 7) + 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") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + self.positioned = true + end + for i = 1, self:GetNumChildren() do + local childFrame = select(i, self:GetChildren()) + UpdateTankSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateTankSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateTankSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + end +end +UPDATERS["tank"] = UpdateTankFrame + +CONSTRUCTORS["tank"] = function(self, unit) + local key = "tank" + local db = MOD.db[key] + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.RaidIcon:SetPoint("BOTTOMRIGHT") + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + UpdateTankSubUnit(self, key, db) + self.originalParent = self:GetParent() + return self +end +--[[ +########################################################## +ASSIST +########################################################## +]]-- +local UpdateAssistSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, key) + if self.isChild and self.originalParent then + local targets = db.targetsGroup; + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if targets.enable then + self:SetParent(self.originalParent) + self:Size(targets.width, targets.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + elseif not InCombatLockdown()then + self:Size(db.width, db.height) + end + + MOD:RefreshUnitLayout(self, key) + + do + local nametext = self.InfoPanel.Name; + if oUF_SuperVillain.colors.healthclass then + self:Tag(nametext, "[name:10]") + else + self:Tag(nametext, "[name:color][name:10]") + end + end + self:UpdateAllElements() +end + +local UpdateAssistFrame = function(self) + local key = "assist" + local db = MOD.db[key] + self:Hide() + DetachSubFrames(self:GetChildren()) + self:SetAttribute("startingIndex", -1) + RegisterAttributeDriver(self, "state-visibility", "show") + self.dirtyWidth, self.dirtyHeight = self:GetSize() + RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") + self:SetAttribute("startingIndex", 1) + self:SetAttribute("point", "BOTTOM") + self:SetAttribute("columnAnchorPoint", "LEFT") + DetachSubFrames(self:GetChildren()) + self:SetAttribute("yOffset", 7) + 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") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + self.positioned = true + end + for i = 1, self:GetNumChildren() do + local childFrame = select(i, self:GetChildren()) + UpdateAssistSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateAssistSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateAssistSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + end +end +UPDATERS["assist"] = UpdateAssistFrame + +CONSTRUCTORS["assist"] = function(self, unit) + local key = "assist" + local db = MOD.db[key] + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.RaidIcon:SetPoint("BOTTOMRIGHT") + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + UpdateAssistSubUnit(self, key, db) + self.originalParent = self:GetParent() + return self +end +--[[ +########################################################## +SUBUNIT CONSTRUCTORS +########################################################## +]]-- +local SecureHeaderClear = function(self) + self:Hide() + self:SetAttribute("showPlayer", true) + self:SetAttribute("showSolo", true) + self:SetAttribute("showParty", true) + self:SetAttribute("showRaid", true) + self:SetAttribute("columnSpacing", nil) + self:SetAttribute("columnAnchorPoint", nil) + self:SetAttribute("sortMethod", nil) + self:SetAttribute("groupFilter", nil) + self:SetAttribute("groupingOrder", nil) + self:SetAttribute("maxColumns", nil) + self:SetAttribute("nameList", nil) + self:SetAttribute("point", nil) + self:SetAttribute("sortDir", nil) + self:SetAttribute("sortMethod", "NAME") + self:SetAttribute("startingIndex", nil) + self:SetAttribute("strictFiltering", nil) + self:SetAttribute("unitsPerColumn", nil) + self:SetAttribute("xOffset", nil) + self:SetAttribute("yOffset", nil) +end + +local function ConstructGroupHeader(parentFrame, filter, styleName, headerName, template1, groupName, template2) + local db = MOD.db[groupName] + oUF_SuperVillain:SetActiveStyle(styleName) + local groupHeader = oUF_SuperVillain:SpawnHeader(headerName, template2, nil, + "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), + "groupFilter", filter, + "showParty", true, + "showRaid", true, + "showSolo", true, + template1 and "template", template1 + ) + groupHeader.___groupkey = groupName + groupHeader:SetParent(parentFrame) + groupHeader:Show() + + groupHeader.Update = UPDATERS[groupName] + groupHeader.MediaUpdate = GroupMediaUpdate + groupHeader.ClearAllAttributes = SecureHeaderClear + + return groupHeader +end +--[[ +########################################################## +GROUP HEADER METHODS +########################################################## +]]-- +local GroupSetConfigEnvironment = function(self) + local key = self.___groupkey + local db = MOD.db[key] + local anchorPoint; + local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; + local sorting = db.showBy; + local pointMap = _POINTMAP[sorting] + local point1, point2, point3, point4, point5, horizontal, vertical, isHorizontal = pointMap[1], pointMap[2], pointMap[3], pointMap[4], pointMap[5], pointMap[6], pointMap[7], pointMap[8]; + for i = 1, db.groupCount do + local frame = self.groups[i] + if frame then + if(db.showBy == "UP") then + db.showBy = "UP_RIGHT" + end + if(db.showBy == "DOWN") then + db.showBy = "DOWN_RIGHT" + end + if isHorizontal then + frame:SetAttribute("xOffset", db.wrapXOffset * horizontal) + frame:SetAttribute("yOffset", 0) + frame:SetAttribute("columnSpacing", db.wrapYOffset) + else + frame:SetAttribute("xOffset", 0) + frame:SetAttribute("yOffset", db.wrapYOffset * vertical) + frame:SetAttribute("columnSpacing", db.wrapXOffset) + end + if not frame.isForced then + if not frame.initialized then + frame:SetAttribute("startingIndex", db.customSorting and (-min(db.groupCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) + frame:Show() + frame.initialized = true + end + frame:SetAttribute("startingIndex", 1) + end + frame:ClearAllPoints() + if db.customSorting and db.invertGroupingOrder then + frame:SetAttribute("columnAnchorPoint", point4) + else + frame:SetAttribute("columnAnchorPoint", point3) + end + DetachSubFrames(frame:GetChildren()) + frame:SetAttribute("point", point1) + if not frame.isForced then + frame:SetAttribute("maxColumns", db.customSorting and db.groupCount or 1) + frame:SetAttribute("unitsPerColumn", db.customSorting and (db.gRowCol * 5) or 5) + _GSORT[db.sortMethod](frame) + frame:SetAttribute("sortDir", db.sortDir) + frame:SetAttribute("showPlayer", db.showPlayer) + end + if i == 1 and db.customSorting then + frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8") + else + frame:SetAttribute("groupFilter", tostring(i)) + end + end + local anchorPoint = point2 + if db.customSorting and db.startFromCenter then + anchorPoint = point5 + end + if (i - 1) % db.gRowCol == 0 then + if isHorizontal then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + db.height + db.wrapYOffset; + yCalc = yCalc + 1 + else + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + db.width + db.wrapXOffset; + xCalc = xCalc + 1 + end + else + if isHorizontal then + if yCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5; + xCalc = xCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, self, anchorPoint, (((db.width + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((db.height + db.wrapYOffset) * (yCalc - 1)) * vertical) + end + else + if xCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5; + yCalc = yCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, self, anchorPoint, ((db.width + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((db.height + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) + end + end + end + if heightCalc == 0 then + heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5 + elseif widthCalc == 0 then + widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5 + end + end + self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset) +end + +local GroupHeaderUpdate = function(self) + local key = self.___groupkey + if MOD.db[key].enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + for i=1,#self.groups do + self.groups[i]:Update() + end +end + +local GroupSetActiveState = function(self) + if not self.isForced then + local key = self.___groupkey + local db = MOD.db[key] + if(db) then + for i=1,#self.groups do + local frame = self.groups[i] + if(i <= db.groupCount and ((db.customSorting and i <= 1) or not db.customSorting)) then + + frame:Show() + else + if frame.forceShow then + frame:Hide() + MOD:RestrictChildren(frame, frame:GetChildren()) + frame:SetAttribute('startingIndex',1) + else + frame:ClearAllAttributes() + end + end + end + end + end +end +--[[ +########################################################## +LOAD/UPDATE METHOD +########################################################## +]]-- +function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2) + if not self.db[key] then return end + local db = self.db[key] + local realName = key:gsub("(.)", upper, 1) + local styleName = "SVUI_"..realName + local frame, groupName + if(not self.Headers[key]) then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + + if(key == "tank" or key == "assist") then + frame = ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2) + else + frame = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + frame.groups = {} + frame.___groupkey = key; + frame.Update = GroupHeaderUpdate + frame.MediaUpdate = GroupMediaUpdate + frame.SetActiveState = GroupSetActiveState + frame.SetConfigEnvironment = GroupSetConfigEnvironment + end + frame:Show() + self.Headers[key] = frame + else + frame = self.Headers[key] + end + + if(key == "tank" or key == "assist") then + frame:Update() + else + if(db.enable ~= true and key ~= "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() + return + end + + if(db.customSorting) then + if(not frame.groups[1]) then + groupName = styleName .. "Group1" + frame.groups[1] = ConstructGroupHeader(frame, 1, styleName, groupName, template1, key, template2) + end + else + for i = 1, db.groupCount do + if(not frame.groups[i]) then + groupName = styleName .. "Group" .. i + frame.groups[i] = ConstructGroupHeader(frame, i, styleName, groupName, template1, key, template2) + end + end + end + + frame:SetActiveState() + + if(forceUpdate or not frame.Avatar) then + frame:SetConfigEnvironment() + if(not frame.isForced) then + RegisterStateDriver(frame, "visibility", db.visibility) + end + else + frame:SetConfigEnvironment() + frame:Update() + end + + if(db.enable ~= true and key == "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() + return + end + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/party.lua b/Interface/AddOns/SVUI/packages/unit/frames/party.lua deleted file mode 100644 index 8e0831d..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/party.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('SVUnit'); -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 ceil,tinsert = math.ceil,table.insert - -local VisibilityUpdate = function(self, event) - local db = MOD.db["party"] - if (not db or (db and not db.enable) or not MOD.db.smartRaidFilter or self.isForced) then return end - local instance, instanceType = IsInInstance() - if(event == "PLAYER_REGEN_ENABLED") then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if(not InCombatLockdown()) then - if(instance and instanceType == "raid") then - UnregisterStateDriver(self,"visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - end -end - -local UpdateTargetGlow = function(self) - if not self.unit then return end - local unit = self.unit; - if(UnitIsUnit(unit, "target")) then - self.TargetGlow:Show() - local reaction = UnitReaction(unit, "player") - if(UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - if class then - local colors = SVUI_CLASS_COLORS[class] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - elseif(reaction) then - local colors = FACTION_BAR_COLORS[reaction] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - else - self.TargetGlow:Hide() - end -end - -local UpdatePartyFrame = function(self) - local frame = self - local db = MOD.db["party"] - frame.colors = oUF_SuperVillain.colors; - frame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') - if frame.isChild then - local altDB = db.petsGroup; - if frame == _G[frame.originalParent:GetName()..'Target'] then - altDB = db.targetsGroup - end - if not frame.originalParent.childList then - frame.originalParent.childList = {} - end - frame.originalParent.childList[frame] = true; - if not InCombatLockdown()then - if altDB.enable then - frame:SetParent(frame.originalParent) - frame:Size(altDB.width,altDB.height) - frame:ClearAllPoints() - SuperVillain:ReversePoint(frame, altDB.anchorPoint, frame.originalParent, altDB.xOffset, altDB.yOffset) - else - frame:SetParent(SuperVillain.Cloaked) - end - end - do - local health = frame.Health; - health.Smooth = nil; - health.frequentUpdates = nil; - health.colorSmooth = nil; - health.colorHealth = nil; - health.colorClass = true; - health.colorReaction = true; - health:ClearAllPoints() - health:Point("TOPRIGHT", frame, "TOPRIGHT", -1, -1) - health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", 1, 1) - end - do - local nametext = frame.InfoPanel.Name - frame:Tag(nametext, altDB.tags) - end - else - if not InCombatLockdown() then - frame:Size(db.width,db.height) - end - MOD:RefreshUnitLayout(frame, "party") - MOD:UpdateAuraWatch(frame) - end - frame:EnableElement('ReadyCheck') - frame:UpdateAllElements() -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD.Construct:party() - local frame = self - frame:SetScript("OnEnter", UnitFrame_OnEnter) - frame:SetScript("OnLeave", UnitFrame_OnLeave) - - MOD:SetActionPanel(frame, "party") - - if frame.isChild then - frame.Health = MOD:CreateHealthBar(frame, true) - frame.originalParent = frame:GetParent() - else - frame.Health = MOD:CreateHealthBar(frame, true) - frame.Power = MOD:CreatePowerBar(frame, true) - frame.Power.frequentUpdates = false - MOD:CreatePortrait(frame, true) - frame.Buffs = MOD:CreateBuffs(frame, "party") - frame.Debuffs = MOD:CreateDebuffs(frame, "party") - frame.AuraWatch = MOD:CreateAuraWatch(frame, "party") - frame.Afflicted = MOD:CreateAfflicted(frame) - frame.ResurrectIcon = MOD:CreateResurectionIcon(frame) - frame.LFDRole = MOD:CreateRoleIcon(frame) - frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame) - frame.RaidIcon = MOD:CreateRaidIcon(frame) - frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame) - frame.HealPrediction = MOD:CreateHealPrediction(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 = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - frame.TargetGlow = shadow - tinsert(frame.__elements, UpdateTargetGlow) - frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - frame:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow) - end - - frame.Range = { insideAlpha = 1, outsideAlpha = 1 } - - return frame -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD.HeaderUpdate:party() - local group = self:GetParent() - 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'); - group.positioned = true; - group:RegisterEvent("PLAYER_ENTERING_WORLD") - group:RegisterEvent("ZONE_CHANGED_NEW_AREA") - group:SetScript("OnEvent", VisibilityUpdate) - end - VisibilityUpdate(group) - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdatePartyFrame(childFrame) - if(_G[childFrame:GetName().."Pet"]) then - UpdatePartyFrame(_G[childFrame:GetName().."Pet"]) - end - if(_G[childFrame:GetName().."Target"]) then - UpdatePartyFrame(_G[childFrame:GetName().."Target"]) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/pet.lua b/Interface/AddOns/SVUI/packages/unit/frames/pet.lua deleted file mode 100644 index e6601d2..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/pet.lua +++ /dev/null @@ -1,95 +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'); -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 ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD.Construct:pet() - MOD:SetActionPanel(self, "pet") - self.Health = MOD:CreateHealthBar(self, true) - self.Health.frequentUpdates = true; - self.HealPrediction = MOD:CreateHealPrediction(self) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false; - MOD:CreatePortrait(self, true) - self.Castbar = MOD:CreateCastbar(self, false, nil, false) - self.Buffs = MOD:CreateBuffs(self, "pet") - self.Debuffs = MOD:CreateDebuffs(self, "pet") - self.AuraWatch = MOD:CreateAuraWatch(self, "pet") - 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") -end - -function MOD.Construct:pettarget() - MOD:SetActionPanel(self, "pettarget") - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Buffs = MOD:CreateBuffs(self, "pettarget") - self.Debuffs = MOD:CreateDebuffs(self, "pettarget") - 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") -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD.FrameUpdate:pet() - local db = MOD.db["pet"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "pet") - do - if SVUI_Player and not InCombatLockdown()then - self:SetParent(SVUI_Player) - end - end - MOD:UpdateAuraWatch(self) - self:UpdateAllElements() -end - -function MOD.FrameUpdate:pettarget() - local db = MOD.db["pettarget"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "pettarget") - do - if SVUI_Pet and not InCombatLockdown()then - self:SetParent(SVUI_Pet) - end - end - self:UpdateAllElements() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/player.lua b/Interface/AddOns/SVUI/packages/unit/frames/player.lua deleted file mode 100644 index 0ff320b..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/player.lua +++ /dev/null @@ -1,212 +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'); -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 ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD.Construct:player() - MOD:SetActionPanel(self, "player") - self.Health = MOD:CreateHealthBar(self, true) - self.Health.frequentUpdates = true - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = true - MOD:CreatePortrait(self, false, true) - self.Buffs = MOD:CreateBuffs(self, "player") - self.Debuffs = MOD:CreateDebuffs(self, "player") - self.Castbar = MOD:CreateCastbar(self, false, L["Player Castbar"], true, true) - MOD:CreateExperienceRepBar(self) - MOD:GetClassResources(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Resting = MOD:CreateRestingIndicator(self) - self.Combat = MOD:CreateCombatIndicator(self) - self.PvPText = self.InfoPanel:CreateFontString(nil,'OVERLAY') - self.PvPText:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - self.Afflicted = MOD:CreateAfflicted(self) - self.HealPrediction = MOD:CreateHealPrediction(self, true) - self.AuraBars = MOD:CreateAuraBarHeader(self, "player") - 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") -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD.FrameUpdate:player() - local db = MOD.db["player"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - local USE_CLASSBAR = db.classbar.enable; - local classBarHeight = db.classbar.height; - local classBarWidth = db.width * 0.4; - local healthPanel = self.HealthPanel - local iconDB = db.icons - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - - MOD:RefreshUnitLayout(self, "player") - - do - local resting = self.Resting; - if resting then - if iconDB and iconDB.restIcon and iconDB.restIcon.enable then - local size = iconDB.restIcon.size; - resting:ClearAllPoints() - resting:Size(size) - SuperVillain:ReversePoint(resting, iconDB.restIcon.attachTo, healthPanel, iconDB.restIcon.xOffset, iconDB.restIcon.yOffset) - if not self:IsElementEnabled("Resting")then - self:EnableElement("Resting") - end - elseif self:IsElementEnabled("Resting")then - self:DisableElement("Resting") - resting:Hide() - end - end - end - do - local combat = self.Combat; - if combat then - if iconDB and iconDB.combatIcon and iconDB.combatIcon.enable then - local size = iconDB.combatIcon.size; - combat:ClearAllPoints() - combat:Size(size) - SuperVillain:ReversePoint(combat, iconDB.combatIcon.attachTo, healthPanel, iconDB.combatIcon.xOffset, iconDB.combatIcon.yOffset) - if not self:IsElementEnabled("Combat")then - self:EnableElement("Combat") - end - elseif self:IsElementEnabled("Combat")then - self:DisableElement("Combat") - combat:Hide() - end - end - end - do - local pvp = self.PvPText; - local point = db.pvp.position; - pvp:ClearAllPoints() - pvp:Point(db.pvp.position, healthPanel, db.pvp.position) - self:Tag(pvp, db.pvp.tags) - end - do - local power = self.Power; - if SuperVillain.class == "DRUID" and self.DruidAltMana then - if db.power.druidMana then - self:EnableElement("DruidAltMana") - else - self:DisableElement("DruidAltMana") - self.DruidAltMana:Hide() - end - end - if SuperVillain.class == "MONK" then - local stagger = self.DrunkenMaster; - if db.stagger.enable then - if not self:IsElementEnabled("DrunkenMaster")then - self:EnableElement("DrunkenMaster") - end - else - if self:IsElementEnabled("DrunkenMaster")then - self:DisableElement("DrunkenMaster") - end - end - end - end - do - if(self.DruidAltMana) then - if db.power.druidMana then - self:EnableElement("DruidAltMana") - else - self:DisableElement("DruidAltMana") - self.DruidAltMana:Hide() - end - end - if(self.DrunkenMaster) then - if db.stagger.enable then - if not self:IsElementEnabled("DrunkenMaster")then - self:EnableElement("DrunkenMaster") - end - else - if self:IsElementEnabled("DrunkenMaster")then - self:DisableElement("DrunkenMaster") - end - end - end - - if(self.ClassBar or self.HyperCombo) then - if self.ClassBarRefresh then - self.ClassBarRefresh(self) - end - if(self.ClassBar) then - local classBar = self[self.ClassBar]; - 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 USE_CLASSBAR then - if(not self:IsElementEnabled(self.ClassBar)) then - self:EnableElement(self.ClassBar) - end - classBar:Show() - else - if(self:IsElementEnabled(self.ClassBar)) then - self:DisableElement(self.ClassBar) - end - classBar:Hide() - end - end - if(self.HyperCombo) then - if not self:IsElementEnabled("HyperCombo") then - self:EnableElement("HyperCombo") - end - else - if self:IsElementEnabled("HyperCombo") then - self:DisableElement("HyperCombo") - end - end - end - end - do - if db.combatfade and not self:IsElementEnabled("CombatFade")then - self:EnableElement("CombatFade") - elseif - not db.combatfade and self:IsElementEnabled("CombatFade")then - self:DisableElement("CombatFade") - end - end - self:UpdateAllElements() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/raid.lua b/Interface/AddOns/SVUI/packages/unit/frames/raid.lua deleted file mode 100644 index ad07102..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/raid.lua +++ /dev/null @@ -1,282 +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'); -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 ceil,tinsert = math.ceil,table.insert - -local VisibilityUpdate = function(self, event) - local db = MOD.db[self.___key] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - local instance, group = IsInInstance() - local _, _, _, _, info, _, _ = GetInstanceInfo() - if event == "PLAYER_REGEN_ENABLED"then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if not InCombatLockdown()then - if(instance and (group == "raid") and (info == i)) then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif(instance and (group == "raid")) then - UnregisterStateDriver(self, "visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local RaidPetVisibility = function(self, event) - local db = MOD.db["raidpet"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - local inInstance, instanceType = IsInInstance() - if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end - - if not InCombatLockdown() then - if inInstance and instanceType == "raid" then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local UpdateTargetGlow = function(self) - if not self.unit then return end - local unit = self.unit; - if(UnitIsUnit(unit, "target")) then - self.TargetGlow:Show() - local reaction = UnitReaction(unit, "player") - if(UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - if class then - local colors = SVUI_CLASS_COLORS[class] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - elseif(reaction) then - local colors = FACTION_BAR_COLORS[reaction] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - else - self.TargetGlow:Hide() - end -end ---[[ -########################################################## -BUILD FUNCTION & UPDATE -########################################################## -]]-- -local ConstructRaidFrame = function(self, unit) - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, unit) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false - self.Buffs = MOD:CreateBuffs(self, unit) - self.Debuffs = MOD:CreateDebuffs(self, unit) - self.AuraWatch = MOD:CreateAuraWatch(self, unit) - self.RaidDebuffs = MOD:CreateRaidDebuffs(self) - self.Afflicted = MOD:CreateAfflicted(self) - self.ResurrectIcon = MOD:CreateResurectionIcon(self) - self.LFDRole = MOD:CreateRoleIcon(self) - self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.ReadyCheck = MOD:CreateReadyCheckIcon(self) - self.HealPrediction = MOD:CreateHealPrediction(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - - local shadow = CreateFrame("Frame", nil, self) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(self:GetFrameStrata()) - shadow:WrapOuter(self, 3, 3) - shadow:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - self.TargetGlow = shadow - tinsert(self.__elements, UpdateTargetGlow) - self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - - return frame -end - -local UpdateRaidFrame = function(self, header) - local db = MOD.db[header] - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - if not InCombatLockdown() then self:Size(db.width, db.height) end - do - local rdBuffs = self.RaidDebuffs; - if db.rdebuffs.enable then - self:EnableElement("RaidDebuffs") - rdBuffs:Size(db.rdebuffs.size) - rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) - else - self:DisableElement("RaidDebuffs") - rdBuffs:Hide() - end - end - MOD:UpdateAuraWatch(self) - MOD:RefreshUnitLayout(self, header) - self:EnableElement("ReadyCheck") - self:UpdateAllElements() -end - -for i = 10, 40, 15 do - local raidGroupName = "raid"..i - MOD.Construct[raidGroupName] = ConstructRaidFrame - MOD.HeaderUpdate[raidGroupName] = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, frame:GetName().."_MOVE", L["Raid 1-"]..i..L[" Frames"], nil, nil, nil, "ALL, RAID"..i) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", VisibilityUpdate) - frame.positioned = true - end - VisibilityUpdate(frame) - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidFrame(childFrame, raidGroupName) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidFrame(_G[childFrame:GetName().."Pet"], raidGroupName) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidFrame(_G[childFrame:GetName().."Target"], raidGroupName) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end - end -end ---[[ -########################################################## -BUILD AND UPDATE RAID PETS -########################################################## -]]-- -local UpdateRaidpetFrame = function(self) - local db = MOD.db["raidpet"] - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - if not InCombatLockdown() then self:Size(db.width, db.height)end - MOD:RefreshUnitLayout(self, "raidpet") - do - local rdBuffs = self.RaidDebuffs; - if db.rdebuffs.enable then - self:EnableElement("RaidDebuffs") - rdBuffs:Size(db.rdebuffs.size) - rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) - else - self:DisableElement("RaidDebuffs") - rdBuffs:Hide() - end - end - MOD:UpdateAuraWatch(self, true) - self:UpdateAllElements() -end - -function MOD.Construct:raidpet() - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, "raidpet") - self.Health = MOD:CreateHealthBar(self, true) - self.Debuffs = MOD:CreateDebuffs(self, "raidpet") - self.AuraWatch = MOD:CreateAuraWatch(self, "raidpet") - self.RaidDebuffs = MOD:CreateRaidDebuffs(self) - self.Afflicted = MOD:CreateAfflicted(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - - local shadow = CreateFrame("Frame", nil, self) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(self:GetFrameStrata()) - shadow:WrapOuter(self, 3, 3) - shadow:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - self.TargetGlow = shadow - tinsert(self.__elements, UpdateTargetGlow) - self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - - return self -end - -function MOD.HeaderUpdate:raidpet() - local raidPets = self:GetParent() - 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") - raidPets.positioned = true; - raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") - raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") - raidPets:SetScript("OnEvent", RaidPetVisibility) - end - RaidPetVisibility(raidPets) - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidpetFrame(childFrame) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidpetFrame(_G[childFrame:GetName().."Pet"]) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidpetFrame(_G[childFrame:GetName().."Target"]) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/tankassist.lua b/Interface/AddOns/SVUI/packages/unit/frames/tankassist.lua deleted file mode 100644 index c353176..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/tankassist.lua +++ /dev/null @@ -1,204 +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'); -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 tinsert = table.insert; ---[[ -########################################################## -TANK HANDLERS -########################################################## -]]-- -local function UpdateTankFrame(header) - local db = MOD.db["tank"] - header.colors = oUF_SuperVillain.colors; - header:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - if header.isChild and header.originalParent then - local targets = db.targetsGroup; - if not header.originalParent.childList then - header.originalParent.childList = {} - end - header.originalParent.childList[header] = true; - if not InCombatLockdown()then - if targets.enable then - header:SetParent(header.originalParent) - header:Size(targets.width, targets.height) - header:ClearAllPoints() - SuperVillain:ReversePoint(header, targets.anchorPoint, header.originalParent, targets.xOffset, targets.yOffset) - else - header:SetParent(SuperVillain.Cloaked) - end - end - elseif not InCombatLockdown()then - header:Size(db.width, db.height) - end - MOD:RefreshUnitLayout(header, "tank") - do - local nametext = header.InfoPanel.Name; - if oUF_SuperVillain.colors.healthclass then - header:Tag(nametext, "[name:10]") - else - header:Tag(nametext, "[name:color][name:10]") - end - end - header:UpdateAllElements() -end - -function MOD.Construct:tank() - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, "tank") - self.Health = MOD:CreateHealthBar(self, true) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.RaidIcon:SetPoint("BOTTOMRIGHT") - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - UpdateTankFrame(self) - self.originalParent = self:GetParent() - return self -end - -function MOD.HeaderUpdate:tank() - local db = MOD.db["tank"] - local header = self - if db.enable ~= true then - UnregisterAttributeDriver(header, "state-visibility") - header:Hide() - return - end - header:Hide() - MOD:DetachSubFrames(header:GetChildren()) - header:SetAttribute("startingIndex", -1) - RegisterAttributeDriver(header, "state-visibility", "show") - header.dirtyWidth, header.dirtyHeight = header:GetSize() - RegisterAttributeDriver(header, "state-visibility", "[@raid1, exists] show;hide") - header:SetAttribute("startingIndex", 1) - header:SetAttribute("point", "BOTTOM") - header:SetAttribute("columnAnchorPoint", "LEFT") - MOD:DetachSubFrames(header:GetChildren()) - header:SetAttribute("yOffset", 7) - if not header.positioned then - header:ClearAllPoints() - header:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -40) - SuperVillain:SetSVMovable(header, header:GetName().."_MOVE", L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - header.Avatar.positionOverride = "TOPLEFT" - header:SetAttribute("minHeight", header.dirtyHeight) - header:SetAttribute("minWidth", header.dirtyWidth) - header.positioned = true - end - for i = 1, header:GetNumChildren() do - local childFrame = select(i, header:GetChildren()) - UpdateTankFrame(childFrame) - if(_G[childFrame:GetName().."Pet"]) then - UpdateTankFrame(_G[childFrame:GetName().."Pet"]) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateTankFrame(_G[childFrame:GetName().."Target"]) - end - end -end ---[[ -########################################################## -ASSIST UPDATE -########################################################## -]]-- -local function UpdateAssistFrame(header) - local db = MOD.db["assist"] - header.colors = oUF_SuperVillain.colors; - header:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - if header.isChild and header.originalParent then - local targets = db.targetsGroup; - if not header.originalParent.childList then - header.originalParent.childList = {} - end - header.originalParent.childList[header] = true; - if not InCombatLockdown()then - if targets.enable then - header:SetParent(header.originalParent) - header:Size(targets.width, targets.height) - header:ClearAllPoints() - SuperVillain:ReversePoint(header, targets.anchorPoint, header.originalParent, targets.xOffset, targets.yOffset) - else - header:SetParent(SuperVillain.Cloaked) - end - end - elseif not InCombatLockdown()then - header:Size(db.width, db.height) - end - - MOD:RefreshUnitLayout(header, "assist") - - do - local nametext = header.InfoPanel.Name; - if oUF_SuperVillain.colors.healthclass then - header:Tag(nametext, "[name:10]") - else - header:Tag(nametext, "[name:color][name:10]") - end - end - header:UpdateAllElements() -end - -function MOD.Construct:assist() - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, "assist") - self.Health = MOD:CreateHealthBar(self, true) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.RaidIcon:SetPoint("BOTTOMRIGHT") - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - UpdateAssistFrame(self) - self.originalParent = self:GetParent() - return self -end - -function MOD.HeaderUpdate:assist() - local db = MOD.db["assist"] - local header = self - header:Hide() - MOD:DetachSubFrames(header:GetChildren()) - header:SetAttribute("startingIndex", -1) - RegisterAttributeDriver(header, "state-visibility", "show") - header.dirtyWidth, header.dirtyHeight = header:GetSize() - RegisterAttributeDriver(header, "state-visibility", "[@raid1, exists] show;hide") - header:SetAttribute("startingIndex", 1) - header:SetAttribute("point", "BOTTOM") - header:SetAttribute("columnAnchorPoint", "LEFT") - MOD:DetachSubFrames(header:GetChildren()) - header:SetAttribute("yOffset", 7) - if not header.positioned then - header:ClearAllPoints() - header:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -140) - SuperVillain:SetSVMovable(header, header:GetName().."_MOVE", L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - header.Avatar.positionOverride = "TOPLEFT" - header:SetAttribute("minHeight", header.dirtyHeight) - header:SetAttribute("minWidth", header.dirtyWidth) - header.positioned = true - end - for i = 1, header:GetNumChildren() do - local childFrame = select(i, header:GetChildren()) - UpdateAssistFrame(childFrame) - if(_G[childFrame:GetName().."Pet"]) then - UpdateAssistFrame(_G[childFrame:GetName().."Pet"]) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateAssistFrame(_G[childFrame:GetName().."Target"]) - end - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/target.lua b/Interface/AddOns/SVUI/packages/unit/frames/target.lua deleted file mode 100644 index c6cb931..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/target.lua +++ /dev/null @@ -1,155 +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'); -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 ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD.Construct:target() - MOD:SetActionPanel(self, "target") - - self.Health = MOD:CreateHealthBar(self, true, true) - self.Health.frequentUpdates = true - self.HealPrediction = MOD:CreateHealPrediction(self, true) - - self.Power = MOD:CreatePowerBar(self, true, true) - self.Power.frequentUpdates = true - - MOD:CreatePortrait(self) - - self.Castbar = MOD:CreateCastbar(self, true, L["Target Castbar"], true) - - self.Buffs = MOD:CreateBuffs(self, "target") - self.Debuffs = MOD:CreateDebuffs(self, "target") - self.AuraBars = MOD:CreateAuraBarHeader(self, "target") - self.Afflicted = MOD:CreateAfflicted(self) - tinsert(self.__elements, MOD.SmartAuraDisplay) - self:RegisterEvent("PLAYER_TARGET_CHANGED", MOD.SmartAuraDisplay) - - self.RaidIcon = MOD:CreateRaidIcon(self) - local isSmall = MOD.db.target.combobar.smallIcons - if(SuperVillain.class == "ROGUE") then - self.HyperCombo = MOD:CreateRogueCombobar(self, isSmall) - elseif(SuperVillain.class == "DRUID") then - self.HyperCombo = MOD:CreateDruidCombobar(self, isSmall) - end - - self.GPS = MOD:CreateGPS(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - 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") -end - -function MOD.Construct:targettarget() - MOD:SetActionPanel(self, "targettarget") - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - MOD:CreatePortrait(self, true) - self.Buffs = MOD:CreateBuffs(self, "targettarget") - self.Debuffs = MOD:CreateDebuffs(self, "targettarget") - 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") -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD.FrameUpdate:target() - local db = MOD.db["target"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - local USE_COMBOBAR = db.combobar.enable; - local comboBarHeight = db.combobar.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - if not self:IsElementEnabled("ActionPanel")then - self:EnableElement("ActionPanel") - end - MOD:RefreshUnitLayout(self, "target") - - if(MOD.db.xrayFocus) then - self.XRay:Show() - else - self.XRay:Hide() - end - - if not IsAddOnLoaded("Clique")then - if db.middleClickFocus then - self:SetAttribute("type3", "focus") - elseif self:GetAttribute("type3") == "focus"then - self:SetAttribute("type3", nil) - end - end - - if (SuperVillain.class == "ROGUE" or SuperVillain.class == "DRUID") and self.HyperCombo then - local comboBar = self.HyperCombo; - if self.ComboRefresh then - self.ComboRefresh(self) - end - if db.combobar.autoHide then - comboBar:SetParent(self) - else - comboBar:SetParent(SuperVillain.UIParent) - end - - if comboBar.Avatar then - comboBar.Avatar:SetScale(0.000001) - comboBar.Avatar:SetAlpha(0) - end - - if USE_COMBOBAR and not self:IsElementEnabled("HyperCombo")then - self:EnableElement("HyperCombo") - elseif not USE_COMBOBAR and self:IsElementEnabled("HyperCombo")then - self:DisableElement("HyperCombo") - comboBar:Hide() - end - end - - do - local gps = self.GPS; - if not self:IsElementEnabled("GPS") then - self:EnableElement("GPS") - end - end - self:UpdateAllElements() -end - -function MOD.FrameUpdate:targettarget() - local db = MOD.db["targettarget"] - local UNIT_WIDTH = db.width - local UNIT_HEIGHT = db.height - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "targettarget") - self:UpdateAllElements() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/units.lua b/Interface/AddOns/SVUI/packages/unit/frames/units.lua new file mode 100644 index 0000000..4472850 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/frames/units.lua @@ -0,0 +1,977 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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; +--[[ STRING METHODS ]]-- +local find, format, upper = string.find, string.format, string.upper; +local match, gsub = string.match, string.gsub; + +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.Registry:Expose('SVUnit'); +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 ceil,tinsert = math.ceil,table.insert +--[[ +########################################################## +LOCAL DATA +########################################################## +]]-- +local CONSTRUCTORS, UPDATERS = {}, {} +local lastArenaFrame, lastBossFrame +--[[ +########################################################## +ALL UNIT HELPERS +########################################################## +]]-- +local UpdateTargetGlow = function(self) + if not self.unit then return end + local unit = self.unit; + if(UnitIsUnit(unit, "target")) then + self.TargetGlow:Show() + local reaction = UnitReaction(unit, "player") + if(UnitIsPlayer(unit)) then + local _, class = UnitClass(unit) + if class then + local colors = SVUI_CLASS_COLORS[class] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + elseif(reaction) then + local colors = FACTION_BAR_COLORS[reaction] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + else + self.TargetGlow:Hide() + end +end +--[[ +########################################################## +PLAYER +########################################################## +]]-- +local UpdatePlayerFrame = function(self) + local db = MOD.db["player"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + local USE_CLASSBAR = db.classbar.enable; + local classBarHeight = db.classbar.height; + local classBarWidth = db.width * 0.4; + local healthPanel = self.HealthPanel + local iconDB = db.icons + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + + MOD.RefreshUnitMedia(self, "player") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + + MOD:RefreshUnitLayout(self, "player") + + do + local resting = self.Resting; + if resting then + if iconDB and iconDB.restIcon and iconDB.restIcon.enable then + local size = iconDB.restIcon.size; + resting:ClearAllPoints() + resting:Size(size) + SuperVillain:ReversePoint(resting, iconDB.restIcon.attachTo, healthPanel, iconDB.restIcon.xOffset, iconDB.restIcon.yOffset) + if not self:IsElementEnabled("Resting")then + self:EnableElement("Resting") + end + elseif self:IsElementEnabled("Resting")then + self:DisableElement("Resting") + resting:Hide() + end + end + end + do + local combat = self.Combat; + if combat then + if iconDB and iconDB.combatIcon and iconDB.combatIcon.enable then + local size = iconDB.combatIcon.size; + combat:ClearAllPoints() + combat:Size(size) + SuperVillain:ReversePoint(combat, iconDB.combatIcon.attachTo, healthPanel, iconDB.combatIcon.xOffset, iconDB.combatIcon.yOffset) + if not self:IsElementEnabled("Combat")then + self:EnableElement("Combat") + end + elseif self:IsElementEnabled("Combat")then + self:DisableElement("Combat") + combat:Hide() + end + end + end + do + local pvp = self.PvPText; + local point = db.pvp.position; + pvp:ClearAllPoints() + pvp:Point(db.pvp.position, healthPanel, db.pvp.position) + self:Tag(pvp, db.pvp.tags) + end + do + if SuperVillain.class == "DRUID" and self.DruidAltMana then + if db.power.druidMana then + self:EnableElement("DruidAltMana") + else + self:DisableElement("DruidAltMana") + self.DruidAltMana:Hide() + end + end + if SuperVillain.class == "MONK" then + local stagger = self.DrunkenMaster; + if db.stagger.enable then + if not self:IsElementEnabled("DrunkenMaster")then + self:EnableElement("DrunkenMaster") + end + else + if self:IsElementEnabled("DrunkenMaster")then + self:DisableElement("DrunkenMaster") + end + end + end + end + do + if(self.DruidAltMana) then + if db.power.druidMana then + self:EnableElement("DruidAltMana") + else + self:DisableElement("DruidAltMana") + self.DruidAltMana:Hide() + end + end + if(self.DrunkenMaster) then + if db.stagger.enable then + if not self:IsElementEnabled("DrunkenMaster")then + self:EnableElement("DrunkenMaster") + end + else + if self:IsElementEnabled("DrunkenMaster")then + self:DisableElement("DrunkenMaster") + end + end + end + + if(self.ClassBar or self.HyperCombo) then + if self.ClassBarRefresh then + self.ClassBarRefresh(self) + end + if(self.ClassBar) then + local classBar = self[self.ClassBar]; + 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 USE_CLASSBAR then + if(not self:IsElementEnabled(self.ClassBar)) then + self:EnableElement(self.ClassBar) + end + classBar:Show() + else + if(self:IsElementEnabled(self.ClassBar)) then + self:DisableElement(self.ClassBar) + end + classBar:Hide() + end + end + if(self.HyperCombo) then + if not self:IsElementEnabled("HyperCombo") then + self:EnableElement("HyperCombo") + end + else + if self:IsElementEnabled("HyperCombo") then + self:DisableElement("HyperCombo") + end + end + end + end + do + if db.combatfade and not self:IsElementEnabled("CombatFade")then + self:EnableElement("CombatFade") + elseif + not db.combatfade and self:IsElementEnabled("CombatFade")then + self:DisableElement("CombatFade") + end + end + self:UpdateAllElements() +end +UPDATERS["player"] = UpdatePlayerFrame + +CONSTRUCTORS["player"] = function(self, unit) + local key = "player" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, "player") + self.Health = MOD:CreateHealthBar(self, true) + self.Health.frequentUpdates = true + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = true + MOD:CreatePortrait(self, false, true) + self.Buffs = MOD:CreateBuffs(self, "player") + self.Debuffs = MOD:CreateDebuffs(self, "player") + self.Castbar = MOD:CreateCastbar(self, false, L["Player Castbar"], true, true) + MOD:CreateExperienceRepBar(self) + MOD:GetClassResources(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Resting = MOD:CreateRestingIndicator(self) + self.Combat = MOD:CreateCombatIndicator(self) + self.PvPText = self.InfoPanel:CreateFontString(nil,'OVERLAY') + self.PvPText:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + self.Afflicted = MOD:CreateAfflicted(self) + self.HealPrediction = MOD:CreateHealPrediction(self, true) + self.AuraBars = MOD:CreateAuraBarHeader(self, "player") + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePlayerFrame + return self +end +--[[ +########################################################## +TARGET +########################################################## +]]-- +local UpdateTargetFrame = function(self) + local db = MOD.db["target"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + local USE_COMBOBAR = db.combobar.enable; + local comboBarHeight = db.combobar.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + + MOD.RefreshUnitMedia(self, "target") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + if not self:IsElementEnabled("ActionPanel")then + self:EnableElement("ActionPanel") + end + MOD:RefreshUnitLayout(self, "target") + + if(MOD.db.xrayFocus) then + self.XRay:Show() + else + self.XRay:Hide() + end + + if not IsAddOnLoaded("Clique")then + if db.middleClickFocus then + self:SetAttribute("type3", "focus") + elseif self:GetAttribute("type3") == "focus"then + self:SetAttribute("type3", nil) + end + end + + if (SuperVillain.class == "ROGUE" or SuperVillain.class == "DRUID") and self.HyperCombo then + local comboBar = self.HyperCombo; + if self.ComboRefresh then + self.ComboRefresh(self) + end + if db.combobar.autoHide then + comboBar:SetParent(self) + else + comboBar:SetParent(SuperVillain.UIParent) + end + + if comboBar.Avatar then + comboBar.Avatar:SetScale(0.000001) + comboBar.Avatar:SetAlpha(0) + end + + if USE_COMBOBAR and not self:IsElementEnabled("HyperCombo")then + self:EnableElement("HyperCombo") + elseif not USE_COMBOBAR and self:IsElementEnabled("HyperCombo")then + self:DisableElement("HyperCombo") + comboBar:Hide() + end + end + + do + local gps = self.GPS; + if not self:IsElementEnabled("GPS") then + self:EnableElement("GPS") + end + end + self:UpdateAllElements() +end +UPDATERS["target"] = UpdateTargetFrame + +CONSTRUCTORS["target"] = function(self, unit) + local key = "target" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + + self.Health = MOD:CreateHealthBar(self, true, true) + self.Health.frequentUpdates = true + self.HealPrediction = MOD:CreateHealPrediction(self, true) + + self.Power = MOD:CreatePowerBar(self, true, true) + self.Power.frequentUpdates = true + + MOD:CreatePortrait(self) + + self.Castbar = MOD:CreateCastbar(self, true, L["Target Castbar"], true) + + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraBars = MOD:CreateAuraBarHeader(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + tinsert(self.__elements, MOD.SmartAuraDisplay) + self:RegisterEvent("PLAYER_TARGET_CHANGED", MOD.SmartAuraDisplay) + + self.RaidIcon = MOD:CreateRaidIcon(self) + local isSmall = MOD.db[key].combobar.smallIcons + if(SuperVillain.class == "ROGUE") then + self.HyperCombo = MOD:CreateRogueCombobar(self, isSmall) + elseif(SuperVillain.class == "DRUID") then + self.HyperCombo = MOD:CreateDruidCombobar(self, isSmall) + end + + self.GPS = MOD:CreateGPS(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateTargetFrame + return self +end +--[[ +########################################################## +TARGET OF TARGET +########################################################## +]]-- +local UpdateTargetTargetFrame = function(self) + local db = MOD.db["targettarget"] + local UNIT_WIDTH = db.width + local UNIT_HEIGHT = db.height + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "targettarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "targettarget") + self:UpdateAllElements() +end +UPDATERS["targettarget"] = UpdateTargetTargetFrame + +CONSTRUCTORS["targettarget"] = function(self, unit) + local key = "targettarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + MOD:CreatePortrait(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateTargetTargetFrame + return self +end +--[[ +########################################################## +PET +########################################################## +]]-- +local UpdatePetFrame = function(self) + local db = MOD.db["pet"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "pet") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "pet") + do + if SVUI_Player and not InCombatLockdown()then + self:SetParent(SVUI_Player) + end + end + MOD:UpdateAuraWatch(self) + self:UpdateAllElements() +end +UPDATERS["pet"] = UpdatePetFrame + +CONSTRUCTORS["pet"] = function(self, unit) + local key = "pet" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Health.frequentUpdates = true; + self.HealPrediction = MOD:CreateHealPrediction(self) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false; + MOD:CreatePortrait(self, true) + self.Castbar = MOD:CreateCastbar(self, false, nil, false) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + 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") + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePetFrame + return self +end +--[[ +########################################################## +TARGET OF PET +########################################################## +]]-- +local UpdatePetTargetFrame = function(self) + local db = MOD.db["pettarget"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "pettarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "pettarget") + do + if SVUI_Pet and not InCombatLockdown()then + self:SetParent(SVUI_Pet) + end + end + self:UpdateAllElements() +end +UPDATERS["pettarget"] = UpdatePetTargetFrame + +CONSTRUCTORS["pettarget"] = function(self, unit) + local key = "pettarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePetTargetFrame + return self +end +--[[ +########################################################## +FOCUS +########################################################## +]]-- +local UpdateFocusFrame = function(self) + local db = MOD.db["focus"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "focus") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "focus") + + if(MOD.db.xrayFocus) then + self.XRay:Show() + else + self.XRay:Hide() + end + + MOD:UpdateAuraWatch(self) + self:UpdateAllElements() +end +UPDATERS["focus"] = UpdateFocusFrame + +CONSTRUCTORS["focus"] = function(self, unit) + local key = "focus" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + + self.Health = MOD:CreateHealthBar(self, true, true) + self.Health.frequentUpdates = true + + self.HealPrediction = MOD:CreateHealPrediction(self, true) + self.Power = MOD:CreatePowerBar(self, true) + + self.Castbar = MOD:CreateCastbar(self, false, L["Focus Castbar"]) + self.Castbar.SafeZone = nil + + self.Castbar.LatencyTexture:Hide() + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraBars = MOD:CreateAuraBarHeader(self, key) + tinsert(self.__elements, MOD.SmartAuraDisplay) + self:RegisterEvent("PLAYER_FOCUS_CHANGED", MOD.SmartAuraDisplay) + + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateFocusFrame + return self +end +--[[ +########################################################## +TARGET OF FOCUS +########################################################## +]]-- +local UpdateFocusTargetFrame = function(self) + local db = MOD.db["focustarget"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "focustarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "focustarget") + self:UpdateAllElements() +end +UPDATERS["focustarget"] = UpdateFocusTargetFrame + +CONSTRUCTORS["focustarget"] = function(self, unit) + local key = "focustarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + 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") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateFocusTargetFrame + return self +end +--[[ +########################################################## +BOSS +########################################################## +]]-- +local UpdateBossFrame = function(self) + local db = MOD.db["boss"] + local INDEX = self:GetID() or 1; + local holder = _G["SVUI_Boss_MOVE"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + + MOD.RefreshUnitMedia(self, "boss") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:ClearAllPoints() + if(tonumber(INDEX) == 1) then + holder:Width(UNIT_WIDTH) + holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) + if db.showBy == "UP"then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") + else + self:Point("TOPRIGHT", holder, "TOPRIGHT") + end + else + local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) + if db.showBy == "UP"then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) + else + self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) + end + end + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD:RefreshUnitLayout(self, "boss") + self:UpdateAllElements() +end +UPDATERS["boss"] = UpdateBossFrame + +CONSTRUCTORS["boss"] = function(self, unit) + local key = "boss" + local selfID = unit:match('boss(%d)') + self.unit = unit + self.___key = key + self:SetID(selfID) + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true, true) + self.Power = MOD:CreatePowerBar(self, true, true) + MOD:CreatePortrait(self) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.AltPowerBar = MOD:CreateAltPowerBar(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:SetAttribute("type2", "focus") + + 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") + else + self:Point("TOPRIGHT", lastBossFrame, "BOTTOMRIGHT", 0, -20) + end + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateBossFrame + lastBossFrame = self + return self +end +--[[ +########################################################## +ARENA +########################################################## +]]-- +local UpdateArenaFrame = function(self) + local db = MOD.db["arena"] + local INDEX = self:GetID() or 1; + local holder = _G["SVUI_Arena_MOVE"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height + + MOD.RefreshUnitMedia(self, "arena") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + do + local trinket = self.Trinket; + trinket.bg:Size(db.pvpTrinket.size) + trinket.bg:ClearAllPoints() + if(db.pvpTrinket.position == "RIGHT") then + trinket.bg:Point("LEFT", self, "RIGHT", db.pvpTrinket.xOffset, db.pvpTrinket.yOffset) + else + trinket.bg:Point("RIGHT", self, "LEFT", db.pvpTrinket.xOffset, db.pvpTrinket.yOffset) + end + if db.pvpTrinket.enable and not self:IsElementEnabled("Trinket")then + self:EnableElement("Trinket") + elseif not db.pvpTrinket.enable and self:IsElementEnabled("Trinket")then + self:DisableElement("Trinket") + end + end + do + local pvp = self.PVPSpecIcon; + pvp.bg:Point("RIGHT", self, "RIGHT") + pvp.bg:Size(UNIT_HEIGHT, UNIT_HEIGHT) + if db.pvpSpecIcon then + self.InfoPanel:Point("TOPLEFT", self, "TOPLEFT", 0, 0) + self.InfoPanel:Point("BOTTOMRIGHT", self.PVPSpecIcon, "BOTTOMLEFT", 0, 0) + if self:IsElementEnabled("PVPSpecIcon")then + self:EnableElement("PVPSpecIcon") + end + elseif self:IsElementEnabled("PVPSpecIcon")then + self:DisableElement("PVPSpecIcon") + end + end + MOD:RefreshUnitLayout(self, "arena") + self:ClearAllPoints() + if(tonumber(INDEX) == 1) then + holder:Width(UNIT_WIDTH) + holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) + if(db.showBy == "UP") then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") + else + self:Point("TOPRIGHT", holder, "TOPRIGHT") + end + else + local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) + if(db.showBy == "UP") then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) + else + self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) + end + end + self:UpdateAllElements() +end +UPDATERS["arena"] = UpdateArenaFrame + +CONSTRUCTORS["arena"] = function(self, unit) + local key = "arena" + local selfID = unit:match('arena(%d)') + self.unit = unit + self.___key = key + self:SetID(selfID) + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + local selfName = self:GetName() + local prepName = selfName.."PrepFrame"; + + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true, true) + self.Power = MOD:CreatePowerBar(self, true) + MOD:CreatePortrait(self) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) + self.Trinket = MOD:CreateTrinket(self) + self.PVPSpecIcon = MOD:CreatePVPSpecIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:SetAttribute("type2", "focus") + + if not _G[prepName] then + local prep = CreateFrame("Frame", prepName, UIParent) + prep:SetFrameStrata("MEDIUM") + prep:SetAllPoints(self) + prep:SetID(selfID) + prep:SetPanelTemplate("Bar", true, 3, 3, 3) + prep.Health = CreateFrame("StatusBar", nil, prep) + prep.Health:SetAllPoints(prep) + prep.Health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + prep.Health:SetPanelTemplate("Bar", true, 3, 3, 3) + prep.Icon = prep:CreateTexture(nil, "OVERLAY") + prep.Icon.bg = CreateFrame("Frame", nil, prep) + prep.Icon.bg:Point("TOPLEFT", prep, "TOPRIGHT", 1, 0) + prep.Icon.bg:Point("BOTTOMRIGHT", prep, "BOTTOMRIGHT", 1, 0) + prep.Icon.bg:SetFixedPanelTemplate("Default", true) + prep.Icon:SetParent(prep.Icon.bg) + prep.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + prep.Icon:FillInner(prep.Icon.bg) + prep.SpecClass = prep.Health:CreateFontString(nil, "OVERLAY") + prep.SpecClass:SetFont(SuperVillain.Media.font.names, 12, "OUTLINE") + prep.SpecClass:SetTextColor(1, 1, 1) + prep.SpecClass:SetPoint("CENTER") + prep:Hide() + end + + 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") + else + self:Point("TOPRIGHT", lastArenaFrame, "BOTTOMRIGHT", 0, -20) + end + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateArenaFrame + lastArenaFrame = self + return self +end +--[[ +########################################################## +PREP FRAME +########################################################## +]]-- +local ArenaPrepHandler = CreateFrame("Frame") +local ArenaPrepHandler_OnEvent = function(self, event) + local _, instanceType = IsInInstance() + if(not MOD.db.arena.enable or instanceType ~= "arena") then return end + if event == "PLAYER_LOGIN" then + for i = 1, 5 do + local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe) then + prepframe:SetAllPoints(_G["SVUI_Arena"..i]) + end + end + elseif event == "ARENA_OPPONENT_UPDATE" then + for i = 1, 5 do + local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe and prepframe:IsShown()) then + prepframe:Hide() + end + end + else + local numOpps = GetNumArenaOpponentSpecs() + if numOpps > 0 then + for i = 1, 5 do + local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if i <= numOpps then + local s = GetArenaOpponentSpec(i) + local _, spec, class = nil, "UNKNOWN", "UNKNOWN" + if s and s > 0 then + _, spec, _, icon, _, _, class = GetSpecializationInfoByID(s) + end + if class and spec then + prepframe.SpecClass:SetText(spec .. " - " .. LOCALIZED_CLASS_NAMES_MALE[class]) + prepframe.Icon:SetTexture(icon or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) + + local color = RAID_CLASS_COLORS[class] + local textcolor = SVUI_CLASS_COLORS[class] or color + if color then + prepframe.Health:SetStatusBarColor(color.r, color.g, color.b) + prepframe.SpecClass:SetTextColor(color.r, color.g, color.b) + else + prepframe.Health:SetStatusBarColor(0.25, 0.25, 0.25) + prepframe.SpecClass:SetTextColor(1, 1, 1) + end + + prepframe:Show() + end + else + prepframe:Hide() + end + end + else + for i = 1, 5 do + local prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe and prepframe:IsShown()) then + prepframe:Hide() + end + end + end + end +end + +ArenaPrepHandler:RegisterEvent("PLAYER_LOGIN") +ArenaPrepHandler:RegisterEvent("PLAYER_ENTERING_WORLD") +ArenaPrepHandler:RegisterEvent("ARENA_OPPONENT_UPDATE") +ArenaPrepHandler:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS") +ArenaPrepHandler:SetScript("OnEvent", ArenaPrepHandler_OnEvent) +--[[ +########################################################## +LOAD/UPDATE METHOD +########################################################## +]]-- +function MOD:SetUnitFrame(key) + if InCombatLockdown() then self:FrameForge() return end + local unit = key + local realName = unit:gsub("(.)", upper, 1) + realName = realName:gsub("t(arget)", "T%1") + local styleName = "SVUI_"..realName + local frame + if not self.Units[unit] then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + frame = oUF_SuperVillain:Spawn(unit, styleName) + self.Units[unit] = frame + else + frame = self.Units[unit] + end + if frame:GetParent() ~= SVUI_UnitFrameParent then + frame:SetParent(SVUI_UnitFrameParent) + end + if self.db[key].enable then + frame:Enable() + frame:Update() + else + frame:Disable() + end +end + +function MOD:SetEnemyFrames(key, maxCount) + if InCombatLockdown() then self:FrameForge() return end + for i = 1, maxCount do + local unit = key..i + local realName = unit:gsub("(.)", upper, 1) + realName = realName:gsub("t(arget)", "T%1") + local styleName = "SVUI_"..realName + local frame + if not self.Units[unit] then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + frame = oUF_SuperVillain:Spawn(unit, styleName) + self.Units[unit] = frame + else + frame = self.Units[unit] + end + if frame:GetParent() ~= SVUI_UnitFrameParent then + frame:SetParent(SVUI_UnitFrameParent) + end + if frame.isForced then + self:AllowElement(frame) + end + if self.db[key].enable then + frame:Enable() + frame:Update() + else + frame:Disable() + end + end +end \ 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 796215d..eb577ea 100644 --- a/Interface/AddOns/SVUI/system/classes/Database.lua +++ b/Interface/AddOns/SVUI/system/classes/Database.lua @@ -55,6 +55,7 @@ local SuperVillain, L = unpack(select(2, ...)); local realm = GetRealmName() local name = UnitName("player") local pkey = name .. " - " .. realm +local logoutListener = CreateFrame("Frame", nil) --[[ ########################################################## DEFINE SHARED MEDIA @@ -3435,29 +3436,27 @@ end local function initializedata(t) local sv = rawget(t, "profile") - local dv = rawget(t, "defaults") - for k,v in pairs(sv) do - if(k ~= "SAFEDATA" and dv[k]) then - removedefaults(sv[k], dv[k]) - end - end if(not sv.copyKey or (sv.copyKey and type(sv.copyKey) ~= "string")) then sv.copyKey = pkey end end -local SanitizeDatabase = function(self, event) - if event == "PLAYER_LOGOUT" then - local db = SuperVillain.db.profile - local src = DatabaseDefaults - for k,v in pairs(db) do - if(k ~= "SAFEDATA" and src[k]) then - removedefaults(db[k], src[k]) - end +local function SanitizeDatabase() + local db = SuperVillain.db.profile + local src = DatabaseDefaults + for k,v in pairs(db) do + if(k ~= "SAFEDATA" and src[k]) then + removedefaults(db[k], src[k]) end end end +local LogOut_OnEvent = function(self, event) + if event == "PLAYER_LOGOUT" then + SanitizeDatabase() + end +end + local metadatabase = { __index = function(t, k) if(not k or k == "") then return end @@ -3486,10 +3485,6 @@ local METAPROFILE = function(sv) db.Export = exportprofile db.Remove = removeprofile - local logout = CreateFrame("Frame",nil) - logout:RegisterEvent("PLAYER_LOGOUT") - logout:SetScript("OnEvent", SanitizeDatabase) - return db end @@ -3589,6 +3584,9 @@ function SuperVillain:SetDatabaseObjects(init) self.db = METAPROFILE(sv) self.db:Init() self.db.profileKey = pkey + + logoutListener:RegisterEvent("PLAYER_LOGOUT") + logoutListener:SetScript("OnEvent", LogOut_OnEvent) end self:SetFilterObjects(init) end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Filters.lua b/Interface/AddOns/SVUI/system/classes/Filters.lua index d1d2d4e..54f0181 100644 --- a/Interface/AddOns/SVUI/system/classes/Filters.lua +++ b/Interface/AddOns/SVUI/system/classes/Filters.lua @@ -52,6 +52,9 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); + +local logoutListener = CreateFrame("Frame", nil) + local CLASS_WATCH_INDEX = { PRIEST = { {-- Weakened Soul @@ -591,6 +594,17 @@ local FilterOverrides = { ["120954"] = 2, ["131523"] = 5 } +local FilterDefaults = { + ["CC"] = {}, + ["Shield"] = {}, + ["Player"] = {}, + ["Blocked"] = {}, + ["Allowed"] = {}, + ["Strict"] = {}, + ["Raid"] = {}, + ['BuffWatch'] = CLASS_WATCH_INDEX[SuperVillain.class], + ['PetBuffWatch'] = CLASS_WATCH_INDEX.PET, +} local function safename(id) local n = GetSpellInfo(id) if not n then @@ -603,17 +617,6 @@ local function safename(id) end return n end -local FilterDefaults = { - ["CC"] = {}, - ["Shield"] = {}, - ["Player"] = {}, - ["Blocked"] = {}, - ["Allowed"] = {}, - ["Strict"] = {}, - ["Raid"] = {}, - ['BuffWatch'] = CLASS_WATCH_INDEX[SuperVillain.class], - ['PetBuffWatch'] = CLASS_WATCH_INDEX.PET, -} for k, x in pairs(FilterIDs) do local src = {}; for id in gmatch(x, '([^,]+)') do @@ -632,24 +635,6 @@ for k, x in pairs(FilterIDs) do FilterDefaults[k] = src end -local function tablecopy(d, s) - if type(s) ~= "table" then return end - if type(d) == "table" then - for k, v in pairs(s) do - if type(v) == "table" then - if not rawget(d, k) then rawset(d, k, {}) end - if type(d[k]) == "table" then - tablecopy(d[k], v) - end - else - if rawget(d, k) == nil then - rawset(d, k, v) - end - end - end - end -end - local function removedefaults(db, src, nometa) if(type(src) ~= "table") then return end if(not nometa) then @@ -669,44 +654,21 @@ local function removedefaults(db, src, nometa) end end -local function initializedata(sv) +local function SanitizeDatabase() + local sv = SuperVillain.Filters local dv = FilterDefaults for k,v in pairs(sv) do removedefaults(sv[k], dv[k]) end end -local SanitizeDatabase = function(self, event) +local LogOut_OnEvent = function(self, event) if event == "PLAYER_LOGOUT" then - local sv = SuperVillain.Filters - local dv = FilterDefaults - for k,v in pairs(sv) do - removedefaults(sv[k], dv[k]) - end + SanitizeDatabase() end end -local metadatabase = { - __index = function(t, k) - if(not k or k == "") then return end - local sv = rawget(t, "filters") - local dv = rawget(t, "defaults") - local src = dv and dv[k] - if(not sv[k]) then sv[k] = {} end - if(src) then - tablecopy(sv[k], src) - end - rawset(t, k, sv[k]) - return rawget(t, k) - end, -} - - local METAFILTERS = function(sv) - local logout = CreateFrame("Frame",nil) - logout:RegisterEvent("PLAYER_LOGOUT") - logout:SetScript("OnEvent", SanitizeDatabase) - for k, x in pairs(FilterIDs) do if (not sv[k]) then sv[k] = {} end local src = {}; @@ -740,5 +702,8 @@ function SuperVillain:SetFilterObjects(init) else local sv = _G["SVUI_AuraFilters"] self.Filters = METAFILTERS(sv) + + logoutListener:RegisterEvent("PLAYER_LOGOUT") + logoutListener:SetScript("OnEvent", LogOut_OnEvent) end end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Registry.lua b/Interface/AddOns/SVUI/system/classes/Registry.lua index b8a312b..a830e76 100644 --- a/Interface/AddOns/SVUI/system/classes/Registry.lua +++ b/Interface/AddOns/SVUI/system/classes/Registry.lua @@ -57,21 +57,6 @@ if GetLocale() == "ruRU" then INFO_HEADER = "SuperVillain UI (устарела %.3f): Плагины"; end -local metatemplate = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} - -function SuperVillain:SetContainer() - local obj = {} - local addonmeta = {} - local oldmeta = getmetatable(obj) - if oldmeta then - for k, v in pairs(oldmeta) do addonmeta[k] = v end - end - addonmeta.__tostring = _addontostring - - setmetatable( obj, addonmeta ) - return obj -end - local function SetPrototype(obj) obj.db = {} obj._loaded = false @@ -148,9 +133,9 @@ local METAREGISTRY = function() if SuperVillain.db[name] then obj.db = SuperVillain.db[name] end - if obj.ConstructThisPackage then - obj:ConstructThisPackage() - obj.ConstructThisPackage = nil + if obj.Load then + obj:Load() + obj.Load = nil end obj._loaded = true; end @@ -192,11 +177,11 @@ local METAREGISTRY = function() setmetatable( obj, addonmeta ) _._packages[name] = SetPrototype(obj) - -- if(SuperVillain.CoreEnabled) then - -- if(_packages[name].ConstructThisPackage) then - -- _packages[name]:ConstructThisPackage() - -- end - -- end + if(SuperVillain.CoreEnabled) then + if(_._packages[name].Load) then + _._packages[name]:Load() + end + end end, FetchPlugins = function(_) local list = ""; @@ -250,20 +235,6 @@ local METAREGISTRY = function() end _._plugins[name] = plugin end, - PreLoad = function(_) - _:_loadPkg(1) - end, - Load = function(_) - _:_loadPkg(2) - _:_loadPkg(3) - local count = #tempScripts - for i=1, count do - local fn = tempScripts[i] - if(fn and type(fn) == "function") then - fn() - end - end - end, RunTemp = function(_, name) local t = _._packages[name] for i,fn in pairs(tempMethods[name]) do @@ -296,8 +267,8 @@ local METAREGISTRY = function() if SuperVillain.db[name] then obj.db = SuperVillain.db[name] end - if obj.UpdateThisPackage and not dataOnly then - obj:UpdateThisPackage() + if obj.ReLoad and not dataOnly then + obj:ReLoad() end end end, @@ -307,14 +278,33 @@ local METAREGISTRY = function() for name,obj in pairs(pkgList) do print(name) local name = obj._name - if obj and obj.UpdateThisPackage then + if obj and obj.ReLoad then if SuperVillain.db[name] then obj.db = SuperVillain.db[name] end - obj:UpdateThisPackage() + obj:ReLoad() end end - end + end, + + --construct stored classes + + Lights = function(_) + _:_loadPkg(1) + end, + Camera = function(_) + _:_loadPkg(2) + _:_loadPkg(3) + end, + Action = function(_) + local count = #tempScripts + for i=1, count do + local fn = tempScripts[i] + if(fn and type(fn) == "function") then + fn() + end + end + end, }; local mt ={ __index = function(t, k) diff --git a/Interface/AddOns/SVUI/system/classes/Visibility.lua b/Interface/AddOns/SVUI/system/classes/Visibility.lua index bfa8d55..1ee44d0 100644 --- a/Interface/AddOns/SVUI/system/classes/Visibility.lua +++ b/Interface/AddOns/SVUI/system/classes/Visibility.lua @@ -72,6 +72,21 @@ end DisplayEventHandler:SetScript("OnEvent", DisplayAudit_OnEvent) +local function SafeFrameRemoval(table, item) + local index = 1; + while table[index] do + if ( item == table[index] ) then + tremove(table, index); + else + index = index + 1; + end + end +end + +local function SecureFadeRemoveFrame(frame) + SafeFrameRemoval(SecureFadeFrames, frame); +end + function SuperVillain:SecureFade_OnUpdate(value) local i = 1; local this, safeFadeState; @@ -86,14 +101,19 @@ function SuperVillain:SecureFade_OnUpdate(value) elseif safeFadeState.mode == "OUT" then this:SetAlpha((safeFadeState.timeToFade - safeFadeState.fadeTimer) / safeFadeState.timeToFade * safeFadeState.startAlpha - safeFadeState.endAlpha + safeFadeState.endAlpha) end - else + else this:SetAlpha(safeFadeState.endAlpha) + SecureFadeRemoveFrame(this) if not this:IsProtected() and safeFadeState.hideOnFinished and this:IsShown() then this:Hide() - end - end; - i = i + 1; - end; + end + if (safeFadeState.finishedFunc) then + safeFadeState.finishedFunc(safeFadeState.finishedArg1, safeFadeState.finishedArg2, safeFadeState.finishedArg3, safeFadeState.finishedArg4) + safeFadeState.finishedFunc = nil + end + end + i = i + 1 + end if #SecureFadeFrames == 0 then SecureFadeManager:SetScript("OnUpdate", nil) end @@ -145,6 +165,7 @@ function SuperVillain:SecureFadeIn(this, duration, startAlpha, endAlpha) this._secureFade.startAlpha = startAlpha or 0; this._secureFade.endAlpha = endAlpha or 1; this._secureFade.hideOnFinished = false; + this._secureFade.finishedFunc = nil SuperVillain:SecureFade(this) end; @@ -157,6 +178,7 @@ function SuperVillain:SecureFadeOut(this, duration, startAlpha, endAlpha, hideOn this._secureFade.startAlpha = startAlpha or 1; this._secureFade.endAlpha = endAlpha or 0; this._secureFade.hideOnFinished = hideOnFinished; + this._secureFade.finishedFunc = nil SuperVillain:SecureFade(this) end; diff --git a/Interface/AddOns/SVUI/system/installer.lua b/Interface/AddOns/SVUI/system/installer.lua index 40c86b6..9f1ba81 100644 --- a/Interface/AddOns/SVUI/system/installer.lua +++ b/Interface/AddOns/SVUI/system/installer.lua @@ -297,7 +297,7 @@ local function initChat(mungs) ChangeChatColor("CHANNEL3", 232 / 255, 228 / 255, 121 / 255) if not mungs then if SuperVillain.Chat then - SuperVillain.Chat:UpdateThisPackage(true) + SuperVillain.Chat:ReLoad(true) if SVUI_Cache["Dock"].RightSuperDockFaded == true then RightSuperDockToggleButton:Click()end; if SVUI_Cache["Dock"].LeftSuperDockFaded == true then LeftSuperDockToggleButton:Click()end end diff --git a/Interface/AddOns/SVUI/system/mentalo.xml b/Interface/AddOns/SVUI/system/mentalo.xml index 9d35127..7598d26 100644 --- a/Interface/AddOns/SVUI/system/mentalo.xml +++ b/Interface/AddOns/SVUI/system/mentalo.xml @@ -63,6 +63,7 @@ <Offset x="-12" y="3"/> </Anchor> </Anchors> + <Scripts> <OnEscapePressed function="SVUI_MentaloPrecisionInput_EscapePressed"/> <OnEnterPressed function="SVUI_MentaloPrecisionInput_EnterPressed"/> @@ -71,8 +72,8 @@ SVUI_MentaloPrecisionInput_OnShow(self) </OnShow> </Scripts> - <FontString inherits="GameFontHighlightSmall"/> </EditBox> + <EditBox name="$parentSetY" inherits="InputBoxTemplate" autoFocus="false"> <Size x="50" y="17"/> <Anchors> @@ -86,19 +87,7 @@ <OnEditFocusLost function="SVUI_MentaloPrecisionInput_FocusLost"/> <OnShow function="SVUI_MentaloPrecisionInput_OnShow"/> </Scripts> - <FontString inherits="GameFontHighlightSmall"/> </EditBox> - <!-- <Button name="$parentResetButton" inherits="UIPanelButtonTemplate" text="RESET"> - <Size x="96" y="24"/> - <Anchors> - <Anchor point="TOP" relativeTo="$parentBG" relativePoint="CENTER"> - <Offset x="0" y="2"/> - </Anchor> - </Anchors> - <Scripts> - <OnClick function="SVUI_MentaloPrecisionResetButton_OnClick"/> - </Scripts> - </Button> --> <Button name="$parentUpButton" inherits="UIPanelSquareButton"> <Size x="25" y="20"/> diff --git a/Interface/AddOns/SVUI/system/screen.lua b/Interface/AddOns/SVUI/system/screen.lua index 57d7df4..fdcb663 100644 --- a/Interface/AddOns/SVUI/system/screen.lua +++ b/Interface/AddOns/SVUI/system/screen.lua @@ -41,6 +41,10 @@ LOCAL VARS ########################################################## ]]-- local scale; +local rez = GetCVar("gxResolution"); +local gxHeight = tonumber(match(rez,"%d+x(%d+)")); +local gxWidth = tonumber(match(rez,"(%d+)x%d+")); +local evalwidth --[[ ########################################################## CORE FUNCTIONS @@ -49,22 +53,22 @@ CORE FUNCTIONS function SuperVillain:UIScale(event) self.ghettoMonitor = nil; if(IsMacClient() and SVUI_Cache and SVUI_Cache.screenheight and SVUI_Cache.screenwidth) then - if(self.screenheight ~= SVUI_Cache.screenheight or self.screenwidth ~= SVUI_Cache.screenwidth) then - self.screenheight = SVUI_Cache.screenheight; - self.screenwidth = SVUI_Cache.screenwidth + if(gxHeight ~= SVUI_Cache.screenheight or gxWidth ~= SVUI_Cache.screenwidth) then + gxHeight = SVUI_Cache.screenheight; + gxWidth = SVUI_Cache.screenwidth end end; if self.db.system.autoScale then - scale = max(0.64, min(1.15, 768 / self.screenheight)) + scale = max(0.64, min(1.15, 768 / gxHeight)) else - scale = max(0.64, min(1.15, GetCVar("uiScale") or UIParent:GetScale() or 768 / self.screenheight)) + scale = max(0.64, min(1.15, GetCVar("uiScale") or UIParent:GetScale() or 768 / gxHeight)) end - if self.screenwidth < 1600 then + if gxWidth < 1600 then self.ghettoMonitor = true; - elseif self.screenwidth >= 3840 then - local width = self.screenwidth; - local height = self.screenheight; + elseif gxWidth >= 3840 then + local width = gxWidth; + local height = gxHeight; if(self.db.system.multiMonitor) then if width >= 9840 then width = 3280; end if width >= 7680 and width < 9840 then width = 2560; end @@ -88,7 +92,7 @@ function SuperVillain:UIScale(event) if width >= 3840 and width < 4080 then width = 3840; end end - self.evaluatedWidth = width; + evalwidth = width; end self.mult = 768 / match(GetCVar("gxResolution"), "%d+x(%d+)") / scale; @@ -105,13 +109,13 @@ function SuperVillain:UIScale(event) SVUI_Cache.screenwidth = floor(GetScreenWidth() * 100 + .5) / 100 end; - if self.evaluatedWidth then - local width = self.evaluatedWidth; - local height = self.screenheight; + if evalwidth then + local width = evalwidth + local height = gxHeight; if not self.db.system.autoScale or height > 1200 then local h = UIParent:GetHeight(); - local ratio = self.screenheight / h; - local w = self.evaluatedWidth / ratio; + local ratio = gxHeight / h; + local w = evalwidth / ratio; width = w; height = h; diff --git a/Interface/AddOns/SVUI/system/system.lua b/Interface/AddOns/SVUI/system/system.lua index 69b75ec..a45da6e 100644 --- a/Interface/AddOns/SVUI/system/system.lua +++ b/Interface/AddOns/SVUI/system/system.lua @@ -58,32 +58,17 @@ LOCALS ########################################################## ]]-- local bld = select(2,GetBuildInfo()); -local resolution = GetCVar("gxResolution"); +local toonClass = select(2,UnitClass("player")); +local rez = GetCVar("gxResolution"); +local gxHeight = tonumber(match(rez,"%d+x(%d+)")); +local gxWidth = tonumber(match(rez,"(%d+)x%d+")); local NewHook = hooksecurefunc; --[[ ########################################################## BUILD ADDON OBJECTS ########################################################## ]]-- -local SuperVillain = {}; -SuperVillain.db = {}; -SuperVillain.Media = {}; -SuperVillain.Filters = {}; -SuperVillain.DisplayAudit = {}; -SuperVillain.DynamicOptions = {}; -SuperVillain.snaps = {}; -SuperVillain.Dispellable = {}; -SuperVillain.Options = { type="group", name="|cff339fffConfig-O-Matic|r", args={}, }; - -local svui_meta = {} -local base_meta = getmetatable(SuperVillain) -if base_meta then - for k, v in pairs(base_meta) do svui_meta[k] = v end -end -svui_meta._name = "SuperVillain" -svui_meta.__tostring = function(self) return self._name end -setmetatable(SuperVillain, svui_meta) - +local SuperVillain = SVUI_LIB:SetObject(SVUINameSpace) local L = SVUI_LOCALE:SetObject() SVUICore[1] = SuperVillain; @@ -99,34 +84,32 @@ _G[SVUINameSpace] = SVUICore; SET MANY VARIABLES ########################################################## ]]-- +local SVUISystemEventHandler = CreateFrame("Frame", "SVUISystemEventHandler") +local SVUIParent = CreateFrame("Frame", "SVUIParent", UIParent); +local StealthFrame = CreateFrame("Frame", nil, UIParent); +StealthFrame:Hide(); +SVUIParent:SetFrameLevel(UIParent:GetFrameLevel()); +SVUIParent:SetPoint("CENTER", UIParent, "CENTER"); +SVUIParent:SetSize(UIParent:GetSize()); + +SuperVillain.db = {}; +SuperVillain.Media = {}; +SuperVillain.Filters = {}; +SuperVillain.DisplayAudit = {}; +SuperVillain.DynamicOptions = {}; +SuperVillain.snaps = {}; +SuperVillain.Dispellable = {}; +SuperVillain.Options = { type="group", name="|cff339fffConfig-O-Matic|r", args={}, }; SuperVillain.Shared = LibStub("LibSharedMedia-3.0") -local toonClass = select(2,UnitClass("player")); SuperVillain.version = GetAddOnMetadata(..., "Version"); -SuperVillain.HVAL = format("|cff%02x%02x%02x", 0.2*255, 0.5*255, 1*255); SuperVillain.class = toonClass; SuperVillain.name = UnitName("player"); SuperVillain.realm = GetRealmName(); SuperVillain.build = tonumber(bld); -SuperVillain.race = select(2,UnitRace("player")); -SuperVillain.faction = select(2,UnitFactionGroup('player')); SuperVillain.guid = UnitGUID('player'); -SuperVillain.mac = IsMacClient(); -SuperVillain.screenheight = tonumber(match(resolution,"%d+x(%d+)")); -SuperVillain.screenwidth = tonumber(match(resolution,"(%d+)x%d+")); -SuperVillain.macheight = tonumber(match(resolution,"%d+x(%d+)")); -SuperVillain.macwidth = tonumber(match(resolution,"(%d+)x%d+")); SuperVillain.mult = 1; ---[[ INTERNAL TEMP STORAGE ]]-- SuperVillain.ConfigurationMode = false; SuperVillain.ClassRole = ""; ---[[ INTERNAL HANDLER FRAMES ]]-- -local SVUISystemEventHandler = CreateFrame("Frame", "SVUISystemEventHandler") -local SVUIParent = CreateFrame("Frame", "SVUIParent", UIParent); -local StealthFrame = CreateFrame("Frame", nil, UIParent); -StealthFrame:Hide(); -SVUIParent:SetFrameLevel(UIParent:GetFrameLevel()); -SVUIParent:SetPoint("CENTER", UIParent, "CENTER"); -SVUIParent:SetSize(UIParent:GetSize()); SuperVillain.UIParent = SVUIParent; SuperVillain.Cloaked = StealthFrame; SuperVillain.snaps[#SuperVillain.snaps + 1] = SuperVillain.UIParent; @@ -359,10 +342,10 @@ local function PreLoad(self) if not SVUI_Cache["Dock"] then SVUI_Cache["Dock"] = {} end if not SVUI_Cache["Mentalo"] then SVUI_Cache["Mentalo"] = {} end if(not SVUI_Cache["screenheight"] or (SVUI_Cache["screenheight"] and type(SVUI_Cache["screenheight"]) ~= "number")) then - SVUI_Cache["screenheight"] = self.screenheight + SVUI_Cache["screenheight"] = gxHeight end if(not SVUI_Cache["screenwidth"] or (SVUI_Cache["screenwidth"] and type(SVUI_Cache["screenwidth"]) ~= "number")) then - SVUI_Cache["screenwidth"] = self.screenwidth + SVUI_Cache["screenwidth"] = gxWidth end --[[ MORE DEPRECATED ]]-- @@ -376,13 +359,14 @@ local function PreLoad(self) self:RefreshSystemFonts(); SVUISystemEventHandler:RegisterEvent('PLAYER_REGEN_DISABLED'); self:LoadSystemAlerts(); - self.Registry:PreLoad(); + self.Registry:Lights(); end local function FullLoad(self) self:SetDatabaseObjects() self:UIScale("PLAYER_LOGIN"); - self.Registry:Load(); + self.Registry:Camera(); + self.Registry:Action(); self:DefinePlayerRole(); self:LoadMovables(); self:SetSVMovablesPositions(); diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua index 64cfcfb..8a3cc91 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua @@ -611,7 +611,7 @@ SuperVillain.Options.args.common = { type = 'group', name = L['Gear Managment'], get = function(a)return SuperVillain.db.SVGear[a[#a]]end, - set = function(a,b)SuperVillain.db.SVGear[a[#a]]=b;GEAR:UpdateThisPackage()end, + set = function(a,b)SuperVillain.db.SVGear[a[#a]]=b;GEAR:ReLoad()end, args={ intro={ order = 1, @@ -718,7 +718,7 @@ SuperVillain.Options.args.common = { guiInline = true, order = 5, get = function(e)return SuperVillain.db.SVGear.durability[e[#e]]end, - set = function(e,value)SuperVillain.db.SVGear.durability[e[#e]] = value;GEAR:UpdateThisPackage()end, + set = function(e,value)SuperVillain.db.SVGear.durability[e[#e]] = value;GEAR:ReLoad()end, args = { enable = { type = "toggle", @@ -746,7 +746,7 @@ SuperVillain.Options.args.common = { guiInline = true, order = 7, get = function(e)return SuperVillain.db.SVGear.itemlevel[e[#e]]end, - set = function(e,value)SuperVillain.db.SVGear.itemlevel[e[#e]] = value;GEAR:UpdateThisPackage()end, + set = function(e,value)SuperVillain.db.SVGear.itemlevel[e[#e]] = value;GEAR:ReLoad()end, args = { enable = { type = "toggle", diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua index fa63347..3636de9 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua @@ -271,7 +271,7 @@ SuperVillain.Options.args.SVAura = { type = "group", name = L["Hyper Buffs"], get = function(b)return SuperVillain.db.SVAura.hyperBuffs[b[#b]]end, - set = function(a,b)MOD:ChangeDBVar(b,a[#a],"hyperBuffs");MOD:ToggleConsolidatedBuffs();MAP:UpdateThisPackage();MOD:UpdateAuraHeader(SVUI_PlayerBuffs)end, + set = function(a,b)MOD:ChangeDBVar(b,a[#a],"hyperBuffs");MOD:ToggleConsolidatedBuffs();MAP:ReLoad();MOD:UpdateAuraHeader(SVUI_PlayerBuffs)end, args = { enable = { order = 1, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua index e57688c..1005cb3 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua @@ -56,7 +56,7 @@ SuperVillain.Options.args.SVMap = { childGroups = "tree", name = L['Minimap'], get = function(a)return SuperVillain.db.SVMap[a[#a]]end, - set = function(a,b)MOD:ChangeDBVar(b,a[#a]);MOD:UpdateThisPackage()end, + set = function(a,b)MOD:ChangeDBVar(b,a[#a]);MOD:ReLoad()end, args={ intro={ order = 1, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua index e847295..73861f6 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua @@ -54,7 +54,7 @@ for w=10,40,15 do order = 2, type = "execute", name = L["Display Frames"], - func = function()MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w], _G["SVUI_Raid" .. w].forceShow ~= true or nil)end, + func = function()MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w], _G["SVUI_Raid" .. w].forceShow ~= true or nil)end, }, resetSettings = { type = "execute", diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index e05fc7a..4d1cdfd 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -38,8 +38,9 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local AddOnName = select(1, ...); -local MOD = SuperVillain:SetContainer(); +local AddOnName, AddOnObject = ...; + +local MOD = SVUI_LIB:SetObject(AddOnName); local DOCK = SuperVillain.Registry:Expose('SVDock'); local SuperDockWindow = _G["SuperDockWindow"]; local SuperDockletMain = _G["SuperDockletMain"]; @@ -645,7 +646,7 @@ end; BUILD FUNCTION ########################################################## ]]-- -function MOD:ConstructThisPackage() +function MOD:Load() local alert = CreateFrame('Frame', nil, UIParent); alert:SetFixedPanelTemplate('Transparent'); alert:SetSize(250, 70); diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.xml b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.xml index 2fd1758..5d27072 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.xml +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.xml @@ -1,6 +1,5 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVUI_StyleOMatic.lua'/> <Script file='common\methods.lua'/> - <Script file='common\docklets.lua'/> <Include file='addons\_load.xml'/> </Ui> \ No newline at end of file