Quantcast

unit names fixed

Steven Jackson [07-13-14 - 06:36]
unit names fixed
Filename
Interface/AddOns/SVUI/packages/unit/SVUnit.lua
Interface/AddOns/SVUI/packages/unit/frames/all_units.lua
Interface/AddOns/SVUI/packages/unit/frames/raid.lua
diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
index 654add2..1d94bfa 100644
--- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
+++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
@@ -265,8 +265,9 @@ function MOD:RefreshUnitColors()
 	oUF_SuperVillain.colors.smooth = {1, 0, 0, 1, 1, 0, r, g, b}
 end

-local RefreshUnitMedia = function(self)
+local RefreshUnitMedia = function(self, unitName)
 	local db = MOD.db
+	local key = unitName or self.___key
 	if(not (db and db.enable) or not self) then return end
 	local CURRENT_BAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.statusbar)
 	local CURRENT_AURABAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.auraBarStatusbar);
@@ -274,7 +275,7 @@ local RefreshUnitMedia = function(self)
 	local CURRENT_AURABAR_FONT = SuperVillain.Shared:Fetch("font", db.auraFont);
 	local CURRENT_AURABAR_FONTSIZE = db.auraFontSize
 	local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline
-	local unitDB = db[self.___key]
+	local unitDB = db[key]
 	if(unitDB and unitDB.enable) then
 		local panel = self.InfoPanel
 		if(panel) then
@@ -316,12 +317,10 @@ local RefreshUnitMedia = function(self)
 			debuffs.textSize = db.auraFontSize
 			debuffs.textOutline = db.auraFontOutline
 		end
-		if(self.RaidDebuffs) then
+		if(self.RaidDebuffs and (unitDB.rdebuffs and unitDB.rdebuffs.enable)) then
 		 	local rdebuffs = self.RaidDebuffs;
-            if unitDB.rdebuffs.enable then
-                rdebuffs.count:SetFontTemplate(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
-                rdebuffs.time:SetFontTemplate(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
-            end
+            rdebuffs.count:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
+            rdebuffs.time:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
         end
 	end
 end
@@ -517,10 +516,11 @@ do
 	end

 	local SecureHeaderMediaUpdate = function(self)
+		local key = self.___key
 		local index = 1;
 		local childFrame = self:GetAttribute("child"..index)
 		while childFrame do
-			RefreshUnitMedia(childFrame)
+			RefreshUnitMedia(childFrame, key)
 			index = index + 1;
 			childFrame = self:GetAttribute("child"..index)
 		end
@@ -564,8 +564,8 @@ do
 		groupUnit.___key = headerName;
 		groupUnit:SetParent(parentFrame)
 		groupUnit:Show()
-		groupUnit.Update = self.HeaderUpdate[headerName]
 		groupUnit.MediaUpdate = SecureHeaderMediaUpdate
+		groupUnit.Update = self.HeaderUpdate[headerName]
 		groupUnit.ClearAllAttributes = SecureHeaderClear
 		return groupUnit
 	end
diff --git a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua b/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua
index 8c3d09b..2e4e426 100644
--- a/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua
+++ b/Interface/AddOns/SVUI/packages/unit/frames/all_units.lua
@@ -103,6 +103,67 @@ do
 		end
 	end
 end
+
+local RefreshUnitMedia = function(self, unitName)
+	local db = MOD.db
+	local key = unitName or self.___key
+	if(not (db and db.enable) or not self) then return end
+	local CURRENT_BAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.statusbar)
+	local CURRENT_AURABAR_TEXTURE = SuperVillain.Shared:Fetch("statusbar", db.auraBarStatusbar);
+	local CURRENT_FONT = SuperVillain.Shared:Fetch("font", db.font)
+	local CURRENT_AURABAR_FONT = SuperVillain.Shared:Fetch("font", db.auraFont);
+	local CURRENT_AURABAR_FONTSIZE = db.auraFontSize
+	local CURRENT_AURABAR_FONTOUTLINE = db.auraFontOutline
+	local unitDB = db[key]
+	if(unitDB and unitDB.enable) then
+		local panel = self.InfoPanel
+		if(panel) then
+			if(panel.Name and unitDB.name) then
+				panel.Name:SetFont(SuperVillain.Shared:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline)
+			end
+			if(panel.Health) then
+				panel.Health:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline)
+			end
+			if(panel.Power) then
+				panel.Power:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline)
+			end
+			if(panel.Misc) then
+				panel.Misc:SetFont(CURRENT_FONT, db.fontSize, db.fontOutline)
+			end
+		end
+		if(self.Health and (unitDB.health and unitDB.health.enable)) then
+			self.Health:SetStatusBarTexture(CURRENT_BAR_TEXTURE)
+		end
+		if(self.Power and (unitDB.power and unitDB.power.enable)) then
+			self.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE)
+		end
+		if(self.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then
+			local ab = self.AuraBars
+			ab.auraBarTexture = CURRENT_AURABAR_TEXTURE
+			ab.textFont = CURRENT_AURABAR_FONT
+			ab.textSize = db.auraFontSize
+			ab.textOutline = db.auraFontOutline
+		end
+		if(self.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then
+			local buffs = self.Buffs
+			buffs.textFont = CURRENT_AURABAR_FONT
+			buffs.textSize = db.auraFontSize
+			buffs.textOutline = db.auraFontOutline
+		end
+		if(self.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then
+			local debuffs = self.Debuffs
+			debuffs.textFont = CURRENT_AURABAR_FONT
+			debuffs.textSize = db.auraFontSize
+			debuffs.textOutline = db.auraFontOutline
+		end
+		if(self.RaidDebuffs and (unitDB.rdebuffs and unitDB.rdebuffs.enable)) then
+		 	local rdebuffs = self.RaidDebuffs;
+            rdebuffs.count:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
+            rdebuffs.time:SetFont(CURRENT_AURABAR_FONT, db.auraFontSize, db.auraFontOutline)
+        end
+	end
+end
+
 local function FindAnchorFrame(frame, anchor, badPoint)
 	if badPoint or anchor == 'FRAME' then
 		return frame
@@ -156,7 +217,9 @@ function MOD:RefreshUnitLayout(frame, template)
 	end

 	if(frame.MediaUpdate) then
-		frame:MediaUpdate()
+		frame:MediaUpdate(template)
+	else
+		RefreshUnitMedia(frame, template)
 	end

 	if(db.portrait and db.portrait.enable) then
diff --git a/Interface/AddOns/SVUI/packages/unit/frames/raid.lua b/Interface/AddOns/SVUI/packages/unit/frames/raid.lua
index 682f5b9..26a2b8a 100644
--- a/Interface/AddOns/SVUI/packages/unit/frames/raid.lua
+++ b/Interface/AddOns/SVUI/packages/unit/frames/raid.lua
@@ -142,9 +142,8 @@ end
 local UpdateRaidFrame = function(self, header)
     local db = MOD.db[header]
     self.colors = oUF_SuperVillain.colors;
-    self:RegisterForClicks(MOD.db.fastClickTarget and"AnyDown"or"AnyUp")
-    if not InCombatLockdown() then self:Size(db.width, db.height)end
-    MOD:RefreshUnitLayout(self, header)
+    self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp")
+    if not InCombatLockdown() then self:Size(db.width, db.height) end
     do
         local rdBuffs = self.RaidDebuffs;
         if db.rdebuffs.enable then
@@ -157,6 +156,7 @@ local UpdateRaidFrame = function(self, header)
         end
     end
     MOD:UpdateAuraWatch(self)
+    MOD:RefreshUnitLayout(self, header)
     self:EnableElement("ReadyCheck")
     self:UpdateAllElements()
 end