PageRenderTime 179ms CodeModel.GetById 32ms app.highlight 108ms RepoModel.GetById 21ms app.codeStats 1ms

/Tukui/modules/unitframes/layouts/asphyxia.lua

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

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