PageRenderTime 240ms CodeModel.GetById 91ms app.highlight 110ms RepoModel.GetById 20ms app.codeStats 2ms

/Tukui/modules/unitframes/layouts/tukui.lua

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

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