PageRenderTime 85ms CodeModel.GetById 23ms app.highlight 50ms RepoModel.GetById 1ms app.codeStats 1ms

/Tukui/modules/unitframes/layouts/smelly.lua

http://github.com/Asphyxia/Tukui
Lua | 2013 lines | 1528 code | 291 blank | 194 comment | 199 complexity | 1e66c26ae5b4086a83d0d338f83e72e3 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1local ADDON_NAME, ns = ...
   2local oUF = ns.oUF or oUF
   3assert(oUF, "Tukui was unable to locate oUF install.")
   4
   5ns._Objects = {}
   6ns._Headers = {}
   7
   8local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
   9if not C["unitframes"].enable == true then return end
  10if C["unitframes"].style ~= "Smelly" then return end
  11
  12------------------------------------------------------------------------
  13--	local variables
  14------------------------------------------------------------------------
  15
  16local font1 = C["media"].uffont
  17local font2 = C["media"].font
  18local font = C["media"].pixelfont
  19local normTex = C["media"].normTex
  20local glowTex = C["media"].glowTex
  21local bubbleTex = C["media"].bubbleTex
  22
  23local backdrop = {
  24	bgFile = C["media"].blank,
  25	insets = {top = -T.mult, left = -T.mult, bottom = -T.mult, right = -T.mult},
  26}
  27
  28------------------------------------------------------------------------
  29--	Layout
  30------------------------------------------------------------------------
  31
  32local function Shared(self, unit)
  33	-- set our own colors
  34	self.colors = T.oUF_colors
  35	
  36	-- register click
  37	self:RegisterForClicks("AnyUp")
  38	self:SetScript('OnEnter', UnitFrame_OnEnter)
  39	self:SetScript('OnLeave', UnitFrame_OnLeave)
  40	
  41	-- menu? lol
  42	self.menu = T.SpawnMenu
  43
  44	------------------------------------------------------------------------
  45	--	Features we want for all units at the same time
  46	------------------------------------------------------------------------
  47	
  48	-- here we create an invisible frame for all element we want to show over health/power.
  49	local InvFrame = CreateFrame("Frame", nil, self)
  50	InvFrame:SetFrameStrata("HIGH")
  51	InvFrame:SetFrameLevel(5)
  52	InvFrame:SetAllPoints()
  53	
  54	-- symbols, now put the symbol on the frame we created above.
  55	local RaidIcon = InvFrame:CreateTexture(nil, "OVERLAY")
  56	RaidIcon:SetTexture("Interface\\AddOns\\Tukui\\medias\\textures\\raidicons.blp") -- thx hankthetank for texture
  57	RaidIcon:SetHeight(20)
  58	RaidIcon:SetWidth(20)
  59	RaidIcon:SetPoint("TOP", 0, 11)
  60	self.RaidIcon = RaidIcon
  61	
  62	------------------------------------------------------------------------
  63	--	Player and Target units layout (mostly mirror'd)
  64	------------------------------------------------------------------------
  65	
  66	if (unit == "player" or unit == "target") then
  67		-- create a panel
  68		local panel = CreateFrame("Frame", nil, self)
  69		if T.lowversion then
  70			panel:CreatePanel("Default", 186, 21, "BOTTOM", self, "BOTTOM", 0, 0)
  71		else
  72			panel:CreatePanel("Default", 186, 21, "BOTTOM", self, "BOTTOM", 0, 0)
  73		end
  74		panel:SetFrameLevel(2)
  75		panel:SetFrameStrata("MEDIUM")
  76		panel:SetBackdropBorderColor(unpack(C["media"].altbordercolor))
  77		panel:SetAlpha(0)
  78		self.panel = panel
  79	
  80		-- health bar
  81		local health = CreateFrame('StatusBar', nil, self)
  82		health:Height(30)
  83		health:SetPoint("TOPLEFT")
  84		health:SetPoint("TOPRIGHT")
  85		health:SetStatusBarTexture(normTex)
  86		
  87		-- Border for HealthBar
  88		local HealthBorder = CreateFrame("Frame", nil, health)
  89		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", T.Scale(-2), T.Scale(2))
  90		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
  91		HealthBorder:SetTemplate("Default")
  92		HealthBorder:CreateShadow("Default")
  93		HealthBorder:SetFrameLevel(2)
  94		self.HealthBorder = HealthBorder
  95				
  96		-- health bar background
  97		local healthBG = health:CreateTexture(nil, 'BORDER')
  98		healthBG:SetAllPoints()
  99		healthBG:SetTexture(0, 0, 0)
 100		
 101		health.value = T.SetFontString(health, font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 102		health.value:Point("RIGHT", health, "RIGHT", -4, 3)
 103		health.PostUpdate = T.PostUpdateHealth
 104				
 105		self.Health = health
 106		self.Health.bg = healthBG
 107
 108		health.frequentUpdates = true
 109		if C["unitframes"].showsmooth == true then
 110			health.Smooth = true
 111		end
 112		
 113		if C["unitframes"].unicolor == true then
 114			health.colorTapping = false
 115			health.colorDisconnected = false
 116			health.colorClass = false
 117			health:SetStatusBarColor(.125, .125, .125, 1)
 118			healthBG:SetVertexColor(0, 0, 0, 1)		
 119		else
 120			health.colorDisconnected = true
 121			health.colorTapping = true	
 122			health.colorClass = true
 123			health.colorReaction = true			
 124		end
 125
 126		-- power
 127		local power = CreateFrame('StatusBar', nil, self)
 128		power:Height(2)
 129		power:Width(215)
 130		if unit == "player" then
 131			power:Point("TOP", health, "BOTTOM", 2, 6)
 132			power:Point("TOPRIGHT", health, "BOTTOMRIGHT", -8, -2)
 133		elseif unit == "target" then
 134			power:Point("TOP", health, "BOTTOM", 2, 6)
 135			power:Point("TOPLEFT", health, "BOTTOMLEFT", 8, 6)
 136		end
 137		power:SetStatusBarTexture(normTex)
 138		power:SetFrameLevel(self.Health:GetFrameLevel() + 2)
 139		
 140		-- Border for Power
 141		local PowerBorder = CreateFrame("Frame", nil, power)
 142		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", T.Scale(-2), T.Scale(2))
 143		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 144		PowerBorder:SetTemplate("Thin")
 145		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
 146		self.PowerBorder = PowerBorder
 147		
 148		local powerBG = power:CreateTexture(nil, 'BORDER')
 149		powerBG:SetAllPoints(power)
 150		powerBG:SetTexture(normTex)
 151		powerBG.multiplier = 0.3
 152		
 153		power.value = T.SetFontString(health, font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 154		power.value:Point("LEFT", health, "LEFT", 6, 3)
 155		power.PreUpdate = T.PreUpdatePower
 156		power.PostUpdate = T.PostUpdatePower
 157				
 158		self.Power = power
 159		self.Power.bg = powerBG
 160		
 161		power.frequentUpdates = true
 162		power.colorDisconnected = true
 163
 164		if C["unitframes"].showsmooth == true then
 165			power.Smooth = true
 166		end
 167		
 168		if C["unitframes"].unicolor == true then
 169			power.colorTapping = true
 170			power.colorClass = true
 171			powerBG.multiplier = 0.1				
 172		else
 173			power.colorPower = true
 174		end
 175		
 176		---Leaving this here, If anyone wants Health Portrait.
 177		
 178		-- name and level
 179		--[[
 180		if (unit == "player") then
 181			local Name = health:CreateFontString(nil, "OVERLAY")
 182			self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort] [Tukui:diffcolor][level] [shortclassification]')
 183			Name:SetPoint("CENTER", health, "CENTER", 0, 1)
 184			Name:SetJustifyH("CENTER")
 185			Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 186			Name:SetShadowColor(0, 0, 0)
 187			Name:SetShadowOffset(1.25, -1.25)
 188			self.Name = Name
 189		end
 190		--]]
 191		
 192		-- portraits
 193		if (C["unitframes"].charportrait == true) then
 194			local portrait = CreateFrame("PlayerModel", nil, health)
 195			portrait:SetFrameLevel(health:GetFrameLevel())
 196			portrait:SetAllPoints(health)
 197			portrait:SetAlpha(.15)
 198			portrait.PostUpdate = T.PortraitUpdate 
 199			self.Portrait = portrait
 200		end
 201			
 202		if (C["unitframes"].classicon == true) then
 203		local classicon = CreateFrame("Frame", self:GetName().."_ClassIconBorder", self)
 204		classicon:CreateShadow("Default")
 205		if unit == "player" then
 206				classicon:CreatePanel("Default", 34, 34, "TOPRIGHT", health, "TOPLEFT", -5,2)
 207		elseif unit == "target" then
 208				classicon:CreatePanel("Default", 34, 34, "TOPLEFT", health, "TOPRIGHT", 5,2)
 209		end
 210
 211		local class = classicon:CreateTexture(self:GetName().."_ClassIcon", "ARTWORK")
 212		class:Point("TOPLEFT", 2, -2)
 213		class:Point("BOTTOMRIGHT", -2, 2)
 214		self.ClassIcon = class
 215	end
 216
 217		if T.myclass == "PRIEST" and C["unitframes"].weakenedsoulbar then
 218			local ws = CreateFrame("StatusBar", self:GetName().."_WeakenedSoul", power)
 219			ws:SetAllPoints(power)
 220			ws:SetStatusBarTexture(C.media.normTex)
 221			ws:GetStatusBarTexture():SetHorizTile(false)
 222			ws:SetBackdrop(backdrop)
 223			ws:SetBackdropColor(unpack(C.media.backdropcolor))
 224			ws:SetStatusBarColor(191/255, 10/255, 10/255)
 225			
 226			self.WeakenedSoul = ws
 227		end
 228		
 229		--[[--leaving here just in case someone want to use it, we now use our own Alt Power Bar.
 230		-- alt power bar
 231		local AltPowerBar = CreateFrame("StatusBar", self:GetName().."_AltPowerBar", self.Health)
 232		AltPowerBar:SetFrameLevel(0)
 233		AltPowerBar:SetFrameStrata("LOW")
 234		AltPowerBar:SetHeight(5)
 235		AltPowerBar:SetStatusBarTexture(C.media.normTex)
 236		AltPowerBar:GetStatusBarTexture():SetHorizTile(false)
 237		AltPowerBar:SetStatusBarColor(163/255,  24/255,  24/255)
 238		AltPowerBar:EnableMouse(true)
 239
 240		AltPowerBar:Point("LEFT", TukuiInfoLeft, 2, -2)
 241		AltPowerBar:Point("RIGHT", TukuiInfoLeft, -2, 2)
 242		AltPowerBar:Point("TOP", TukuiInfoLeft, 2, -2)
 243		AltPowerBar:Point("BOTTOM", TukuiInfoLeft, -2, 2)
 244		
 245		AltPowerBar:SetBackdrop({
 246			bgFile = C["media"].blank, 
 247			edgeFile = C["media"].blank, 
 248			tile = false, tileSize = 0, edgeSize = 1, 
 249			insets = { left = 0, right = 0, top = 0, bottom = T.Scale(-1)}
 250		})
 251		AltPowerBar:SetBackdropColor(0, 0, 0)
 252
 253		self.AltPowerBar = AltPowerBar
 254		--]]
 255			
 256		if (unit == "player") then
 257			-- combat icon
 258			local Combat = health:CreateTexture(nil, "OVERLAY")
 259			Combat:Height(19)
 260			Combat:Width(19)
 261			Combat:SetPoint("CENTER",0,0)
 262			Combat:SetVertexColor(0.69, 0.31, 0.31)
 263			self.Combat = Combat
 264
 265			-- custom info (low mana warning)
 266			FlashInfo = CreateFrame("Frame", "TukuiFlashInfo", self)
 267			FlashInfo:SetScript("OnUpdate", T.UpdateManaLevel)
 268			FlashInfo.parent = self
 269			FlashInfo:SetAllPoints(health)
 270			FlashInfo.ManaLevel = T.SetFontString(FlashInfo, font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 271			FlashInfo.ManaLevel:SetPoint("CENTER", health, "CENTER", 0, 1)
 272			self.FlashInfo = FlashInfo
 273			
 274			-- pvp status icon
 275			local PVP = health:CreateTexture(nil, "OVERLAY")
 276			PVP:SetHeight(T.Scale(32))
 277			PVP:SetWidth(T.Scale(32))
 278			PVP:SetPoint("CENTER", health, "CENTER", 0, -5)
 279			self.PvP = PVP
 280			
 281			-- leader icon
 282			local Leader = InvFrame:CreateTexture(nil, "OVERLAY")
 283			Leader:Height(14)
 284			Leader:Width(14)
 285			Leader:Point("TOPLEFT", -8, 10)
 286			self.Leader = Leader
 287			
 288			-- master looter
 289			local MasterLooter = InvFrame:CreateTexture(nil, "OVERLAY")
 290			MasterLooter:Height(14)
 291			MasterLooter:Width(14)
 292			self.MasterLooter = MasterLooter
 293			self:RegisterEvent("PARTY_LEADER_CHANGED", T.MLAnchorUpdate)
 294			self:RegisterEvent("PARTY_MEMBERS_CHANGED", T.MLAnchorUpdate)
 295
 296			--This is the edited code for the original rep/exp bar
 297			-- experience bar on player via mouseover for player currently levelling a character
 298			if T.level ~= MAX_PLAYER_LEVEL then
 299				local Experience = CreateFrame("StatusBar", self:GetName().."_Experience", self)
 300				Experience:SetStatusBarTexture(normTex)
 301				Experience:SetStatusBarColor(0, 0.4, 1, .8)
 302				Experience:Size(TukuiChatBackgroundLeft:GetWidth() - 4, 2)
 303				Experience:Point("BOTTOM", TukuiChatBackgroundLeft, "TOP", 0, 5)
 304				Experience:SetFrameLevel(8)
 305				Experience:SetFrameStrata("HIGH")
 306				Experience.Tooltip = true
 307				self.Experience = Experience
 308				
 309				local ExperienceBG = Experience:CreateTexture(nil, 'BORDER')
 310				ExperienceBG:SetAllPoints()
 311				ExperienceBG:SetTexture(normTex)
 312				ExperienceBG:SetVertexColor(0,0,0)
 313
 314				Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY')
 315				Experience.Text:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 316				Experience.Text:SetPoint('CENTER', 0, 1)
 317				Experience.Text:SetShadowOffset(T.mult, -T.mult)
 318				self.Experience.Text = Experience.Text
 319				self.Experience.PostUpdate = T.ExperienceText
 320
 321				self.Experience.Rested = CreateFrame('StatusBar', nil, self.Experience)
 322				self.Experience.Rested:SetAllPoints(self.Experience)
 323				self.Experience.Rested:SetStatusBarTexture(normTex)
 324				self.Experience.Rested:SetStatusBarColor(1, 0, 1, 0.2)		
 325				
 326				local Resting = self:CreateTexture(nil, "OVERLAY")
 327				Resting:SetHeight(28)
 328				Resting:SetWidth(28)
 329				Resting:SetPoint("BOTTOMRIGHT", self, "TOPLEFT", 10, -4)
 330				Resting:SetTexture([=[Interface\CharacterFrame\UI-StateIcon]=])
 331				Resting:SetTexCoord(0, 0.5, 0, 0.421875)
 332				self.Resting = Resting
 333
 334				local ExperienceFrame = CreateFrame("Frame", nil, self.Experience)
 335				ExperienceFrame:SetPoint("TOPLEFT", T.Scale(-2), T.Scale(2))
 336				ExperienceFrame:SetPoint("BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 337				ExperienceFrame:SetTemplate("Transparent")
 338				ExperienceFrame:CreateShadow("Default")
 339				ExperienceFrame:SetFrameLevel(self.Experience:GetFrameLevel() - 1)
 340			
 341			local function ModifiedBackdrop(self)
 342				local color = RAID_CLASS_COLORS[T.myclass]
 343				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 344				self:SetBackdropBorderColor(color.r, color.g, color.b)
 345			end
 346
 347			local function OriginalBackdrop(self)
 348				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 349				self:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 350			end
 351		end
 352			
 353			-- reputation bar for max level character
 354			if T.level == MAX_PLAYER_LEVEL then
 355				local Reputation = CreateFrame("StatusBar", self:GetName().."_Reputation", self)
 356				Reputation:SetStatusBarTexture(normTex)
 357				Reputation:Size(TukuiChatBackgroundLeft:GetWidth() - 4, 2)
 358				Reputation:Point("BOTTOM", TukuiChatBackgroundLeft, "TOP", 0, 5)
 359				Reputation:SetFrameLevel(10)
 360				local ReputationBG = Reputation:CreateTexture(nil, 'BORDER')
 361				ReputationBG:SetAllPoints()
 362				ReputationBG:SetTexture(normTex)
 363				ReputationBG:SetVertexColor(0,0,0)
 364
 365				Reputation.Text = Reputation:CreateFontString(nil, 'OVERLAY')
 366				Reputation.Text:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 367				Reputation.Text:SetPoint('CENTER', 0, 1)
 368				Reputation.Text:SetShadowOffset(T.mult, -T.mult)
 369				Reputation.Text:Show()
 370				Reputation.PostUpdate = T.UpdateReputation
 371				Reputation.Text = Reputation.Text
 372
 373				Reputation.PostUpdate = T.UpdateReputationColor
 374				Reputation.Tooltip = true
 375				self.Reputation = Reputation
 376
 377				local ReputationFrame = CreateFrame("Frame", nil, self.Reputation)
 378				ReputationFrame:SetPoint("TOPLEFT", T.Scale(-2), T.Scale(2))
 379				ReputationFrame:SetPoint("BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 380				ReputationFrame:SetTemplate("Transparent")
 381				ReputationFrame:CreateShadow("Default")
 382				ReputationFrame:SetFrameLevel(self.Reputation:GetFrameLevel() - 1)
 383				
 384			local function ModifiedBackdrop(self)
 385				local color = RAID_CLASS_COLORS[T.myclass]
 386				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 387				self:SetBackdropBorderColor(color.r, color.g, color.b)
 388			end
 389
 390			local function OriginalBackdrop(self)
 391				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 392				self:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 393			end
 394		end	
 395	
 396				-- show druid mana when shapeshifted in bear, cat or whatever
 397			if T.myclass == "DRUID" then
 398				CreateFrame("Frame"):SetScript("OnUpdate", function() T.UpdateDruidMana(self) end)
 399				local DruidMana = T.SetFontString(health, font1, 12)
 400				DruidMana:SetTextColor(1, 0.49, 0.04)
 401				self.DruidManaText = DruidMana
 402			end
 403
 404			if C["unitframes"].classbar then
 405				if T.myclass == "DRUID" then
 406					-- DRUID MANA BAR
 407					local DruidManaBackground = CreateFrame("Frame", nil, self)
 408					DruidManaBackground:Point("TOPLEFT", health, "TOPLEFT", 7, 5)
 409					DruidManaBackground:Size(85, 5)
 410					DruidManaBackground:SetFrameStrata("MEDIUM")
 411					DruidManaBackground:SetFrameLevel(8)
 412					DruidManaBackground:SetTemplate("Default")
 413					DruidManaBackground:SetBackdropBorderColor(0,0,0,0)
 414					
 415					local DruidManaBarStatus = CreateFrame('StatusBar', nil, DruidManaBackground)
 416					DruidManaBarStatus:SetPoint('LEFT', DruidManaBackground, 'LEFT', 0, 0)
 417					DruidManaBarStatus:SetSize(DruidManaBackground:GetWidth(), DruidManaBackground:GetHeight())
 418					DruidManaBarStatus:SetStatusBarTexture(normTex)
 419					DruidManaBarStatus:SetStatusBarColor(.30, .52, .90)
 420					
 421					DruidManaBarStatus:SetScript("OnShow", function() T.DruidBarDisplay(self, false) end)
 422					DruidManaBarStatus:SetScript("OnUpdate", function() T.DruidBarDisplay(self, true) end) -- just forcing 1 update on login for buffs/shadow/etc.
 423					DruidManaBarStatus:SetScript("OnHide", function() T.DruidBarDisplay(self, false) end)
 424					
 425					self.DruidManaBackground = DruidManaBackground
 426					self.DruidMana = DruidManaBarStatus
 427					
 428					DruidManaBackground.FrameBackdrop = CreateFrame( "Frame", nil, DruidManaBackground )
 429					DruidManaBackground.FrameBackdrop:SetTemplate( "Default" )
 430					DruidManaBackground.FrameBackdrop:SetPoint( "TOPLEFT", -2, 2 )
 431					DruidManaBackground.FrameBackdrop:SetPoint( "BOTTOMRIGHT", 2, -2 )
 432					DruidManaBackground.FrameBackdrop:SetFrameLevel( DruidManaBackground:GetFrameLevel() - 1 )
 433					
 434					local eclipseBar = CreateFrame('Frame', nil, self)
 435					eclipseBar:Point("TOPLEFT", health, "TOPLEFT", 7, 5)
 436					eclipseBar:Size(85, 5)
 437					eclipseBar:SetFrameStrata("MEDIUM")
 438					eclipseBar:SetFrameLevel(8)
 439					eclipseBar:SetBackdropBorderColor(0,0,0,0)
 440					eclipseBar:SetScript("OnShow", function() T.DruidBarDisplay(self, false) end)
 441					eclipseBar:SetScript("OnHide", function() T.DruidBarDisplay(self, false) end)
 442					
 443					local lunarBar = CreateFrame('StatusBar', nil, eclipseBar)
 444					lunarBar:SetPoint('LEFT', eclipseBar, 'LEFT', 0, 0)
 445					lunarBar:SetSize(DruidManaBackground:GetWidth(), DruidManaBackground:GetHeight())
 446					lunarBar:SetStatusBarTexture(normTex)
 447					lunarBar:SetStatusBarColor(.30, .52, .90)
 448					eclipseBar.LunarBar = lunarBar
 449
 450					local solarBar = CreateFrame('StatusBar', nil, eclipseBar)
 451					solarBar:SetPoint('LEFT', lunarBar:GetStatusBarTexture(), 'RIGHT', 0, 0)
 452					solarBar:SetSize(DruidManaBackground:GetWidth(), DruidManaBackground:GetHeight())
 453					solarBar:SetStatusBarTexture(normTex)
 454					solarBar:SetStatusBarColor(.80, .82,  .60)
 455					eclipseBar.SolarBar = solarBar
 456
 457					local eclipseBarText = DruidManaBackground:CreateFontString(nil, 'OVERLAY')
 458					eclipseBarText:SetPoint('TOP', eclipseBar, 0, 25)
 459					eclipseBarText:SetPoint('BOTTOM', eclipseBar)
 460					eclipseBarText:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 461					eclipseBarText:SetShadowOffset(T.mult, -T.mult)
 462					eclipseBarText:SetShadowColor(0, 0, 0, 0.4)
 463					eclipseBar.PostUpdatePower = T.EclipseDirection
 464					
 465					-- hide "low mana" text on load if eclipseBar is show
 466					if eclipseBar and DruidManaBackground:IsShown() then FlashInfo.ManaLevel:SetAlpha(0) end
 467
 468					self.EclipseBar = eclipseBar
 469					self.EclipseBar.Text = eclipseBarText
 470					
 471					eclipseBar.FrameBackdrop = CreateFrame("Frame", nil, eclipseBar)
 472					eclipseBar.FrameBackdrop:SetTemplate("Default")
 473					eclipseBar.FrameBackdrop:SetPoint("TOPLEFT", T.Scale(-2), T.Scale(2))
 474					eclipseBar.FrameBackdrop:SetPoint("BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 475					eclipseBar.FrameBackdrop:SetFrameLevel(DruidManaBackground:GetFrameLevel() - 1)
 476				end
 477
 478				-- set holy power bar or shard bar
 479				if (T.myclass == "WARLOCK" or T.myclass == "PALADIN") then
 480		
 481					local bars = CreateFrame("Frame", nil, self)
 482                    bars:Size(15, 11)
 483					bars:Point("TOPLEFT", health, "TOPLEFT", 7, 8)
 484					bars:SetBackdropBorderColor(0,0,0,0)
 485					bars:SetFrameLevel(self:GetFrameLevel() + 3)
 486					bars:SetFrameStrata("HIGH")
 487					
 488					for i = 1, 3 do					
 489						bars[i]=CreateFrame("StatusBar", self:GetName().."_Shard"..i, bars)
 490						bars[i]:Height(7)					
 491						bars[i]:SetStatusBarTexture(normTex)
 492						bars[i]:GetStatusBarTexture():SetHorizTile(false)
 493						
 494						if T.myclass == "WARLOCK" then
 495							bars[i]:SetStatusBarColor(148/255, 130/255, 201/255)
 496						elseif T.myclass == "PALADIN" then
 497							bars[i]:SetStatusBarColor(228/255,225/255,16/255)
 498						end
 499						
 500						if i == 1 then
 501							bars[i]:SetPoint("LEFT", bars)
 502							bars[i]:SetWidth(T.Scale(20 /2)) 
 503						else
 504							bars[i]:Point("LEFT", bars[i-1], "RIGHT", T.Scale(8), 0)
 505							bars[i]:SetWidth(T.Scale(20/2))
 506						end
 507						
 508						bars[i].border = CreateFrame("Frame", nil, bars)
 509					    bars[i].border:SetPoint("TOPLEFT", bars[i], "TOPLEFT", T.Scale(-2), T.Scale(2))
 510					    bars[i].border:SetPoint("BOTTOMRIGHT", bars[i], "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 511					    bars[i].border:SetFrameStrata("MEDIUM")
 512						bars[i].border:SetFrameLevel(6)
 513						bars[i]:SetFrameLevel(2)
 514						bars[i]:SetFrameStrata("HIGH")
 515					    bars[i].border:SetTemplate("Default")
 516					    bars[i].border:CreateShadow("Default")
 517						--bars[i].border:SetBackdropColor(.1,.1,.1,1)
 518					end
 519					
 520					if T.myclass == "WARLOCK" then
 521						bars.Override = T.UpdateShards				
 522						self.SoulShards = bars
 523					elseif T.myclass == "PALADIN" then
 524						bars.Override = T.UpdateHoly
 525						self.HolyPower = bars
 526					end
 527				end	
 528
 529			-- deathknight runes
 530				if T.myclass == "DEATHKNIGHT" then
 531					
 532				local Runes = CreateFrame("Frame", nil, self)
 533                Runes:Point("TOPLEFT", health, "TOPLEFT", 7, 5)
 534                Runes:Size(30, 5)
 535				Runes:SetFrameLevel(self:GetFrameLevel() + 3)
 536				Runes:SetFrameStrata("MEDIUM")
 537
 538				for i = 1, 6 do
 539                    Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
 540                    Runes[i]:SetHeight(T.Scale(7))
 541
 542                if i == 1 then
 543                        Runes[i]:SetPoint("LEFT", Runes, "LEFT", 0, 0)
 544						Runes[i]:SetWidth(T.Scale(20 /2))
 545                    else
 546                        Runes[i]:SetPoint("LEFT", Runes[i-1], "RIGHT", T.Scale(5), 0)
 547						Runes[i]:SetWidth(T.Scale(20 /2))
 548                    end
 549                    Runes[i]:SetStatusBarTexture(normTex)
 550                    Runes[i]:GetStatusBarTexture():SetHorizTile(false)
 551					Runes[i]:SetBackdrop(backdrop)
 552                    Runes[i]:SetBackdropColor(0,0,0)
 553                    Runes[i]:SetFrameLevel(4)
 554                    
 555                    Runes[i].bg = Runes[i]:CreateTexture(nil, "BORDER")
 556                    Runes[i].bg:SetAllPoints(Runes[i])
 557                    Runes[i].bg:SetTexture(normTex)
 558                    Runes[i].bg.multiplier = 0.3
 559					
 560					Runes[i].border = CreateFrame("Frame", nil, Runes[i])
 561					Runes[i].border:SetPoint("TOPLEFT", Runes[i], "TOPLEFT", T.Scale(-2), T.Scale(2))
 562					Runes[i].border:SetPoint("BOTTOMRIGHT", Runes[i], "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 563					Runes[i].border:SetFrameStrata("MEDIUM")
 564                    Runes[i].border:SetFrameLevel(4)					
 565					Runes[i].border:SetTemplate("Default")
 566					Runes[i].border:CreateShadow("Default")
 567					Runes[i]:SetOrientation'VERTICAL'
 568                end
 569
 570                    self.Runes = Runes
 571                end
 572		
 573		-- shaman totem bar
 574				if T.myclass == "SHAMAN" then
 575				local TotemBar = {}
 576					TotemBar.Destroy = true
 577					for i = 1, 4 do
 578						TotemBar[i] = CreateFrame("StatusBar", self:GetName().."_TotemBar"..i, self)
 579						TotemBar[i]:SetFrameLevel(self:GetFrameLevel() + 3)
 580						if (i == 1) then
 581					    TotemBar[i]:Point("TOPLEFT", health, "TOPLEFT", 7, 5) else
 582					    TotemBar[i]:SetPoint("TOPLEFT", TotemBar[i-1], "TOPRIGHT", T.Scale(7), 0)
 583					end
 584					TotemBar[i]:SetStatusBarTexture(normTex)
 585					TotemBar[i]:SetHeight(T.Scale(7))
 586					TotemBar[i]:SetWidth(T.Scale(20) / 2)
 587					TotemBar[i]:SetFrameLevel(4)
 588				
 589					TotemBar[i]:SetBackdrop(backdrop)
 590					TotemBar[i]:SetBackdropColor(0, 0, 0, 1)
 591					TotemBar[i]:SetMinMaxValues(0, 1)
 592
 593					TotemBar[i].bg = TotemBar[i]:CreateTexture(nil, "BORDER")
 594					TotemBar[i].bg:SetAllPoints(TotemBar[i])
 595					TotemBar[i].bg:SetTexture(normTex)
 596					TotemBar[i].bg.multiplier = 0.2
 597					
 598					TotemBar[i].border = CreateFrame("Frame", nil, TotemBar[i])
 599					TotemBar[i].border:SetPoint("TOPLEFT", TotemBar[i], "TOPLEFT", T.Scale(-2), T.Scale(2))
 600					TotemBar[i].border:SetPoint("BOTTOMRIGHT", TotemBar[i], "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 601					TotemBar[i].border:SetFrameStrata("MEDIUM")
 602					TotemBar[i].border:SetFrameLevel(4)
 603					TotemBar[i]:SetFrameLevel(4)
 604					TotemBar[i]:SetFrameStrata("MEDIUM")
 605					TotemBar[i].border:SetTemplate("Default")
 606					TotemBar[i].border:CreateShadow("Default")
 607					TotemBar[i]:SetOrientation'VERTICAL'
 608				end
 609				self.TotemBar = TotemBar
 610			end
 611		end	
 612			
 613			-- script for pvp status and low mana
 614			self:SetScript("OnEnter", function(self)
 615				if self.EclipseBar and self.DruidManaBackground:IsShown() then 
 616					self.EclipseBar.Text:Hide()
 617				end
 618				FlashInfo.ManaLevel:Hide()
 619				UnitFrame_OnEnter(self) 
 620			end)
 621			self:SetScript("OnLeave", function(self) 
 622				if self.EclipseBar and self.DruidManaBackground:IsShown() then 
 623					self.EclipseBar.Text:Show()
 624				end
 625				FlashInfo.ManaLevel:Show()
 626				UnitFrame_OnLeave(self) 
 627			end)
 628		end
 629		
 630		-- Unit name on target
 631		if (unit == "target") then			
 632			local Name = health:CreateFontString(nil, "OVERLAY")
 633			--Name:Point("LEFT", health, "LEFT", 4, 3)
 634			Name:Point("CENTER", health, "CENTER", 0, 12)
 635			Name:SetJustifyH("LEFT")
 636			Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 637			Name:SetShadowOffset(1.25, -1.25)
 638
 639			self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort] [Tukui:diffcolor][level] [shortclassification]')
 640			self.Name = Name
 641			
 642			-- Combo points on target (manipulated for sCombo compatibility)
 643			local cp = T.SetFontString(self, font2, 15, "THINOUTLINE")
 644			cp:SetPoint("RIGHT", health.border, "LEFT", -5, 0)
 645			
 646			self.CPoints = cp
 647		end
 648
 649		if (unit == "target" and C["unitframes"].targetauras) or (unit == "player" and C["unitframes"].playerauras) then
 650			local buffs = CreateFrame("Frame", nil, self)
 651			local debuffs = CreateFrame("Frame", nil, self)
 652			
 653			if (T.myclass == "SHAMAN" or T.myclass == "DEATHKNIGHT" or T.myclass == "PALADIN" or T.myclass == "WARLOCK") and (C["unitframes"].playerauras) and (unit == "player") then
 654				if T.lowversion then
 655					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 34)
 656				else
 657					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 38)
 658				end
 659			else
 660				if T.lowversion then
 661					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 26)
 662				else
 663					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 32)
 664				end
 665			end
 666			
 667			if T.lowversion then
 668				buffs:SetHeight(21.5)
 669				buffs:SetWidth(186)
 670				buffs.size = 21.5
 671				buffs.num = 8
 672				
 673				debuffs:SetHeight(21.5)
 674				debuffs:SetWidth(186)
 675				debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", 0, 2)
 676				debuffs.size = 21.5	
 677				debuffs.num = 24
 678			else				
 679				buffs:SetHeight(26)
 680				buffs:SetWidth(252)
 681				buffs.size = 27.5
 682				buffs.num = 8
 683				
 684				debuffs:SetHeight(26)
 685				debuffs:SetWidth(247)
 686				debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", -2, 2)
 687				debuffs.size = 26
 688				debuffs.num = 24
 689			end
 690						
 691			buffs.spacing = 2
 692			buffs.initialAnchor = 'TOPLEFT'
 693			buffs.PostCreateIcon = T.PostCreateAura
 694			buffs.PostUpdateIcon = T.PostUpdateAura
 695			self.Buffs = buffs	
 696						
 697			debuffs.spacing = 2
 698			debuffs.initialAnchor = 'TOPRIGHT'
 699			debuffs["growth-y"] = "UP"
 700			debuffs["growth-x"] = "LEFT"
 701			debuffs.PostCreateIcon = T.PostCreateAura
 702			debuffs.PostUpdateIcon = T.PostUpdateAura
 703			
 704			-- An option to show only our debuffs on target
 705			if unit == "target" then
 706				debuffs.onlyShowPlayer = C.unitframes.onlyselfdebuffs
 707			end
 708			
 709			self.Debuffs = debuffs
 710		end
 711		
 712		-- cast bar for player and target
 713		if (C["unitframes"].unitcastbar == true) then
 714			local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
 715			castbar:SetStatusBarTexture(normTex)
 716			
 717			castbar.bg = castbar:CreateTexture(nil, "BORDER")
 718			castbar.bg:SetAllPoints(castbar)
 719			castbar.bg:SetTexture(normTex)
 720			castbar.bg:SetVertexColor(.05, .05, .05)
 721			if unit == "player" then
 722				if C["unitframes"].cbicons == true then
 723					castbar:SetWidth(TukuiBar1:GetWidth() - 31)
 724				else
 725					castbar:SetWidth(TukuiBar1:GetWidth() - 4)
 726				end
 727				castbar:SetHeight(20)
 728				castbar:Point("BOTTOMRIGHT", TukuiBar1, "TOPRIGHT", -2, 5)
 729			elseif unit == "target" then
 730				if C["unitframes"].cbicons == true then
 731					castbar:SetWidth(225 - 28)
 732				else
 733					castbar:SetWidth(246)
 734				end
 735				castbar:SetHeight(20)
 736				castbar:Point("TOPRIGHT", self, "BOTTOMRIGHT", 0, 20)
 737			end
 738			castbar:SetFrameLevel(6)
 739			
 740			if( C["unitframes"].cbspark == true ) then
 741					castbar.Spark = castbar:CreateTexture(nil, 'OVERLAY')
 742					castbar.Spark:SetHeight(36)
 743					castbar.Spark:SetWidth(15)
 744					castbar.Spark:SetBlendMode('ADD')
 745				end
 746
 747			-- Border
 748			castbar.border = CreateFrame("Frame", nil, castbar)
 749			castbar.border:CreatePanel("Default",1,1,"TOPLEFT", castbar, "TOPLEFT", -2, 2)
 750			castbar.border:CreateShadow("Default")
 751			castbar.border:Point("BOTTOMRIGHT", castbar, "BOTTOMRIGHT", 2, -2)
 752			
 753			castbar.CustomTimeText = T.CustomCastTimeText
 754			castbar.CustomDelayText = T.CustomCastDelayText
 755			castbar.PostCastStart = T.PostCastStart
 756			castbar.PostChannelStart = T.PostCastStart
 757
 758			castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 759			castbar.time:Point("RIGHT", castbar.bg, "RIGHT", -4, 0)
 760			castbar.time:SetTextColor(0, 4, 0)
 761			castbar.time:SetJustifyH("RIGHT")
 762
 763			castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 764			castbar.Text:Point("LEFT", castbar.bg, "LEFT", 4, 0)
 765			castbar.Text:SetTextColor(0.3, 0.2, 1)
 766			castbar.Text:Width(100)
 767			castbar.Text:Height(10)
 768			
 769			if C["unitframes"].cbicons == true then
 770				castbar.button = CreateFrame("Frame", nil, castbar)
 771				castbar.button:Size(24)
 772				castbar.button:SetTemplate("Default")
 773				castbar.button:CreateShadow("Default")
 774				castbar.button:SetPoint("RIGHT",castbar,"LEFT", -5, 0)
 775
 776				castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
 777				castbar.icon:Point("TOPLEFT", castbar.button, 2, -2)
 778				castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
 779				castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
 780			end
 781			
 782			-- cast bar latency on player
 783			if unit == "player" and C["unitframes"].cblatency == true then
 784				castbar.safezone = castbar:CreateTexture(nil, "ARTWORK")
 785				castbar.safezone:SetTexture(normTex)
 786				castbar.safezone:SetVertexColor(0.8, 0.2, 0.2, 0.75)
 787				castbar.SafeZone = castbar.safezone
 788			end
 789					
 790			self.Castbar = castbar
 791			self.Castbar.Time = castbar.time
 792			self.Castbar.Icon = castbar.icon
 793		end
 794		
 795		-- add combat feedback support
 796		if C["unitframes"].combatfeedback == true then
 797			local CombatFeedbackText 
 798			CombatFeedbackText = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 799			CombatFeedbackText:SetPoint("CENTER", 0, 1)
 800			CombatFeedbackText.colors = {
 801				DAMAGE = {0.69, 0.31, 0.31},
 802				CRUSHING = {0.69, 0.31, 0.31},
 803				CRITICAL = {0.69, 0.31, 0.31},
 804				GLANCING = {0.69, 0.31, 0.31},
 805				STANDARD = {0.84, 0.75, 0.65},
 806				IMMUNE = {0.84, 0.75, 0.65},
 807				ABSORB = {0.84, 0.75, 0.65},
 808				BLOCK = {0.84, 0.75, 0.65},
 809				RESIST = {0.84, 0.75, 0.65},
 810				MISS = {0.84, 0.75, 0.65},
 811				HEAL = {0.33, 0.59, 0.33},
 812				CRITHEAL = {0.33, 0.59, 0.33},
 813				ENERGIZE = {0.31, 0.45, 0.63},
 814				CRITENERGIZE = {0.31, 0.45, 0.63},
 815			}
 816			self.CombatFeedbackText = CombatFeedbackText
 817		end
 818		
 819		if C["unitframes"].healcomm then
 820			local mhpb = CreateFrame('StatusBar', nil, self.Health)
 821			mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
 822			mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
 823			if T.lowversion then
 824				mhpb:SetWidth(186)
 825			else
 826				mhpb:SetWidth(250)
 827			end
 828			mhpb:SetStatusBarTexture(normTex)
 829			mhpb:SetStatusBarColor(0, 1, 0.5, 0.25)
 830			mhpb:SetMinMaxValues(0,1)
 831
 832			local ohpb = CreateFrame('StatusBar', nil, self.Health)
 833			ohpb:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
 834			ohpb:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
 835			ohpb:SetWidth(250)
 836			ohpb:SetStatusBarTexture(normTex)
 837			ohpb:SetStatusBarColor(0, 1, 0, 0.25)
 838
 839			self.HealPrediction = {
 840				myBar = mhpb,
 841				otherBar = ohpb,
 842				maxOverflow = 1,
 843			}
 844		end
 845		
 846		-- player aggro
 847		if C["unitframes"].playeraggro == true then
 848			table.insert(self.__elements, T.UpdateThreat)
 849			self:RegisterEvent('PLAYER_TARGET_CHANGED', T.UpdateThreat)
 850			self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', T.UpdateThreat)
 851			self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', T.UpdateThreat)
 852		end
 853	end
 854	
 855	------------------------------------------------------------------------
 856	--	Target of Target unit layout
 857	------------------------------------------------------------------------
 858	
 859	if (unit == "targettarget") then
 860		
 861		-- create panel for both high and low version
 862		local panel = CreateFrame("Frame", nil, self)
 863		if T.lowversion then
 864			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 865			panel:SetFrameLevel(2)
 866			panel:SetFrameStrata("MEDIUM")
 867			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 868			panel:SetAlpha(0)
 869			self.panel = panel
 870		else
 871			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 872			panel:SetFrameLevel(2)
 873			panel:SetFrameStrata("MEDIUM")
 874			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 875			panel:SetAlpha(0)
 876			self.panel = panel
 877		end
 878		
 879		-- health bar
 880		local health = CreateFrame('StatusBar', nil, self)
 881		health:Height(20)
 882		health:SetPoint("TOPLEFT")
 883		health:SetPoint("TOPRIGHT")
 884		health:SetStatusBarTexture(normTex)
 885		
 886		-- Border for ToT
 887		local HealthBorder = CreateFrame("Frame", nil, health)
 888		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", T.Scale(-2), T.Scale(2))
 889		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 890		HealthBorder:SetTemplate("Default")
 891		HealthBorder:CreateShadow("Default")
 892		HealthBorder:SetFrameLevel(2)
 893		self.HealthBorder = HealthBorder
 894		
 895		local healthBG = health:CreateTexture(nil, 'BORDER')
 896		healthBG:SetAllPoints()
 897		healthBG:SetTexture(0, 0, 0)
 898		
 899		self.Health = health
 900		self.Health.bg = healthBG
 901		
 902		health.frequentUpdates = true
 903		if C["unitframes"].showsmooth == true then
 904			health.Smooth = true
 905		end
 906					
 907		-- power
 908		local power = CreateFrame('StatusBar', nil, self)
 909		power:Height(2)
 910		power:Point("TOPLEFT", health, "BOTTOMLEFT", 9, 5)
 911		power:Point("TOPRIGHT", health, "BOTTOMRIGHT", -9, -2)
 912		power:SetStatusBarTexture(normTex)
 913		power:SetFrameLevel(self.Health:GetFrameLevel() + 2)
 914		
 915		-- Border for Power
 916		local PowerBorder = CreateFrame("Frame", nil, power)
 917		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", T.Scale(-2), T.Scale(2))
 918		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 919		PowerBorder:SetTemplate("Thin")
 920		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
 921		self.PowerBorder = PowerBorder
 922		
 923		power.frequentUpdates = true
 924		power.colorPower = true
 925		if C["unitframes"].showsmooth == true then
 926			power.Smooth = true
 927		end
 928
 929		local powerBG = power:CreateTexture(nil, 'BORDER')
 930		powerBG:SetAllPoints(power)
 931		powerBG:SetTexture(normTex)
 932		powerBG.multiplier = 0.3
 933				
 934		self.Power = power
 935		self.Power.bg = powerBG
 936
 937		if C["unitframes"].showsmooth == true then
 938			power.Smooth = true
 939		end
 940		
 941		if C["unitframes"].unicolor == true then
 942			health.colorDisconnected = false
 943			health.colorClass = false
 944			health:SetStatusBarColor(.150, .150, .150, 1)
 945			healthBG:SetVertexColor(0, 0, 0, 1)		
 946		else
 947			health.colorDisconnected = true
 948			health.colorClass = true
 949			health.colorReaction = true			
 950		end
 951		
 952		-- name and level
 953		local Name = health:CreateFontString(nil, "OVERLAY")
 954		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort] [Tukui:diffcolor][level] [shortclassification]')
 955		Name:SetPoint("CENTER", health, "CENTER", 2, 4)
 956		Name:SetJustifyH("CENTER")
 957		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 958		Name:SetShadowColor(0, 0, 0)
 959		Name:SetShadowOffset(1.25, -1.25)
 960		self.Name = Name
 961		
 962		--[[
 963		-- portraits
 964		if (C["unitframes"].charportrait == true) then
 965			local portrait = CreateFrame("PlayerModel", nil, health)
 966			portrait.PostUpdate = function(self) self:SetAlpha(0) self:SetAlpha(0.15) end -- edit the 0.15 to the alpha you want
 967			portrait:SetAllPoints(health)
 968			table.insert(self.__elements, T.HidePortrait)
 969			self.Portrait = portrait
 970		end
 971		--]]
 972		
 973		if C["unitframes"].totdebuffs == true and T.lowversion ~= true then
 974			local debuffs = CreateFrame("Frame", nil, health)
 975			debuffs:SetHeight(20)
 976			debuffs:SetWidth(127)
 977			debuffs.size = 20
 978			debuffs.spacing = 2
 979			debuffs.num = 6
 980
 981			debuffs:SetPoint("TOPLEFT", health, "TOPLEFT", -0.5, 24)
 982			debuffs.initialAnchor = "TOPLEFT"
 983			debuffs["growth-y"] = "UP"
 984			debuffs.PostCreateIcon = T.PostCreateAura
 985			debuffs.PostUpdateIcon = T.PostUpdateAura
 986			self.Debuffs = debuffs
 987		end
 988	end
 989	
 990	------------------------------------------------------------------------
 991	--	Pet unit layout
 992	------------------------------------------------------------------------
 993	
 994	if (unit == "pet") then
 995	
 996		-- create panel for both high and low version
 997		local panel = CreateFrame("Frame", nil, self)
 998		if T.lowversion then
 999			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
1000			panel:SetFrameLevel(2)
1001			panel:SetFrameStrata("MEDIUM")
1002			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1003			panel:SetAlpha(0)
1004			self.panel = panel
1005		else
1006			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
1007			panel:SetFrameLevel(2)
1008			panel:SetFrameStrata("MEDIUM")
1009			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1010			panel:SetAlpha(0)
1011			self.panel = panel
1012		end
1013		
1014		-- health bar
1015		local health = CreateFrame('StatusBar', nil, self)
1016		if C["unitframes"].extendedpet == true then
1017			health:Height(20)
1018		else
1019			health:Height(16)
1020		end
1021		health:SetPoint("TOPLEFT")
1022		health:SetPoint("TOPRIGHT")
1023		health:SetStatusBarTexture(normTex)
1024		
1025		-- Border for Health
1026		local HealthBorder = CreateFrame("Frame", nil, health)
1027		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", T.Scale(-2), T.Scale(2))
1028		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
1029		HealthBorder:SetTemplate("Default")
1030		HealthBorder:CreateShadow("Default")
1031		HealthBorder:SetFrameLevel(2)
1032		self.HealthBorder = HealthBorder
1033		
1034		health.PostUpdate = T.PostUpdatePetColor
1035				
1036		self.Health = health
1037		self.Health.bg = healthBG
1038		
1039		local healthBG = health:CreateTexture(nil, 'BORDER')
1040		healthBG:SetAllPoints()
1041		healthBG:SetTexture(0, 0, 0)
1042		
1043		health.frequentUpdates = true
1044		if C["unitframes"].showsmooth == true then
1045			health.Smooth = true
1046		end
1047		
1048		if C["unitframes"].unicolor == true then
1049			health.colorDisconnected = false
1050			health.colorClass = false
1051			health:SetStatusBarColor(.150, .150, .150, 1)
1052			healthBG:SetVertexColor(0, 0, 0, 1)		
1053		else
1054			health.colorDisconnected = true	
1055			health.colorClass = true
1056			health.colorReaction = true	
1057			if T.myclass == "HUNTER" then
1058				health.colorHappiness = true
1059			end
1060		end
1061		
1062		-- power
1063		if C["unitframes"].extendedpet == true then
1064			local power = CreateFrame('StatusBar', nil, self)
1065			power:Height(2)
1066			power:Point("TOPLEFT", health, "BOTTOMLEFT", 9, 6)
1067			power:Point("TOPRIGHT", health, "BOTTOMRIGHT", -9, -2)
1068			power:SetStatusBarTexture(normTex)
1069			power:SetFrameLevel(self.Health:GetFrameLevel() + 2)
1070
1071			power.frequentUpdates = true
1072			power.colorPower = true
1073			if C["unitframes"].showsmooth == true then
1074				power.Smooth = true
1075			end
1076
1077			local powerBG = power:CreateTexture(nil, 'BORDER')
1078			powerBG:SetAllPoints(power)
1079			powerBG:SetTexture(normTex)
1080			powerBG.multiplier = 0.3
1081			
1082			-- Border for Power
1083			local PowerBorder = CreateFrame("Frame", nil, power)
1084			PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", T.Scale(-2), T.Scale(2))
1085			PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
1086			PowerBorder:SetTemplate("Thin")
1087			PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1088			self.PowerBorder = PowerBorder
1089
1090			self.Power = power
1091			self.Power.bg = powerBG
1092		end
1093		
1094		-- Unit name
1095		local Name = health:CreateFontString(nil, "OVERLAY")
1096		Name:Point("CENTER", health, "CENTER", 0, 5)
1097		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1098		Name:SetJustifyH("CENTER")
1099		Name:SetShadowOffset(1.25, -1.25)
1100
1101		self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
1102		self.Name = Name
1103		
1104		--[[
1105		-- portraits
1106		if (C["unitframes"].charportrait == true) then
1107			local portrait = CreateFrame("PlayerModel", nil, health)
1108			portrait.PostUpdate = function(self) self:SetAlpha(0) self:SetAlpha(0.15) end -- edit the 0.15 to the alpha you want
1109			portrait:SetAllPoints(health)
1110			table.insert(self.__elements, T.HidePortrait)
1111			self.Portrait = portrait
1112		end
1113		--]]
1114		
1115		-- update pet name, this should fix "UNKNOWN" pet names on pet unit, health and bar color sometime being "grayish".
1116		self:RegisterEvent("UNIT_PET", T.updateAllElements)
1117	end
1118	
1119	------------------------------------------------------------------------
1120	--	Pet target unit layout
1121	------------------------------------------------------------------------
1122	
1123	if (unit == "pettarget") then
1124		-- health bar
1125		local health = CreateFrame('StatusBar', nil, self)
1126		health:Height(15)
1127		health:SetPoint("TOPLEFT")
1128		health:SetPoint("TOPRIGHT")
1129		health:SetStatusBarTexture(normTex)
1130		
1131		-- Border for ToT
1132		local HealthBorder = CreateFrame("Frame", nil, health)
1133		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1134		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1135		HealthBorder:SetTemplate("Default")
1136		HealthBorder:CreateShadow("Default")
1137		HealthBorder:SetFrameLevel(2)
1138		self.HealthBorder = HealthBorder
1139		
1140		local healthBG = health:CreateTexture(nil, 'BORDER')
1141		healthBG:SetAllPoints()
1142		healthBG:SetTexture(0, 0, 0)
1143		
1144		self.Health = health
1145		self.Health.bg = healthBG
1146		
1147		health.frequentUpdates = true
1148		if C["unitframes"].showsmooth == true then
1149			health.Smooth = true
1150		end
1151		
1152		if C["unitframes"].unicolor == true then
1153			health.colorDisconnected = false
1154			health.colorClass = false
1155			health:SetStatusBarColor(.150, .150, .150, 1)
1156			healthBG:SetVertexColor(0, 0, 0, 1)		
1157		else
1158			health.colorDisconnected = true
1159			health.colorClass = true
1160			health.colorReaction = true			
1161		end
1162		
1163		-- power
1164		local power = CreateFrame('StatusBar', nil, self)
1165		power:Size(128, 2)
1166		power:Point("TOP", health, "BOTTOM", 0, -7)
1167		power:SetStatusBarTexture(normTex)
1168		
1169		-- Border for Power
1170		local PowerBorder = CreateFrame("Frame", nil, power)
1171		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1172		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1173		PowerBorder:SetTemplate("Default")
1174		PowerBorder:CreateShadow("Default")
1175		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1176		self.PowerBorder = PowerBorder
1177		
1178		power.frequentUpdates = true
1179
1180		if C["unitframes"].showsmooth == true then
1181			power.Smooth = true
1182		end
1183
1184		local powerBG = power:CreateTexture(nil, 'BORDER')
1185		powerBG:SetAllPoints(power)
1186		powerBG:SetTexture(normTex)
1187		powerBG.multiplier = 0.3
1188				
1189		self.Power = power
1190		self.Power.bg = powerBG
1191
1192		if C["unitframes"].showsmooth == true then
1193			power.Smooth = true
1194		end
1195		
1196		if C["unitframes"].unicolor == true then
1197			power.colorTapping = true
1198			power.colorClass = true
1199			power.colorReaction = true
1200			powerBG.multiplier = 0.1				
1201		else
1202			power.colorPower = true
1203		end
1204		
1205		-- Unit name
1206		local Name = health:CreateFontString(nil, "OVERLAY")
1207		Name:SetPoint("CENTER", self.Health, "CENTER", 0, 1)
1208		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1209		Name:SetJustifyH("CENTER")
1210
1211		self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
1212		self.Name = Name
1213		
1214		-- update pet name, this should fix "UNKNOWN" pet names on pet unit, health and bar color sometime being "grayish".
1215		self:RegisterEvent("UNIT_PET", T.updateAllElements)
1216	end
1217
1218	------------------------------------------------------------------------
1219	--	Focus unit layout
1220	------------------------------------------------------------------------
1221	
1222	if (unit == "focus") then
1223		-- health 
1224		local health = CreateFrame('StatusBar', nil, self)
1225		health:Height(22)
1226		health:SetPoint("TOPLEFT")
1227		health:SetPoint("TOPRIGHT")
1228		health:SetStatusBarTexture(normTex)
1229		
1230		-- Border for Health
1231		local HealthBorder = CreateFrame("Frame", nil, health)
1232		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", T.Scale(-2), T.Scale(2))
1233		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
1234		HealthBorder:SetTemplate("Default")
1235		HealthBorder:CreateShadow("Default")
1236		HealthBorder:SetFrameLevel(2)
1237		self.HealthBorder = HealthBorder
1238
1239		health.frequentUpdates = true
1240		health.colorDisconnected = true
1241		if C["unitframes"].showsmooth == true then
1242			health.Smooth = true
1243		end
1244		health.colorClass = true
1245		
1246		local healthBG = health:CreateTexture(nil, 'BORDER')
1247		healthBG:SetAllPoints()
1248		healthBG:SetTexture(0, 0, 0)
1249
1250		health.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1251		health.value:Point("LEFT", 6, 4)
1252		health.PostUpdate = T.PostUpdateHealth
1253				
1254		self.Health = health
1255		self.Health.bg = healthBG
1256		
1257		health.frequentUpdates = true
1258		if C["unitframes"].showsmooth == true then
1259			health.Smooth = true
1260		end
1261		
1262		if C["unitframes"].unicolor == true then
1263			health.colorDisconnected = false
1264			health.colorClass = false
1265			health:SetStatusBarColor(.150, .150, .150, 1)
1266			healthBG:SetVertexColor(0, 0, 0, 1)		
1267		else
1268			health.colorDisconnected = true
1269			health.colorClass = true
1270			health.colorReaction = true	
1271		end
1272	
1273		-- power
1274		local power = CreateFrame('StatusBar', nil, self)
1275		power:Height(2)
1276		power:Point("TOPLEFT", health, "BOTTOMLEFT", 9, 5)
1277		power:Point("TOPRIGHT", health, "BOTTOMRIGHT", -9, -2)
1278		power:SetStatusBarTexture(normTex)
1279		power:SetFrameLevel(self.Health:GetFrameLevel() + 2)
1280		
1281		-- Border for Power
1282		local PowerBorder = CreateFrame("Frame", nil, power)
1283		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", T.Scale(-2), T.Scale(2))
1284		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
1285		PowerBorder:SetTemplate("Thin")
1286		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1287		self.PowerBorder = PowerBorder
1288		
1289		power.frequentUpdates = true
1290		power.colorPower = true
1291		if C["unitframes"].showsmooth == true then
1292			power.Smooth = true
1293		end
1294
1295		local powerBG = power:CreateTexture(nil, 'BORDER')
1296		powerBG:SetAllPoints(power)
1297		powerBG:SetTexture(normTex)
1298		powerBG.multiplier = 0.3
1299		
1300		power.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1301		power.value:Point("RIGHT", -2, 4)
1302		power.PreUpdate = T.PreUpdatePower
1303		power.PostUpdate = T.PostUpdatePower
1304				
1305		self.Power = power
1306		self.Power.bg = powerBG
1307		
1308		-- Names
1309		local Name = health:CreateFontString(nil, "OVERLAY")
1310		Name:SetPoint("CENTER", health, "CENTER", 0, 3)
1311		Name:SetJustifyH("CENTER")
1312		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1313		Name:SetShadowColor(0, 0, 0)
1314		Name:SetShadowOffset(1.25, -1.25)
1315		
1316		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
1317		self.Name = Name
1318		
1319		-- create debuff for arena units
1320		local debuffs = CreateFrame("Frame", nil, self)
1321		debuffs:SetHeight(26)
1322		debuffs:SetWidth(200)
1323		debuffs:Point('LEFT', self, 'RIGHT', 4, 6)
1324		debuffs.size = 22
1325		debuffs.num = 8
1326		debuffs.spacing = 2
1327		debuffs.initialAnchor = 'LEFT'
1328		debuffs["growth-x"] = "RIGHT"
1329		debuffs.PostCreateIcon = T.PostCreateAura
1330		debuffs.PostUpdateIcon = T.PostUpdateAura
1331		self.Debuffs = debuffs
1332		
1333		local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
1334		castbar:SetPoint("LEFT", 0, 0)
1335		castbar:SetPoint("RIGHT", -23, 0)
1336		castbar:SetPoint("BOTTOM", 0, -20)
1337		
1338		castbar:SetHeight(16)
1339		castbar:SetStatusBarTexture(normTex)
1340		castbar:SetFrameLevel(6)
1341		
1342		castbar.bg = CreateFrame("Frame", nil, castbar)
1343		castbar.bg:SetTemplate("Default")
1344		castbar.bg:CreateShadow("Default")
1345		castbar.bg:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1346		castbar.bg:Point("TOPLEFT", -2, 2)
1347		castbar.bg:Point("BOTTOMRIGHT", 2, -2)
1348		castbar.bg:SetFrameLevel(5)
1349		
1350		castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1351		castbar.time:Point("RIGHT", castbar, "RIGHT", -4, 0)
1352		castbar.time:SetTextColor(0, 4, 0)
1353		castbar.time:SetJustifyH("RIGHT")
1354		castbar.CustomTimeText = T.CustomCastTimeText
1355
1356		castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1357		castbar.Text:SetPoint("LEFT", castbar, "LEFT", 4, 0)
1358		castbar.Text:SetTextColor(0.3, 0.2, 1)
1359		castbar.Text:Width(100)
1360		castbar.Text:Height(12)
1361		
1362		castbar.CustomDelayText = T.CustomCastDelayText
1363		castbar.PostCastStart =T.PostCastStart
1364		castbar.PostChannelStart = T.PostCastStart
1365								
1366		castbar.button = CreateFrame("Frame", nil, castbar)
1367		castbar.button:Height(castbar:GetHeight()+4)
1368		castbar.button:Width(castbar:GetHeight()+4)
1369		castbar.button:Point("LEFT", castbar, "RIGHT", 5, 0)
1370		castbar.button:SetTemplate("Default")
1371		castbar.button:CreateShadow("Default")
1372		castbar.button:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1373		castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
1374		castbar.icon:Point("TOPLEFT", castbar.button, 2, -2)
1375		castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
1376		castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
1377
1378		self.Castbar = castbar
1379		self.Castbar.Time = castbar.time
1380		self.Castbar.Icon = castbar.icon
1381	end
1382	
1383	------------------------------------------------------------------------
1384	--	Focus target unit layout
1385	------------------------------------------------------------------------
1386
1387	if (unit == "focustarget") then
1388		-- health 
1389		local health = CreateFrame('StatusBar', nil, self)
1390		health:Height(22)
1391		health:SetPoint("TOPLEFT")
1392		health:SetPoint("TOPRIGHT")
1393		health:SetStatusBarTexture(normTex)
1394		
1395		-- Border for Health
1396		local HealthBorder = CreateFrame("Frame", nil, health)
1397		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", T.Scale(-2), T.Scale(2))
1398		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
1399		HealthBorder:SetTemplate("Default")
1400		HealthBorder:CreateShadow("Default")
1401		HealthBorder:SetFrameLevel(2)
1402		self.HealthBorder = HealthBorder
1403
1404		health.frequentUpdates = true
1405		health.colorDisconnected = true
1406		if C["unitframes"].showsmooth == true then
1407			health.Smooth = true
1408		end
1409		health.colorClass = true
1410		
1411		local healthBG = health:CreateTexture(nil, 'BORDER')
1412		healthBG:SetAllPoints()
1413		healthBG:SetTexture(0, 0, 0)
1414
1415		health.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1416		health.value:Point("LEFT", 6, 4)
1417		health.PostUpdate = T.PostUpdateHealth
1418				
1419		self.Health = health
1420		self

Large files files are truncated, but you can click here to view the full file