diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua index 1524896..370016e 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua @@ -343,28 +343,28 @@ local function SetFlyoutButton(button) if button:GetParent() and button:GetParent():GetParent() and button:GetParent():GetParent():GetName() and button:GetParent():GetParent():GetName() == "SpellBookSpellIconsFrame" then return end; if button:GetParent() then local point = Pinpoint(button:GetParent()) - if strfind(point, "RIGHT") then + if point:find("RIGHT") then button.FlyoutArrow:ClearAllPoints() button.FlyoutArrow:SetPoint("LEFT", button, "LEFT", -offset, 0) SetClampedTextureRotation(button.FlyoutArrow, 270) if not LOCKDOWN then button:SetAttribute("flyoutDirection", "LEFT") end - elseif strfind(point, "LEFT") then + elseif point:find("LEFT") then button.FlyoutArrow:ClearAllPoints() button.FlyoutArrow:SetPoint("RIGHT", button, "RIGHT", offset, 0) SetClampedTextureRotation(button.FlyoutArrow, 90) if not LOCKDOWN then button:SetAttribute("flyoutDirection", "RIGHT") end - elseif strfind(point, "TOP") then + elseif point:find("TOP") then button.FlyoutArrow:ClearAllPoints() button.FlyoutArrow:SetPoint("BOTTOM", button, "BOTTOM", 0, -offset) SetClampedTextureRotation(button.FlyoutArrow, 180) if not LOCKDOWN then button:SetAttribute("flyoutDirection", "DOWN") end - elseif point == "CENTER" or strfind(point, "BOTTOM") then + elseif point == "CENTER" or point:find("BOTTOM") then button.FlyoutArrow:ClearAllPoints() button.FlyoutArrow:SetPoint("TOP", button, "TOP", 0, offset) SetClampedTextureRotation(button.FlyoutArrow, 0) diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index ff95bd1..3cf92cf 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -49,16 +49,6 @@ MODULE DATA ########################################################## ]]-- local LoadedBasicFrames, LoadedGroupFrames, LoadedExtraFrames; -local BasicFrames, GroupFrames, ExtraFrames = {},{},{} -local CURRENT_BAR_TEXTURE = [[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]; -local CURRENT_AURABAR_TEXTURE = [[Interface\AddOns\SVUI\assets\artwork\Bars\GLOWING]]; -local CURRENT_FONT = [[Interface\AddOns\SVUI\assets\fonts\Names.ttf]]; -local CURRENT_FONTSIZE = 10; -local CURRENT_FONTOUTLINE = "OUTLINE"; -local CURRENT_AURABAR_FONT = [[Interface\AddOns\SVUI\assets\fonts\Alert.ttf]]; -local CURRENT_AURABAR_FONTSIZE = 14 -local CURRENT_AURABAR_FONTOUTLINE = "NONE" -local INIT_UPDATE = false; --[[ ########################################################## LOCAL FUNCTIONS @@ -68,7 +58,7 @@ local dummy = CreateFrame("Frame") dummy:Hide() local KillBlizzardUnit = function(unit) local frame; - if type(unit)=='string' then frame=_G[unit] else frame=unit end + if type(unit) == "string" then frame = _G[unit] else frame = unit end if frame then frame:UnregisterAllEvents() frame:Hide() @@ -83,23 +73,13 @@ local KillBlizzardUnit = function(unit) if p then p:UnregisterAllEvents()end end end - -local function UpdateUnitMediaLocals() - CURRENT_BAR_TEXTURE = LSM:Fetch("statusbar", MOD.db.statusbar) - CURRENT_AURABAR_TEXTURE = LSM:Fetch("statusbar", MOD.db.auraBarStatusbar); - CURRENT_FONT = LSM:Fetch("font", MOD.db.font) - CURRENT_FONTSIZE = MOD.db.fontSize - CURRENT_FONTOUTLINE = MOD.db.fontOutline - CURRENT_AURABAR_FONT = LSM:Fetch("font", MOD.db.auraFont); - CURRENT_AURABAR_FONTSIZE = MOD.db.auraFontSize - CURRENT_AURABAR_FONTOUTLINE = MOD.db.auraFontOutline - INIT_UPDATE = true -end --[[ ########################################################## INNER CLASSES ########################################################## ]]-- +MOD.Units = {} +MOD.Headers = {} MOD.Construct = {} MOD.FrameUpdate = {} MOD.HeaderUpdate = {} @@ -131,8 +111,8 @@ function oUF_SuperVillain:DisableBlizzard(unit) KillBlizzardUnit(TargetofFocusFrame) elseif(unit == "targettarget") then KillBlizzardUnit(TargetFrameToT) - elseif(unit:match"(boss)%d?$" == "boss") then - local id = unit:match"boss(%d)" + elseif(unit:match("(boss)%d?$") == "boss") then + local id = unit:match("boss(%d)") if(id) then KillBlizzardUnit("Boss"..id.."TargetFrame") else @@ -140,8 +120,8 @@ function oUF_SuperVillain:DisableBlizzard(unit) KillBlizzardUnit(("Boss%dTargetFrame"):format(i)) end end - elseif(unit:match"(party)%d?$" == "party") then - local id = unit:match"party(%d)" + elseif(unit:match("(party)%d?$") == "party") then + local id = unit:match("party(%d)") if(id) then KillBlizzardUnit("PartyMemberFrame"..id) else @@ -149,8 +129,8 @@ function oUF_SuperVillain:DisableBlizzard(unit) KillBlizzardUnit(("PartyMemberFrame%d"):format(i)) end end - elseif(unit:match"(arena)%d?$" == "arena") then - local id = unit:match"arena(%d)" + elseif(unit:match("(arena)%d?$") == "arena") then + local id = unit:match("arena(%d)") if(id) then KillBlizzardUnit("ArenaEnemyFrame"..id) KillBlizzardUnit("ArenaPrepFrame"..id) @@ -165,75 +145,6 @@ function oUF_SuperVillain:DisableBlizzard(unit) end end -function MOD:RefreshUnitColors() - local db = SuperVillain.db.media.unitframes - for i, setting in pairs(db) do - if setting and type(setting) == "table" then - if(setting[1]) then - oUF_SuperVillain.colors[i] = setting - else - local bt = {} - for x, color in pairs(setting) do - if(color)then - bt[x] = color - end - oUF_SuperVillain.colors[i] = bt - end - end - elseif setting then - oUF_SuperVillain.colors[i] = setting - end - end - local r, g, b = db.health[1], db.health[2], db.health[3] - oUF_SuperVillain.colors.smooth = {1, 0, 0, 1, 1, 0, r, g, b} -end - -function MOD:RefreshUnitMedia(frame, updateUpvalues) - if(not frame or not self.db or (self.db and self.db.enable ~= true)) then return end - if((not INIT_UPDATE) or updateUpvalues == true) then UpdateUnitMediaLocals() end - local db = self.db - local unitDB = frame.db - if(unitDB and unitDB.enable) then - local panel = frame.InfoPanel - if(panel) then - if(panel.Name and unitDB.name) then - panel.Name:SetFont(LSM:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) - end - if(panel.Health) then - panel.Health:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) - end - if(panel.Power) then - panel.Power:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) - end - if(panel.Misc) then - panel.Misc:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) - end - end - if(frame.Power and (unitDB.power and unitDB.power.enable)) then - frame.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) - end - if(frame.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then - local ab = frame.AuraBars - ab.auraBarTexture = CURRENT_AURABAR_TEXTURE - ab.textFont = CURRENT_AURABAR_FONT - ab.textSize = CURRENT_AURABAR_FONTSIZE - ab.textOutline = CURRENT_AURABAR_FONTOUTLINE - end - if(frame.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then - local buffs = frame.Buffs - buffs.textFont = CURRENT_AURABAR_FONT - buffs.textSize = CURRENT_AURABAR_FONTSIZE - buffs.textOutline = CURRENT_AURABAR_FONTOUTLINE - end - if(frame.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then - local debuffs = frame.Debuffs - debuffs.textFont = CURRENT_AURABAR_FONT - debuffs.textSize = CURRENT_AURABAR_FONTSIZE - debuffs.textOutline = CURRENT_AURABAR_FONTOUTLINE - end - end -end - function MOD:DetachSubFrames(...) for i = 1, select("#", ...) do local frame = select(i,...) @@ -287,7 +198,7 @@ function MOD:RestrictChildren(parentFrame, ...) for i=1,select("#",...) do local childFrame = select(i,...) - childFrame:RegisterForClicks(self.db.fastClickTarget and 'AnyDown' or 'AnyUp') + childFrame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') childFrame.TargetGlow:SetAlpha(1) self:RestrictElement(childFrame) end @@ -310,25 +221,111 @@ function MOD:ResetUnitOptions(unit) self:RefreshUnitFrames() end -function MOD:RefreshUnitFrames() - if SuperVillain.db['SVUnit'].enable~=true then return end - self:RefreshUnitColors() +function MOD:RefreshUnitColors() + local db = SuperVillain.db.media.unitframes + for i, setting in pairs(db) do + if setting and type(setting) == "table" then + if(setting[1]) then + oUF_SuperVillain.colors[i] = setting + else + local bt = {} + for x, color in pairs(setting) do + if(color)then + bt[x] = color + end + oUF_SuperVillain.colors[i] = bt + end + end + elseif setting then + oUF_SuperVillain.colors[i] = setting + end + end + local r, g, b = db.health[1], db.health[2], db.health[3] + oUF_SuperVillain.colors.smooth = {1, 0, 0, 1, 1, 0, r, g, b} +end - for unit in pairs(BasicFrames)do - if self.db[unit].enable then - self[unit]:Enable() - self[unit]:Update() - else - self[unit]:Disable() +function MOD:RefreshUnitMedia(frame) + local db = self.db + if(not (db and db.enable) or not frame) then return end + local CURRENT_BAR_TEXTURE = LSM:Fetch("statusbar", db.statusbar) + local CURRENT_AURABAR_TEXTURE = LSM:Fetch("statusbar", db.auraBarStatusbar); + local CURRENT_FONT = LSM:Fetch("font", db.font) + local CURRENT_AURABAR_FONT = LSM:Fetch("font", db.auraFont); + local CURRENT_AURABAR_FONTSIZE = db.auraFontSize + local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline + local key = frame.datakey + local unitDB = db[key] + if(unitDB and unitDB.enable) then + local panel = frame.InfoPanel + if(panel) then + if(panel.Name and unitDB.name) then + panel.Name:SetFont(LSM:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) + end + if(panel.Health) then + panel.Health:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + if(panel.Power) then + panel.Power:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + if(panel.Misc) then + panel.Misc:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline) + end + end + if(frame.Power and (unitDB.power and unitDB.power.enable)) then + frame.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) + end + if(frame.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then + local ab = frame.AuraBars + ab.auraBarTexture = CURRENT_AURABAR_TEXTURE + ab.textFont = CURRENT_AURABAR_FONT + ab.textSize = db.auraFontSize + ab.textOutline = db.auraFontOutline + end + if(frame.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then + local buffs = frame.Buffs + buffs.textFont = CURRENT_AURABAR_FONT + buffs.textSize = db.auraFontSize + buffs.textOutline = db.auraFontOutline + end + if(frame.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then + local debuffs = frame.Debuffs + debuffs.textFont = CURRENT_AURABAR_FONT + debuffs.textSize = db.auraFontSize + debuffs.textOutline = db.auraFontOutline + end + end +end + +function MOD:RefreshAllUnitMedia() + if(not self.db or (self.db and self.db.enable ~= true)) then return end + self:RefreshUnitColors() + -- [[ FRAMES ]] -- + for _,frame in pairs(self.Units)do + local key = frame.datakey + if self.db[key].enable then + frame:MediaUpdate() end end + + for _,group in pairs(self.Headers) do + group:MediaUpdate() + end - for unit,group in pairs(ExtraFrames)do - if self.db[group].enable then - self[unit]:Enable() - self[unit]:Update() + collectgarbage("collect") + INIT_UPDATE = false +end + +function MOD:RefreshUnitFrames() + if SuperVillain.db['SVUnit'].enable~=true then return end + self:RefreshUnitColors() + + for unit,frame in pairs(self.Units)do + local key = frame.datakey + if self.db[key].enable then + frame:Enable() + frame:Update() else - self[unit]:Disable() + frame:Disable() end end @@ -343,7 +340,7 @@ function MOD:RefreshUnitFrames() end end - for _,group in pairs(GroupFrames) do + for _,group in pairs(self.Headers) do group:Update() if group.SetConfigEnvironment then group:SetConfigEnvironment() @@ -357,118 +354,28 @@ function MOD:RefreshUnitFrames() collectgarbage("collect") end -function MOD:RefreshAllUnitMedia() - if(not self.db or (self.db and self.db.enable ~= true)) then return end - UpdateUnitMediaLocals() - self:RefreshUnitColors() - -- [[ FRAMES ]] -- - for unit in pairs(BasicFrames)do - if self.db[unit].enable then - self:RefreshUnitMedia(self[unit], false) - end - end - - for unit,group in pairs(ExtraFrames)do - if self.db[group].enable then - self:RefreshUnitMedia(self[unit], false) - end - end - - for group,_ in pairs(GroupFrames) do - MOD:SetGroupFrame(group) - end - - collectgarbage("collect") -end - -do - local SecureHeaderUpdate = function(self) - local unit = self.NameKey; - local db = MOD.db[unit] - MOD.HeaderUpdate[unit](MOD, self, db) - - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - MOD.FrameUpdate[unit](MOD, childFrame, db) - if _G[childFrame:GetName().."Pet"] then - MOD.FrameUpdate[unit](MOD, _G[childFrame:GetName().."Pet"], db) - end - - if _G[childFrame:GetName().."Target"] then - MOD.FrameUpdate[unit](MOD, _G[childFrame:GetName().."Target"], db) - end - - index = index + 1; - childFrame = self:GetAttribute("child"..index) - 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 - - function MOD:SpawnGroupHeader(parentFrame, filter, realName, template1, secureName, template2) - local name = parentFrame.NameKey or secureName; - local db = MOD.db[name] - local frameName = name:gsub("(.)", upper, 1) - oUF_SuperVillain:SetActiveStyle("SVUI_" .. frameName) - local header = oUF_SuperVillain:SpawnHeader(realName, template2, nil, - "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), - "groupFilter", filter, - "showParty", true, - "showRaid", true, - "showSolo", true, - template1 and "template", template1 - ); - header.NameKey = name; - header:SetParent(parentFrame) - header:Show() - header.Update = SecureHeaderUpdate - header.ClearAllAttributes = SecureHeaderClear - return header - end -end - function MOD:SetBasicFrame(unit) assert(unit, "No unit provided to create or update.") - if InCombatLockdown()then self:FrameForge() return end + if InCombatLockdown() then self:FrameForge() return end local realName = unit:gsub("(.)", upper, 1); realName = realName:gsub("t(arget)", "T%1"); - if not self[unit] then - self[unit] = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) - BasicFrames[unit] = unit + if not self.Units[unit] then + self.Units[unit] = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) end - self[unit].Update = function() - self.FrameUpdate[unit](MOD, unit, MOD[unit], MOD.db[unit]) + self.Units[unit].Update = function() + self.FrameUpdate[unit](MOD, unit, MOD.Units[unit], MOD.db[unit]) end - if self[unit]:GetParent() ~= SVUI_UnitFrameParent then - self[unit]:SetParent(SVUI_UnitFrameParent) + self.Units[unit].MediaUpdate = function() + self:RefreshUnitMedia(MOD.Units[unit]) + end + if self.Units[unit]:GetParent() ~= SVUI_UnitFrameParent then + self.Units[unit]:SetParent(SVUI_UnitFrameParent) end if self.db[unit].enable then - self[unit]:Enable() - self[unit].Update() + self.Units[unit]:Enable() + self.Units[unit].Update() else - self[unit]:Disable() + self.Units[unit]:Disable() end end @@ -479,29 +386,26 @@ function MOD:SetExtraFrame(name, count) local unit = name..i; local realName = unit:gsub("(.)", upper, 1) realName = realName:gsub("t(arget)", "T%1") - if not self[unit]then - ExtraFrames[unit] = name; - self[unit] = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) - self[unit].index = i; - self[unit]:SetParent(SVUI_UnitFrameParent) - self[unit]:SetID(i) + if not self.Units[unit] then + self.Units[unit] = oUF_SuperVillain:Spawn(unit, "SVUI_"..realName) + self.Units[unit].index = i; + self.Units[unit]:SetParent(SVUI_UnitFrameParent) + self.Units[unit]:SetID(i) end - - local secureName = name:gsub("(.)", upper, 1) - secureName = secureName:gsub("t(arget)", "T%1") - self[unit].Update = function() - self.FrameUpdate[name](MOD, unit, MOD[unit], MOD.db[name]) + self.Units[unit].Update = function() + self.FrameUpdate[name](MOD, unit, MOD.Units[unit], MOD.db[name]) + end + self.Units[unit].MediaUpdate = function() + self:RefreshUnitMedia(MOD.Units[unit]) end - if self.db[name].enable then - self[unit]:Enable() - self[unit].Update() - - if self[unit].isForced then - self:AllowElement(self[unit]) + self.Units[unit]:Enable() + self.Units[unit].Update() + if self.Units[unit].isForced then + self:AllowElement(MOD.Units[unit]) end else - self[unit]:Disable() + self.Units[unit]:Disable() end end end @@ -595,15 +499,16 @@ do local function AppendUpdateHandler(unit) return function() + local header = MOD.Headers[unit] local db = MOD.db[unit] if db.enable ~= true then - UnregisterAttributeDriver(MOD[unit], "state-visibility") - MOD[unit]:Hide() + UnregisterAttributeDriver(header, "state-visibility") + header:Hide() return end - MOD.HeaderUpdate[unit](MOD, MOD[unit], db) - for i = 1, MOD[unit]:GetNumChildren()do - local childFrame = select(i, MOD[unit]:GetChildren()) + MOD.HeaderUpdate[unit](MOD, header, db) + for i = 1, header:GetNumChildren()do + local childFrame = select(i, header:GetChildren()) MOD.FrameUpdate[unit](MOD, childFrame, MOD.db[unit]) if _G[childFrame:GetName().."Target"]then MOD.FrameUpdate[unit](MOD, _G[childFrame:GetName().."Target"], MOD.db[unit]) @@ -615,90 +520,170 @@ do end end + local SecureHeaderUpdate = function(self) + local unit = self.NameKey; + local db = MOD.db[unit] + MOD.HeaderUpdate[unit](MOD, self, db) + + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + MOD.FrameUpdate[unit](MOD, childFrame, db) + if _G[childFrame:GetName().."Pet"] then + MOD.FrameUpdate[unit](MOD, _G[childFrame:GetName().."Pet"], db) + end + + if _G[childFrame:GetName().."Target"] then + MOD.FrameUpdate[unit](MOD, _G[childFrame:GetName().."Target"], db) + end + + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end + end + + local SecureHeaderMediaUpdate = function(self) + local unit = self.NameKey; + local db = MOD.db[unit] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + MOD:RefreshUnitMedia(childFrame) + index = index + 1; + childFrame = self:GetAttribute("child"..index) + 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 + + function MOD:SpawnGroupHeader(parentFrame, filter, realName, template1, secureName, template2) + local name = parentFrame.NameKey or secureName; + local db = MOD.db[name] + local frameName = name:gsub("(.)", upper, 1) + oUF_SuperVillain:SetActiveStyle("SVUI_" .. frameName) + local groupUnit = oUF_SuperVillain:SpawnHeader(realName, template2, nil, + "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), + "groupFilter", filter, + "showParty", true, + "showRaid", true, + "showSolo", true, + template1 and "template", template1 + ); + groupUnit.NameKey = name; + groupUnit:SetParent(parentFrame) + groupUnit:Show() + groupUnit.Update = SecureHeaderUpdate + groupUnit.MediaUpdate = SecureHeaderMediaUpdate + groupUnit.ClearAllAttributes = SecureHeaderClear + return groupUnit + end + local GroupSetConfigEnvironment = function(self) - local db = MOD.db[self.NameKey] + local headerName = self.NameKey + local db = MOD.db[headerName] local anchorPoint; - local widthCalc,heightCalc,xCalc,yCalc = 0,0,0,0; + local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; local sorting = db.showBy; local pointMap = _POINTMAP[sorting] - local point1,point2,point3,point4,point5,horizontal,vertical,isHorizontal = pointMap[1],pointMap[2],pointMap[3],pointMap[4],pointMap[5],pointMap[6],pointMap[7],pointMap[8]; - for i=1,db.gCount do + 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.gCount do local frame = self.subunits[i] --<< if frame then dbMapping(frame) if isHorizontal then - frame:SetAttribute("xOffset",db.wrapXOffset * horizontal) - frame:SetAttribute("yOffset",0) - frame:SetAttribute("columnSpacing",db.wrapYOffset) + 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) + 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.rSort and (-min(db.gCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) + frame:SetAttribute("startingIndex", db.rSort and (-min(db.gCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) frame:Show() - frame.initialized=true + frame.initialized = true end - frame:SetAttribute('startingIndex',1) + frame:SetAttribute("startingIndex", 1) end frame:ClearAllPoints() if db.rSort and db.invertGroupingOrder then - frame:SetAttribute("columnAnchorPoint",point4) + frame:SetAttribute("columnAnchorPoint", point4) else - frame:SetAttribute("columnAnchorPoint",point3) + frame:SetAttribute("columnAnchorPoint", point3) end MOD:DetachSubFrames(frame:GetChildren()) - frame:SetAttribute("point",point1) + frame:SetAttribute("point", point1) if not frame.isForced then - frame:SetAttribute("maxColumns",db.rSort and db.gCount or 1) - frame:SetAttribute("unitsPerColumn",db.rSort and (db.gRowCol * 5) or 5) + frame:SetAttribute("maxColumns", db.rSort and db.gCount or 1) + frame:SetAttribute("unitsPerColumn", db.rSort and (db.gRowCol * 5) or 5) _GSORT[db.sortMethod](frame) - frame:SetAttribute('sortDir',db.sortDir) - frame:SetAttribute("showPlayer",db.showPlayer) + frame:SetAttribute("sortDir", db.sortDir) + frame:SetAttribute("showPlayer", db.showPlayer) end - if i==1 and db.rSort then - frame:SetAttribute("groupFilter","1,2,3,4,5,6,7,8") + if i == 1 and db.rSort then + frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8") else - frame:SetAttribute("groupFilter",tostring(i)) + frame:SetAttribute("groupFilter", tostring(i)) end end - local anchorPoint=point2 + local anchorPoint = point2 if db.rSort and db.startFromCenter then - anchorPoint=point5 + anchorPoint = point5 end - if (i - 1) % db.gRowCol==0 then + if (i - 1) % db.gRowCol == 0 then if isHorizontal then if frame then frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) end - heightCalc=heightCalc + db.height + db.wrapYOffset; + heightCalc = heightCalc + db.height + db.wrapYOffset; yCalc = yCalc + 1 else if frame then frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) end - widthCalc=widthCalc + db.width + db.wrapXOffset; + widthCalc = widthCalc + db.width + db.wrapXOffset; xCalc = xCalc + 1 end else if isHorizontal then - if yCalc==1 then + if yCalc == 1 then if frame then frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) end - widthCalc=widthCalc + (db.width + db.wrapXOffset) * 5; + widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5; xCalc = xCalc + 1 elseif frame then frame:SetPoint(anchorPoint, self, anchorPoint, (((db.width + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((db.height + db.wrapYOffset) * (yCalc - 1)) * vertical) end else - if xCalc==1 then + if xCalc == 1 then if frame then frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) end - heightCalc=heightCalc + (db.height + db.wrapYOffset) * 5; + heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5; yCalc = yCalc + 1 elseif frame then frame:SetPoint(anchorPoint, self, anchorPoint, ((db.width + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((db.height + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) @@ -715,110 +700,120 @@ do end local GroupUpdate = function(self) --<< - local unitName = self.NameKey; - MOD[unitName].db = MOD.db[unitName] - if MOD[unitName].db.enable ~= true then - UnregisterAttributeDriver(MOD[unitName], "state-visibility") - MOD[unitName]:Hide() + local headerName = self.NameKey + local header = MOD.Headers[headerName] + if MOD.db[headerName].enable ~= true then + UnregisterAttributeDriver(header, "state-visibility") + header:Hide() return end - for i=1,#self.subunits do - self.subunits[i].db = MOD.db[unitName] + for i=1,#self.subunits do self.subunits[i]:Update() end end + local GroupMediaUpdate = function(self) --<< + for i=1,#self.subunits do + self.subunits[i]:MediaUpdate() + end + end + local GroupSetActiveState = function(self) --<< - if not self.isForced then - for i=1,#self.subunits do - local frame = self.subunits[i] - if i <= self.db.gCount and self.db.rSort and i <= 1 or not self.db.rSort then - frame:Show() - else - if frame.forceShow then - frame:Hide() - MOD:RestrictChildren(frame, frame:GetChildren()) - frame:SetAttribute('startingIndex',1) + if not self.isForced then + local key = self.NameKey + local db = MOD.db[key] + if(db) then + for i=1,#self.subunits do + local frame = self.subunits[i] + if i <= db.gCount and db.rSort and i <= 1 or not db.rSort then + frame:Show() else - frame:ClearAllAttributes() + if frame.forceShow then + frame:Hide() + MOD:RestrictChildren(frame, frame:GetChildren()) + frame:SetAttribute('startingIndex',1) + else + frame:ClearAllAttributes() + end end - end + end end end end - function MOD:SetGroupFrame(group, filter, template1, forceUpdate, template2) - if not self.db[group] then return end - local db = self.db[group] + function MOD:SetGroupFrame(header, filter, template1, forceUpdate, template2) + if not self.db[header] then return end + local db = self.db[header] - if not self[group] then - local realName = group:gsub("(.)", upper, 1) - oUF_SuperVillain:RegisterStyle("SVUI_"..realName, MOD.Construct[group]) + local realName + + if not self.Headers[header] then + realName = header:gsub("(.)", upper, 1) + oUF_SuperVillain:RegisterStyle("SVUI_"..realName, MOD.Construct[header]) oUF_SuperVillain:SetActiveStyle("SVUI_"..realName) if db.gCount then - self[group] = CreateFrame("Frame", "SVUI_"..realName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") - self[group].subunits = {} - self[group].NameKey = group; - self[group].SetConfigEnvironment = GroupSetConfigEnvironment - self[group].Update = GroupUpdate - self[group].SetActiveState = GroupSetActiveState + self.Headers[header] = CreateFrame("Frame", "SVUI_"..realName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + self.Headers[header].subunits = {} + self.Headers[header].NameKey = header; + self.Headers[header].SetConfigEnvironment = GroupSetConfigEnvironment + self.Headers[header].Update = GroupUpdate + self.Headers[header].MediaUpdate = GroupMediaUpdate + self.Headers[header].SetActiveState = GroupSetActiveState else - self[group] = self:SpawnGroupHeader(SVUI_UnitFrameParent, filter, "SVUI_"..realName, template1, group, template2) + self.Headers[header] = self:SpawnGroupHeader(SVUI_UnitFrameParent, filter, "SVUI_"..realName, template1, header, template2) end - - self[group].db = db; - GroupFrames[group] = self[group] - self[group]:Show() + self.Headers[header]:Show() end + local frame = self.Headers[header] + if db.gCount then - local xname = self[group].NameKey + local xname = frame.NameKey realName = xname:gsub("(.)", upper, 1) - if(db.enable ~= true and group ~= "raidpet") then - UnregisterStateDriver(self[group], "visibility") - self[group]:Hide() + if(db.enable ~= true and header ~= "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() return end if db.rSort then - if not self[group].subunits[1] then - self[group].subunits[1] = self:SpawnGroupHeader(self[group], 1, "SVUI_" .. realName .. "Group1", template1, nil, template2) + if not frame.subunits[1] then + frame.subunits[1] = MOD:SpawnGroupHeader(frame, 1, "SVUI_" .. realName .. "Group1", template1, nil, template2) end else - while db.gCount > #self[group].subunits do - local index = tostring(#self[group].subunits + 1) - tinsert(self[group].subunits, self:SpawnGroupHeader(self[group], index, "SVUI_" .. realName .. "Group"..index, template1, nil, template2)) + while db.gCount > #frame.subunits do + local index = tostring(#frame.subunits + 1) + tinsert(frame.subunits, MOD:SpawnGroupHeader(frame, index, "SVUI_" .. realName .. "Group"..index, template1, nil, template2)) end end - if self[group].SetActiveState then - self[group]:SetActiveState() + if frame.SetActiveState then + frame:SetActiveState() end - if forceUpdate or not self[group].Avatar then - self[group]:SetConfigEnvironment() - if not self[group].isForced and not self[group].blockVisibilityChanges then - RegisterStateDriver(self[group], "visibility", db.visibility) + if forceUpdate or not frame.Avatar then + frame:SetConfigEnvironment() + if not frame.isForced and not frame.blockVisibilityChanges then + RegisterStateDriver(frame, "visibility", db.visibility) end else - self[group]:SetConfigEnvironment() - self[group]:Update() + frame:SetConfigEnvironment() + frame:Update() end - if(db.enable ~= true and group == "raidpet") then - UnregisterStateDriver(self[group], "visibility") - self[group]:Hide() + if(db.enable ~= true and header == "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() return end - else - self[group].db = db; - self[group].Update = AppendUpdateHandler(group) + else + frame.Update = AppendUpdateHandler(header) if forceUpdate then - self.HeaderUpdate[xname](self, self[group], db) + self.HeaderUpdate[xname](MOD, frame, db) else - self[group].Update() + frame.Update() end end end @@ -850,14 +845,6 @@ function MOD:FrameForge() self:SetGroupFrame("party", nil, "SVUI_UNITPET, SVUI_UNITTARGET") self:SetGroupFrame("tank", "MAINTANK", "SVUI_UNITTARGET") self:SetGroupFrame("assist", "MAINASSIST", "SVUI_UNITTARGET") - for i, group in pairs(LoadedGroupFrames)do - local filter, template1, template2; - local config = group_settings[i] - if(type(config) == "table") then - filter, template1, template2 = unpack(config) - end - MOD:SetGroupFrame(group, filter, template1, nil, template2) - end LoadedGroupFrames = true end @@ -876,24 +863,17 @@ function MOD:KillBlizzardRaidFrames() end function MOD:PLAYER_REGEN_DISABLED() - for _,frame in pairs(GroupFrames) do - if frame.forceShow then + for _,frame in pairs(self.Headers) do + if frame and frame.forceShow then self:UpdateGroupConfig(frame) end end - for _,unit in pairs(BasicFrames) do - local frame = self[unit] + for _,frame in pairs(self.Units) do if frame and frame.forceShow then self:RestrictElement(frame) end end - - for unit,_ in pairs(ExtraFrames)do - if(self[unit] and self[unit].isForced) then - self:RestrictElement(self[unit]) - end - end end function MOD:ADDON_LOADED(event, addon) @@ -932,13 +912,14 @@ function MOD:ConstructThisPackage() frame:SetScript("OnEnter", UnitFrame_OnEnter) frame:SetScript("OnLeave", UnitFrame_OnLeave) frame:SetFrameLevel(2) - local frameName = ExtraFrames[unit] or unit; + local frameName = unit + if(unit:find("arena")) then frameName = "arena" end + if(unit:find("boss")) then frameName = "boss" end MOD.Construct[frameName](MOD, frame, unit); return frame end) - self:Protect("FrameForge", true); - -- self:SetFadeManager(); + self:Protect("FrameForge", true) self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_REGEN_DISABLED") diff --git a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua b/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua index c2a891c..3e94076 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua @@ -61,14 +61,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.Runes; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/druid.lua b/Interface/AddOns/SVUI/packages/unit/class/druid.lua index 44c2cdb..b7c550a 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/druid.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/druid.lua @@ -95,18 +95,20 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) - local bar = self.EclipseBar; - if not bar or not self.db then print("Error") return end - local height = self.db.classbar.height + local bar = self.EclipseBar + local key = self.datakey + local db = MOD.db[key] + if not bar or not db then print("Error") return end + local height = db.classbar.height local offset = (height - 10) local adjustedBar = (height * 1.5) local adjustedAnim = (height * 1.25) local scaled = (height * 0.8) - local width = self.db.width * 0.4; + local width = db.width * 0.4; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", offset, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) @@ -305,10 +307,12 @@ local HideSmallPoint = function(self) end local RepositionCombo = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.HyperCombo.CPoints; local max = MAX_COMBO_POINTS; - local height = self.db.combobar.height - local isSmall = self.db.combobar.smallIcons + local height = db.combobar.height + local isSmall = db.combobar.smallIcons local size = isSmall and 22 or (height - 4) local width = (size + 4) * max; bar:ClearAllPoints() diff --git a/Interface/AddOns/SVUI/packages/unit/class/mage.lua b/Interface/AddOns/SVUI/packages/unit/class/mage.lua index ace8349..3853f7d 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/mage.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/mage.lua @@ -48,14 +48,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.ArcaneChargeBar; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/monk.lua b/Interface/AddOns/SVUI/packages/unit/class/monk.lua index 9e727e6..cf50de9 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/monk.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/monk.lua @@ -48,14 +48,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.MonkHarmony; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua b/Interface/AddOns/SVUI/packages/unit/class/paladin.lua index c3b391c..ea6aad0 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/paladin.lua @@ -54,14 +54,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.HolyPower; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/priest.lua b/Interface/AddOns/SVUI/packages/unit/class/priest.lua index 190dabf..639cab3 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/priest.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/priest.lua @@ -49,14 +49,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.PriestOrbs; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua b/Interface/AddOns/SVUI/packages/unit/class/rogue.lua index d0cc9d8..ae04b01 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/rogue.lua @@ -67,10 +67,12 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.HyperCombo.CPoints; local max = MAX_COMBO_POINTS; - local height = self.db.combobar.height - local isSmall = self.db.combobar.smallIcons + local height = db.combobar.height + local isSmall = db.combobar.smallIcons local size = isSmall and 22 or (height - 4) local width = (size + 4) * max; bar:ClearAllPoints() @@ -166,15 +168,17 @@ ROGUE COMBO TRACKER ########################################################## ]]-- local RepositionTracker = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.HyperCombo; - if not self.db then return end - local height = self.db.classbar.height + if not db then return end + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * 3; local textwidth = height * 1.25; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua b/Interface/AddOns/SVUI/packages/unit/class/shaman.lua index 23067bb..8eb7861 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/shaman.lua @@ -59,14 +59,16 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.TotemBars; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua b/Interface/AddOns/SVUI/packages/unit/class/warlock.lua index ec65325..453bf50 100644 --- a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua +++ b/Interface/AddOns/SVUI/packages/unit/class/warlock.lua @@ -76,15 +76,17 @@ POSITIONING ########################################################## ]]-- local Reposition = function(self) + local key = self.datakey + local db = MOD.db[key] local bar = self.WarlockShards; local max = self.MaxClassPower; - local height = self.db.classbar.height + local height = db.classbar.height local size = (height - 4) local width = (size + 2) * max; local dbOffset = (height * 0.15) bar:ClearAllPoints() bar:Size(width, height) - if(self.db and self.db.classbar.slideLeft and (not self.db.power.tags or self.db.power.tags == '')) then + if(db and db.classbar.slideLeft and (not db.power.tags or db.power.tags == '')) then bar:Point("TOPLEFT", self.InfoPanel, "TOPLEFT", 0, -2) else bar:Point("TOP", self.InfoPanel, "TOP", 0, -2) diff --git a/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua b/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua index 6374454..e8ad6c7 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/actionpanel.lua @@ -214,6 +214,7 @@ ACTIONPANEL / INFOPANEL ########################################################## ]]-- function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) + frame.datakey = unit if(unit and (unit == "target" or unit == "player")) then frame.ActionPanel = CreateActionPanel(frame, 3) frame.Threat = CreateThreat(frame.ActionPanel, unit) diff --git a/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua b/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua index 3c50390..5a004d6 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/aurabars.lua @@ -87,10 +87,11 @@ local function CheckAuraFilter(setting, helpful) end local function AuraBarFilter(self, unit, name, _, _, _, debuffType, duration, _, unitCaster, isStealable, shouldConsolidate, spellID) - if((not self.db) or (spellID == 65148)) then + local key = self.datakey + if((not MOD.db[key]) or (MOD.db[key] and not MOD.db[key].aurabar) or (spellID == 65148)) then return false; end - local db = self.db.aurabar + local db = MOD.db[key].aurabar local filtered = (unitCaster == "player" or unitCaster == "vehicle") and true or false; local allowed = true; local pass = false; diff --git a/Interface/AddOns/SVUI/packages/unit/common/auras.lua b/Interface/AddOns/SVUI/packages/unit/common/auras.lua index a946b04..35faa04 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/auras.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/auras.lua @@ -36,7 +36,7 @@ local format = string.format; --[[ MATH METHODS ]]-- local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; --[[ TABLE METHODS ]]-- -local tremove, tsort = table.remove, table.sort; +local tremove, tsort, twipe = table.remove, table.sort, table.wipe; --[[ ########################################################## GET ADDON DATA @@ -242,11 +242,17 @@ do end CustomAuraFilter = function(self, unit, icon, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossAura) - if spellID == 65148 then return false end - local isPlayer, friendly; - local db = self:GetParent().db; + local key = self.datakey + if((not MOD.db[key]) or (spellID == 65148)) then + return false; + end + local auraType = self.type; - if not db or not auraType or not db[auraType] then return true end; + + if(not auraType or not MOD.db[key][auraType]) then return true end; + + local isPlayer, friendly; + local db = MOD.db[key][auraType] local filtered = true; local allowed = true; local pass = false; @@ -326,6 +332,7 @@ BUILD FUNCTION ]]-- function MOD:CreateBuffs(frame) local aura = CreateFrame("Frame", nil, frame) + aura.datakey = frame.datakey aura.spacing = 2; aura.PostCreateIcon = PostCreateAuraIcon; aura.PostUpdateIcon = PostUpdateAuraIcon; @@ -340,6 +347,7 @@ end function MOD:CreateDebuffs(frame) local aura = CreateFrame("Frame", nil, frame) + aura.datakey = frame.datakey aura.spacing = 2; aura.PostCreateIcon = PostCreateAuraIcon; aura.PostUpdateIcon = PostUpdateAuraIcon; @@ -354,6 +362,7 @@ end function MOD:CreateAuraWatch(frame) local aWatch = CreateFrame("Frame", nil, frame) + aWatch.datakey = frame.datakey aWatch:SetFrameLevel(frame:GetFrameLevel() + 25) aWatch:FillInner(frame.Health) aWatch.presentAlpha = 1; @@ -364,8 +373,9 @@ function MOD:CreateAuraWatch(frame) end function MOD:SmartAuraDisplay() - local db = self.db; local unit = self.unit; + local key = self.datakey + local db = MOD.db[key]; if not db or not db.smartAuraDisplay or db.smartAuraDisplay == 'DISABLED' or not UnitExists(unit) then return end local buffs = self.Buffs; local debuffs = self.Debuffs; @@ -415,10 +425,12 @@ end UPDATE ########################################################## ]]-- +local temp = {} function MOD:UpdateAuraWatch(frame, override) - local temp = {} local AW = frame.AuraWatch; - local db = frame.db.buffIndicator; + local unit = frame.unit + local key = frame.datakey + local db = MOD.db[key].buffIndicator; if not db then return end if not db.enable then AW:Hide() @@ -428,7 +440,7 @@ function MOD:UpdateAuraWatch(frame, override) end local bwSize = db.size; - if frame.unit == "pet" and not override then + if unit == "pet" and not override then local petBW = SuperVillain.Filters["PetBuffWatch"] or {} for _, buff in pairs(petBW)do if buff.style == "text"then @@ -578,13 +590,14 @@ function MOD:UpdateAuraWatch(frame, override) if frame.AuraWatch.Update then frame.AuraWatch.Update(frame) end - temp = nil + twipe(temp) end -function MOD:UpdateAuraWatchFromHeader(group, override) - assert(self[group], "Invalid group specified.") - for i = 1, self[group]:GetNumChildren() do - local frame = select(i, self[group]:GetChildren()) +function MOD:UpdateAuraWatchFromHeader(header, override) + assert(self.Headers[header], "Invalid group specified.") + local group = self.Headers[header] + for i = 1, group:GetNumChildren() do + local frame = select(i, group:GetChildren()) if frame and frame.Health then MOD:UpdateAuraWatch(frame, override) end end end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua b/Interface/AddOns/SVUI/packages/unit/common/castbar.lua index b866cfe..f6ebcaa 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/castbar.lua @@ -1,16 +1,16 @@ --[[ ############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# ############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # +S U P E R - V I L L A I N - U I By: Munglunch # ############################################################################## ########################################################## LOCALIZED LUA FUNCTIONS @@ -18,21 +18,21 @@ LOCALIZED LUA FUNCTIONS ]]-- --[[ GLOBALS ]]-- local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; --[[ STRING METHODS ]]-- local find, format, len, split = string.find, string.format, string.len, string.split; local match, sub, join = string.match, string.sub, string.join; --[[ MATH METHODS ]]-- -local abs, ceil, floor = math.abs, math.ceil, math.floor; -- Basic -local parsefloat = math.parsefloat; -- Uncommon +local abs, ceil, floor = math.abs, math.ceil, math.floor; -- Basic +local parsefloat = math.parsefloat; -- Uncommon --[[ TABLE METHODS ]]-- local tremove, tcopy, twipe, tsort, tconcat = table.remove, table.copy, table.wipe, table.sort, table.concat; --[[ @@ -90,9 +90,9 @@ local CustomTickData = { [SpellName(115175)] = 9, -- "Smoothing Mist" }, ["ChannelTicksSize"] = { - --Warlock - [SpellName(1120)] = 2, --"Drain Soul" - [SpellName(689)] = 1, -- "Drain Life" + --Warlock + [SpellName(1120)] = 2, --"Drain Soul" + [SpellName(689)] = 1, -- "Drain Life" [SpellName(108371)] = 1, -- "Harvest Life" [SpellName(103103)] = 1, -- "Malefic Grasp" }, @@ -110,11 +110,12 @@ local function HideTicks() for i=1,#ticks do ticks[i]:Hide() end -end; +end + local function SetCastTicks(bar,count,mod) mod = mod or 0; HideTicks() - if count and count <= 0 then return end; + if count and count <= 0 then return end local barWidth = bar:GetWidth() local offset = barWidth / count + mod; for i=1,count do @@ -124,18 +125,80 @@ local function SetCastTicks(bar,count,mod) ticks[i]:SetVertexColor(0,0,0,0.8) ticks[i]:Width(1) ticks[i]:SetHeight(bar:GetHeight()) - end; + end ticks[i]:ClearAllPoints() ticks[i]:SetPoint("RIGHT", bar, "LEFT", offset * i, 0) ticks[i]:Show() end -end; -local function SetCastbarFading(frame,castbar,texture) - local fader=CreateFrame("Frame",nil,frame) +end + +local Fader_OnEvent = function(self, event, arg) + if arg ~= "player" then return end + if event == "UNIT_SPELLCAST_START" then + self.fails = nil; + self.isokey = nil; + self.ischanneling = nil; + self:SetAlpha(0) + self.mask:SetAlpha(1) + if self.anim:IsPlaying() then + self.anim:Stop() + end + elseif event == "UNIT_SPELLCAST_CHANNEL_START" then + self:SetAlpha(0) + self.mask:SetAlpha(1) + if self.anim:IsPlaying() then + self.anim:Stop() + end + self.iscasting = nil; + self.fails = nil; + self.isokey = nil + elseif event == "UNIT_SPELLCAST_SUCCEEDED" then + self.fails = nil; + self.isokey = true; + self.fails_a = nil + elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then + self.fails = true; + self.isokey = nil; + self.fails_a = nil + elseif event == "UNIT_SPELLCAST_INTERRUPTED" then + self.fails = nil; + self.isokey = nil; + self.fails_a = true + elseif event == "UNIT_SPELLCAST_STOP" then + if self.fails or self.fails_a then + self:SetBackdropColor(1, 0.2, 0.2, 0.5) + self.txt:SetText(SPELL_FAILED_FIZZLE) + self.txt:SetTextColor(1, 0.8, 0, 0.5) + elseif self.isokey then + self:SetBackdropColor(0.2, 1, 0.2, 0.5) + self.txt:SetText(SUCCESS) + self.txt:SetTextColor(0.5, 1, 0.4, 0.5) + end + self.mask:SetAlpha(0) + self:SetAlpha(0) + if not self.anim:IsPlaying() then + self.anim:Play() + end + elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" then + self.mask:SetAlpha(0) + self:SetAlpha(0) + if self.fails_a then + self:SetBackdropColor(1, 0.2, 0.2, 0.5) + self.txt:SetText(SPELL_FAILED_FIZZLE) + self.txt:SetTextColor(0.5, 1, 0.4, 0.5) + if not self.anim:IsPlaying() then + self.anim:Play() + end + end + end +end + +local function SetCastbarFading(frame, castbar, texture) + local fader = CreateFrame("Frame", nil, frame) fader:SetFrameLevel(2) fader:FillInner(castbar) - fader:SetBackdrop({bgFile=texture}) - fader:SetBackdropColor(0,0,0,0) + fader:SetBackdrop({bgFile = texture}) + fader:SetBackdropColor(0, 0, 0, 0) fader:SetAlpha(0) fader:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") fader:RegisterEvent("UNIT_SPELLCAST_START") @@ -145,136 +208,77 @@ local function SetCastbarFading(frame,castbar,texture) fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") fader:RegisterEvent("UNIT_SPELLCAST_FAILED") fader:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") - fader.mask=CreateFrame("Frame",nil,frame) - fader.mask:SetBackdrop({bgFile=texture}) + fader.mask = CreateFrame("Frame", nil, frame) + fader.mask:SetBackdrop({bgFile = texture}) fader.mask:FillInner(castbar) fader.mask:SetFrameLevel(2) - fader.mask:SetBackdropColor(0,0,0,0) + fader.mask:SetBackdropColor(0, 0, 0, 0) fader.mask:SetAlpha(0) - fader.txt=fader:CreateFontString(nil,"OVERLAY") - fader.txt:SetFont(SuperVillain.Media.font.alert,16) + fader.txt = fader:CreateFontString(nil, "OVERLAY") + fader.txt:SetFont(SuperVillain.Media.font.alert, 16) fader.txt:SetAllPoints(fader) fader.txt:SetJustifyH("CENTER") fader.txt:SetJustifyV("CENTER") fader.txt:SetText("") - fader.anim=fader:CreateAnimationGroup("Flash") - fader.anim.fadein=fader.anim:CreateAnimation("ALPHA","FadeIn") + fader.anim = fader:CreateAnimationGroup("Flash") + fader.anim.fadein = fader.anim:CreateAnimation("ALPHA", "FadeIn") fader.anim.fadein:SetChange(1) fader.anim.fadein:SetOrder(1) - fader.anim.fadeout1=fader.anim:CreateAnimation("ALPHA","FadeOut") + fader.anim.fadeout1 = fader.anim:CreateAnimation("ALPHA", "FadeOut") fader.anim.fadeout1:SetChange(-.25) fader.anim.fadeout1:SetOrder(2) - fader.anim.fadeout2=fader.anim:CreateAnimation("ALPHA","FadeOut") + fader.anim.fadeout2 = fader.anim:CreateAnimation("ALPHA", "FadeOut") fader.anim.fadeout2:SetChange(-.75) fader.anim.fadeout2:SetOrder(3) fader.anim.fadein:SetDuration(0) fader.anim.fadeout1:SetDuration(.8) fader.anim.fadeout2:SetDuration(.4) - fader:SetScript("OnEvent",function(self,event,...) - local T=... - if T~="player" then return end; - if event=="UNIT_SPELLCAST_START" then - self.fails=nil; - self.isokey=nil; - self.ischanneling=nil; - self:SetAlpha(0) - self.mask:SetAlpha(1) - if self.anim:IsPlaying() then - self.anim:Stop() - end - elseif event=="UNIT_SPELLCAST_CHANNEL_START" then - self:SetAlpha(0) - self.mask:SetAlpha(1) - if self.anim:IsPlaying() then - self.anim:Stop() - end; - self.iscasting=nil; - self.fails=nil; - self.isokey=nil - elseif event=="UNIT_SPELLCAST_SUCCEEDED" then - self.fails=nil; - self.isokey=true; - self.fails_a=nil - elseif event=="UNIT_SPELLCAST_FAILED" or event=="UNIT_SPELLCAST_FAILED_QUIET" then - self.fails=true; - self.isokey=nil; - self.fails_a=nil - elseif event=="UNIT_SPELLCAST_INTERRUPTED" then - self.fails=nil; - self.isokey=nil; - self.fails_a=true - elseif event=="UNIT_SPELLCAST_STOP" then - if self.fails or self.fails_a then - self:SetBackdropColor(1,0.2,0.2,0.5) - self.txt:SetText(SPELL_FAILED_FIZZLE) - self.txt:SetTextColor(1,0.8,0,0.5) - elseif self.isokey then - self:SetBackdropColor(0.2,1,0.2,0.5) - self.txt:SetText(SUCCESS) - self.txt:SetTextColor(0.5,1,0.4,0.5) - end; - self.mask:SetAlpha(0) - self:SetAlpha(0) - if not self.anim:IsPlaying() then - self.anim:Play() - end - elseif event=="UNIT_SPELLCAST_CHANNEL_STOP" then - self.mask:SetAlpha(0) - self:SetAlpha(0) - if self.fails_a then - self:SetBackdropColor(1,0.2,0.2,0.5) - self.txt:SetText(SPELL_FAILED_FIZZLE) - self.txt:SetTextColor(0.5,1,0.4,0.5) - if not self.anim:IsPlaying() then - self.anim:Play() - end - end - end - end) -end; + fader:SetScript("OnEvent", Fader_OnEvent) +end + local CustomCastDelayText = function(self, value) - local db=self:GetParent().db; - if not db then return end; + if not self.TimeFormat then return end if self.channeling then - if db.castbar.format=='CURRENT' then + if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(abs(value - self.max), self.delay)) - elseif db.castbar.format=='CURRENTMAX' then + elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f |cffaf5050%.1f|r"):format(value, self.max, self.delay)) - elseif db.castbar.format=='REMAINING' then + elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(value, self.delay)) end else - if db.castbar.format=='CURRENT' then + if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(value, "+", self.delay)) - elseif db.castbar.format=='CURRENTMAX' then + elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f |cffaf5050%s %.1f|r"):format(value, self.max, "+", self.delay)) - elseif db.castbar.format=='REMAINING'then + elseif self.TimeFormat == "REMAINING"then self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(abs(value - self.max), "+", self.delay)) end end -end; +end + local CustomTimeText = function(self, value) - local db=self:GetParent().db; - if not db then return end; + if not self.TimeFormat then return end if self.channeling then - if db.castbar.format=='CURRENT' then + if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f"):format(abs(value - self.max))) - elseif db.castbar.format=='CURRENTMAX' then + elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) self.Time:SetText(("%.1f / %.1f"):format(abs(value - self.max), self.max)) - elseif db.castbar.format=='REMAINING' then + elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f"):format(value)) end else - if db.castbar.format=='CURRENT' then + if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f"):format(value)) - elseif db.castbar.format=='CURRENTMAX' then + elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) - elseif db.castbar.format=='REMAINING' then + elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f"):format(abs(value - self.max))) end end -end; +end + local CustomCastTimeUpdate = function(self, duration) if(self.Time) then if(self.delay ~= 0) then @@ -305,6 +309,7 @@ local CustomCastTimeUpdate = function(self, duration) end end end + local CustomCastBarUpdate = function(self, elapsed) self.lastUpdate = (self.lastUpdate or 0) + elapsed @@ -331,7 +336,7 @@ local CustomCastBarUpdate = function(self, elapsed) if(self.Spark[1]) then self.Spark[1]:Show() self.Spark[1].overlay:Show() - if not self.Spark[1].anim:IsPlaying() then self.Spark[1].anim:Play() end + if not self.Spark[1].anim:IsPlaying() then self.Spark[1].anim:Play() end end end @@ -358,7 +363,7 @@ local CustomCastBarUpdate = function(self, elapsed) if(self.Spark[2]) then self.Spark[2]:Show() self.Spark[2].overlay:Show() - if not self.Spark[2].anim:IsPlaying() then self.Spark[2].anim:Play() end + if not self.Spark[2].anim:IsPlaying() then self.Spark[2].anim:Play() end end end local duration = self.duration - self.lastUpdate @@ -378,11 +383,10 @@ local CustomCastBarUpdate = function(self, elapsed) end self.lastUpdate = 0 -end; +end + local CustomChannelUpdate = function(self, unit, index, hasTicks) - local db=self:GetParent().db; - if not db then return end; - if not(unit=="player" or unit=="vehicle") then return end; + if not(unit == "player" or unit == "vehicle") then return end if hasTicks then local activeTicks = CustomTickData.ChannelTicks[index] if activeTicks and CustomTickData.ChannelTicksSize[index] and CustomTickData.HastedChannelTicks[index] then @@ -390,21 +394,21 @@ local CustomChannelUpdate = function(self, unit, index, hasTicks) local haste = UnitSpellHaste("player") * 0.01; local mod2 = mod1 / 2; local total = 0; - if haste >= mod2 then total = total + 1 end; + if haste >= mod2 then total = total + 1 end local calc1 = tonumber(parsefloat(mod2 + mod1, 2)) while haste >= calc1 do calc1 = tonumber(parsefloat(mod2 + mod1 * total, 2)) if haste >= calc1 then total = total + 1 end - end; + end local activeSize = CustomTickData.ChannelTicksSize[index] local sizeMod = activeSize / 1 + haste; local calc2 = self.max - sizeMod * activeTicks + total; if self.chainChannel then self.extraTickRatio = calc2 / sizeMod; self.chainChannel = nil - end; + end SetCastTicks(self, activeTicks + total, self.extraTickRatio) elseif activeTicks and CustomTickData.ChannelTicksSize[index] then local haste = UnitSpellHaste("player") * 0.01; @@ -414,7 +418,7 @@ local CustomChannelUpdate = function(self, unit, index, hasTicks) if self.chainChannel then self.extraTickRatio = calc2 / sizeMod; self.chainChannel = nil - end; + end SetCastTicks(self, activeTicks, self.extraTickRatio) elseif activeTicks then SetCastTicks(self, activeTicks) @@ -424,9 +428,10 @@ local CustomChannelUpdate = function(self, unit, index, hasTicks) else HideTicks() end -end; +end + local CustomInterruptible = function(self, unit, useClass) -local colors = oUF_SuperVillain.colors + local colors = oUF_SuperVillain.colors local r, g, b = self.CastColor[1], self.CastColor[2], self.CastColor[3] if useClass then local colorOverride; @@ -435,14 +440,14 @@ local colors = oUF_SuperVillain.colors colorOverride = colors.class[class] elseif UnitReaction(unit, "player") then colorOverride = colors.reaction[UnitReaction(unit, "player")] - end; + end if colorOverride then r, g, b = colorOverride[1], colorOverride[2], colorOverride[3] end - end; + end if self.interrupt and unit ~= "player" and UnitCanAttack("player", unit) then r, g, b = colors.interrupt[1], colors.interrupt[2], colors.interrupt[3] - end; + end self:SetStatusBarColor(r, g, b) if self.bg:IsShown() then self.bg:SetVertexColor(r * 0.2, g * 0.2, b * 0.2) @@ -453,7 +458,7 @@ local colors = oUF_SuperVillain.colors self.Spark[1]:SetVertexColor(r, g, b) self.Spark[2]:SetVertexColor(r, g, b) end -end; +end --[[ ########################################################## BUILD FUNCTION @@ -511,7 +516,7 @@ function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) bgFrame:FillInner(castbar, -2, 10) bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) - castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.lazer) + castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.lazer) castbar.noupdate = true; castbar.pewpew = true hadouken.iscustom = true; @@ -631,36 +636,36 @@ function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) else iconHolder:Point("RIGHT", castbar, "LEFT", -6, 0) end - end; + end castbar.bg = bgFrame:CreateTexture(nil, "BACKGROUND") castbar.bg:SetAllPoints(bgFrame) castbar.bg:SetTexture(SuperVillain.Media.bar.default) - castbar.bg:SetVertexColor(0,0,0,0.5) + castbar.bg:SetVertexColor(0,0,0,0.5) local borderB = bgFrame:CreateTexture(nil,"OVERLAY") - borderB:SetTexture(0,0,0) - borderB:SetPoint("BOTTOMLEFT") - borderB:SetPoint("BOTTOMRIGHT") - borderB:SetHeight(2) - - local borderT = bgFrame:CreateTexture(nil,"OVERLAY") - borderT:SetTexture(0,0,0) - borderT:SetPoint("TOPLEFT") - borderT:SetPoint("TOPRIGHT") - borderT:SetHeight(2) - - local borderL = bgFrame:CreateTexture(nil,"OVERLAY") - borderL:SetTexture(0,0,0) - borderL:SetPoint("TOPLEFT") - borderL:SetPoint("BOTTOMLEFT") - borderL:SetWidth(2) - - local borderR = bgFrame:CreateTexture(nil,"OVERLAY") - borderR:SetTexture(0,0,0) - borderR:SetPoint("TOPRIGHT") - borderR:SetPoint("BOTTOMRIGHT") - borderR:SetWidth(2) + borderB:SetTexture(0,0,0) + borderB:SetPoint("BOTTOMLEFT") + borderB:SetPoint("BOTTOMRIGHT") + borderB:SetHeight(2) + + local borderT = bgFrame:CreateTexture(nil,"OVERLAY") + borderT:SetTexture(0,0,0) + borderT:SetPoint("TOPLEFT") + borderT:SetPoint("TOPRIGHT") + borderT:SetHeight(2) + + local borderL = bgFrame:CreateTexture(nil,"OVERLAY") + borderL:SetTexture(0,0,0) + borderL:SetPoint("TOPLEFT") + borderL:SetPoint("BOTTOMLEFT") + borderL:SetWidth(2) + + local borderR = bgFrame:CreateTexture(nil,"OVERLAY") + borderR:SetTexture(0,0,0) + borderR:SetPoint("TOPRIGHT") + borderR:SetPoint("BOTTOMRIGHT") + borderR:SetWidth(2) castbar:SetStatusBarColor(colors.casting[1],colors.casting[2],colors.casting[3]) castbar.LatencyTexture:SetVertexColor(0.1, 1, 0.2, 0.5) @@ -673,46 +678,54 @@ function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) if moverName then SuperVillain:SetSVMovable(castbar.Holder, frame:GetName().."Castbar_MOVE", moverName, nil, -6, nil, "ALL, SOLO") - end; + end if useFader then SetCastbarFading(frame, castbar, SuperVillain.Media.bar.lazer) - end; + end + + castbar.TimeFormat = "REMAINING" return castbar -end; +end --[[ ########################################################## UPDATE ########################################################## ]]-- function MOD:PostCastStart(unit, index, ...) - local db = self:GetParent().db; - if not db or not db.castbar then return end; - if unit == "vehicle" then unit = "player" end; - if db.castbar.displayTarget and self.curTarget then - self.Text:SetText(sub(index.." --> "..self.curTarget, 0, floor(32 / 245 * self:GetWidth() / SuperVillain.db["SVUnit"].fontSize * 12))) + if unit == "vehicle" then unit = "player" end + local db = MOD.db + if(not db or not(db and db[unit] and db[unit].castbar)) then return end + local unitDB = db[unit].castbar + if unitDB.displayTarget and self.curTarget then + self.Text:SetText(sub(index.." --> "..self.curTarget, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) else - self.Text:SetText(sub(index, 0, floor(32 / 245 * self:GetWidth() / SuperVillain.db["SVUnit"].fontSize * 12))) - end; + self.Text:SetText(sub(index, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) + end self.unit = unit; if unit == "player" or unit == "target" then - CustomChannelUpdate(self, unit, index, db.castbar.ticks) - CustomInterruptible(self, unit, MOD.db.castClassColor) - end; -end; + CustomChannelUpdate(self, unit, index, unitDB.ticks) + CustomInterruptible(self, unit, db.castClassColor) + end +end + function MOD:PostCastStop(unit, ...) self.chainChannel = nil; self.prevSpellCast = nil -end; +end + function MOD:PostChannelUpdate(unit, index) - local db = self:GetParent().db; - if not db or not(unit == "player" or unit == "vehicle") then return end; + if unit == "vehicle" then unit = "player" end + local db = MOD.db[unit]; + if(not db or not db.castbar or not(unit == "player")) then return end CustomChannelUpdate(self, unit, index, db.castbar.ticks) -end; +end + function MOD:PostCastInterruptible(unit) - if unit == "vehicle" or unit == "player" then return end; + if unit == "vehicle" or unit == "player" then return end CustomInterruptible(self, unit, MOD.db.castClassColor) -end; +end + function MOD:PostCastNotInterruptible(unit) local castColor = self.CastColor; self:SetStatusBarColor(castColor[1], castColor[2], castColor[3]) @@ -721,4 +734,4 @@ function MOD:PostCastNotInterruptible(unit) self.Spark[1]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) self.Spark[2]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) end -end; \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/health.lua b/Interface/AddOns/SVUI/packages/unit/common/health.lua index 127972f..91a076e 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/health.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/health.lua @@ -213,6 +213,22 @@ local CustomUpdate = function(self, event, unit) local current = random(1,max) health:SetValue(-current) end + + local portrait = self.Portrait + if(portrait and portrait:IsObjectType'Model') then + if(UnitIsDeadOrGhost(unit) and not portrait.isdead) then + portrait:SetCamDistanceScale(1) + portrait:SetPortraitZoom(0) + portrait:SetPosition(4,-1,1) + portrait:ClearModel() + portrait:SetModel(DEAD_MODEL_FILE) + portrait.isdead = true + portrait.guid = nil + elseif(not UnitIsDeadOrGhost(unit) and portrait.isdead == true) then + portrait.isdead = nil + MOD.Update3DPortrait(self, event, unit) + end + end end local Update = function(self, event, unit) @@ -239,7 +255,7 @@ local Update = function(self, event, unit) end local bg = health.bg; - local db = self:GetParent().db or SuperVillain.db.SVUnit; + local db = MOD.db or SuperVillain.db.SVUnit; local r, g, b, t, t2; if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then @@ -294,6 +310,22 @@ local Update = function(self, event, unit) if(db.gridMode) then health:SetOrientation("VERTICAL") end + + local portrait = self.Portrait + if(portrait and portrait:IsObjectType'Model') then + if(UnitIsDeadOrGhost(unit) and not portrait.isdead) then + portrait:SetCamDistanceScale(1) + portrait:SetPortraitZoom(0) + portrait:SetPosition(4,-1,1) + portrait:ClearModel() + portrait:SetModel(DEAD_MODEL_FILE) + portrait.isdead = true + portrait.guid = nil + elseif(not UnitIsDeadOrGhost(unit) and portrait.isdead == true) then + portrait.isdead = nil + MOD.Update3DPortrait(self, event, unit) + end + end end --[[ ########################################################## @@ -340,8 +372,10 @@ function MOD:CreateHealthBar(frame, hasbg, reverse) end function MOD:RefreshHealthBar(frame) - if(frame.db and frame.db.portrait) then - local db = frame.db.portrait + local key = frame.datakey + local db = MOD.db[key] + if(db and db.portrait) then + db = db.portrait local useOverlayHealth = (db.enable and db.overlay); if useOverlayHealth then frame.Health:SetStatusBarTexture(SuperVillain.Media.bar.default) diff --git a/Interface/AddOns/SVUI/packages/unit/common/misc.lua b/Interface/AddOns/SVUI/packages/unit/common/misc.lua index c0df411..d4ed8b6 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/misc.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/misc.lua @@ -138,10 +138,12 @@ function MOD:CreateRoleIcon(frame) end function MOD:UpdateRoleIcon() - local lfd = self.LFDRole; - if not self.db or not self.db.icons then return end - local db = self.db.icons.roleIcon; - if not db or db and not db.enable then lfd:Hide()return end + local lfd = self.LFDRole + local key = self.datakey + local db = MOD.db[key] + if not db or not db.icons then return end + local db = db.icons.roleIcon; + if(not db or (db and not db.enable)) then lfd:Hide()return end local unitRole = UnitGroupRolesAssigned(self.unit) if self.isForced and unitRole == "NONE"then local rng = random(1, 3) @@ -192,8 +194,8 @@ function MOD:RaidRoleUpdate() local leaderIcon = frame.Leader; local looterIcon = frame.MasterLooter; if not leaderIcon or not looterIcon then return end - local unit = frame.unit; - local db = frame.db; + local key = frame.datakey; + local db = MOD.db[key]; local leaderShown = leaderIcon:IsShown() local looterShown = looterIcon:IsShown() leaderIcon:ClearAllPoints() diff --git a/Interface/AddOns/SVUI/packages/unit/common/power.lua b/Interface/AddOns/SVUI/packages/unit/common/power.lua index 1037110..e8831b8 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/power.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/power.lua @@ -106,8 +106,9 @@ UPDATE ]]-- local function PowerUpdateNamePosition(frame, unit) local panel = frame.InfoPanel - if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end - local db = frame.db; + if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end + local key = frame.datakey + local db = MOD.db[key] local parent = panel.Name:GetParent() if UnitIsPlayer(unit)then local point = db.name.position; @@ -142,7 +143,8 @@ function MOD:PostUpdatePower(unit, value, max) if not colors then return end self:SetStatusBarColor(colors[1], colors[2], colors[3]) self.bg:SetVertexColor(colors[1] * mult, colors[2] * mult, colors[3] * mult) - local db = parent.db; + local key = parent.datakey + local db = MOD.db[key] if db and db.power and db.power.hideonnpc then PowerUpdateNamePosition(parent, unit) end diff --git a/Interface/AddOns/SVUI/packages/unit/common/secure.lua b/Interface/AddOns/SVUI/packages/unit/common/secure.lua index 32688fa..269ec0e 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/secure.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/secure.lua @@ -119,7 +119,8 @@ local function ChangeGroupIndex(self) if not self:IsShown() then return end local max = MAX_RAID_MEMBERS; - local db = self.db or self:GetParent().db; + local key = self.NameKey + local db = MOD.db[key] local newIndex = db.rSort and -(min(db.gCount * (db.gRowCol * 5), max) + 1 ) or -4; if self:GetAttribute("startingIndex") ~= newIndex then @@ -133,15 +134,18 @@ end CORE FUNCTIONS ########################################################## ]]-- -function MOD:SwapElement(unitGroup, numGroup) +function MOD:SwapElement(unit, numGroup) if InCombatLockdown()then return end - for i=1,numGroup do + for i=1, numGroup do local unitName = unitGroup..i - if self[unitName] and not self[unitName].isForced then - self:AllowElement(self[unitName]) - elseif self[unitName] then - self:RestrictElement(self[unitName]) - end + local frame = self.Units[unit] + if(frame) then + if frame.isForced then + self:AllowElement(frame) + else + self:RestrictElement(frame) + end + end end end @@ -155,7 +159,7 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) if InCombatLockdown()then return end SetProxyEnv() - + headerFrame.forceShow = setForced; headerFrame.forceShowAuras = setForced; headerFrame.isForced = setForced; @@ -175,13 +179,14 @@ function MOD:UpdateGroupConfig(headerFrame, setForced) setfenv(func, fenv) definedEnvs[func] = nil end - RegisterStateDriver(headerFrame, "visibility", headerFrame.db.visibility) + local key = headerFrame.NameKey + local db = MOD.db[key] + RegisterStateDriver(headerFrame, "visibility", db.visibility) headerFrame:GetScript("OnEvent")(headerFrame, "PLAYER_ENTERING_WORLD") end - for i = 1, #headerFrame.subunits do + for i = 1, #headerFrame.subunits do local groupFrame = headerFrame.subunits[i] - local db = groupFrame.db; if groupFrame:IsShown()then groupFrame.forceShow = headerFrame.forceShow; diff --git a/Interface/AddOns/SVUI/packages/unit/common/unique.lua b/Interface/AddOns/SVUI/packages/unit/common/unique.lua index f01ab35..99643e9 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/unique.lua +++ b/Interface/AddOns/SVUI/packages/unit/common/unique.lua @@ -66,54 +66,56 @@ local ExRep_OnEnter = function(self)if self:IsShown() then UIFrameFadeIn(self,.1 local ExRep_OnLeave = function(self)if self:IsShown() then UIFrameFadeOut(self,.2,1,0) end end; function MOD:CreateExperienceRepBar(frame) - local db=MOD.db.player; + local db = MOD.db.player; + if db.playerExpBar then - local xp=CreateFrame('StatusBar','PlayerFrameExperienceBar',frame.Power) - xp:FillInner(frame.Power,0,0) + local xp = CreateFrame("StatusBar", "PlayerFrameExperienceBar", frame.Power) + xp:FillInner(frame.Power, 0, 0) xp:SetPanelTemplate() xp:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp:SetStatusBarColor(0,0.1,0.6) - --xp:SetBackdropColor(1,1,1,0.8) + xp:SetStatusBarColor(0, 0.1, 0.6) + --xp:SetBackdropColor(1, 1, 1, 0.8) xp:SetFrameLevel(xp:GetFrameLevel() + 2) - xp.Tooltip=true; - xp.Rested=CreateFrame('StatusBar',nil,xp) + xp.Tooltip = true; + xp.Rested = CreateFrame("StatusBar", nil, xp) xp.Rested:SetAllPoints(xp) xp.Rested:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp.Rested:SetStatusBarColor(1,0,1,0.6) - xp.Value=xp:CreateFontString(nil,'TOOLTIP') + xp.Rested:SetStatusBarColor(1, 0, 1, 0.6) + xp.Value = xp:CreateFontString(nil, "TOOLTIP") xp.Value:SetAllPoints(xp) - xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto,10,"NONE") - xp.Value:SetTextColor(0.2,0.75,1) - xp.Value:SetShadowColor(0,0,0,0) - xp.Value:SetShadowOffset(0,0) - frame:Tag(xp.Value,"[curxp] / [maxxp]") - xp.Rested:SetBackdrop({bgFile=[[Interface\BUTTONS\WHITE8X8]]}) + xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + xp.Value:SetTextColor(0.2, 0.75, 1) + xp.Value:SetShadowColor(0, 0, 0, 0) + xp.Value:SetShadowOffset(0, 0) + frame:Tag(xp.Value, "[curxp] / [maxxp]") + xp.Rested:SetBackdrop({bgFile = [[Interface\BUTTONS\WHITE8X8]]}) xp.Rested:SetBackdropColor(unpack(SuperVillain.Media.color.default)) - xp:SetScript('OnEnter', ExRep_OnEnter) - xp:SetScript('OnLeave', ExRep_OnLeave) + xp:SetScript("OnEnter", ExRep_OnEnter) + xp:SetScript("OnLeave", ExRep_OnLeave) xp:SetAlpha(0) - frame.Experience=xp + frame.Experience = xp end; + if db.playerRepBar then - local rep=CreateFrame('StatusBar','PlayerFrameReputationBar',frame.Power) - rep:FillInner(frame.Power,0,0) + local rep = CreateFrame("StatusBar", "PlayerFrameReputationBar", frame.Power) + rep:FillInner(frame.Power, 0, 0) rep:SetPanelTemplate() rep:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - rep:SetStatusBarColor(0,0.6,0) - --rep:SetBackdropColor(1,1,1,0.8) + rep:SetStatusBarColor(0, 0.6, 0) + --rep:SetBackdropColor(1, 1, 1, 0.8) rep:SetFrameLevel(rep:GetFrameLevel() + 2) - rep.Tooltip=true; - rep.Value=rep:CreateFontString(nil,'TOOLTIP') + rep.Tooltip = true; + rep.Value = rep:CreateFontString(nil, "TOOLTIP") rep.Value:SetAllPoints(rep) - rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto,10,"NONE") - rep.Value:SetTextColor(0.1,1,0.2) - rep.Value:SetShadowColor(0,0,0,0) - rep.Value:SetShadowOffset(0,0) - frame:Tag(rep.Value,"[standing]: [currep] / [maxrep]") - rep:SetScript('OnEnter', ExRep_OnEnter) - rep:SetScript('OnLeave', ExRep_OnLeave) + rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + rep.Value:SetTextColor(0.1, 1, 0.2) + rep.Value:SetShadowColor(0, 0, 0, 0) + rep.Value:SetShadowOffset(0, 0) + frame:Tag(rep.Value, "[standing]: [currep] / [maxrep]") + rep:SetScript("OnEnter", ExRep_OnEnter) + rep:SetScript("OnLeave", ExRep_OnLeave) rep:SetAlpha(0) - frame.Reputation=rep + frame.Reputation = rep end end; --[[ diff --git a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua b/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua index 760fda6..e101f72 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua @@ -127,7 +127,7 @@ CORE FUNCTIONS ########################################################## ]]-- function MOD:RefreshUnitLayout(frame, template) - local db = frame.db + local db = MOD.db[template] local GAP = SuperVillain:Scale(3); local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; @@ -157,6 +157,8 @@ function MOD:RefreshUnitLayout(frame, template) AURA_HOLDER = 100 end + MOD:RefreshUnitMedia(frame) + if(db.portrait and db.portrait.enable) then if(not db.portrait.overlay) then portraitWidth = ((db.portrait.width * TOP_MODIFIER) + (1 * TOP_MODIFIER)) @@ -240,9 +242,6 @@ function MOD:RefreshUnitLayout(frame, template) if(frame.Power and infoPanel.Power and db.power) then local powertext = infoPanel.Power - if(infoPanel.Health) then - powertext:SetFont(infoPanel.Health:GetFont()) - end if db.power.tags and db.power.tags ~= '' then local point = db.power.position powertext:ClearAllPoints() @@ -260,9 +259,6 @@ function MOD:RefreshUnitLayout(frame, template) end if(infoPanel.Misc and db.misc) then - if(infoPanel.Health) then - infoPanel.Misc:SetFont(infoPanel.Health:GetFont()) - end frame:Tag(infoPanel.Misc, db.misc.tags) end @@ -454,6 +450,8 @@ function MOD:RefreshUnitLayout(frame, template) local sparkSize = castHeight * 4; local adjustedWidth = castWidth - 2; local lazerScale = castHeight * 1.8; + + if(db.castbar.format) then castbar.TimeFormat = db.castbar.format end if(not castbar.pewpew) then castbar:SetSize(adjustedWidth, castHeight) diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/focus.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/focus.lua index 4438cb0..f334d5e 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/focus.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/focus.lua @@ -58,10 +58,8 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:focus(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/ft.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/ft.lua index afec53c..cbc9cfa 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/ft.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/ft.lua @@ -43,10 +43,8 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:focustarget(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/pet.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/pet.lua index 0d8ef7b..f192a51 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/pet.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/pet.lua @@ -49,10 +49,8 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:pet(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/player.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/player.lua index 9f63383..907b318 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/player.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/player.lua @@ -57,7 +57,6 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:player(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; local USE_CLASSBAR = db.classbar.enable; @@ -65,7 +64,7 @@ function MOD.FrameUpdate:player(unit, frame, db) local classBarWidth = db.width * 0.4; local healthPanel = frame.HealthPanel local iconDB = db.icons - MOD:RefreshUnitMedia(frame) + frame.unit = unit frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/pt.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/pt.lua index 9d2197c..36b521d 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/pt.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/pt.lua @@ -42,10 +42,9 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:pettarget(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) + frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/target.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/target.lua index 0c2bfcd..e9caf8a 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/target.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/target.lua @@ -68,12 +68,11 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:target(unit, frame, db) - frame.db = db local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; local USE_COMBOBAR = db.combobar.enable; local comboBarHeight = db.combobar.height; - MOD:RefreshUnitMedia(frame) + frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/basic/tot.lua b/Interface/AddOns/SVUI/packages/unit/frames/basic/tot.lua index c15183d..41a6bcc 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/basic/tot.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/basic/tot.lua @@ -44,10 +44,9 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:targettarget(unit, frame, db) - frame.db = db; local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) + frame.unit = unit; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/extra/arena.lua b/Interface/AddOns/SVUI/packages/unit/frames/extra/arena.lua index 9a8108f..e889cf3 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/extra/arena.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/extra/arena.lua @@ -35,20 +35,24 @@ local function PrepFrame_OnUpdate(self, event, unit, arg) return end - local spec = GetArenaOpponentSpec(MOD[self.unit]:GetID()) - local _, x, y, z; - if spec and spec > 0 then - _, x, _, y, _, _, z = GetSpecializationInfoByID(spec) - end + local frame = self:GetParent() + if(frame and frame.GetParent) then + local id = frame:GetID() + local spec = GetArenaOpponentSpec(id) + local _, x, y, z; + if spec and spec > 0 then + _, x, _, y, _, _, z = GetSpecializationInfoByID(spec) + end - if z and x then - local color = RAID_CLASS_COLORS[z] - self.SpecClass:SetText(x .. " - " .. LOCALIZED_CLASS_NAMES_MALE[z]) - self.Health:SetStatusBarColor(color.r, color.g, color.b) - self.Icon:SetTexture(y or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) - self:Show() - else - self:Hide() + if z and x then + local color = RAID_CLASS_COLORS[z] + self.SpecClass:SetText(x .. " - " .. LOCALIZED_CLASS_NAMES_MALE[z]) + self.Health:SetStatusBarColor(color.r, color.g, color.b) + self.Icon:SetTexture(y or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) + self:Show() + else + self:Hide() + end end end @@ -109,12 +113,11 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:arena(unit, frame, db) - frame.db = db; local INDEX = frame.index; local holder = _G["SVUI_Arena_MOVE"] local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) + MOD:RefreshUnitMedia(frame, db) frame.unit = unit frame.colors = oUF_SuperVillain.colors; frame:Size(UNIT_WIDTH, UNIT_HEIGHT) diff --git a/Interface/AddOns/SVUI/packages/unit/frames/extra/boss.lua b/Interface/AddOns/SVUI/packages/unit/frames/extra/boss.lua index a77f346..1f4e94b 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/extra/boss.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/extra/boss.lua @@ -56,12 +56,11 @@ UPDATE ########################################################## ]]-- function MOD.FrameUpdate:boss(unit, frame, db) - frame.db = db; frameNumber = frame.index; local holder = _G["SVUI_Boss_MOVE"] local UNIT_WIDTH = db.width; local UNIT_HEIGHT = db.height; - MOD:RefreshUnitMedia(frame) + frame.unit = unit; frame.colors = oUF_SuperVillain.colors; frame:Size(UNIT_WIDTH, UNIT_HEIGHT) diff --git a/Interface/AddOns/SVUI/packages/unit/frames/group/assist.lua b/Interface/AddOns/SVUI/packages/unit/frames/group/assist.lua index f8bd478..1c1a6ab 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/group/assist.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/group/assist.lua @@ -47,7 +47,6 @@ UPDATE ]]-- function MOD.HeaderUpdate:assist(frame, db) frame:Hide() - frame.db = db; MOD:DetachSubFrames(frame:GetChildren()) frame:SetAttribute("startingIndex", -1) RegisterAttributeDriver(frame, "state-visibility", "show") @@ -70,12 +69,11 @@ function MOD.HeaderUpdate:assist(frame, db) end function MOD.FrameUpdate:assist(frame, db) - MOD:RefreshUnitMedia(frame) + frame.colors = oUF_SuperVillain.colors; frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") if frame.isChild and frame.originalParent then local targets = db.targetsGroup; - frame.db = db.targetsGroup; if not frame.originalParent.childList then frame.originalParent.childList = {} end @@ -90,8 +88,7 @@ function MOD.FrameUpdate:assist(frame, db) frame:SetParent(StealthFrame) end end - elseif not InCombatLockdown()then - frame.db = db; + elseif not InCombatLockdown()then frame:Size(db.width, db.height) end diff --git a/Interface/AddOns/SVUI/packages/unit/frames/group/party.lua b/Interface/AddOns/SVUI/packages/unit/frames/group/party.lua index ffb7156..da20133 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/group/party.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/group/party.lua @@ -111,12 +111,8 @@ end UPDATE ########################################################## ]]-- -function MOD.HeaderUpdate:party(frame,db) - frame.db = db; - +function MOD.HeaderUpdate:party(frame) local group = frame:GetParent() - group.db = db; - if not group.positioned then group:ClearAllPoints() group:Point("LEFT",SuperVillain.UIParent,"LEFT",40,0) @@ -133,7 +129,8 @@ function MOD.HeaderUpdate:party(frame,db) end function MOD.VisibilityUpdate:party(event) - if (not self.db or (self.db and not self.db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + local db = MOD.db["party"] + if (not db or (db and not db.enable) or not MOD.db.smartRaidFilter or self.isForced) then return end local instance, instanceType = IsInInstance() if(event == "PLAYER_REGEN_ENABLED") then self:UnregisterEvent("PLAYER_REGEN_ENABLED") @@ -142,8 +139,8 @@ function MOD.VisibilityUpdate:party(event) if(instance and instanceType == "raid") then UnregisterStateDriver(self,"visibility") self:Hide() - elseif self.db.visibility then - RegisterStateDriver(self,"visibility", self.db.visibility) + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) end else self:RegisterEvent("PLAYER_REGEN_ENABLED") @@ -151,8 +148,6 @@ function MOD.VisibilityUpdate:party(event) end function MOD.FrameUpdate:party(frame,db) - frame.db = db; - MOD:RefreshUnitMedia(frame) frame.colors = oUF_SuperVillain.colors; frame:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') if frame.isChild then diff --git a/Interface/AddOns/SVUI/packages/unit/frames/group/raid.lua b/Interface/AddOns/SVUI/packages/unit/frames/group/raid.lua index 7bdc0c0..1c91fad 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/group/raid.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/group/raid.lua @@ -124,7 +124,6 @@ for i = 10, 40, 15 do MOD.HeaderUpdate[raidGroupName] = function(_, unit, db) local frame = unit:GetParent() - frame.db = db; if not frame.positioned then frame:ClearAllPoints() frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) @@ -138,8 +137,6 @@ for i = 10, 40, 15 do end; MOD.FrameUpdate[raidGroupName] = function(_, frame, db) - frame.db = db; - MOD:RefreshUnitMedia(frame) local rdSize = MOD.db.auraFontSize; local rdFont = LSM:Fetch("font", MOD.db.auraFont) frame.colors = oUF_SuperVillain.colors; diff --git a/Interface/AddOns/SVUI/packages/unit/frames/group/rpet.lua b/Interface/AddOns/SVUI/packages/unit/frames/group/rpet.lua index 9f6e9da..ef30291 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/group/rpet.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/group/rpet.lua @@ -130,9 +130,7 @@ function MOD.VisibilityUpdate:raidpet(arg) end function MOD.HeaderUpdate:raidpet(frame, db) - frame.db = db; local raidPets = frame:GetParent() - raidPets.db = db; if not raidPets.positioned then raidPets:ClearAllPoints() raidPets:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", 4, 433) @@ -146,8 +144,6 @@ function MOD.HeaderUpdate:raidpet(frame, db) end function MOD.FrameUpdate:raidpet(frame, db) - frame.db = db; - MOD:RefreshUnitMedia(frame) frame.colors = oUF_SuperVillain.colors; frame:RegisterForClicks(MOD.db.fastClickTarget and"AnyDown"or"AnyUp") if not InCombatLockdown()then frame:Size(db.width, db.height)end diff --git a/Interface/AddOns/SVUI/packages/unit/frames/group/tank.lua b/Interface/AddOns/SVUI/packages/unit/frames/group/tank.lua index 9118746..487d192 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames/group/tank.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames/group/tank.lua @@ -47,7 +47,6 @@ UPDATE ]]-- function MOD.HeaderUpdate:tank(frame, db) frame:Hide() - frame.db = db; MOD:DetachSubFrames(frame:GetChildren()) frame:SetAttribute("startingIndex", -1) RegisterAttributeDriver(frame, "state-visibility", "show") @@ -70,12 +69,10 @@ function MOD.HeaderUpdate:tank(frame, db) end function MOD.FrameUpdate:tank(frame, db) - MOD:RefreshUnitMedia(frame) frame.colors = oUF_SuperVillain.colors; - frame:RegisterForClicks(MOD.db.fastClickTarget and"AnyDown"or"AnyUp") + frame:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") if frame.isChild and frame.originalParent then local targets = db.targetsGroup; - frame.db = db.targetsGroup; if not frame.originalParent.childList then frame.originalParent.childList = {} end @@ -91,7 +88,6 @@ function MOD.FrameUpdate:tank(frame, db) end end elseif not InCombatLockdown()then - frame.db = db; frame:Size(db.width, db.height) end diff --git a/Interface/AddOns/SVUI/system/classes/Database.lua b/Interface/AddOns/SVUI/system/classes/Database.lua index 376dbdd..558e8d8 100644 --- a/Interface/AddOns/SVUI/system/classes/Database.lua +++ b/Interface/AddOns/SVUI/system/classes/Database.lua @@ -262,25 +262,7 @@ local DatabaseDefaults = { [6] = {0.19, 0.85, 0.13}, [7] = {0.19, 0.85, 0.13}, [8] = {0.19, 0.85, 0.13}, - }, - ["Runes"] = { - [1] = {1, 0, 0}, - [2] = {0, 0.5, 0}, - [3] = {0, 1, 1}, - [4] = {0.9, 0.1, 1} - }, - ["MonkHarmony"] = { - [1] = {0.57, 0.87, 0.35}, - [2] = {0.47, 0.87, 0.35}, - [3] = {0.37, 0.87, 0.35}, - [4] = {0.27, 0.87, 0.33}, - [5] = {0.17, 0.87, 0.33} - }, - ["WarlockShards"] = { - [1] = {0.58, 0.51, 0.79}, - [2] = {0.58, 0.51, 0.79}, - [3] = {1, 0.06, 0} - }, + }, ["tapped"] = {0.55, 0.57, 0.61}, ["disconnected"] = {0.84, 0.75, 0.65}, ["casting"] = {0.8, 0.8, 0}, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua index bb70766..64cfcfb 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua @@ -451,7 +451,7 @@ SuperVillain.Options.args.common = { name = L["Textures"], guiInline = true, get = function(key) - return SuperVillain.db.media.textures[key[#key]][2] + return SuperVillain.db.media.textures[key[#key]] end, set = function(key, value) SuperVillain.db.media.textures[key[#key]] = {"background", value} @@ -502,10 +502,22 @@ SuperVillain.Options.args.common = { step = 1, set = function(j,value)SuperVillain.db.media.fonts[j[#j]] = value;CommonFontSizeUpdate()end }, + fontSpacer1 = { + order = 3, + type = "description", + name = "", + desc = "", + }, + fontSpacer2 = { + order = 4, + type = "description", + name = "", + desc = "", + }, default = { type = "select", dialogControl = 'LSM30_Font', - order = 3, + order = 5, name = L["Default Font"], desc = L["Set/Override the global UI font. |cff00FF00NOTE:|r |cff00FF99This WILL NOT affect configurable fonts.|r"], values = AceGUIWidgetLSMlists.font, @@ -515,7 +527,7 @@ SuperVillain.Options.args.common = { name = { type = "select", dialogControl = 'LSM30_Font', - order = 4, + order = 6, name = L["Unit Name Font"], desc = L["Set/Override the global name font. |cff00FF00NOTE:|r |cff00FF99This WILL NOT affect styled nameplates or unitframes.|r"], values = AceGUIWidgetLSMlists.font, @@ -525,7 +537,7 @@ SuperVillain.Options.args.common = { combat = { type = "select", dialogControl = 'LSM30_Font', - order = 5, + order = 7, name = L["CombatText Font"], desc = L["Set/Override the font that combat text will use. |cffFF0000NOTE:|r |cffFF9900This requires a game restart or re-log for this change to take effect.|r"], values = AceGUIWidgetLSMlists.font, @@ -535,7 +547,7 @@ SuperVillain.Options.args.common = { number = { type = "select", dialogControl = 'LSM30_Font', - order = 6, + order = 8, name = L["Numbers Font"], desc = L["Set/Override the global font used for numbers. |cff00FF00NOTE:|r |cff00FF99This WILL NOT affect all numbers.|r"], values = AceGUIWidgetLSMlists.font, @@ -602,16 +614,22 @@ SuperVillain.Options.args.common = { set = function(a,b)SuperVillain.db.SVGear[a[#a]]=b;GEAR:UpdateThisPackage()end, args={ intro={ - order=1, - type='description', - name=L["EQUIPMENT_DESC"] + order = 1, + type = 'description', + name = function() + if(GetNumEquipmentSets()==0) then + return L["EQUIPMENT_DESC"] .. "\n" .. "|cffFF0000Must create an equipment set to use some of these features|r" + else + return L["EQUIPMENT_DESC"] + end + end }, specialization={ - order=2, - type="group", - name=L["Specialization"], - guiInline=true, - disabled=function()return GetNumEquipmentSets()==0 end, + order = 2, + type = "group", + name = L["Specialization"], + guiInline = true, + disabled = function()return GetNumEquipmentSets()==0 end, args={ enable={ type="toggle", @@ -619,7 +637,7 @@ SuperVillain.Options.args.common = { name=L["Enable"], desc=L['Enable/Disable the specialization switch.'], get=function(e)return SuperVillain.db.SVGear.specialization.enable end, - set=function(e,value)SuperVillain.db.SVGear.specialization.enable=value end + set=function(e,value) SuperVillain.db.SVGear.specialization.enable = value end }, primary={ type="select", diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua index 20cc413..8159ad5 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua @@ -1508,7 +1508,7 @@ SuperVillain.Options.args.SVUnit = { guiInline = true, name = "Unit Backgrounds (3D Portraits Only)", get = function(key) - return SuperVillain.db.media.textures[key[#key]][2] + return SuperVillain.db.media.textures[key[#key]] end, set = function(key, value) SuperVillain.db.media.textures[key[#key]] = {"background", value} diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua index a63998f..4858db0 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua @@ -317,48 +317,4 @@ SuperVillain.Options.args.SVUnit.args.assist = { } } } -} ---[[ -################################################################################################## -################################################################################################## -################################################################################################## -]] -if SuperVillain.class == "MONK" or SuperVillain.class == "WARLOCK" or SuperVillain.class == "DEATHKNIGHT" then - SuperVillain.Options.args.SVUnit.args.common.args.allColorsGroup.args.classResourceGroup = { - order = -1, - type = "group", - guiInline = true, - name = L["Class Resources"], - args = {} - } - if SuperVillain.class == "MONK" then - for w = 1, 5 do - SuperVillain.Options.args.SVUnit.args.common.args.allColorsGroup.args.classResourceGroup.args["resource"..w] = { - type = "color", - name = L["Harmony"].." #"..w, - get = function(l)local P = SuperVillain.db.media.unitframes.MonkHarmony[w]return P.r, P.g, P.b, P.a end, - set = function(l, Q, R, S)SuperVillain.db.media.unitframes.MonkHarmony[w] = {}local P = SuperVillain.db.media.unitframes.MonkHarmony[w]P.r, P.g, P.b = Q, R, S;MOD:RefreshUnitFrames()end - } - end - elseif SuperVillain.class == "WARLOCK" then - local W = {[1] = L["Affliction"], [2] = L["Demonology"], [3] = L["Destruction"]} - for w = 1, 3 do - SuperVillain.Options.args.SVUnit.args.common.args.allColorsGroup.args.classResourceGroup.args["resource"..w] = { - type = "color", - name = W[w], - get = function(l)local P = SuperVillain.db.media.unitframes.WarlockShards[w]return P.r, P.g, P.b, P.a end, - set = function(l, Q, R, S)SuperVillain.db.media.unitframes.WarlockShards[w] = {}local P = SuperVillain.db.media.unitframes.WarlockShards[w]P.r, P.g, P.b = Q, R, S;MOD:RefreshUnitFrames()end - } - end - elseif SuperVillain.class == "DEATHKNIGHT" then - local W = {[1] = L["Blood"], [2] = L["Unholy"], [3] = L["Frost"], [4] = L["Death"]} - for w = 1, 4 do - SuperVillain.Options.args.SVUnit.args.common.args.allColorsGroup.args.classResourceGroup.args["resource"..w] = { - type = "color", - name = W[w], - get = function(l)local P = SuperVillain.db.media.unitframes.Runes[w]return P.r, P.g, P.b, P.a end, - set = function(l, Q, R, S)SuperVillain.db.media.unitframes.Runes[w] = {}local P = SuperVillain.db.media.unitframes.Runes[w]P.r, P.g, P.b = Q, R, S;MOD:RefreshUnitFrames()end - } - end - end -end \ No newline at end of file +} \ No newline at end of file