diff --git a/Interface/AddOns/SVUI/packages/aura/SVAura.lua b/Interface/AddOns/SVUI/packages/aura/SVAura.lua index 1ba5483..603697e 100644 --- a/Interface/AddOns/SVUI/packages/aura/SVAura.lua +++ b/Interface/AddOns/SVUI/packages/aura/SVAura.lua @@ -587,6 +587,7 @@ function MOD:Load() SVUI_ConsolidatedBuffs:SetParent(SV.UIParent) SVUI_ConsolidatedBuffs:SetAllPoints(auras) + SVUI_ConsolidatedBuffs:SetFrameStrata("BACKGROUND") for i = 1, NUM_LE_RAID_BUFF_TYPES do SVUI_ConsolidatedBuffs[i] = CreateHyperBuff(i) diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index 90283e6..eaef255 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -1396,10 +1396,10 @@ do end frame:SetScript("OnHide", CloseAllBags) - UISpecialFrames[uisCount] = bagName; - --SV:AddToDisplayAudit(frame) - self.BagFrames[bagsCount] = frame + tinsert(UISpecialFrames, bagName) + tinsert(self.BagFrames, frame) + self.BagFrame = frame end @@ -1503,9 +1503,8 @@ do local Transfer_OnClick = MOD:RunSortingProcess(MOD.Transfer, "bank bags") frame.transferButton:SetScript("OnClick", Transfer_OnClick) - UISpecialFrames[uisCount] = bagName; - --SV:AddToDisplayAudit(frame) - self.BagFrames[bagsCount] = frame + tinsert(UISpecialFrames, bagName) + tinsert(self.BagFrames, frame) frame.bagsButton = CreateFrame("Button", nil, frame) frame.bagsButton:Point("RIGHT", frame.sortButton, "LEFT", -10, 0) diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua index 4c7a893..396795e 100644 --- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua +++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua @@ -580,9 +580,10 @@ local _hook_GameTooltip_SetDefaultAnchor = function(self, parent) self:SetOwner(parent, "ANCHOR_NONE") end end - if not SV.Mentalo:HasMoved("SVUI_ToolTip_MOVE")then - if(SV.SVBag.BagFrame and SV.SVBag.BagFrame:IsShown()) then - self:SetPoint("BOTTOMLEFT", SV.SVBag.BagFrame, "TOPLEFT", 0, 18) + if not SV.Mentalo:HasMoved("SVUI_ToolTip_MOVE")then + self:ClearAllPoints() + if(SV.SVBag.BagFrame and SV.SVBag.BagFrame:IsShown()) then + self:SetPoint("BOTTOMRIGHT", SV.SVBag.BagFrame, "TOPRIGHT", -44, 18) elseif(RightSuperDock:GetAlpha() == 1 and RightSuperDock:IsShown()) then self:SetPoint("BOTTOMRIGHT", RightSuperDock, "TOPRIGHT", -44, 18) else @@ -604,9 +605,9 @@ end MOD.GameTooltip_SetDefaultAnchor = _hook_GameTooltip_SetDefaultAnchor local _hook_BNToastOnShow = function(self,anchor,parent,relative,x,y) - if parent ~= BNET_MOVE then + if parent ~= BattleNetToasts_MOVE then BNToastFrame:ClearAllPoints() - BNToastFrame:Point('TOPLEFT',BNET_MOVE,'TOPLEFT') + BNToastFrame:Point('TOPLEFT',BattleNetToasts_MOVE,'TOPLEFT') end end @@ -860,7 +861,7 @@ end function MOD:Load() BNToastFrame:Point("TOPRIGHT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, -10) - SV.Mentalo:Add(BNToastFrame, L["BNet Frame"]) + SV.Mentalo:Add(BNToastFrame, L["BattleNet Frame"], nil, nil, nil, nil, "BattleNetToasts") NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) if not SV.db.SVTip.enable then return end diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index f6de03b..37a442f 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -1231,6 +1231,7 @@ local _ENV = { return LOCALIZED_CLASS_NAMES_MALE[token], token end, Hex = function(r, g, b) + if not r then return end if type(r) == "table" then if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end end @@ -1273,11 +1274,10 @@ local function ChangeGroupIndex(self) if not self:GetParent().forceShow and not self.forceShow then return end if not self:IsShown() then return end - local max = MAX_RAID_MEMBERS; local key = self.___groupkey local db = SV.db.SVUnit[key] - local newIndex = db.customSorting and -(min(db.groupCount * (db.gRowCol * 5), max) + 1 ) or -4; + local newIndex = -4; if self:GetAttribute("startingIndex") ~= newIndex then self:SetAttribute("startingIndex", newIndex) self.isForced = true; @@ -1300,22 +1300,17 @@ function MOD:SwapElement(unit, numGroup) end end -local attrOverride = { - ["showRaid"] = true, - ["showParty"] = true, - ["showSolo"] = true -} - -function MOD:UpdateGroupConfig(headerFrame, setForced) +function MOD:UpdateGroupConfig(headerFrame, setForced, overrideToken) if InCombatLockdown() then return end SetProxyEnv() - local key = headerFrame.___groupkey - local db = SV.db.SVUnit[key] headerFrame.forceShow = setForced; headerFrame.forceShowAuras = setForced; headerFrame.isForced = setForced; + local raidToken = headerFrame.___groupkey + local db = SV.db.SVUnit[raidToken] + if setForced then for _, func in pairs(tags) do if type(func) == "function" then @@ -1338,29 +1333,30 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) end end - for i = 1, #headerFrame.groups do + local groupCount = db.groupCount + for i = 1, groupCount do local groupFrame = headerFrame.groups[i] - - if groupFrame:IsShown()then - groupFrame.forceShow = headerFrame.forceShow; - groupFrame.forceShowAuras = headerFrame.forceShowAuras; + groupFrame.forceShow = headerFrame.forceShow; + groupFrame.forceShowAuras = headerFrame.forceShowAuras; + if(not groupFrame.ChangeHooked) then groupFrame:HookScript("OnAttributeChanged", ChangeGroupIndex) - if setForced then - for attr in pairs(attrOverride)do - groupFrame:SetAttribute(attr, nil) - end + groupFrame.ChangeHooked = true + end + if setForced then + groupFrame:SetAttribute("showRaid", nil) + groupFrame:SetAttribute("showParty", nil) + groupFrame:SetAttribute("showSolo", nil) - ChangeGroupIndex(groupFrame) - groupFrame:Update() - else - for attr in pairs(attrOverride)do - groupFrame:SetAttribute(attr, true) - end + ChangeGroupIndex(groupFrame) + groupFrame:Update() + else + groupFrame:SetAttribute("showRaid", true) + groupFrame:SetAttribute("showParty", true) + groupFrame:SetAttribute("showSolo", true) - self:RestrictChildren(groupFrame, groupFrame:GetChildren()) - groupFrame:SetAttribute("startingIndex", 1) - groupFrame:Update() - end + self:RestrictChildren(groupFrame, groupFrame:GetChildren()) + groupFrame:SetAttribute("startingIndex", 1) + groupFrame:Update() end end @@ -1386,13 +1382,13 @@ function MOD:FrameForge() LoadedUnitFrames = true; end if not LoadedGroupHeaders then - self:SetGroupFrame("raid10") - self:SetGroupFrame("raid25") - self:SetGroupFrame("raid40") - self:SetGroupFrame("raidpet", nil, "SVUI_UNITPET", nil, "SecureGroupPetHeaderTemplate") - self:SetGroupFrame("party", nil, "SVUI_UNITPET, SVUI_UNITTARGET") - self:SetGroupFrame("tank", "MAINTANK", "SVUI_UNITTARGET") - self:SetGroupFrame("assist", "MAINASSIST", "SVUI_UNITTARGET") + self:SetRaidGroup("raid10") + self:SetRaidGroup("raid25") + self:SetRaidGroup("raid40") + self:SetRaidPetGroup("raidpet") + self:SetPartyGroup("party") + self:SetTankAssistFrame("tank") + self:SetTankAssistFrame("assist") LoadedGroupHeaders = true end end diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml index a8bbb31..a414258 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml @@ -61,4 +61,5 @@ <Script file="resources\warrior.lua"/> <Script file="frames.lua"/> + <Script file="groups.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames.lua b/Interface/AddOns/SVUI/packages/unit/frames.lua index 0c5c78f..6deac6f 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames.lua @@ -62,68 +62,8 @@ if(not MOD) then return end LOCAL DATA ########################################################## ]]-- -local CONSTRUCTORS, GROUP_UPDATES = {}, {} +local CONSTRUCTORS = {} local lastArenaFrame, lastBossFrame -local sortMapping = { - ["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 GroupDistributor = { - ["CLASS"] = function(x) - x:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","CLASS") - end, - ["MTMA"] = function(x) - x:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","ROLE") - end, - ["ROLE_TDH"] = function(x) - x:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","ASSIGNEDROLE") - end, - ["ROLE_HTD"] = function(x) - x:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","ASSIGNEDROLE") - end, - ["ROLE_HDT"] = function(x) - x:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","ASSIGNEDROLE") - end, - ["ROLE"] = function(x) - x:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy","ASSIGNEDROLE") - end, - ["NAME"] = function(x) - x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy",nil) - end, - ["GROUP"] = function(x) - x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - x:SetAttribute("sortMethod","INDEX") - x:SetAttribute("groupBy","GROUP") - end, - ["PETNAME"] = function(x) - x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - x:SetAttribute("sortMethod","NAME") - x:SetAttribute("groupBy", nil) - x:SetAttribute("filterOnPet", true) - end -} --[[ ########################################################## ALL UNIT HELPERS @@ -155,8 +95,6 @@ local UpdateTargetGlow = function(self) end --[[ ########################################################## -STANDARD UNITS -########################################################## PLAYER ########################################################## ]]-- @@ -785,50 +723,6 @@ end ARENA ########################################################## ]]-- -local function CreatePrepFrame(frameName, parentFrame, parentID) - local prep = CreateFrame("Frame", frameName, UIParent) - prep:SetFrameStrata("MEDIUM") - prep:SetAllPoints(parentFrame) - prep:SetID(parentID) - prep:SetPanelTemplate("Bar", true, 3, 1, 1) - - local health = CreateFrame("StatusBar", nil, prep) - health:SetAllPoints(prep) - health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - prep.Health = health - - local icon = CreateFrame("Frame", nil, prep) - icon:SetSize(45,45) - icon:SetPoint("LEFT", prep, "RIGHT", 2, 0) - icon:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 2, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0 - } - }) - icon:SetBackdropColor(0, 0, 0, 0) - icon:SetBackdropBorderColor(0, 0, 0) - icon.Icon = icon:CreateTexture(nil, "OVERLAY") - icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - icon.Icon:FillInner(icon, 2, 2) - prep.SpecIcon = icon - - local text = prep.Health:CreateFontString(nil, "OVERLAY") - text:SetFont(SV.Media.font.names, 16, "OUTLINE") - text:SetTextColor(1, 1, 1) - text:SetPoint("CENTER") - prep.SpecClass = text - - prep:Hide() -end - local UpdateArenaFrame = function(self) local db = SV.db.SVUnit["arena"] local INDEX = self:GetID() or 1; @@ -933,7 +827,49 @@ CONSTRUCTORS["arena"] = function(self, unit) self.Range = { insideAlpha = 1, outsideAlpha = 1 } self:SetAttribute("type2", "focus") - if(not _G[prepName]) then CreatePrepFrame(prepName, self, selfID) end + 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, 1, 1) + + local health = CreateFrame("StatusBar", nil, prep) + health:SetAllPoints(prep) + health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + prep.Health = health + + local icon = CreateFrame("Frame", nil, prep) + icon:SetSize(45,45) + icon:SetPoint("LEFT", prep, "RIGHT", 2, 0) + icon:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + edgeSize = 2, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }) + icon:SetBackdropColor(0, 0, 0, 0) + icon:SetBackdropBorderColor(0, 0, 0) + icon.Icon = icon:CreateTexture(nil, "OVERLAY") + icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + icon.Icon:FillInner(icon, 2, 2) + prep.SpecIcon = icon + + local text = prep.Health:CreateFontString(nil, "OVERLAY") + text:SetFont(SV.Media.font.names, 16, "OUTLINE") + text:SetTextColor(1, 1, 1) + text:SetPoint("CENTER") + prep.SpecClass = text + + prep:Hide() + end if(not _G["SVUI_Arena_MOVE"]) then self:Point("RIGHT", SV.UIParent, "RIGHT", -105, 0) @@ -1080,1049 +1016,4 @@ function MOD:SetEnemyFrames(key, maxCount) frame:Disable() end end -end ---[[ -########################################################## -HEADER UNITS -########################################################## -HEADER FRAME HELPERS -########################################################## -]]-- -local GroupMediaUpdate = function(self) - local key = self.___groupkey - 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 - childFrame:UpdateAllElements() - index = index + 1; - childFrame = self:GetAttribute("child"..index) - 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 = SV.db.SVUnit["raid10"] - if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, raidType, maxPlayers, _, isDynamic, _, activePlayers = GetInstanceInfo() - 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") - if((activePlayers and (activePlayers > 5 and activePlayers < 11)) or (maxPlayers and maxPlayers == 10)) then - self:Show() - else - self:Hide() - end - 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 = SV.db.SVUnit["raid25"] - if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, raidType, maxPlayers, _, isDynamic, _, activePlayers = GetInstanceInfo() - 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") - if((activePlayers and (activePlayers > 10 and activePlayers < 26)) or (maxPlayers and (maxPlayers > 10 and maxPlayers < 26))) then - self:Show() - else - self:Hide() - end - 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 = SV.db.SVUnit["raid40"] - if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, raidType, maxPlayers, _, isDynamic, _, activePlayers = GetInstanceInfo() - 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") - if((activePlayers and activePlayers > 25) or (maxPlayers and maxPlayers > 25)) then - self:Show() - else - self:Hide() - end - 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_Villain.colors; - self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp") - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) - if not InCombatLockdown() then - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - end - do - local rdBuffs = self.RaidDebuffs; - if db.rdebuffs.enable then - if not self:IsElementEnabled('RaidDebuffs')then - self:EnableElement("RaidDebuffs") - end - local actualSz = numMin(db.rdebuffs.size, (UNIT_HEIGHT - 8)) - rdBuffs:Size(actualSz) - rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) - rdBuffs:Show() - else - self:DisableElement("RaidDebuffs") - rdBuffs:Hide() - end - end - MOD.RefreshUnitMedia(self, key) - MOD:UpdateAuraWatch(self, key) - MOD:RefreshUnitLayout(self, key) - if(key ~= "raidpet") then - self:EnableElement("ReadyCheck") - end - self:UpdateAllElements() -end - -GROUP_UPDATES["raid10"] = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) - SV.Mentalo:Add(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid10Visibility) - frame.positioned = true - end - Raid10Visibility(frame) - local key = "raid10" - local db = SV.db.SVUnit[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 - -GROUP_UPDATES["raid25"] = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) - SV.Mentalo:Add(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid25Visibility) - frame.positioned = true - end - Raid25Visibility(frame) - local key = "raid25" - local db = SV.db.SVUnit[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 - -GROUP_UPDATES["raid40"] = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) - SV.Mentalo:Add(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid40Visibility) - frame.positioned = true - end - Raid40Visibility(frame) - local key = "raid40" - local db = SV.db.SVUnit[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 - -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 = 3, - insets = { - left = 5, - right = 5, - top = 5, - bottom = 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.Health.frequentUpdates = false - 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.Health.frequentUpdates = false - 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.Health.frequentUpdates = false - 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 = SV.db.SVUnit["raidpet"] - if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.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 - -GROUP_UPDATES["raidpet"] = function(self) - local raidPets = self:GetParent() - if not raidPets.positioned then - raidPets:ClearAllPoints() - raidPets:Point("BOTTOMLEFT", SV.UIParent, "BOTTOMLEFT", 4, 433) - SV.Mentalo:Add(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") - raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") - raidPets:SetScript("OnEvent", RaidPetVisibility) - raidPets.positioned = true; - end - RaidPetVisibility(raidPets) - local key = "raidpet" - local db = SV.db.SVUnit[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 - -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 = 3, - insets = { - left = 5, - right = 5, - top = 5, - bottom = 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 = SV.db.SVUnit["party"] - if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.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_Villain.colors; - self:RegisterForClicks(SV.db.SVUnit.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 - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(altDB) - self:SetParent(self.originalParent) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - self:ClearAllPoints() - SV:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset) - else - self:SetParent(SV.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 - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - end - MOD:RefreshUnitLayout(self, key) - MOD:UpdateAuraWatch(self, key) - end - self:EnableElement('ReadyCheck') - self:UpdateAllElements() -end - -GROUP_UPDATES["party"] = function(self) - local group = self:GetParent() - if not group.positioned then - group:ClearAllPoints() - group:Point("LEFT",SV.UIParent,"LEFT",40,0) - SV.Mentalo:Add(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); - group:RegisterEvent("PLAYER_ENTERING_WORLD") - group:RegisterEvent("ZONE_CHANGED_NEW_AREA") - group:SetScript("OnEvent", PartyVisibility) - group.positioned = true; - end - PartyVisibility(group) - local key = "party" - local db = SV.db.SVUnit[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 - -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) - --self.GPS = MOD:CreateGPS(self, true) - - 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 = 3, - insets = { - left = 5, - right = 5, - top = 5, - bottom = 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_Villain.colors; - self:RegisterForClicks(SV.db.SVUnit.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 - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets) - self:SetParent(self.originalParent) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - self:ClearAllPoints() - SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) - else - self:SetParent(SV.Cloaked) - end - end - elseif not InCombatLockdown() then - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - end - MOD:RefreshUnitLayout(self, key) - do - local nametext = self.InfoPanel.Name; - if oUF_Villain.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 = SV.db.SVUnit[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", SV.UIParent, "TOPLEFT", 4, -40) - SV.Mentalo:Add(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - self.Avatar.positionOverride = "TOPLEFT" - self:SetAttribute("minHeight", self.dirtyHeight) - self:SetAttribute("minWidth", self.dirtyWidth) - 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 - -CONSTRUCTORS["tank"] = function(self, unit) - local key = "tank" - local db = SV.db.SVUnit[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_Villain.colors; - self:RegisterForClicks(SV.db.SVUnit.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 - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets) - self:SetParent(self.originalParent) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - self:ClearAllPoints() - SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) - else - self:SetParent(SV.Cloaked) - end - end - elseif not InCombatLockdown() then - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - end - - MOD:RefreshUnitLayout(self, key) - - do - local nametext = self.InfoPanel.Name; - if oUF_Villain.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 = SV.db.SVUnit[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", SV.UIParent, "TOPLEFT", 4, -140) - SV.Mentalo:Add(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - self.Avatar.positionOverride = "TOPLEFT" - self:SetAttribute("minHeight", self.dirtyHeight) - self:SetAttribute("minWidth", self.dirtyWidth) - 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 - -CONSTRUCTORS["assist"] = function(self, unit) - local key = "assist" - local db = SV.db.SVUnit[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 ---[[ -########################################################## -GROUP HEADER METHODS -########################################################## -]]-- -local GroupSetConfigEnvironment = function(self) - local key = self.___groupkey - local db = SV.db.SVUnit[key] - local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) - local anchorPoint; - local sorting = db.showBy - local pointMap = sortMapping[sorting] - local sortMethod = db.sortMethod - local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; - 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 (-numMin(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) - GroupDistributor[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 + UNIT_HEIGHT + db.wrapYOffset; - yCalc = yCalc + 1 - else - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) - end - widthCalc = widthCalc + UNIT_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 + (UNIT_WIDTH + db.wrapXOffset) * 5; - xCalc = xCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, (((UNIT_WIDTH + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((UNIT_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 + (UNIT_HEIGHT + db.wrapYOffset) * 5; - yCalc = yCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, ((UNIT_WIDTH + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((UNIT_HEIGHT + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) - end - end - end - if heightCalc == 0 then - heightCalc = heightCalc + (UNIT_HEIGHT + db.wrapYOffset) * 5 - elseif widthCalc == 0 then - widthCalc = widthCalc + (UNIT_WIDTH + db.wrapXOffset) * 5 - end - end - self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset) -end - -local GroupHeaderUpdate = function(self) - local key = self.___groupkey - if SV.db.SVUnit[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 GroupHeaderMediaUpdate = function(self) - for i=1,#self.groups do - self.groups[i]:MediaUpdate() - end -end - -local GroupSetActiveState = function(self) - if not self.isForced then - local key = self.___groupkey - local db = SV.db.SVUnit[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 ---[[ -########################################################## -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 - -function MOD:ConstructGroupHeader(parentFrame, filter, styleName, headerName, template1, groupName, template2, updateFunc) - local db = SV.db.SVUnit[groupName] - local UNIT_WIDTH, UNIT_HEIGHT = self:GetActiveSize(db) - - oUF_Villain:SetActiveStyle(styleName) - local groupHeader = oUF_Villain:SpawnHeader(headerName, template2, nil, - "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(UNIT_WIDTH, UNIT_HEIGHT), - "groupFilter", filter, - "showParty", true, - "showRaid", true, - "showSolo", true, - template1 and "template", template1 - ) - groupHeader.___groupkey = groupName - groupHeader:SetParent(parentFrame) - groupHeader:Show() - - groupHeader.Update = updateFunc or GROUP_UPDATES[groupName] - groupHeader.MediaUpdate = GroupMediaUpdate - groupHeader.ClearAllAttributes = SecureHeaderClear - - return groupHeader -end ---[[ -########################################################## -LOAD/UPDATE METHOD -########################################################## -]]-- -function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2) - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - if(not SV.db.SVUnit.enable or not SV.db.SVUnit[key]) then return end - local db = SV.db.SVUnit[key] - local realName = key:gsub("(.)", upper, 1) - local styleName = "SVUI_"..realName - local frame, groupName - - if(not self.Headers[key]) then - oUF_Villain:RegisterStyle(styleName, CONSTRUCTORS[key]) - oUF_Villain:SetActiveStyle(styleName) - - if(key == "tank") then - frame = self:ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2, UpdateTankFrame) - elseif(key == "assist") then - frame = self:ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2, UpdateAssistFrame) - else - frame = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") - frame.groups = {} - frame.___groupkey = key; - frame.Update = GroupHeaderUpdate - frame.MediaUpdate = GroupHeaderMediaUpdate - 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" - local subunit = self:ConstructGroupHeader(frame, 1, styleName, groupName, template1, key, template2) - frame.groups[1] = subunit - end - else - for i = 1, db.groupCount do - if(not frame.groups[i]) then - groupName = styleName .. "Group" .. i - local subunit = self:ConstructGroupHeader(frame, i, styleName, groupName, template1, key, template2) - frame.groups[i] = subunit - 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/groups.lua b/Interface/AddOns/SVUI/packages/unit/groups.lua new file mode 100644 index 0000000..99bce41 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/groups.lua @@ -0,0 +1,1220 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +--]] +--LUA +local unpack = unpack; +local select = select; +local pairs = pairs; +local type = type; +local rawset = rawset; +local rawget = rawget; +local tostring = tostring; +local error = error; +local next = next; +local pcall = pcall; +local getmetatable = getmetatable; +local setmetatable = setmetatable; +local assert = assert; +--BLIZZARD +local _G = _G; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; +--STRING +local string = string; +local format = string.format; +local sub = string.sub; +local upper = string.upper; +local match = string.match; +local gsub = string.gsub; +--MATH +local math = math; +local numMin = math.min; +--TABLE +local table = table; +local tsort = table.sort; +local tremove = table.remove; + +local SV = select(2, ...) +local oUF_Villain = SV.oUF + +assert(oUF_Villain, "SVUI was unable to locate oUF.") + +local L = SV.L; +local MOD = SV.SVUnit + +if(not MOD) then return end +--[[ +########################################################## +LOCAL DATA +########################################################## +]]-- +local sortMapping = { + ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]=1,[5]=-1,[6]=false}, + ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]=1,[5]=-1,[6]=false}, + ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]=1,[5]=1,[6]=false}, + ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]=-1,[5]=1,[6]=false}, + ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]=1,[5]=-1,[6]=true}, + ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]=1,[5]=1,[6]=true}, + ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]=-1,[5]=-1,[6]=true}, + ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]=-1,[5]=1,[6]=true}, + ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]=1,[5]=1,[6]=false}, + ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]=1,[5]=1,[6]=false}, +} +local GroupDistributor = { + ["CLASS"] = function(x) + x:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","CLASS") + end, + ["MTMA"] = function(x) + x:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","ROLE") + end, + ["ROLE_TDH"] = function(x) + x:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","ASSIGNEDROLE") + end, + ["ROLE_HTD"] = function(x) + x:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","ASSIGNEDROLE") + end, + ["ROLE_HDT"] = function(x) + x:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","ASSIGNEDROLE") + end, + ["ROLE"] = function(x) + x:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy","ASSIGNEDROLE") + end, + ["NAME"] = function(x) + x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy",nil) + end, + ["GROUP"] = function(x) + x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + x:SetAttribute("sortMethod","INDEX") + x:SetAttribute("groupBy","GROUP") + end, + ["PETNAME"] = function(x) + x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + x:SetAttribute("sortMethod","NAME") + x:SetAttribute("groupBy", nil) + x:SetAttribute("filterOnPet", true) + end +} +--[[ +########################################################## +FRAME HELPERS +########################################################## +]]-- +local function GetRaidToken(active) + local maxPlayers = select(5, GetInstanceInfo()) + local token = "raid10"; + if(maxPlayers > 10 and maxPlayers < 40) then + token = "raid25" + elseif(maxPlayers > 25) then + token = "raid40" + end + + return token == active +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 = RAID_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 GroupMediaUpdate = function(self) + local token = self.___groupkey + local index = 1; + local attIndex = ("child%d"):format(index) + local childFrame = groupHeader:GetAttribute(attIndex) + local childName = childFrame:GetName() + local petFrame = _G[("%sPet"):format(childName)] + local targetFrame = _G[("%sTarget"):format(childName)] + + while childFrame do + MOD.RefreshUnitMedia(childFrame, token) + + if(petFrame) then + MOD.RefreshUnitMedia(petFrame, token) + end + + if(targetFrame) then + MOD.RefreshUnitMedia(targetFrame, token) + end + + index = index + 1; + attIndex = ("child%d"):format(index) + childFrame = raid:GetAttribute(attIndex) + childName = childFrame:GetName() + petFrame = _G[("%sPet"):format(childName)] + targetFrame = _G[("%sTarget"):format(childName)] + end +end + +local GroupHeaderMediaUpdate = function(self) + for i=1,#self.groups do + self.groups[i]:MediaUpdate() + end +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 + +local DetachSubFrames = function(...) + for i = 1, select("#", ...) do + local frame = select(i,...) + frame:ClearAllPoints() + end +end + +local function SetForcedEnvironment(groupHeader) + local token = groupHeader.___groupkey + local settings = SV.db.SVUnit[token] + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(settings) + local sorting = settings.showBy + local sortMethod = settings.sortMethod + local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; + local point, anchorPoint, columnAnchor, horizontal, vertical, isHorizontal = unpack(sortMapping[sorting]); + local groupCount = #groupHeader.groups + for i = 1, groupCount do + local frame = groupHeader.groups[i] + if frame then + if(settings.showBy == "UP") then + settings.showBy = "UP_RIGHT" + end + if(settings.showBy == "DOWN") then + settings.showBy = "DOWN_RIGHT" + end + if isHorizontal then + frame:SetAttribute("xOffset", settings.wrapXOffset * horizontal) + frame:SetAttribute("yOffset", 0) + frame:SetAttribute("columnSpacing", settings.wrapYOffset) + else + frame:SetAttribute("xOffset", 0) + frame:SetAttribute("yOffset", settings.wrapYOffset * vertical) + frame:SetAttribute("columnSpacing", settings.wrapXOffset) + end + if not frame.isForced then + if not frame.initialized then + frame:SetAttribute("startingIndex", -4) + frame:Show() + frame.initialized = true + end + frame:SetAttribute("startingIndex", 1) + end + frame:ClearAllPoints() + frame:SetAttribute("columnAnchorPoint", columnAnchor) + DetachSubFrames(frame:GetChildren()) + frame:SetAttribute("point", point) + if not frame.isForced then + frame:SetAttribute("maxColumns", 1) + frame:SetAttribute("unitsPerColumn", 5) + GroupDistributor[sortMethod](frame) + frame:SetAttribute("sortDir", settings.sortDir) + frame:SetAttribute("showPlayer", settings.showPlayer) + end + frame:SetAttribute("groupFilter", tostring(i)) + end + + if (i - 1) % settings.gRowCol == 0 then + if isHorizontal then + if frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + UNIT_HEIGHT + settings.wrapYOffset; + yCalc = yCalc + 1 + else + if frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + UNIT_WIDTH + settings.wrapXOffset; + xCalc = xCalc + 1 + end + else + if isHorizontal then + if yCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + (UNIT_WIDTH + settings.wrapXOffset) * 5; + xCalc = xCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, (((UNIT_WIDTH + settings.wrapXOffset) * 5) * ((i - 1) % settings.gRowCol)) * horizontal, ((UNIT_HEIGHT + settings.wrapYOffset) * (yCalc - 1)) * vertical) + end + else + if xCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + (UNIT_HEIGHT + settings.wrapYOffset) * 5; + yCalc = yCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, groupHeader, anchorPoint, ((UNIT_WIDTH + settings.wrapXOffset) * (xCalc - 1)) * horizontal, (((UNIT_HEIGHT + settings.wrapYOffset) * 5) * ((i - 1) % settings.gRowCol)) * vertical) + end + end + end + if heightCalc == 0 then + heightCalc = heightCalc + (UNIT_HEIGHT + settings.wrapYOffset) * 5 + elseif widthCalc == 0 then + widthCalc = widthCalc + (UNIT_WIDTH + settings.wrapXOffset) * 5 + end + end + groupHeader:SetSize(widthCalc - settings.wrapXOffset, heightCalc - settings.wrapYOffset) +end + +local function SetGroupHeader(parentFrame, filter, styleName, headerName, template1, token, template2, updateFunction) + local db = SV.db.SVUnit[token] + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) + local groupHeader = oUF_Villain:SpawnHeader(headerName, template2, nil, + "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(UNIT_WIDTH, UNIT_HEIGHT), + "groupFilter", filter, + "showParty", true, + "showRaid", true, + "showSolo", true, + template1 and "template", template1 + ) + groupHeader.___groupkey = token + groupHeader:SetParent(parentFrame) + groupHeader:Show() + + groupHeader.Update = updateFunction + groupHeader.MediaUpdate = GroupMediaUpdate + groupHeader.ClearAllAttributes = SecureHeaderClear + + return groupHeader +end +--[[ +########################################################## +PARTY FRAMES +########################################################## +]]-- +local PartyVisibility = function(self, event) + local db = SV.db.SVUnit.party + if(not SV.db.SVUnit or (not SV.db.SVUnit.party)) then return end + if ((not SV.db.SVUnit.party.enable) or self.isForced) then return end + + if(event == "PLAYER_REGEN_ENABLED") then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + + if(not InCombatLockdown()) then + local instance, instanceType = IsInInstance() + if(instance and instanceType == "raid") then + UnregisterStateDriver(self,"visibility") + self:Hide() + else + RegisterStateDriver(self, "visibility", "[@raid6, exists][nogroup] hide;show") + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + end +end + +local UpdatePartySubUnit = function(self, key, db) + self.colors = oUF_Villain.colors; + self:RegisterForClicks(SV.db.SVUnit.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 + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(altDB) + self:SetParent(self.originalParent) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:ClearAllPoints() + SV:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset) + else + self:SetParent(SV.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 + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + end + MOD:RefreshUnitLayout(self, key) + MOD:UpdateAuraWatch(self, key) + end + self:EnableElement('ReadyCheck') + self:UpdateAllElements() +end + +local PartyGroupUpdate = function(self) + local group = self:GetParent() + + if not group.positioned then + group:ClearAllPoints() + group:Point("LEFT",SV.UIParent,"LEFT",40,0) + SV.Mentalo:Add(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); + group:RegisterEvent("PLAYER_ENTERING_WORLD") + group:RegisterEvent("ZONE_CHANGED_NEW_AREA") + group:SetScript("OnEvent", PartyVisibility) + group.positioned = true; + end + + PartyVisibility(group) + + local key = "party" + local db = SV.db.SVUnit[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 + +local PartyPrototype = 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) + --self.GPS = MOD:CreateGPS(self, true) + + 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 = 3, + insets = { + left = 5, + right = 5, + top = 5, + bottom = 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 + +local PartyHeaderUpdate = function(self) + if SV.db.SVUnit.party.enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + for i=1,#self.groups do + self.groups[i]:Update() + end +end + +local SetPartyHeaderState = function(self) + if not self.isForced then + local db = SV.db.SVUnit.party + if(db) then + local groupCount = #self.groups + for i=1, groupCount do + local frame = self.groups[i] + frame:Show() + end + end + end +end + +function MOD:SetPartyGroup(token, forceUpdate) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + if(not SV.db.SVUnit.enable) then return end + local settings = SV.db.SVUnit.party + local styleName = "SVUI_Party" + local partyGroup, groupName + + if(not self.Headers.party) then + oUF_Villain:RegisterStyle(styleName, PartyPrototype) + oUF_Villain:SetActiveStyle(styleName) + partyGroup = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + partyGroup.groups = {} + partyGroup.___groupkey = "party"; + partyGroup.Update = PartyHeaderUpdate + partyGroup.MediaUpdate = GroupHeaderMediaUpdate + partyGroup.SetActiveState = SetPartyHeaderState + partyGroup.SetConfigEnvironment = SetForcedEnvironment + partyGroup:Show() + + local groupHeader = SetGroupHeader(partyGroup, 1, styleName, "SVUI_PartyGroup1", "SVUI_UNITPET, SVUI_UNITTARGET", token, nil, PartyGroupUpdate) + partyGroup.groups[1] = groupHeader + + self.Headers.party = partyGroup + else + partyGroup = self.Headers.party + end + + if(SV.db.SVUnit.party.enable ~= true) then + UnregisterStateDriver(partyGroup, "visibility") + partyGroup:Hide() + return + end + + partyGroup:SetActiveState() + + if(forceUpdate or not partyGroup.Avatar) then + partyGroup:SetConfigEnvironment() + if(not partyGroup.isForced) then + RegisterStateDriver(partyGroup, "visibility", "[group:raid] show; hide") + end + else + partyGroup:SetConfigEnvironment() + partyGroup:Update() + end +end +--[[ +########################################################## +RAID FRAMES +########################################################## +]]-- +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 = 3, + insets = { + left = 5, + right = 5, + top = 5, + bottom = 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 + +local function UpdateRaidSubUnit(subUnit, token) + local db = SV.db.SVUnit[token] + subUnit.colors = oUF_Villain.colors; + subUnit:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp") + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) + if not InCombatLockdown() then + subUnit:Size(UNIT_WIDTH, UNIT_HEIGHT) + end + + do + local rdBuffs = subUnit.RaidDebuffs; + if db.rdebuffs.enable then + if not subUnit:IsElementEnabled('RaidDebuffs') then + subUnit:EnableElement("RaidDebuffs") + end + local actualSz = numMin(db.rdebuffs.size, (UNIT_HEIGHT - 8)) + rdBuffs:Size(actualSz) + rdBuffs:Point("CENTER", subUnit, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) + rdBuffs:Show() + else + subUnit:DisableElement("RaidDebuffs") + rdBuffs:Hide() + end + end + + MOD.RefreshUnitMedia(subUnit, token) + MOD:UpdateAuraWatch(subUnit, token) + MOD:RefreshUnitLayout(subUnit, token) + + subUnit:EnableElement("ReadyCheck") + subUnit:UpdateAllElements() +end + +local RaidVisibility = function(groupFrame, event) + if(not SV.db.SVUnit or (not SV.db.SVUnit.raid)) then return end + if ((not SV.db.SVUnit.raid.enable) or groupFrame.isForced) then return end + + if(event == "PLAYER_REGEN_ENABLED") then + groupFrame:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + + if not InCombatLockdown() then + local token = groupFrame.___groupkey + local db = SV.db.SVUnit[token] + local instance, instanceType = IsInInstance() + if(instance and (instanceType == "raid")) then + UnregisterStateDriver(groupFrame, "visibility") + if(GetRaidToken(token)) then + groupFrame:Show() + else + groupFrame:Hide() + end + elseif(db.visibility) then + RegisterStateDriver(groupFrame, "visibility", db.visibility) + end + else + groupFrame:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local RaidGroupUpdate = function(groupHeader) + if(not SV.db.SVUnit or (not SV.db.SVUnit.raid)) then return end + local groupFrame = groupHeader:GetParent() + local token = groupFrame.___groupkey + + if not groupFrame.positioned then + groupFrame:ClearAllPoints() + groupFrame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) + SV.Mentalo:Add(groupFrame, L["Raid Frames"]) + groupFrame:RegisterEvent("PLAYER_ENTERING_WORLD") + groupFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + groupFrame:SetScript("OnEvent", RaidVisibility) + groupFrame.positioned = true + end + + RaidVisibility(groupFrame) + + local index = 1; + local attIndex = ("child%d"):format(index) + local childFrame = groupHeader:GetAttribute(attIndex) + local childName = childFrame:GetName() + local petFrame = _G[("%sPet"):format(childName)] + local targetFrame = _G[("%sTarget"):format(childName)] + + while childFrame do + UpdateRaidSubUnit(childFrame, token) + + childName = childFrame:GetName() + petFrame = _G[("%sPet"):format(childName)] + targetFrame = _G[("%sTarget"):format(childName)] + + if(petFrame) then + UpdateRaidSubUnit(petFrame, token) + end + + if(targetFrame) then + UpdateRaidSubUnit(targetFrame, token) + end + + index = index + 1; + attIndex = ("child%d"):format(index) + childFrame = groupHeader:GetAttribute(attIndex) + end +end + +local RaidPrototype = function(token) + return function(self, unit) + self.unit = unit + self.___key = token + MOD:SetActionPanel(self, token) + self.Health = MOD:CreateHealthBar(self, true) + self.Health.frequentUpdates = false + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, token) + self.Debuffs = MOD:CreateDebuffs(self, token) + self.AuraWatch = MOD:CreateAuraWatch(self, token) + return SetRaidFrame(self) + end +end + +local GroupHeaderUpdate = function(self) + if SV.db.SVUnit.raid.enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + for i=1,#self.groups do + self.groups[i]:Update() + end +end + +local SetGroupHeaderState = function(self) + if not self.isForced then + local token = self.___groupkey + local db = SV.db.SVUnit[token] + if(db) then + for i=1,#self.groups do + local frame = self.groups[i] + if(i <= db.groupCount) 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 + +function MOD:SetRaidGroup(token, forceUpdate) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + if(not SV.db.SVUnit.enable) then return end + local db = SV.db.SVUnit[token] + local realName = token:gsub("(.)", upper, 1) + local styleName = "SVUI_"..realName + local raidGroup, groupName + + if(not self.Headers[token]) then + oUF_Villain:RegisterStyle(styleName, RaidPrototype(token)) + oUF_Villain:SetActiveStyle(styleName) + raidGroup = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + raidGroup.groups = {} + raidGroup.___groupkey = token; + raidGroup.Update = GroupHeaderUpdate + raidGroup.MediaUpdate = GroupHeaderMediaUpdate + raidGroup.SetActiveState = SetGroupHeaderState + raidGroup.SetConfigEnvironment = SetForcedEnvironment + raidGroup:Show() + + self.Headers[token] = raidGroup + else + raidGroup = self.Headers[token] + end + + if(SV.db.SVUnit.raid.enable ~= true) then + UnregisterStateDriver(raidGroup, "visibility") + raidGroup:Hide() + return + end + + for i = 1, db.groupCount do + if(not raidGroup.groups[i]) then + groupName = styleName .. "Group" .. i + raidGroup.groups[i] = SetGroupHeader(raidGroup, i, styleName, groupName, nil, token, nil, RaidGroupUpdate) + end + end + + raidGroup:SetActiveState() + + if(forceUpdate or not raidGroup.Avatar) then + raidGroup:SetConfigEnvironment() + if(not raidGroup.isForced) then + RegisterStateDriver(raidGroup, "visibility", db.visibility) + end + else + raidGroup:SetConfigEnvironment() + raidGroup:Update() + end +end +--[[ +########################################################## +RAID PETS +########################################################## +]]-- +local RaidPetVisibility = function(self, event) + local db = SV.db.SVUnit["raidpet"] + if (not db or (db and not db.enable) 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() + else + RegisterStateDriver(self, "visibility", "[group:raid] show; hide") + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local RaidPetUpdate = function(self) + local raidPets = self:GetParent() + if not raidPets.positioned then + raidPets:ClearAllPoints() + raidPets:Point("BOTTOMLEFT", SV.UIParent, "BOTTOMLEFT", 4, 433) + SV.Mentalo:Add(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") + raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") + raidPets:SetScript("OnEvent", RaidPetVisibility) + raidPets.positioned = true; + end + RaidPetVisibility(raidPets) + local key = "raidpet" + local db = SV.db.SVUnit[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 + +local RaidPetPrototype = 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 = 3, + insets = { + left = 5, + right = 5, + top = 5, + bottom = 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 + +local PetHeaderUpdate = function(self) + if SV.db.SVUnit.raidpet.enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + for i=1,#self.groups do + self.groups[i]:Update() + end +end + +local SetPetHeaderState = function(self) + if not self.isForced then + local db = SV.db.SVUnit.raidpet + if(db) then + local groupCount = #self.groups + for i=1, groupCount do + local frame = self.groups[i] + frame:Show() + end + end + end +end + +function MOD:SetRaidPetGroup(token, forceUpdate) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + if(not SV.db.SVUnit.enable) then return end + local settings = SV.db.SVUnit.raidpet + local styleName = "SVUI_RaidPets" + local petGroup, groupName + + if(not self.Headers.raidpet) then + oUF_Villain:RegisterStyle(styleName, RaidPetPrototype) + oUF_Villain:SetActiveStyle(styleName) + petGroup = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + petGroup.groups = {} + petGroup.___groupkey = "raidpet"; + petGroup.Update = PetHeaderUpdate + petGroup.MediaUpdate = GroupHeaderMediaUpdate + petGroup.SetActiveState = SetPetHeaderState + petGroup.SetConfigEnvironment = SetForcedEnvironment + petGroup:Show() + for i = 1, 2 do + if(not petGroup.groups[i]) then + groupName = "SVUI_RaidPetsGroup" .. i + local groupHeader = SetGroupHeader(petGroup, i, styleName, groupName, "SVUI_UNITPET", "raidpet", "SecureGroupPetHeaderTemplate", RaidPetUpdate) + petGroup.groups[i] = groupHeader + end + end + + self.Headers.raidpet = petGroup + else + petGroup = self.Headers.raidpet + end + + petGroup:SetActiveState() + + if(forceUpdate or not petGroup.Avatar) then + petGroup:SetConfigEnvironment() + if(not petGroup.isForced) then + RegisterStateDriver(petGroup, "visibility", "[group:raid] show; hide") + end + else + petGroup:SetConfigEnvironment() + petGroup:Update() + end + + if(settings.enable ~= true) then + UnregisterStateDriver(petGroup, "visibility") + petGroup:Hide() + return + end +end +--[[ +########################################################## +TANK +########################################################## +]]-- +local UpdateTankSubUnit = function(self, key, db) + self.colors = oUF_Villain.colors; + self:RegisterForClicks(SV.db.SVUnit.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 + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets) + self:SetParent(self.originalParent) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:ClearAllPoints() + SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SV.Cloaked) + end + end + elseif not InCombatLockdown() then + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + end + MOD:RefreshUnitLayout(self, key) + do + local nametext = self.InfoPanel.Name; + if oUF_Villain.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 = SV.db.SVUnit[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", SV.UIParent, "TOPLEFT", 4, -40) + SV.Mentalo:Add(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + 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 + +local TankPrototype = function(self, unit) + local key = "tank" + local db = SV.db.SVUnit[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_Villain.colors; + self:RegisterForClicks(SV.db.SVUnit.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 + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets) + self:SetParent(self.originalParent) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:ClearAllPoints() + SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SV.Cloaked) + end + end + elseif not InCombatLockdown() then + local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db) + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + end + + MOD:RefreshUnitLayout(self, key) + + do + local nametext = self.InfoPanel.Name; + if oUF_Villain.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 = SV.db.SVUnit[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", SV.UIParent, "TOPLEFT", 4, -140) + SV.Mentalo:Add(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + 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 + +local AssistPrototype = function(self, unit) + local key = "assist" + local db = SV.db.SVUnit[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 + +function MOD:SetTankAssistFrame(token, forceUpdate) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + if(not SV.db.SVUnit.enable or not SV.db.SVUnit[token]) then return end + local db = SV.db.SVUnit[token] + local realName = token:gsub("(.)", upper, 1) + local styleName = "SVUI_"..realName + local groupHeader, groupName + + if(not self.Headers[token]) then + if(token == "tank") then + oUF_Villain:RegisterStyle(styleName, TankPrototype) + oUF_Villain:SetActiveStyle(styleName) + groupHeader = SetGroupHeader(SVUI_UnitFrameParent, "MAINTANK", styleName, styleName, "SVUI_UNITTARGET", token, nil, UpdateTankFrame) + else + oUF_Villain:RegisterStyle(styleName, AssistPrototype) + oUF_Villain:SetActiveStyle(styleName) + groupHeader = SetGroupHeader(SVUI_UnitFrameParent, "MAINASSIST", styleName, styleName, "SVUI_UNITTARGET", token, nil, UpdateAssistFrame) + end + + groupHeader:Show() + self.Headers[token] = groupHeader + else + groupHeader = self.Headers[token] + end + + groupHeader:Update() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/setup/installer.lua b/Interface/AddOns/SVUI/setup/installer.lua index f6aa752..6566bf7 100644 --- a/Interface/AddOns/SVUI/setup/installer.lua +++ b/Interface/AddOns/SVUI/setup/installer.lua @@ -209,13 +209,13 @@ local function UFMoveTopQuadrant(toggle) anchors.SVUI_LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0350" anchors.SVUI_AltPowerBar_MOVE = "TOPSVUIParentTOP0-40" anchors.LoC_MOVE = "BOTTOMSVUIParentBOTTOM0350" - anchors.BNET_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-250" + anchors.BattleNetToasts_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-250" else anchors.GM_MOVE = "TOPLEFTSVUIParentTOPLEFT344-25" anchors.SVUI_LootFrame_MOVE = "BOTTOMSVUIParentBOTTOM0254" anchors.SVUI_AltPowerBar_MOVE = "TOPSVUIParentTOP0-39" anchors.LoC_MOVE = "BOTTOMSVUIParentBOTTOM0443" - anchors.BNET_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-248" + anchors.BattleNetToasts_MOVE = "TOPRIGHTSVUIParentTOPRIGHT-4-248" end end diff --git a/Interface/AddOns/SVUI/system/configs.lua b/Interface/AddOns/SVUI/system/configs.lua index 5a4848b..a0ca53a 100644 --- a/Interface/AddOns/SVUI/system/configs.lua +++ b/Interface/AddOns/SVUI/system/configs.lua @@ -704,7 +704,6 @@ SV.configs["SVUnit"] = { ["combatFadeRoles"] = true, ["combatFadeNames"] = true, ["debuffHighlighting"] = true, - ["smartRaidFilter"] = true, ["fastClickTarget"] = false, ["healglow"] = true, ["glowtime"] = 0.8, @@ -2240,14 +2239,12 @@ SV.configs["SVUnit"] = { ["visibility"] = "[@raid6, exists][nogroup] hide;show", ["showBy"] = "UP_RIGHT", ["wrapXOffset"] = 9, - ["wrapYOffset"] = 13, - ["groupCount"] = 1, + ["wrapYOffset"] = 13, + ["groupCount"] = 1, ["gRowCol"] = 1, - ["customSorting"] = false, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["invertGroupingOrder"] = false, - ["startFromCenter"] = false, ["showPlayer"] = true, ["predict"] = false, ["colorOverride"] = "USE_DEFAULT", @@ -2412,17 +2409,20 @@ SV.configs["SVUnit"] = { ["style"] = "3D", }, }, + ["raid"] = { + ["enable"] = true, + ["gridAllowed"] = true, + ["visibility"] = "[group:raid] show; hide", + }, ["raid10"] = { - ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, exists][nogroup] hide;show", + ["visibility"] = "[group:raid] show; hide", ["showBy"] = "RIGHT_DOWN", ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 2, + ["wrapYOffset"] = 8, + ["groupCount"] = 2, ["gRowCol"] = 1, - ["customSorting"] = false, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["showPlayer"] = true, @@ -2430,7 +2430,6 @@ SV.configs["SVUnit"] = { ["colorOverride"] = "USE_DEFAULT", ["width"] = 75, ["height"] = 34, - ["gridAllowed"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2563,16 +2562,14 @@ SV.configs["SVUnit"] = { }, }, ["raid25"] = { - ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, exists][nogroup] hide;show", + ["visibility"] = "[group:raid] show; hide", ["showBy"] = "RIGHT_DOWN", ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 5, + ["wrapYOffset"] = 8, + ["groupCount"] = 5, ["gRowCol"] = 1, - ["customSorting"] = false, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["showPlayer"] = true, @@ -2580,7 +2577,6 @@ SV.configs["SVUnit"] = { ["colorOverride"] = "USE_DEFAULT", ["width"] = 50, ["height"] = 30, - ["gridAllowed"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2712,16 +2708,14 @@ SV.configs["SVUnit"] = { }, }, ["raid40"] = { - ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, noexists][nogroup] hide;show", + ["visibility"] = "[group:raid] show; hide", ["showBy"] = "RIGHT_DOWN", ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 8, + ["wrapYOffset"] = 8, + ["groupCount"] = 8, ["gRowCol"] = 1, - ["customSorting"] = false, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["showPlayer"] = true, @@ -2729,7 +2723,6 @@ SV.configs["SVUnit"] = { ["colorOverride"] = "USE_DEFAULT", ["width"] = 50, ["height"] = 30, - ["gridAllowed"] = true, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2868,14 +2861,12 @@ SV.configs["SVUnit"] = { ["visibility"] = "[group:raid] show; hide", ["showBy"] = "DOWN_RIGHT", ["wrapXOffset"] = 3, - ["wrapYOffset"] = 3, - ["groupCount"] = 2, + ["wrapYOffset"] = 3, + ["groupCount"] = 2, ["gRowCol"] = 1, - ["customSorting"] = true, ["sortMethod"] = "PETNAME", ["sortDir"] = "ASC", ["invertGroupingOrder"] = false, - ["startFromCenter"] = false, ["predict"] = false, ["colorOverride"] = "USE_DEFAULT", ["width"] = 80, diff --git a/Interface/AddOns/SVUI/system/mentalo.lua b/Interface/AddOns/SVUI/system/mentalo.lua index 209dba8..1f1e0cf 100644 --- a/Interface/AddOns/SVUI/system/mentalo.lua +++ b/Interface/AddOns/SVUI/system/mentalo.lua @@ -649,14 +649,6 @@ function Mentalo:Add(frame, title, raised, snapOffset, dragStopFunc, movableGrou end self:New(frame, moveName, title, raised, snapOffset, dragStopFunc) - - -- local ghost; - -- for entry,_ in pairs(self.Frames) do - -- ghost = _G[entry] - -- if(ghost) then - -- ghost:SetAlpha(0.5) - -- end - -- end end function Mentalo:Reset(request) diff --git a/Interface/AddOns/SVUI_ChatOMatic/Loader.lua b/Interface/AddOns/SVUI_ChatOMatic/Loader.lua index 152f5cb..7c628df 100644 --- a/Interface/AddOns/SVUI_ChatOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_ChatOMatic/Loader.lua @@ -38,7 +38,7 @@ CONFIG DATA ########################################################## ]]-- PLUGIN.configs = { - ["saveChats"] = true, + ["saveChats"] = false, ["service"] = true, ["autoAnswer"] = false, ["prefix"] = true diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua index 1dbed74..a739d2a 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua @@ -141,7 +141,7 @@ SV.Options.args.SVDock.args["leftDockGroup"] = { local acceptableDocklets = { ["alDamageMeter"] = L["alDamageMeter"], - --["Skada"] = L["Skada"], + ["Skada"] = L["Skada"], ["Recount"] = L["Recount"], ["TinyDPS"] = L["TinyDPS"], ["Omen"] = L["Omen"] @@ -152,14 +152,15 @@ local function GetLiveDockletsA() local t = {["None"] = L["None"]}; for n,l in pairs(acceptableDocklets) do if IsAddOnLoaded(n) or IsAddOnLoaded(l) then - -- if n == "Skada" and _G.Skada then - -- for index,window in pairs(_G.Skada:GetWindows()) do - -- local key = window.db.name - -- t["Skada"..key] = (key=="Skada") and "Skada - Main" or "Skada - "..key; - -- end - -- end if (test ~= n and test ~= l) then - t[n] = l; + if n == "Skada" and _G.Skada then + for index,window in pairs(_G.Skada:GetWindows()) do + local key = window.db.name + t["SkadaBarWindow"..key] = (key == "Skada") and "Skada - Main" or "Skada - "..key; + end + else + t[n] = l; + end end end end @@ -171,14 +172,15 @@ local function GetLiveDockletsB() local t = {["None"] = L["None"]}; for n,l in pairs(acceptableDocklets) do if IsAddOnLoaded(n) or IsAddOnLoaded(l) then - -- if n == "Skada" and _G.Skada then - -- for index,window in pairs(_G.Skada:GetWindows()) do - -- local key = window.db.name - -- t["Skada"..key] = (key=="Skada") and "Skada - Main" or "Skada - "..key; - -- end - -- end if (test ~= n and test ~= l) then - t[n] = l; + if n == "Skada" and _G.Skada then + for index,window in pairs(_G.Skada:GetWindows()) do + local key = window.db.name + t["SkadaBarWindow"..key] = (key == "Skada") and "Skada - Main" or "Skada - "..key; + end + else + t[n] = l; + end end end end diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua index ca47fef..437b795 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua @@ -49,7 +49,7 @@ SV.Options.args.SVUnit.args.grid = { order = 1, type = "execute", name = L["Display Frames"], - func = function()MOD:UpdateGroupConfig(_G["SVUI_Raid40"], _G["SVUI_Raid40"].forceShow ~= true or nil)end, + func = function()MOD:UpdateGroupConfig(_G["SVUI_Raid"], _G["SVUI_Raid"].forceShow ~= true or nil, "raid40")end, }, gridCommon = { order = 2, @@ -112,7 +112,7 @@ SV.Options.args.SVUnit.args.grid = { name = L['Party Grid'], desc = L['If grid-mode is enabled, these units will be changed.'], get = function(key) return SV.db.SVUnit.party.gridAllowed end, - set = function(key, value) SV.db.SVUnit.party.gridAllowed = value; MOD:SetGroupFrame("party") end, + set = function(key, value) SV.db.SVUnit.party.gridAllowed = value; MOD:SetPartyGroup() end, }, partypets = { type = 'toggle', @@ -120,7 +120,7 @@ SV.Options.args.SVUnit.args.grid = { name = L['Party Pets Grid'], desc = L['If grid-mode is enabled, these units will be changed.'], get = function(key) return SV.db.SVUnit.party.petsGroup.gridAllowed end, - set = function(key, value) SV.db.SVUnit.party.petsGroup.gridAllowed = value; MOD:SetGroupFrame("party") end, + set = function(key, value) SV.db.SVUnit.party.petsGroup.gridAllowed = value; MOD:SetPartyGroup() end, }, partytargets = { type = 'toggle', @@ -128,39 +128,23 @@ SV.Options.args.SVUnit.args.grid = { name = L['Party Targets Grid'], desc = L['If grid-mode is enabled, these units will be changed.'], get = function(key) return SV.db.SVUnit.party.targetsGroup.gridAllowed end, - set = function(key, value) SV.db.SVUnit.party.targetsGroup.gridAllowed = value; MOD:SetGroupFrame("party") end, + set = function(key, value) SV.db.SVUnit.party.targetsGroup.gridAllowed = value; MOD:SetPartyGroup() end, }, - raid10 = { + raid = { type = 'toggle', order = 4, - name = L['Raid 10 Grid'], + name = L['Raid Grid'], desc = L['If grid-mode is enabled, these units will be changed.'], - get = function(key) return SV.db.SVUnit.raid10.gridAllowed end, - set = function(key, value) SV.db.SVUnit.raid10.gridAllowed = value; MOD:SetGroupFrame("raid10") end, - }, - raid25 = { - type = 'toggle', - order = 5, - name = L['Raid 25 Grid'], - desc = L['If grid-mode is enabled, these units will be changed.'], - get = function(key) return SV.db.SVUnit.raid25.gridAllowed end, - set = function(key, value) SV.db.SVUnit.raid25.gridAllowed = value; MOD:SetGroupFrame("raid25") end, - }, - raid40 = { - type = 'toggle', - order = 6, - name = L['Raid 40 Grid'], - desc = L['If grid-mode is enabled, these units will be changed.'], - get = function(key) return SV.db.SVUnit.raid40.gridAllowed end, - set = function(key, value) SV.db.SVUnit.raid40.gridAllowed = value; MOD:SetGroupFrame("raid40") end, + get = function(key) return SV.db.SVUnit.raid.gridAllowed end, + set = function(key, value) SV.db.SVUnit.raid.gridAllowed = value; MOD:SetRaidGroup("raid10"); MOD:SetRaidGroup("raid25"); MOD:SetRaidGroup("raid40") end, }, raidpet = { type = 'toggle', - order = 4, + order = 5, name = L['Raid Pet Grid'], desc = L['If grid-mode is enabled, these units will be changed.'], get = function(key) return SV.db.SVUnit.raidpet.gridAllowed end, - set = function(key, value) SV.db.SVUnit.raidpet.gridAllowed = value; MOD:SetGroupFrame("raidpet") end, + set = function(key, value) SV.db.SVUnit.raidpet.gridAllowed = value; MOD:SetRaidPetGroup() end, }, } }, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua index b0e76cb..8a6b9c6 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua @@ -285,7 +285,7 @@ SV.Options.args.SVUnit.args.tank = { order = 1200, childGroups = "tab", get = function(l)return SV.db.SVUnit["tank"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank");MOD:SetGroupFrame("tank")end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank");MOD:SetTankAssistFrame("tank")end, args = { enable = {type = "toggle", order = 1, name = L["Enable"]}, resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("tank")end}, @@ -310,7 +310,7 @@ SV.Options.args.SVUnit.args.tank = { name = L["Tank Target"], guiInline = true, get = function(l)return SV.db.SVUnit["tank"]["targetsGroup"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank", "targetsGroup");MOD:SetGroupFrame("tank")end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank", "targetsGroup");MOD:SetTankAssistFrame("tank")end, args = { enable = {type = "toggle", name = L["Enable"], order = 1}, width = {order = 2, name = L["Width"], type = "range", min = 10, max = 500, step = 1}, @@ -335,7 +335,7 @@ SV.Options.args.SVUnit.args.assist = { order = 1300, childGroups = "tab", get = function(l)return SV.db.SVUnit["assist"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist");MOD:SetGroupFrame("assist")end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist");MOD:SetTankAssistFrame("assist")end, args = { enable = {type = "toggle", order = 1, name = L["Enable"]}, resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("assist")end}, @@ -360,7 +360,7 @@ SV.Options.args.SVUnit.args.assist = { name = L["Assist Target"], guiInline = true, get = function(l)return SV.db.SVUnit["assist"]["targetsGroup"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist", "targetsGroup");MOD:SetGroupFrame("assist")end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist", "targetsGroup");MOD:SetTankAssistFrame("assist")end, args = { enable = {type = "toggle", name = L["Enable"], order = 1}, width = {order = 2, name = L["Width"], type = "range", min = 10, max = 500, step = 1}, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua index 66b399f..9b99e0d 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua @@ -42,7 +42,7 @@ SV.Options.args.SVUnit.args.party = { childGroups = "tab", get = function(l)return SV.db.SVUnit['party'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetPartyGroup('party')end, args = { enable = { type = 'toggle', @@ -74,13 +74,21 @@ SV.Options.args.SVUnit.args.party = { type = 'group', name = L['General'], args = { + showPlayer = { + order = 1, + type = 'toggle', + name = L['Display Player'], + desc = L['When true, always show player in party frames'], + get = function(l)return SV.db.SVUnit.party.showPlayer end, + set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetPartyGroup("party", true) end, + }, hideonnpc = { type = 'toggle', order = 2, name = L['Text Toggle On NPC'], desc = L['Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point.'], get = function(l)return SV.db.SVUnit['party']['power'].hideonnpc end, - set = function(l, m)SV.db.SVUnit['party']['power'].hideonnpc = m;MOD:SetGroupFrame('party')end, + set = function(l, m)SV.db.SVUnit['party']['power'].hideonnpc = m;MOD:SetPartyGroup('party')end, }, rangeCheck = { order = 3, @@ -121,7 +129,7 @@ SV.Options.args.SVUnit.args.party = { name = L['Size and Positions'], type = 'group', guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetPartyGroup('party', true)end, args = { width = { order = 1, @@ -130,7 +138,7 @@ SV.Options.args.SVUnit.args.party = { min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetPartyGroup('party')end, }, height = { order = 2, @@ -139,7 +147,7 @@ SV.Options.args.SVUnit.args.party = { min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetPartyGroup('party')end, }, spacer = { order = 3, @@ -163,40 +171,8 @@ SV.Options.args.SVUnit.args.party = { LEFT_UP = format(L['%s and then %s'], L['Left'], L['Up']), }, }, - groupCount = { - order = 5, - type = 'range', - name = L['Number of Groups'], - min = 1, - max = 8, - step = 1, - set = function(l, m) - MOD:ChangeDBVar(m, l[#l], "party"); - MOD:SetGroupFrame('party') - if SVUI_Party.isForced then - MOD:UpdateGroupConfig(SVUI_Party) - MOD:UpdateGroupConfig(SVUI_Party, true) - end - end, - }, - gRowCol = { - order = 6, - type = 'range', - name = L['Groups Per Row/Column'], - min = 1, - max = 8, - step = 1, - set = function(l, m) - MOD:ChangeDBVar(m, l[#l], "party"); - MOD:SetGroupFrame('party') - if SVUI_Party.isForced then - MOD:UpdateGroupConfig(SVUI_Party) - MOD:UpdateGroupConfig(SVUI_Party, true) - end - end, - }, wrapXOffset = { - order = 7, + order = 5, type = 'range', name = L['Horizontal Spacing'], min = 0, @@ -204,7 +180,7 @@ SV.Options.args.SVUnit.args.party = { step = 1, }, wrapYOffset = { - order = 8, + order = 6, type = 'range', name = L['Vertical Spacing'], min = 0, @@ -213,35 +189,12 @@ SV.Options.args.SVUnit.args.party = { }, }, }, - visibilityGroup = { - order = 200, - name = L['Visibility'], - type = 'group', - guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end, - args = { - showPlayer = { - order = 1, - type = 'toggle', - name = L['Display Player'], - desc = L['When true, the header includes the player when not in a raid.'], - }, - visibility = { - order = 2, - type = 'input', - name = L['Visibility'], - desc = L['The following macro must be true in order for the group to be shown, in addition to any filter that may already be set.'], - width = 'full', - desc = L['TEXT_FORMAT_DESC'], - }, - }, - }, sortingGroup = { order = 300, type = 'group', guiInline = true, name = L['Grouping & Sorting'], - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetPartyGroup('party', true)end, args = { sortMethod = { order = 1, @@ -274,26 +227,13 @@ SV.Options.args.SVUnit.args.party = { width = 'full', name = ' ', }, - customSorting = { - order = 4, - name = L['Custom Sorting'], - desc = L['Enabling this allows unique sorting.'], - type = 'toggle', - }, invertGroupingOrder = { - order = 5, + order = 4, name = L['Invert Grouping Order'], desc = L['Enabling this inverts the sorting order.'], disabled = function()return not SV.db.SVUnit['party'].customSorting end, type = 'toggle', }, - startFromCenter = { - order = 6, - name = L['Start Near Center'], - desc = L['The initial group will start near the center and grow out.'], - disabled = function()return not SV.db.SVUnit['party'].customSorting end, - type = 'toggle', - }, }, }, @@ -305,7 +245,7 @@ SV.Options.args.SVUnit.args.party = { name = L['Aura Watch'], get = function(l)return SV.db.SVUnit['party']['auraWatch'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "auraWatch");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "auraWatch");MOD:SetPartyGroup('party')end, args = { enable = { type = 'toggle', @@ -330,19 +270,19 @@ SV.Options.args.SVUnit.args.party = { }, }, - misc = ns:SetMiscConfigGroup(true, MOD.SetGroupFrame, 'party'), - health = ns:SetHealthConfigGroup(true, MOD.SetGroupFrame, 'party'), - power = ns:SetPowerConfigGroup(false, MOD.SetGroupFrame, 'party'), - name = ns:SetNameConfigGroup(MOD.SetGroupFrame, 'party'), - portrait = ns:SetPortraitConfigGroup(MOD.SetGroupFrame, 'party'), - buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'party'), - debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'party'), + misc = ns:SetMiscConfigGroup(true, MOD.SetPartyGroup, 'party'), + health = ns:SetHealthConfigGroup(true, MOD.SetPartyGroup, 'party'), + power = ns:SetPowerConfigGroup(false, MOD.SetPartyGroup, 'party'), + name = ns:SetNameConfigGroup(MOD.SetPartyGroup, 'party'), + portrait = ns:SetPortraitConfigGroup(MOD.SetPartyGroup, 'party'), + buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetPartyGroup, 'party'), + debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetPartyGroup, 'party'), petsGroup = { order = 800, type = 'group', name = L['Party Pets'], get = function(l)return SV.db.SVUnit['party']['petsGroup'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "petsGroup");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "petsGroup");MOD:SetPartyGroup('party')end, args = { enable = { type = 'toggle', @@ -413,7 +353,7 @@ SV.Options.args.SVUnit.args.party = { name = L['Party Targets'], get = function(l)return SV.db.SVUnit['party']['targetsGroup'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "targetsGroup");MOD:SetGroupFrame('party')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "targetsGroup");MOD:SetPartyGroup('party')end, args = { enable = { type = 'toggle', @@ -478,7 +418,7 @@ SV.Options.args.SVUnit.args.party = { } }, }, - icons = ns:SetIconConfigGroup(MOD.SetGroupFrame, 'party') + icons = ns:SetIconConfigGroup(MOD.SetPartyGroup, 'party') } } }, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua index dc6ec19..34dcef4 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua @@ -35,34 +35,48 @@ local MOD = SV.SVUnit if(not MOD) then return end local _, ns = ... +local RaidCategories = { + [10] = "Raid (10)", + [25] = "Raid (15,20,25)", + [40] = "Raid (40)", +} + local subOrder = 11; -for w=10,40,15 do +for w=10,40,15 do + local raidToken = ("raid%d"):format(w) + local raidGlobal = ("SVUI_Raid%d"):format(w) subOrder = subOrder + 1 - SV.Options.args.SVUnit.args["raid" .. w] = { - name = L["Raid-" .. w .. " Frames"], + SV.Options.args.SVUnit.args[raidToken] = { + name = RaidCategories[w], type = "group", order = subOrder, childGroups = "tab", - get = function(l) return SV.db.SVUnit["raid" .. w][l[#l]] end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end, + get = function(l) return SV.db.SVUnit[raidToken][l[#l]] end, + set = function(l, m) MOD:ChangeDBVar(m, l[#l], raidToken); MOD:SetRaidGroup(raidToken) end, args = { enable = { type = "toggle", order = 1, - name = L["Enable"], + name = L["Enable"], + get = function(l) return SV.db.SVUnit.raid.enable end, + set = function(l, m) SV.db.SVUnit.raid.enable = m; MOD:SetRaidGroup(raidToken) end, }, configureToggle = { 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() + local setForced = (_G[raidGlobal].forceShow ~= true) or nil; + local token = setForced and raidToken or nil + MOD:UpdateGroupConfig(_G[raidGlobal], setForced, token) + end, }, resetSettings = { type = "execute", order = 3, name = L["Restore Defaults"], - func = function(l, m)MOD:ResetUnitOptions("raid" .. w)SV.Mentalo:Reset("Raid 1-" .. w .. " Frames")end, + func = function(l, m)MOD:ResetUnitOptions(raidToken) SV.Mentalo:Reset("Raid Frames") end, }, tabGroups = { order = 3, @@ -75,40 +89,49 @@ for w=10,40,15 do type = "group", name = L["General Settings"], args = { + showPlayer = + { + order = 1, + type = "toggle", + name = L["Display Player"], + desc = L["When true, always show player in raid frames."], + get = function(l)return SV.db.SVUnit[raidToken].showPlayer end, + set = function(l, m) MOD:ChangeDBVar(m, l[#l], raidToken); MOD:SetRaidGroup(raidToken, true) end, + }, hideonnpc = { type = "toggle", - order = 1, + order = 2, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], - get = function(l)return SV.db.SVUnit["raid" .. w]["power"].hideonnpc end, - set = function(l, m)SV.db.SVUnit["raid" .. w]["power"].hideonnpc = m;MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SV.db.SVUnit[raidToken]["power"].hideonnpc end, + set = function(l, m) SV.db.SVUnit[raidToken]["power"].hideonnpc = m; MOD:SetRaidGroup(raidToken)end, }, rangeCheck = { - order = 2, + order = 3, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle", }, gps = { - order = 3, + order = 4, name = "GPS Tracking", desc = "Show an arrow giving the direction and distance to the frames unit.", type = "toggle", }, predict = { - order = 4, + order = 5, name = L["Heal Prediction"], desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."], type = "toggle", }, threatEnabled = { type = "toggle", - order = 5, + order = 6, name = L["Show Threat"], }, colorOverride = { - order = 6, + order = 7, name = L["Class Color Override"], desc = L["Override the default class color setting."], type = "select", @@ -124,7 +147,7 @@ for w=10,40,15 do name = L["Size and Positions"], type = "group", guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetRaidGroup(raidToken, true)end, args = { width = @@ -135,7 +158,7 @@ for w=10,40,15 do min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetRaidGroup(raidToken)end, }, height = { @@ -145,7 +168,7 @@ for w=10,40,15 do min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetRaidGroup(raidToken)end, }, spacer = { @@ -171,44 +194,27 @@ for w=10,40,15 do LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]), LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"]), }, - }, - groupCount = - { - order = 5, - type = "range", - name = L["Number of Groups"], - min = 1, - max = 8, - step = 1, - set = function(l, m) - MOD:ChangeDBVar(m, l[#l], "raid" .. w); - MOD:SetGroupFrame("raid" .. w) - if _G["SVUI_Raid" .. w].isForced then - MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w]) - MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w], true) - end - end, - }, + }, gRowCol = { - order = 6, + order = 5, type = "range", name = L["Groups Per Row / Column"], min = 1, max = 8, step = 1, set = function(l, m) - MOD:ChangeDBVar(m, l[#l], "raid" .. w); - MOD:SetGroupFrame("raid" .. w) - if _G["SVUI_Raid" .. w].isForced then - MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w]) - MOD:UpdateGroupConfig(_G["SVUI_Raid" .. w], true) + MOD:ChangeDBVar(m, l[#l], raidToken); + MOD:SetRaidGroup(raidToken) + if(_G[raidGlobal] and _G[raidGlobal].isForced) then + MOD:UpdateGroupConfig(_G[raidGlobal]) + MOD:UpdateGroupConfig(_G[raidGlobal], true) end end, }, wrapXOffset = { - order = 7, + order = 6, type = "range", name = L["Horizontal Spacing"], min = 0, @@ -217,7 +223,7 @@ for w=10,40,15 do }, wrapYOffset = { - order = 8, + order = 7, type = "range", name = L["Vertical Spacing"], min = 0, @@ -225,39 +231,13 @@ for w=10,40,15 do step = 1, }, }, - }, - visibilityGroup = { - order = 200, - name = L["Visibility"], - type = "group", - guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end, - args = - { - showPlayer = - { - order = 1, - type = "toggle", - name = L["Display Player"], - desc = L["When true, the header includes the player when not in a raid."], - }, - visibility = - { - order = 2, - type = "input", - name = L["Visibility"], - desc = L["The following macro must be true in order for the group to be shown, in addition to any filter that may already be set."], - width = "full", - desc = L["TEXT_FORMAT_DESC"], - }, - }, - }, + }, sortingGroup = { order = 300, type = "group", guiInline = true, name = L["Sorting"], - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetRaidGroup(raidToken, true)end, args = { sortMethod = @@ -296,40 +276,25 @@ for w=10,40,15 do type = "description", width = "full", name = " ", - }, - customSorting = - { - order = 4, - name = L["Raid-Wide Sorting"], - desc = L["Enabling this allows raid-wide sorting however you will not be able to distinguish between groups."], - type = "toggle", - }, + }, invertGroupingOrder = { - order = 5, + order = 4, name = L["Invert Grouping Order"], desc = L["Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from."], - disabled = function()return not SV.db.SVUnit["raid" .. w].customSorting end, - type = "toggle", - }, - startFromCenter = - { - order = 6, - name = L["Start Near Center"], - desc = L["The initial group will start near the center and grow out."], - disabled = function()return not SV.db.SVUnit["raid" .. w].customSorting end, + disabled = function()return not SV.db.SVUnit[raidToken].customSorting end, type = "toggle", - }, + }, }, } } }, - misc = ns:SetMiscConfigGroup(true, MOD.SetGroupFrame, "raid" .. w), - health = ns:SetHealthConfigGroup(true, MOD.SetGroupFrame, "raid" .. w), - power = ns:SetPowerConfigGroup(false, MOD.SetGroupFrame, "raid" .. w), - name = ns:SetNameConfigGroup(MOD.SetGroupFrame, "raid" .. w), - buffs = ns:SetAuraConfigGroup(true, "buffs", true, MOD.SetGroupFrame, "raid" .. w), - debuffs = ns:SetAuraConfigGroup(true, "debuffs", true, MOD.SetGroupFrame, "raid" .. w), + misc = ns:SetMiscConfigGroup(true, MOD.SetRaidGroup, raidToken), + health = ns:SetHealthConfigGroup(true, MOD.SetRaidGroup, raidToken), + power = ns:SetPowerConfigGroup(false, MOD.SetRaidGroup, raidToken), + name = ns:SetNameConfigGroup(MOD.SetRaidGroup, raidToken), + buffs = ns:SetAuraConfigGroup(true, "buffs", true, MOD.SetRaidGroup, raidToken), + debuffs = ns:SetAuraConfigGroup(true, "debuffs", true, MOD.SetRaidGroup, raidToken), auraWatch = { order = 600, type = "group", @@ -339,8 +304,8 @@ for w=10,40,15 do type = "toggle", name = L["Enable"], order = 1, - get = function(l)return SV.db.SVUnit["raid" .. w].auraWatch.enable end, - set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SV.db.SVUnit[raidToken].auraWatch.enable end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", raidToken, "auraWatch");MOD:SetRaidGroup(raidToken)end, }, size = { type = "range", @@ -350,8 +315,8 @@ for w=10,40,15 do min = 4, max = 15, step = 1, - get = function(l)return SV.db.SVUnit["raid" .. w].auraWatch.size end, - set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SV.db.SVUnit[raidToken].auraWatch.size end, + set = function(l, m)MOD:ChangeDBVar(m, "size", raidToken, "auraWatch");MOD:SetRaidGroup(raidToken)end, }, configureButton = { type = "execute", @@ -367,8 +332,8 @@ for w=10,40,15 do type = "group", name = L["RaidDebuff Indicator"], get = function(l)return - SV.db.SVUnit["raid" .. w]["rdebuffs"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w, "rdebuffs");MOD:SetGroupFrame("raid" .. w)end, + SV.db.SVUnit[raidToken]["rdebuffs"][l[#l]]end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken, "rdebuffs");MOD:SetRaidGroup(raidToken)end, args = { enable = { type = "toggle", @@ -415,7 +380,7 @@ for w=10,40,15 do }, }, }, - icons = ns:SetIconConfigGroup(MOD.SetGroupFrame, "raid" .. w), + icons = ns:SetIconConfigGroup(MOD.SetRaidGroup, raidToken), }, }, }, @@ -423,108 +388,108 @@ for w=10,40,15 do end subOrder = subOrder + 1 -SV.Options.args.SVUnit.args.raidpet ={ +SV.Options.args.SVUnit.args.raidpet = { order = subOrder, type = 'group', name = L['Raid Pet Frames'], childGroups = "tab", get = function(l)return SV.db.SVUnit['raidpet'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end, - args ={ - enable ={ + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet')end, + args = { + enable = { type = 'toggle', order = 1, name = L['Enable'], }, - configureToggle ={ + configureToggle = { order = 2, type = 'execute', name = L['Display Frames'], func = function()MOD:UpdateGroupConfig(SVUI_Raidpet, SVUI_Raidpet.forceShow ~= true or nil)end, }, - resetSettings ={ + resetSettings = { type = 'execute', order = 3, name = L['Restore Defaults'], - func = function(l, m)MOD:ResetUnitOptions('raidpet')SV.Mentalo:Reset('Raid Pet Frames')MOD:SetGroupFrame('raidpet', nil, nil, true)end, + func = function(l, m)MOD:ResetUnitOptions('raidpet')SV.Mentalo:Reset('Raid Pet Frames')MOD:SetRaidPetGroup('raidpet', true)end, }, - tabGroups={ + tabGroups= { order=3, type='group', name=L['Unit Options'], childGroups="tree", - args={ - commonGroup={ + args= { + commonGroup= { order=1, type='group', name=L['General Settings'], - args={ - rangeCheck ={ + args= { + rangeCheck = { order = 3, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle", }, - predict ={ + predict = { order = 4, name = L['Heal Prediction'], desc = L['Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals.'], type = 'toggle', }, - threatEnabled ={ + threatEnabled = { type = 'toggle', order = 5, name = L['Show Threat'], }, - colorOverride ={ + colorOverride = { order = 6, name = L['Class Color Override'], desc = L['Override the default class color setting.'], type = 'select', - values ={ + values = { ['USE_DEFAULT'] = L['Use Default'], ['FORCE_ON'] = L['Force On'], ['FORCE_OFF'] = L['Force Off'], }, }, - positionsGroup ={ + positionsGroup = { order = 100, name = L['Size and Positions'], type = 'group', guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end, - args ={ - width ={ + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet', true)end, + args = { + width = { order = 1, name = L['Width'], type = 'range', min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet')end, }, - height ={ + height = { order = 2, name = L['Height'], type = 'range', min = 10, max = 500, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet')end, }, - spacer ={ + spacer = { order = 3, name = '', type = 'description', width = 'full', }, - showBy ={ + showBy = { order = 4, name = L['Growth Direction'], desc = L['Growth direction from the first unitframe.'], type = 'select', - values ={ + values = { DOWN_RIGHT = format(L['%s and then %s'], L['Down'], L['Right']), DOWN_LEFT = format(L['%s and then %s'], L['Down'], L['Left']), UP_RIGHT = format(L['%s and then %s'], L['Up'], L['Right']), @@ -535,36 +500,26 @@ SV.Options.args.SVUnit.args.raidpet ={ LEFT_UP = format(L['%s and then %s'], L['Left'], L['Up']), }, }, - groupCount ={ - order = 7, - type = 'range', - name = L['Number of Groups'], - min = 1, - max = 8, - step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')if - SVUI_Raidpet.isForced then MOD:UpdateGroupConfig(SVUI_Raidpet)MOD:UpdateGroupConfig(SVUI_Raidpet, true)end end, - }, - gRowCol ={ - order = 8, + gRowCol = { + order = 5, type = 'range', name = L['Groups Per Row/Column'], min = 1, max = 8, step = 1, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')if + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet')if SVUI_Raidpet.isForced then MOD:UpdateGroupConfig(SVUI_Raidpet)MOD:UpdateGroupConfig(SVUI_Raidpet, true)end end, }, - wrapXOffset ={ - order = 9, + wrapXOffset = { + order = 6, type = 'range', name = L['Horizontal Spacing'], min = 0, max = 50, step = 1, }, - wrapYOffset ={ - order = 10, + wrapYOffset = { + order = 7, type = 'range', name = L['Vertical Spacing'], min = 0, @@ -573,14 +528,14 @@ SV.Options.args.SVUnit.args.raidpet ={ }, }, }, - visibilityGroup ={ + visibilityGroup = { order = 200, name = L['Visibility'], type = 'group', guiInline = true, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end, - args ={ - visibility ={ + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet', true)end, + args = { + visibility = { order = 2, type = 'input', name = L['Visibility'], @@ -590,80 +545,67 @@ SV.Options.args.SVUnit.args.raidpet ={ }, }, }, - sortingGroup ={ + sortingGroup = { order = 300, type = 'group', guiInline = true, name = L['Grouping & Sorting'], - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end, - args ={ - sortMethod ={ + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetRaidPetGroup('raidpet', true)end, + args = { + sortMethod = { order = 1, name = L['Group By'], desc = L['Set the order that the group will sort.'], type = 'select', - values ={ + values = { ['NAME'] = L['Owners Name'], ['PETNAME'] = L['Pet Name'], ['GROUP'] = GROUP, }, }, - sortDir ={ + sortDir = { order = 2, name = L['Sort Direction'], desc = L['Defines the sort order of the selected sort method.'], type = 'select', - values ={ + values = { ['ASC'] = L['Ascending'], ['DESC'] = L['Descending'], }, }, - spacer ={ + spacer = { order = 3, type = 'description', width = 'full', name = ' ', }, - customSorting ={ + invertGroupingOrder = { order = 4, - name = L['Raid-Wide Sorting'], - desc = L['Enabling this allows raid-wide sorting however you will not be able to distinguish between groups.'], - type = 'toggle', - }, - invertGroupingOrder ={ - order = 5, name = L['Invert Grouping Order'], desc = L['Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from.'], disabled = function()return not SV.db.SVUnit['raidpet'].customSorting end, type = 'toggle', }, - startFromCenter ={ - order = 6, - name = L['Start Near Center'], - desc = L['The initial group will start near the center and grow out.'], - disabled = function()return not SV.db.SVUnit['raidpet'].customSorting end, - type = 'toggle', - }, }, } } }, - misc = ns:SetMiscConfigGroup(true, MOD.SetGroupFrame, 'raidpet'), - health = ns:SetHealthConfigGroup(true, MOD.SetGroupFrame, 'raidpet'), - name = ns:SetNameConfigGroup(MOD.SetGroupFrame, 'raidpet'), - buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'raidpet'), - debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'raidpet'), - auraWatch ={ + misc = ns:SetMiscConfigGroup(true, MOD.SetRaidPetGroup, 'raidpet'), + health = ns:SetHealthConfigGroup(true, MOD.SetRaidPetGroup, 'raidpet'), + name = ns:SetNameConfigGroup(MOD.SetRaidPetGroup, 'raidpet'), + buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetRaidPetGroup, 'raidpet'), + debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetRaidPetGroup, 'raidpet'), + auraWatch = { order = 600, type = 'group', name = L['Aura Watch'], - args ={ + args = { enable = { type = "toggle", name = L["Enable"], order = 1, get = function(l)return SV.db.SVUnit["raidpet"].auraWatch.enable end, - set = function(l, m)MOD:ChangeDBVar(m, "enable", "raidpet", "auraWatch");MOD:SetGroupFrame("raidpet")end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", "raidpet", "auraWatch");MOD:SetRaidPetGroup('raidpet')end, }, size = { type = "range", @@ -674,9 +616,9 @@ SV.Options.args.SVUnit.args.raidpet ={ max = 15, step = 1, get = function(l)return SV.db.SVUnit["raidpet"].auraWatch.size end, - set = function(l, m)MOD:ChangeDBVar(m, "size", "raidpet", "auraWatch");MOD:SetGroupFrame("raidpet")end, + set = function(l, m)MOD:ChangeDBVar(m, "size", "raidpet", "auraWatch");MOD:SetRaidPetGroup('raidpet')end, }, - configureButton ={ + configureButton = { type = 'execute', name = L['Configure Auras'], func = function()ns:SetToFilterConfig('BuffWatch')end, @@ -684,20 +626,20 @@ SV.Options.args.SVUnit.args.raidpet ={ }, }, }, - rdebuffs ={ + rdebuffs = { order = 700, type = 'group', name = L['RaidDebuff Indicator'], get = function(l)return SV.db.SVUnit['raidpet']['rdebuffs'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet", "rdebuffs");MOD:SetGroupFrame('raidpet')end, - args ={ - enable ={ + set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raidpet", "rdebuffs"); MOD:SetRaidPetGroup('raidpet')end, + args = { + enable = { type = 'toggle', name = L['Enable'], order = 1, }, - size ={ + size = { type = 'range', name = L['Size'], order = 2, @@ -705,7 +647,7 @@ SV.Options.args.SVUnit.args.raidpet ={ max = 35, step = 1, }, - xOffset ={ + xOffset = { order = 3, type = 'range', name = L['xOffset'], @@ -713,7 +655,7 @@ SV.Options.args.SVUnit.args.raidpet ={ max = 300, step = 1, }, - yOffset ={ + yOffset = { order = 4, type = 'range', name = L['yOffset'], @@ -721,7 +663,7 @@ SV.Options.args.SVUnit.args.raidpet ={ max = 300, step = 1, }, - configureButton ={ + configureButton = { type = 'execute', name = L['Configure Auras'], func = function()ns:SetToFilterConfig('Raid')end, @@ -729,7 +671,7 @@ SV.Options.args.SVUnit.args.raidpet ={ }, }, }, - icons = ns:SetIconConfigGroup(MOD.SetGroupFrame, 'raidpet'), + icons = ns:SetIconConfigGroup(MOD.SetRaidPetGroup, 'raidpet'), }, }, }, diff --git a/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua b/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua index 61ad8ba..3affcd0 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua @@ -160,7 +160,7 @@ local ModeCapture_EventHandler = function(self, event, ...) if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") PLUGIN:ChangeModeGear() - self:GetScript("PostClick")() + ModeCapture_PostClickHandler(self) end if event == "PLAYER_ENTERING_WORLD" then if (IsSpellKnown(131474) or IsSpellKnown(80451) or IsSpellKnown(818)) then diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index 1f12f79..b056b7f 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -275,12 +275,12 @@ local RegisterAddonDocklets = function() if find(alternate, "Skada") and EXTRA.FrameName ~= "SkadaHolder2" then tipRight = "and Skada"; SV:RegisterExtraDocklet("SkadaHolder2") - --PLUGIN.DockedParent["Skada"] = EXTRA + PLUGIN.DockedParent["Skada"] = EXTRA end if find(main, "Skada") and MAIN.FrameName ~= "SkadaHolder" then tipLeft = "Skada"; SV:RegisterMainDocklet("SkadaHolder") - --PLUGIN.DockedParent["Skada"] = MAIN + PLUGIN.DockedParent["Skada"] = MAIN end end end diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua index b0342b3..beb1acb 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua @@ -34,6 +34,7 @@ local PLUGIN = select(2, ...); local Schema = PLUGIN.Schema; local activePanels = {}; local SkadaHolder, SkadaHolder2 +local StupidSkada = function() return end --[[ ########################################################## SKADA @@ -51,40 +52,38 @@ local function CheckForHolders() end local function skada_panel_loader(holder, window) - if not window then return end + if(not window) then return end local bars = Skada.displays['bar'] - if(not bars or (bars and not bars.ApplySettings)) then return end - + if(not bars) then return end + bars.ApplySettings = StupidSkada local width,height = holder:GetSize() window.db.barspacing = 1; window.db.barwidth = width - 4; window.db.background.height = height - (window.db.enabletitle and window.db.title.height or 0) - 1; - window.db.spark=false; + window.db.spark = false; window.db.barslocked = true; window.bargroup:ClearAllPoints() - window.bargroup:SetPoint('BOTTOMLEFT', holder, 'BOTTOMLEFT', 0, 0) - window.bargroup:SetParent(UIParent) + window.bargroup:SetParent(holder) + window.bargroup:SetAllPoints(holder) window.bargroup:SetFrameStrata('LOW') + --bars:ApplySettings(window) local bgroup = window.bargroup.backdrop; if bgroup then bgroup:Show() - bgroup:SetFixedPanelTemplate('Transparent',true) + bgroup:SetFixedPanelTemplate('Transparent', true) end - - bars:ApplySettings(window) - window.bargroup:SetParent(holder) end function PLUGIN:Docklet_Skada() if not Skada then return end CheckForHolders() for index,window in pairs(Skada:GetWindows()) do - local wname = window.db.name or "" - local key = "Skada" .. wname + local wname = window.db.name or "Skada" + local key = "SkadaBarWindow" .. wname if(SVUI.db.SVDock.docklets.DockletMain == key)then skada_panel_loader(SkadaHolder, window) elseif(SVUI.db.SVDock.docklets.enableExtra and SVUI.db.SVDock.docklets.DockletExtra == key) then diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua index 85522e6..e8ffd69 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua @@ -28,6 +28,7 @@ local SV = _G.SVUI; local L = SV.L; local PLUGIN = select(2, ...); local Schema = PLUGIN.Schema; +local BAGS = SV.SVBag --[[ ########################################################## HELPERS @@ -115,8 +116,108 @@ local function GCTabHelper(tab) tab.bg3:SetDrawLayer("BACKGROUND",2) tab.bg3:SetTexture(0,0,0,1) tab.bg3:SetAllPoints(tab.Panel) +end + +local function Tab_OnEnter(this) + this.backdrop:SetBackdropColor(0.1, 0.8, 0.8) + this.backdrop:SetBackdropBorderColor(0.1, 0.8, 0.8) +end + +local function Tab_OnLeave(this) + this.backdrop:SetBackdropColor(0,0,0,1) + this.backdrop:SetBackdropBorderColor(0,0,0,1) +end + +local function ChangeTabHelper(this) + this:RemoveTextures() + local nTex = this:GetNormalTexture() + if(nTex) then + nTex:SetTexCoord(0.1, 0.9, 0.1, 0.9) + nTex:FillInner() + end + + this.pushed = true; + + this.backdrop = CreateFrame("Frame", nil, this) + this.backdrop:WrapOuter(this,1,1) + this.backdrop:SetFrameLevel(0) + this.backdrop:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = 3, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }); + this.backdrop:SetBackdropColor(0,0,0,1) + this.backdrop:SetBackdropBorderColor(0,0,0,1) + this:SetScript("OnEnter", Tab_OnEnter) + this:SetScript("OnLeave", Tab_OnLeave) + + local a,b,c,d,e = this:GetPoint() + this:Point(a,b,c,1,e) end +local function StyleSortingButton(button) + if button.styled then return end + + local outer = button:CreateTexture(nil, "OVERLAY") + outer:WrapOuter(button, 6, 6) + outer:SetTexture([[Interface\Addons\SVUI\assets\artwork\Template\ROUND]]) + outer:SetGradient("VERTICAL", 0.4, 0.47, 0.5, 0.3, 0.33, 0.35) + + if button.SetNormalTexture then + iconTex = button:GetNormalTexture() + iconTex:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + end + + local icon = button:CreateTexture(nil, "OVERLAY") + icon:WrapOuter(button, 6, 6) + SetPortraitToTexture(icon, iconTex) + hooksecurefunc(icon, "SetTexture", SetPortraitToTexture) + + local hover = button:CreateTexture(nil, "HIGHLIGHT") + hover:WrapOuter(button, 6, 6) + hover:SetTexture([[Interface\Addons\SVUI\assets\artwork\Template\ROUND]]) + hover:SetGradient(unpack(SV.Media.gradient.yellow)) + + if button.SetPushedTexture then + local pushed = button:CreateTexture(nil, "BORDER") + pushed:WrapOuter(button, 6, 6) + pushed:SetTexture([[Interface\Addons\SVUI\assets\artwork\Template\ROUND]]) + pushed:SetGradient(unpack(SV.Media.gradient.highlight)) + button:SetPushedTexture(pushed) + end + + if button.SetCheckedTexture then + local checked = button:CreateTexture(nil, "BORDER") + checked:WrapOuter(button, 6, 6) + checked:SetTexture([[Interface\Addons\SVUI\assets\artwork\Template\ROUND]]) + checked:SetGradient(unpack(SV.Media.gradient.green)) + button:SetCheckedTexture(checked) + end + + if button.SetDisabledTexture then + local disabled = button:CreateTexture(nil, "BORDER") + disabled:WrapOuter(button, 6, 6) + disabled:SetTexture([[Interface\Addons\SVUI\assets\artwork\Template\ROUND]]) + disabled:SetGradient(unpack(SV.Media.gradient.default)) + button:SetDisabledTexture(disabled) + end + + local cd = button:GetName() and _G[button:GetName().."Cooldown"] + if cd then + cd:ClearAllPoints() + cd:FillInner() + end + button.styled = true +end + local _hook_RankOrder_OnUpdate = function() for i = 1, GuildControlGetNumRanks()do local frame = _G["GuildControlUIRankOrderFrameRank"..i] @@ -276,6 +377,17 @@ local function GuildBankStyle() GuildBankFrameWithdrawButton:SetButtonTemplate() GuildBankInfoSaveButton:SetButtonTemplate() GuildBankFramePurchaseButton:SetButtonTemplate() + + + local sortButton = CreateFrame("Button", nil, GuildBankFrame) + sortButton:Point("BOTTOMLEFT", GuildBankFrame, "BOTTOMRIGHT", 2, 0) + sortButton:Size(36, 36) + sortButton:SetFramedButtonTemplate() + sortButton:SetNormalTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\BAGS-CLEANUP]]) + --StyleSortingButton(sortButton) + local Sort_OnClick = BAGS:RunSortingProcess(BAGS.Sort, "guild") + sortButton:SetScript("OnClick", Sort_OnClick) + GuildBankFrameWithdrawButton:Point("RIGHT", GuildBankFrameDepositButton, "LEFT", -2, 0) GuildBankInfoScrollFrame:Point('TOPLEFT', GuildBankInfo, 'TOPLEFT', -10, 12) GuildBankInfoScrollFrame:RemoveTextures() @@ -295,8 +407,8 @@ local function GuildBankStyle() if texture then texture:SetTexture(0,0,0,0) end - - button:SetSlotTemplate() + button:RemoveTextures() + button:SetSlotTemplate(true, 2, 0, 0) local icon = _G[btnName.."IconTexture"] if(icon) then @@ -312,14 +424,12 @@ local function GuildBankStyle() local baseName = ("GuildBankTab%d"):format(i) local tab = _G[baseName] if(tab) then + tab:RemoveTextures(true) local btnName = ("%sButton"):format(baseName) - local button = _G[baseName] + local button = _G[btnName] if(button) then - tab:RemoveTextures(true) button:RemoveTextures() button:SetButtonTemplate() - button:SetFixedPanelTemplate("Default") - local texture = _G[btnName.."IconTexture"] if(texture) then texture:FillInner()