PageRenderTime 90ms CodeModel.GetById 3ms app.highlight 72ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/unitframes/layouts/asphyxia2.lua

http://github.com/Asphyxia/Tukui
Lua | 2015 lines | 1569 code | 299 blank | 147 comment | 211 complexity | 5141aaa91efe28d1cca87ac38426e1a2 MD5 | raw 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 ~= "Asphyxia2" 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(13)
  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, 1)
 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(244, 2)
 130		if unit == "player" then
 131			power:Point("TOPRIGHT", health, "BOTTOMRIGHT", 7, -11)
 132		elseif unit == "target" then
 133			power:Point("TOPLEFT", health, "BOTTOMLEFT", -7, -11)
 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		-- portraits
 186		if (C["unitframes"].charportrait == true) then
 187			local portrait = CreateFrame("PlayerModel", self:GetName().."_Portrait", self)
 188			portrait:SetFrameLevel(8)
 189			portrait:SetHeight(12)
 190			portrait:SetWidth(230)
 191			portrait:SetAlpha(1)
 192			if unit == "player" then
 193				portrait:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -24)
 194			elseif unit == "target" then
 195				portrait:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -24)
 196			end
 197			table.insert(self.__elements, T.HidePortrait)
 198			self.Portrait = portrait
 199			
 200			-- Border for Portrait
 201			local PFrame = CreateFrame("Frame", nil, portrait)
 202			PFrame:SetPoint("TOPLEFT", portrait, "TOPLEFT", T.Scale(-2), T.Scale(2))
 203			PFrame:SetPoint("BOTTOMRIGHT", portrait, "BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 204			PFrame:SetTemplate("Default")
 205			PFrame:CreateShadow("Default")
 206			PFrame:SetFrameLevel(2)
 207			self.PFrame = PFrame
 208		end
 209		
 210		if (C["unitframes"].classicon == true) then
 211		local classicon = CreateFrame("Frame", self:GetName().."_ClassIconBorder", self)
 212		--classicon:CreateShadow("Default")
 213		if unit == "player" then
 214				classicon:CreatePanel("Default", 38, 38, "RIGHT", TukuiPlayer, "LEFT", -14, -4)
 215		elseif unit == "target" then
 216				classicon:CreatePanel("Default", 38, 38, "LEFT", TukuiTarget, "RIGHT", 14, -4)
 217		end
 218
 219		local class = classicon:CreateTexture(self:GetName().."_ClassIcon", "ARTWORK")
 220		class:Point("TOPLEFT", 2, -2)
 221		class:Point("BOTTOMRIGHT", -2, 2)
 222		self.ClassIcon = class
 223	end
 224
 225		if T.myclass == "PRIEST" and C["unitframes"].weakenedsoulbar then
 226			local ws = CreateFrame("StatusBar", self:GetName().."_WeakenedSoul", power)
 227			ws:SetAllPoints(power)
 228			ws:SetStatusBarTexture(C.media.normTex)
 229			ws:GetStatusBarTexture():SetHorizTile(false)
 230			ws:SetBackdrop(backdrop)
 231			ws:SetBackdropColor(unpack(C.media.backdropcolor))
 232			ws:SetStatusBarColor(191/255, 10/255, 10/255)
 233
 234			self.WeakenedSoul = ws
 235		end
 236
 237		if (unit == "player") then
 238			-- combat icon
 239			local Combat = health:CreateTexture(nil, "OVERLAY")
 240			Combat:Height(19)
 241			Combat:Width(19)
 242			Combat:SetPoint("CENTER",0,0)
 243			Combat:SetVertexColor(0.69, 0.31, 0.31)
 244			self.Combat = Combat
 245
 246			-- custom info (low mana warning)
 247			FlashInfo = CreateFrame("Frame", "TukuiFlashInfo", self)
 248			FlashInfo:SetScript("OnUpdate", T.UpdateManaLevel)
 249			FlashInfo.parent = self
 250			FlashInfo:SetAllPoints(health)
 251			FlashInfo.ManaLevel = T.SetFontString(FlashInfo, font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 252			FlashInfo.ManaLevel:SetPoint("CENTER", health, "CENTER", 0, 1)
 253			self.FlashInfo = FlashInfo
 254
 255			-- pvp status icon
 256			local PVP = health:CreateTexture(nil, "OVERLAY")
 257			PVP:SetHeight(32)
 258			PVP:SetWidth(32)
 259			PVP:SetPoint("CENTER", 5, -6)
 260			self.PvP = PVP
 261			if(UnitIsPVP(unit) and factionGroup) then
 262				if(factionGroup == 'Horde') then
 263					pvp:SetTexture([[Interface\AddOns\Tukui\medias\textures\Horde]])
 264				else
 265					pvp:SetTexture([[Interface\AddOns\Tukui\medias\textures\Alliance]])
 266				end
 267			end
 268			
 269			-- leader icon
 270			local Leader = InvFrame:CreateTexture(nil, "OVERLAY")
 271			Leader:Height(14)
 272			Leader:Width(14)
 273			Leader:Point("TOPLEFT", -9, 9)
 274			self.Leader = Leader
 275
 276			-- master looter
 277			local MasterLooter = InvFrame:CreateTexture(nil, "OVERLAY")
 278			MasterLooter:Height(14)
 279			MasterLooter:Width(14)
 280			self.MasterLooter = MasterLooter
 281			self:RegisterEvent("PARTY_LEADER_CHANGED", T.MLAnchorUpdate)
 282			self:RegisterEvent("PARTY_MEMBERS_CHANGED", T.MLAnchorUpdate)
 283			
 284			--This is the edited code for the original rep/exp bar
 285			-- experience bar on player via mouseover for player currently levelling a character
 286			if T.level ~= MAX_PLAYER_LEVEL then
 287				local Experience = CreateFrame("StatusBar", self:GetName().."_Experience", self)
 288				Experience:SetStatusBarTexture(normTex)
 289				Experience:SetStatusBarColor(0, 0.4, 1, .8)
 290				Experience:Size(TukuiChatBackgroundLeft:GetWidth() - 4, 2)
 291				Experience:Point("BOTTOM", TukuiChatBackgroundLeft, "TOP", 0, 5)
 292				Experience:SetFrameLevel(8)
 293				Experience:SetFrameStrata("HIGH")
 294				Experience.Tooltip = true
 295				self.Experience = Experience
 296				
 297				local ExperienceBG = Experience:CreateTexture(nil, 'BORDER')
 298				ExperienceBG:SetAllPoints()
 299				ExperienceBG:SetTexture(normTex)
 300				ExperienceBG:SetVertexColor(0,0,0)
 301
 302				Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY')
 303				Experience.Text:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 304				Experience.Text:SetPoint('CENTER', 0, 1)
 305				Experience.Text:SetShadowOffset(T.mult, -T.mult)
 306				self.Experience.Text = Experience.Text
 307				self.Experience.PostUpdate = T.ExperienceText
 308
 309				self.Experience.Rested = CreateFrame('StatusBar', nil, self.Experience)
 310				self.Experience.Rested:SetAllPoints(self.Experience)
 311				self.Experience.Rested:SetStatusBarTexture(normTex)
 312				self.Experience.Rested:SetStatusBarColor(1, 0, 1, 0.2)		
 313				
 314				local Resting = self:CreateTexture(nil, "OVERLAY")
 315				Resting:SetHeight(28)
 316				Resting:SetWidth(28)
 317				Resting:SetPoint("BOTTOMRIGHT", self, "TOPLEFT", 10 -4)
 318				Resting:SetTexture([=[Interface\CharacterFrame\UI-StateIcon]=])
 319				Resting:SetTexCoord(0, 0.5, 0, 0.421875)
 320				self.Resting = Resting
 321
 322				local ExperienceFrame = CreateFrame("Frame", nil, self.Experience)
 323				ExperienceFrame:SetPoint("TOPLEFT", T.Scale(-2), T.Scale(2))
 324				ExperienceFrame:SetPoint("BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 325				ExperienceFrame:SetTemplate("Transparent")
 326				ExperienceFrame:CreateShadow("Default")
 327				ExperienceFrame:SetFrameLevel(self.Experience:GetFrameLevel() - 1)
 328			
 329			local function ModifiedBackdrop(self)
 330				local color = RAID_CLASS_COLORS[T.myclass]
 331				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 332				self:SetBackdropBorderColor(color.r, color.g, color.b)
 333			end
 334
 335			local function OriginalBackdrop(self)
 336				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 337				self:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 338			end
 339		end
 340		
 341			-- reputation bar for max level character
 342			if T.level == MAX_PLAYER_LEVEL then
 343				local Reputation = CreateFrame("StatusBar", self:GetName().."_Reputation", self)
 344				Reputation:SetStatusBarTexture(normTex)
 345				Reputation:Size(TukuiChatBackgroundLeft:GetWidth() - 4, 2)
 346				Reputation:Point("BOTTOM", TukuiChatBackgroundLeft, "TOP", 0, 5)
 347				Reputation:SetFrameLevel(10)
 348				local ReputationBG = Reputation:CreateTexture(nil, 'BORDER')
 349				ReputationBG:SetAllPoints()
 350				ReputationBG:SetTexture(normTex)
 351				ReputationBG:SetVertexColor(0,0,0)
 352
 353				Reputation.Text = Reputation:CreateFontString(nil, 'OVERLAY')
 354				Reputation.Text:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 355				Reputation.Text:SetPoint('CENTER', 0, 1)
 356				Reputation.Text:SetShadowOffset(T.mult, -T.mult)
 357				Reputation.Text:Show()
 358				Reputation.PostUpdate = T.UpdateReputation
 359				Reputation.Text = Reputation.Text
 360
 361				Reputation.PostUpdate = T.UpdateReputationColor
 362				Reputation.Tooltip = true
 363				self.Reputation = Reputation
 364
 365				local ReputationFrame = CreateFrame("Frame", nil, self.Reputation)
 366				ReputationFrame:SetPoint("TOPLEFT", T.Scale(-2), T.Scale(2))
 367				ReputationFrame:SetPoint("BOTTOMRIGHT", T.Scale(2), T.Scale(-2))
 368				ReputationFrame:SetTemplate("Transparent")
 369				ReputationFrame:CreateShadow("Default")
 370				ReputationFrame:SetFrameLevel(self.Reputation:GetFrameLevel() - 1)
 371				
 372			local function ModifiedBackdrop(self)
 373				local color = RAID_CLASS_COLORS[T.myclass]
 374				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 375				self:SetBackdropBorderColor(color.r, color.g, color.b)
 376			end
 377
 378			local function OriginalBackdrop(self)
 379				self:SetBackdropColor(unpack(C["media"].backdropcolor))
 380				self:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 381			end
 382		end	
 383			
 384			-- show druid mana when shapeshifted in bear, cat or whatever
 385			if T.myclass == "DRUID" then
 386				CreateFrame("Frame"):SetScript("OnUpdate", function() T.UpdateDruidMana(self) end)
 387				local DruidMana = T.SetFontString(health, font1, 12)
 388				DruidMana:SetTextColor(1, 0.49, 0.04)
 389				self.DruidManaText = DruidMana
 390			end
 391
 392			if C["unitframes"].classbar then
 393				if T.myclass == "DRUID" then
 394					-- DRUID MANA BAR
 395					local DruidManaBackground = CreateFrame("Frame", nil, self)
 396					DruidManaBackground:Point("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
 397					DruidManaBackground:Size(230, 2)
 398					DruidManaBackground:SetFrameLevel(8)
 399					DruidManaBackground:SetFrameStrata("MEDIUM")
 400					DruidManaBackground:SetTemplate("Default")
 401					DruidManaBackground:SetBackdropBorderColor(0,0,0,0)
 402				
 403					local DruidManaBarStatus = CreateFrame('StatusBar', nil, DruidManaBackground)
 404					DruidManaBarStatus:SetPoint('LEFT', DruidManaBackground, 'LEFT', 0, 0)
 405					DruidManaBarStatus:SetSize(DruidManaBackground:GetWidth(), DruidManaBackground:GetHeight())
 406					DruidManaBarStatus:SetStatusBarTexture(normTex)
 407					DruidManaBarStatus:SetStatusBarColor(.30, .52, .90)
 408					
 409					DruidManaBarStatus:SetScript("OnShow", function() T.DruidBarDisplay(self, false) end)
 410					DruidManaBarStatus:SetScript("OnUpdate", function() T.DruidBarDisplay(self, true) end) -- just forcing 1 update on login for buffs/shadow/etc.
 411					DruidManaBarStatus:SetScript("OnHide", function() T.DruidBarDisplay(self, false) end)
 412					
 413					self.DruidManaBackground = DruidManaBackground
 414					self.DruidMana = DruidManaBarStatus
 415					
 416					DruidManaBackground.FrameBackdrop = CreateFrame( "Frame", nil, DruidManaBackground )
 417					DruidManaBackground.FrameBackdrop:SetTemplate( "Default" )
 418					DruidManaBackground.FrameBackdrop:SetPoint( "TOPLEFT", -2, 2 )
 419					DruidManaBackground.FrameBackdrop:SetPoint( "BOTTOMRIGHT", 2, -2 )
 420					DruidManaBackground.FrameBackdrop:SetFrameLevel( DruidManaBackground:GetFrameLevel() - 1 )
 421
 422					local eclipseBar = CreateFrame('Frame', nil, self)
 423					eclipseBar:Point("LEFT", health, "TOPLEFT", 0, 8)
 424					eclipseBar:Size(230, 2)
 425					eclipseBar:SetFrameStrata("MEDIUM")
 426					eclipseBar:SetFrameLevel(8)
 427					eclipseBar:SetBackdropBorderColor(0,0,0,0)
 428					eclipseBar:SetScript("OnShow", function() T.DruidBarDisplay(self, false) end)
 429					eclipseBar:SetScript("OnHide", function() T.DruidBarDisplay(self, false) end)
 430
 431					local lunarBar = CreateFrame('StatusBar', nil, eclipseBar)
 432					lunarBar:SetPoint('LEFT', eclipseBar, 'LEFT', 0, 0)
 433					lunarBar:SetSize(eclipseBar:GetWidth(), eclipseBar:GetHeight())
 434					lunarBar:SetStatusBarTexture(normTex)
 435					lunarBar:SetStatusBarColor(.30, .52, .90)
 436					eclipseBar.LunarBar = lunarBar
 437				
 438					local solarBar = CreateFrame('StatusBar', nil, eclipseBar)
 439					solarBar:SetPoint('LEFT', lunarBar:GetStatusBarTexture(), 'RIGHT', 0, 0)
 440					solarBar:SetSize(eclipseBar:GetWidth(), eclipseBar:GetHeight())
 441					solarBar:SetStatusBarTexture(normTex)
 442					solarBar:SetStatusBarColor(.80, .82,  .60)
 443					eclipseBar.SolarBar = solarBar
 444
 445					local eclipseBarText = eclipseBar:CreateFontString(nil, 'OVERLAY')
 446					eclipseBarText:SetPoint('TOP', eclipseBar, 0, 25)
 447					eclipseBarText:SetPoint('BOTTOM', eclipseBar)
 448					eclipseBarText:SetFont(font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 449					eclipseBarText:SetShadowOffset(T.mult, -T.mult)
 450					eclipseBarText:SetShadowColor(0, 0, 0, 0.4)
 451					eclipseBar.PostUpdatePower = T.EclipseDirection
 452
 453					-- hide "low mana" text on load if eclipseBar is shown
 454					if eclipseBar and eclipseBar:IsShown() then FlashInfo.ManaLevel:SetAlpha(0) end
 455
 456					self.EclipseBar = eclipseBar
 457					self.EclipseBar.Text = eclipseBarText
 458
 459					eclipseBar.FrameBackdrop = CreateFrame("Frame", nil, eclipseBar)
 460					eclipseBar.FrameBackdrop:SetTemplate("Default")
 461					eclipseBar.FrameBackdrop:CreateShadow("Default")
 462					eclipseBar.FrameBackdrop:SetPoint("TOPLEFT", -2, 2)
 463					eclipseBar.FrameBackdrop:SetPoint("BOTTOMRIGHT", 2, -2)
 464					eclipseBar.FrameBackdrop:SetFrameLevel(eclipseBar:GetFrameLevel() - 1)
 465				end
 466
 467				-- set holy power bar or shard bar
 468				if (T.myclass == "WARLOCK" or T.myclass == "PALADIN") then
 469
 470					local bars = CreateFrame("Frame", nil, self)
 471					bars:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
 472					bars:Size(230, 2)
 473					bars:SetBackdropBorderColor(0,0,0,0)
 474
 475					for i = 1, 3 do					
 476						bars[i]=CreateFrame("StatusBar", self:GetName().."_Shard"..i, bars)
 477						bars[i]:Height(2)					
 478						bars[i]:SetStatusBarTexture(normTex)
 479						bars[i]:GetStatusBarTexture():SetHorizTile(false)
 480
 481						bars[i].bg = bars[i]:CreateTexture(nil, 'BORDER')
 482
 483						if T.myclass == "WARLOCK" then
 484							bars[i]:SetStatusBarColor(148/255, 130/255, 201/255)
 485							bars[i].bg:SetTexture(148/255, 130/255, 201/255)
 486						elseif T.myclass == "PALADIN" then
 487							bars[i]:SetStatusBarColor(228/255,225/255,16/255)
 488							bars[i].bg:SetTexture(228/255,225/255,16/255)
 489						end
 490
 491						if i == 1 then
 492							bars[i]:SetPoint("LEFT", bars)
 493							bars[i]:Width(229/3) -- setting SetWidth here just to fit fit 250 perfectly
 494							bars[i].bg:SetAllPoints(bars[i])
 495						else
 496							bars[i]:Point("LEFT", bars[i-1], "RIGHT", 1, 0)
 497							bars[i]:Width(229/3) -- setting SetWidth here just to fit fit 250 perfectly
 498							bars[i].bg:SetAllPoints(bars[i])
 499						end
 500						
 501						bars[i].bg:SetTexture(normTex)					
 502						bars[i].bg:SetAlpha(.15)
 503					end
 504
 505					if T.myclass == "WARLOCK" then
 506						bars.Override = T.UpdateShards				
 507						self.SoulShards = bars
 508					elseif T.myclass == "PALADIN" then
 509						bars.Override = T.UpdateHoly
 510						self.HolyPower = bars
 511					end
 512					bars.FrameBackdrop = CreateFrame("Frame", nil, bars)
 513					bars.FrameBackdrop:SetTemplate("Default")
 514					bars.FrameBackdrop:CreateShadow("Default")
 515					bars.FrameBackdrop:SetPoint("TOPLEFT", -2, 2)
 516					bars.FrameBackdrop:SetPoint("BOTTOMRIGHT", 2, -2)
 517					bars.FrameBackdrop:SetFrameLevel(bars:GetFrameLevel() - 1)
 518				end
 519
 520				-- deathknight runes
 521				if T.myclass == "DEATHKNIGHT" then
 522
 523					local Runes = CreateFrame("Frame", nil, self)
 524					Runes:Point("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
 525					Runes:Size(230, 2)
 526
 527					for i = 1, 6 do
 528						Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, health)
 529						Runes[i]:SetHeight(2)
 530						if i == 1 then
 531							Runes[i]:SetWidth(35)
 532						else
 533							Runes[i]:SetWidth(229/6)
 534						end
 535						if (i == 1) then
 536							Runes[i]:Point("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
 537						else
 538							Runes[i]:Point("TOPLEFT", Runes[i-1], "TOPRIGHT", 1, 0)
 539						end
 540						Runes[i]:SetStatusBarTexture(normTex)
 541						Runes[i]:GetStatusBarTexture():SetHorizTile(false)
 542					end
 543
 544					self.Runes = Runes
 545
 546					Runes.FrameBackdrop = CreateFrame("Frame", nil, Runes)
 547					Runes.FrameBackdrop:SetTemplate("Default")
 548					Runes.FrameBackdrop:CreateShadow("Default")
 549					Runes.FrameBackdrop:SetPoint("TOPLEFT", -2, 2)
 550					Runes.FrameBackdrop:SetPoint("BOTTOMRIGHT", 2, -2)
 551					Runes.FrameBackdrop:SetFrameLevel(Runes:GetFrameLevel() - 1)
 552				end
 553
 554				-- shaman totem bar
 555				if T.myclass == "SHAMAN" then
 556
 557					local TotemBar = {}
 558					TotemBar.Destroy = true
 559					for i = 1, 4 do
 560						TotemBar[i] = CreateFrame("StatusBar", self:GetName().."_TotemBar"..i, self)
 561						if (i == 1) then
 562						   TotemBar[i]:Point("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
 563						else
 564						   TotemBar[i]:Point("TOPLEFT", TotemBar[i-1], "TOPRIGHT", 5, 0)
 565						end
 566						TotemBar[i]:SetStatusBarTexture(normTex)
 567						TotemBar[i]:Height(2)
 568						if i == 4 then
 569							TotemBar[i]:SetWidth(215/4)
 570						else
 571							TotemBar[i]:SetWidth(215/4)
 572						end
 573						TotemBar[i]:SetBackdrop(backdrop)
 574						TotemBar[i]:SetBackdropColor(0, 0, 0)
 575						TotemBar[i]:SetMinMaxValues(0, 1)
 576
 577						TotemBar[i].bg = TotemBar[i]:CreateTexture(nil, "BORDER")
 578						TotemBar[i].bg:SetAllPoints(TotemBar[i])
 579						TotemBar[i].bg:SetTexture(normTex)
 580						TotemBar[i].bg.multiplier = 0.3
 581						
 582						TotemBar[i].FrameBackdrop = CreateFrame("Frame", nil, TotemBar[i])
 583						TotemBar[i].FrameBackdrop:SetTemplate("Default")
 584						TotemBar[i].FrameBackdrop:CreateShadow("Default")
 585						TotemBar[i].FrameBackdrop:SetPoint("TOPLEFT", -2, 2)
 586						TotemBar[i].FrameBackdrop:SetPoint("BOTTOMRIGHT", 2, -2)
 587						TotemBar[i].FrameBackdrop:SetFrameLevel(TotemBar[i]:GetFrameLevel() - 1)
 588					end
 589					self.TotemBar = TotemBar
 590				end
 591			end	
 592
 593			-- script for low mana
 594			self:SetScript("OnEnter", function(self)
 595				if self.EclipseBar and self.EclipseBar:IsShown() then 
 596					self.EclipseBar.Text:Hide()
 597				end
 598				FlashInfo.ManaLevel:Hide()
 599				UnitFrame_OnEnter(self) 
 600			end)
 601			self:SetScript("OnLeave", function(self) 
 602				if self.EclipseBar and self.EclipseBar:IsShown() then 
 603					self.EclipseBar.Text:Show()
 604				end
 605				FlashInfo.ManaLevel:Show()
 606				UnitFrame_OnLeave(self) 
 607			end)
 608		end
 609
 610		if (unit == "target") then			
 611			-- Unit name on target
 612			local Name = health:CreateFontString(nil, "OVERLAY")
 613			Name:Point("CENTER", health, "CENTER", 0, 1)
 614			Name:SetJustifyH("LEFT")
 615			Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 616			Name:SetShadowOffset(1.25, -1.25)
 617
 618			self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort] [Tukui:diffcolor][level] [shortclassification]')
 619			--self.Name = Name
 620			
 621			--combo points change to support sCombo
 622			local cp = T.SetFontString(self, font, 15, "MONOCHROMEOUTLINE")
 623			cp:SetPoint("RIGHT", health.border, "LEFT", -5, 0)
 624			self.CPoints = cp
 625		end
 626		
 627		if (unit == "target" and C["unitframes"].targetauras) or (unit == "player" and C["unitframes"].playerauras) then
 628			local buffs = CreateFrame("Frame", nil, self)
 629			local debuffs = CreateFrame("Frame", nil, self)
 630			
 631			if (T.myclass == "SHAMAN" or T.myclass == "DEATHKNIGHT" or T.myclass == "PALADIN" or T.myclass == "WARLOCK") and (C["unitframes"].playerauras) and (unit == "player") then
 632				if T.lowversion then
 633					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 34)
 634				else
 635					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 38)
 636				end
 637			else
 638				if T.lowversion then
 639					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 26)
 640				else
 641					buffs:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 32)
 642				end
 643			end
 644			
 645			if T.lowversion then
 646				buffs:SetHeight(21.5)
 647				buffs:SetWidth(186)
 648				buffs.size = 21.5
 649				buffs.num = 8
 650				
 651				debuffs:SetHeight(21.5)
 652				debuffs:SetWidth(186)
 653				debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", 0, 2)
 654				debuffs.size = 21.5	
 655				debuffs.num = 24
 656			else				
 657				buffs:SetHeight(26)
 658				buffs:SetWidth(252)
 659				buffs.size = 27.5
 660				buffs.num = 8
 661				
 662				debuffs:SetHeight(26)
 663				debuffs:SetWidth(247)
 664				debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", -2, 2)
 665				debuffs.size = 26
 666				debuffs.num = 24
 667			end
 668						
 669			buffs.spacing = 2
 670			buffs.initialAnchor = 'TOPLEFT'
 671			buffs.PostCreateIcon = T.PostCreateAura
 672			buffs.PostUpdateIcon = T.PostUpdateAura
 673			self.Buffs = buffs	
 674						
 675			debuffs.spacing = 2
 676			debuffs.initialAnchor = 'TOPRIGHT'
 677			debuffs["growth-y"] = "UP"
 678			debuffs["growth-x"] = "LEFT"
 679			debuffs.PostCreateIcon = T.PostCreateAura
 680			debuffs.PostUpdateIcon = T.PostUpdateAura
 681			
 682			-- An option to show only our debuffs on target
 683			if unit == "target" then
 684				debuffs.onlyShowPlayer = C.unitframes.onlyselfdebuffs
 685			end
 686			
 687			self.Debuffs = debuffs
 688		end
 689
 690		-- cast bar for player and target
 691		if (C["unitframes"].unitcastbar == true) then
 692			local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
 693			castbar:SetStatusBarTexture(normTex)
 694			
 695			castbar.bg = castbar:CreateTexture(nil, "BORDER")
 696			castbar.bg:SetAllPoints(castbar)
 697			castbar.bg:SetTexture(normTex)
 698			castbar.bg:SetVertexColor(.05, .05, .05)
 699			if unit == "player" then
 700				if C["unitframes"].cbicons == true then
 701					castbar:SetWidth(TukuiBar1:GetWidth() - 31)
 702				else
 703					castbar:SetWidth(TukuiBar1:GetWidth() - 4)
 704				end
 705				castbar:SetHeight(20)
 706				castbar:Point("BOTTOMRIGHT", TukuiBar1, "TOPRIGHT", -2, 5)
 707			elseif unit == "target" then
 708				if C["unitframes"].cbicons == true then
 709					castbar:SetWidth(225 - 28)
 710				else
 711					castbar:SetWidth(246)
 712				end
 713				castbar:SetHeight(20)
 714				castbar:Point("BOTTOM", TukuiBar1, "TOP", 0, 60)
 715			end
 716			castbar:SetFrameLevel(6)
 717			
 718			if( C["unitframes"].cbspark == true ) then
 719					castbar.Spark = castbar:CreateTexture(nil, 'OVERLAY')
 720					castbar.Spark:SetHeight(36)
 721					castbar.Spark:SetWidth(15)
 722					castbar.Spark:SetBlendMode('ADD')
 723				end
 724
 725			-- Border
 726			castbar.border = CreateFrame("Frame", nil, castbar)
 727			castbar.border:CreatePanel("Default",1,1,"TOPLEFT", castbar, "TOPLEFT", -2, 2)
 728			castbar.border:CreateShadow("Default")
 729			castbar.border:Point("BOTTOMRIGHT", castbar, "BOTTOMRIGHT", 2, -2)
 730			
 731			castbar.CustomTimeText = T.CustomCastTimeText
 732			castbar.CustomDelayText = T.CustomCastDelayText
 733			castbar.PostCastStart = T.PostCastStart
 734			castbar.PostChannelStart = T.PostCastStart
 735
 736			castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 737			castbar.time:Point("RIGHT", castbar.bg, "RIGHT", -4, 0)
 738			castbar.time:SetTextColor(0, 4, 0)
 739			castbar.time:SetJustifyH("RIGHT")
 740
 741			castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
 742			castbar.Text:Point("LEFT", castbar.bg, "LEFT", 4, 0)
 743			castbar.Text:SetTextColor(0.3, 0.2, 1)
 744			castbar.Text:Width(100)
 745			castbar.Text:Height(10)
 746			
 747			if C["unitframes"].cbicons == true then
 748				castbar.button = CreateFrame("Frame", nil, castbar)
 749				castbar.button:Size(24)
 750				castbar.button:SetTemplate("Default")
 751				castbar.button:CreateShadow("Default")
 752				castbar.button:SetPoint("RIGHT",castbar,"LEFT", -5, 0)
 753
 754				castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
 755				castbar.icon:Point("TOPLEFT", castbar.button, 2, -2)
 756				castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
 757				castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
 758			end
 759			
 760			-- cast bar latency on player
 761			if unit == "player" and C["unitframes"].cblatency == true then
 762				castbar.safezone = castbar:CreateTexture(nil, "ARTWORK")
 763				castbar.safezone:SetTexture(normTex)
 764				castbar.safezone:SetVertexColor(0.8, 0.2, 0.2, 0.75)
 765				castbar.SafeZone = castbar.safezone
 766			end
 767					
 768			self.Castbar = castbar
 769			self.Castbar.Time = castbar.time
 770			self.Castbar.Icon = castbar.icon
 771		end
 772
 773		-- add combat feedback support
 774		if C["unitframes"].combatfeedback == true then
 775			local CombatFeedbackText 
 776			CombatFeedbackText = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 777			CombatFeedbackText:SetPoint("CENTER", 0, 1)
 778			CombatFeedbackText.colors = {
 779				DAMAGE = {0.69, 0.31, 0.31},
 780				CRUSHING = {0.69, 0.31, 0.31},
 781				CRITICAL = {0.69, 0.31, 0.31},
 782				GLANCING = {0.69, 0.31, 0.31},
 783				STANDARD = {0.84, 0.75, 0.65},
 784				IMMUNE = {0.84, 0.75, 0.65},
 785				ABSORB = {0.84, 0.75, 0.65},
 786				BLOCK = {0.84, 0.75, 0.65},
 787				RESIST = {0.84, 0.75, 0.65},
 788				MISS = {0.84, 0.75, 0.65},
 789				HEAL = {0.33, 0.59, 0.33},
 790				CRITHEAL = {0.33, 0.59, 0.33},
 791				ENERGIZE = {0.31, 0.45, 0.63},
 792				CRITENERGIZE = {0.31, 0.45, 0.63},
 793			}
 794			self.CombatFeedbackText = CombatFeedbackText
 795		end
 796		
 797		if C["unitframes"].healcomm then
 798			local mhpb = CreateFrame('StatusBar', nil, self.Health)
 799			mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
 800			mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
 801			if T.lowversion then
 802				mhpb:SetWidth(186)
 803			else
 804				mhpb:SetWidth(250)
 805			end
 806			mhpb:SetStatusBarTexture(normTex)
 807			mhpb:SetStatusBarColor(0, 1, 0.5, 0.25)
 808			mhpb:SetMinMaxValues(0,1)
 809
 810			local ohpb = CreateFrame('StatusBar', nil, self.Health)
 811			ohpb:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
 812			ohpb:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
 813			ohpb:SetWidth(250)
 814			ohpb:SetStatusBarTexture(normTex)
 815			ohpb:SetStatusBarColor(0, 1, 0, 0.25)
 816
 817			self.HealPrediction = {
 818				myBar = mhpb,
 819				otherBar = ohpb,
 820				maxOverflow = 1,
 821			}
 822		end
 823		
 824		-- player aggro
 825		if C["unitframes"].playeraggro == true then
 826			table.insert(self.__elements, T.UpdateThreat)
 827			self:RegisterEvent('PLAYER_TARGET_CHANGED', T.UpdateThreat)
 828			self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', T.UpdateThreat)
 829			self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', T.UpdateThreat)
 830		end
 831	end
 832	
 833	------------------------------------------------------------------------
 834	--	Target of Target unit layout
 835	------------------------------------------------------------------------
 836	
 837	if (unit == "targettarget") then
 838	
 839		-- create panel for both high and low version
 840		local panel = CreateFrame("Frame", nil, self)
 841		if T.lowversion then
 842			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 843			panel:SetFrameLevel(2)
 844			panel:SetFrameStrata("MEDIUM")
 845			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 846			panel:SetAlpha(0)
 847			self.panel = panel
 848		else
 849			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 850			panel:SetFrameLevel(2)
 851			panel:SetFrameStrata("MEDIUM")
 852			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 853			panel:SetAlpha(0)
 854			self.panel = panel
 855		end
 856		
 857		-- health bar
 858		local health = CreateFrame('StatusBar', nil, self)
 859		health:Height(15)
 860		health:SetPoint("TOPLEFT")
 861		health:SetPoint("TOPRIGHT")
 862		health:SetStatusBarTexture(normTex)
 863		
 864		-- Border for ToT
 865		local HealthBorder = CreateFrame("Frame", nil, health)
 866		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
 867		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
 868		HealthBorder:SetTemplate("Default")
 869		HealthBorder:CreateShadow("Default")
 870		HealthBorder:SetFrameLevel(2)
 871		self.HealthBorder = HealthBorder
 872		
 873		local healthBG = health:CreateTexture(nil, 'BORDER')
 874		healthBG:SetAllPoints()
 875		healthBG:SetTexture(0, 0, 0)
 876		
 877		self.Health = health
 878		self.Health.bg = healthBG
 879		
 880		health.frequentUpdates = true
 881		if C["unitframes"].showsmooth == true then
 882			health.Smooth = true
 883		end
 884		
 885		if C["unitframes"].unicolor == true then
 886			health.colorDisconnected = false
 887			health.colorClass = false
 888			health:SetStatusBarColor(.150, .150, .150, 1)
 889			healthBG:SetVertexColor(0, 0, 0, 1)		
 890		else
 891			health.colorDisconnected = true
 892			health.colorClass = true
 893			health.colorReaction = true			
 894		end
 895		
 896		-- power
 897		local power = CreateFrame('StatusBar', nil, self)
 898		power:Size(130, 2)
 899		power:Point("TOP", health, "BOTTOM", 0, -7)
 900		power:SetStatusBarTexture(normTex)
 901		
 902		-- Border for Power
 903		local PowerBorder = CreateFrame("Frame", nil, power)
 904		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
 905		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
 906		PowerBorder:SetTemplate("Default")
 907		PowerBorder:CreateShadow("Default")
 908		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
 909		self.PowerBorder = PowerBorder
 910		
 911		power.frequentUpdates = true
 912
 913		if C["unitframes"].showsmooth == true then
 914			power.Smooth = true
 915		end
 916
 917		local powerBG = power:CreateTexture(nil, 'BORDER')
 918		powerBG:SetAllPoints(power)
 919		powerBG:SetTexture(normTex)
 920		powerBG.multiplier = 0.3
 921				
 922		self.Power = power
 923		self.Power.bg = powerBG
 924
 925		if C["unitframes"].showsmooth == true then
 926			power.Smooth = true
 927		end
 928		
 929		if C["unitframes"].unicolor == true then
 930			power.colorTapping = true
 931			power.colorClass = true
 932			power.colorReaction = true
 933			powerBG.multiplier = 0.1				
 934		else
 935			power.colorPower = true
 936		end
 937		
 938		-- Unit name
 939		local Name = health:CreateFontString(nil, "OVERLAY")
 940		Name:SetPoint("CENTER", self.Health, "CENTER", 0, 1)
 941		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
 942		Name:SetJustifyH("CENTER")
 943
 944		self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
 945		self.Name = Name
 946		
 947		if C["unitframes"].totdebuffs == true then
 948			local debuffs = CreateFrame("Frame", nil, health)
 949			debuffs:SetHeight(24)
 950			debuffs:SetWidth(128)
 951			debuffs.size = 24
 952			debuffs.spacing = 3
 953			debuffs.num = 5
 954
 955			debuffs:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 29)
 956			debuffs.initialAnchor = "TOPLEFT"
 957			debuffs["growth-y"] = "UP"
 958			debuffs.PostCreateIcon = T.PostCreateAura
 959			debuffs.PostUpdateIcon = T.PostUpdateAura
 960			self.Debuffs = debuffs
 961		end
 962	end
 963	
 964	------------------------------------------------------------------------
 965	--	Pet unit layout
 966	------------------------------------------------------------------------
 967	
 968	if (unit == "pet") then
 969	
 970		-- create panel for both high and low version
 971		local panel = CreateFrame("Frame", nil, self)
 972		if T.lowversion then
 973			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 974			panel:SetFrameLevel(2)
 975			panel:SetFrameStrata("MEDIUM")
 976			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 977			panel:SetAlpha(0)
 978			self.panel = panel
 979		else
 980			panel:CreatePanel("Default", 129, 17, "BOTTOM", self, "BOTTOM", 0, T.Scale(0))
 981			panel:SetFrameLevel(2)
 982			panel:SetFrameStrata("MEDIUM")
 983			panel:SetBackdropBorderColor(unpack(C["media"].bordercolor))
 984			panel:SetAlpha(0)
 985			self.panel = panel
 986		end
 987		
 988		-- health bar
 989		local health = CreateFrame('StatusBar', nil, self)
 990		if C["unitframes"].extendedpet == true then
 991			health:Height(15)
 992		else
 993			health:Height(22)
 994		end
 995		health:SetPoint("TOPLEFT")
 996		health:SetPoint("TOPRIGHT")
 997		health:SetStatusBarTexture(normTex)
 998		
 999		-- Border for Health
1000		local HealthBorder = CreateFrame("Frame", nil, health)
1001		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1002		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1003		HealthBorder:SetTemplate("Default")
1004		HealthBorder:CreateShadow("Default")
1005		HealthBorder:SetFrameLevel(2)
1006		self.HealthBorder = HealthBorder
1007		
1008		health.PostUpdate = T.PostUpdatePetColor
1009				
1010		self.Health = health
1011		self.Health.bg = healthBG
1012		
1013		local healthBG = health:CreateTexture(nil, 'BORDER')
1014		healthBG:SetAllPoints()
1015		healthBG:SetTexture(0, 0, 0)
1016		
1017		health.frequentUpdates = true
1018		if C["unitframes"].showsmooth == true then
1019			health.Smooth = true
1020		end
1021		
1022		if C["unitframes"].unicolor == true then
1023			health.colorDisconnected = false
1024			health.colorClass = false
1025			health:SetStatusBarColor(.150, .150, .150, 1)
1026			healthBG:SetVertexColor(0, 0, 0, 1)		
1027		else
1028			health.colorDisconnected = true	
1029			health.colorClass = true
1030			health.colorReaction = true	
1031			if T.myclass == "HUNTER" then
1032				health.colorHappiness = true
1033			end
1034		end
1035		
1036		-- power
1037		if C["unitframes"].extendedpet == true then
1038			local power = CreateFrame('StatusBar', nil, self)
1039			power:Size(130, 2)
1040			power:Point("TOP", health, "BOTTOM", 0, -7)
1041			power:SetStatusBarTexture(normTex)
1042
1043			power.frequentUpdates = true
1044			power.colorPower = true
1045			if C["unitframes"].showsmooth == true then
1046				power.Smooth = true
1047			end
1048
1049			local powerBG = power:CreateTexture(nil, 'BORDER')
1050			powerBG:SetAllPoints(power)
1051			powerBG:SetTexture(normTex)
1052			powerBG.multiplier = 0.3
1053			
1054			-- Border for Power
1055			local PowerBorder = CreateFrame("Frame", nil, power)
1056			PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1057			PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1058			PowerBorder:SetTemplate("Default")
1059			PowerBorder:CreateShadow("Default")
1060			PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1061			self.PowerBorder = PowerBorder
1062
1063			self.Power = power
1064			self.Power.bg = powerBG
1065		end
1066				
1067		-- Unit name
1068		local Name = health:CreateFontString(nil, "OVERLAY")
1069		Name:SetPoint("CENTER", self.Health, "CENTER", 1, 1)
1070		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1071		Name:SetJustifyH("CENTER")
1072
1073		self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
1074		self.Name = Name
1075		
1076		-- update pet name, this should fix "UNKNOWN" pet names on pet unit, health and bar color sometime being "grayish".
1077		self:RegisterEvent("UNIT_PET", T.updateAllElements)
1078	end
1079	
1080	------------------------------------------------------------------------
1081	--	Pet target unit layout
1082	------------------------------------------------------------------------
1083	
1084	if (unit == "pettarget") then
1085		-- health bar
1086		local health = CreateFrame('StatusBar', nil, self)
1087		health:Height(15)
1088		health:SetPoint("TOPLEFT")
1089		health:SetPoint("TOPRIGHT")
1090		health:SetStatusBarTexture(normTex)
1091		
1092		-- Border for ToT
1093		local HealthBorder = CreateFrame("Frame", nil, health)
1094		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1095		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1096		HealthBorder:SetTemplate("Default")
1097		HealthBorder:CreateShadow("Default")
1098		HealthBorder:SetFrameLevel(2)
1099		self.HealthBorder = HealthBorder
1100		
1101		local healthBG = health:CreateTexture(nil, 'BORDER')
1102		healthBG:SetAllPoints()
1103		healthBG:SetTexture(0, 0, 0)
1104		
1105		self.Health = health
1106		self.Health.bg = healthBG
1107		
1108		health.frequentUpdates = true
1109		if C["unitframes"].showsmooth == true then
1110			health.Smooth = true
1111		end
1112		
1113		if C["unitframes"].unicolor == true then
1114			health.colorDisconnected = false
1115			health.colorClass = false
1116			health:SetStatusBarColor(.150, .150, .150, 1)
1117			healthBG:SetVertexColor(0, 0, 0, 1)		
1118		else
1119			health.colorDisconnected = true
1120			health.colorClass = true
1121			health.colorReaction = true			
1122		end
1123		
1124		-- power
1125		local power = CreateFrame('StatusBar', nil, self)
1126		power:Size(128, 2)
1127		power:Point("TOP", health, "BOTTOM", 0, -7)
1128		power:SetStatusBarTexture(normTex)
1129		
1130		-- Border for Power
1131		local PowerBorder = CreateFrame("Frame", nil, power)
1132		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1133		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1134		PowerBorder:SetTemplate("Default")
1135		PowerBorder:CreateShadow("Default")
1136		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1137		self.PowerBorder = PowerBorder
1138		
1139		power.frequentUpdates = true
1140
1141		if C["unitframes"].showsmooth == true then
1142			power.Smooth = true
1143		end
1144
1145		local powerBG = power:CreateTexture(nil, 'BORDER')
1146		powerBG:SetAllPoints(power)
1147		powerBG:SetTexture(normTex)
1148		powerBG.multiplier = 0.3
1149				
1150		self.Power = power
1151		self.Power.bg = powerBG
1152
1153		if C["unitframes"].showsmooth == true then
1154			power.Smooth = true
1155		end
1156		
1157		if C["unitframes"].unicolor == true then
1158			power.colorTapping = true
1159			power.colorClass = true
1160			power.colorReaction = true
1161			powerBG.multiplier = 0.1				
1162		else
1163			power.colorPower = true
1164		end
1165		
1166		-- Unit name
1167		local Name = health:CreateFontString(nil, "OVERLAY")
1168		Name:SetPoint("CENTER", self.Health, "CENTER", 0, 1)
1169		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1170		Name:SetJustifyH("CENTER")
1171
1172		self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
1173		self.Name = Name
1174		
1175		-- update pet name, this should fix "UNKNOWN" pet names on pet unit, health and bar color sometime being "grayish".
1176		self:RegisterEvent("UNIT_PET", T.updateAllElements)
1177	end
1178
1179
1180	------------------------------------------------------------------------
1181	--	Focus unit layout
1182	------------------------------------------------------------------------
1183	
1184	if (unit == "focus") then
1185		-- health 
1186		local health = CreateFrame('StatusBar', nil, self)
1187		health:Height(18)
1188		health:SetPoint("TOPLEFT")
1189		health:SetPoint("TOPRIGHT")
1190		health:SetStatusBarTexture(normTex)
1191		
1192		-- Border for Health
1193		local HealthBorder = CreateFrame("Frame", nil, health)
1194		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1195		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1196		HealthBorder:SetTemplate("Default")
1197		HealthBorder:CreateShadow("Default")
1198		HealthBorder:SetFrameLevel(2)
1199		self.HealthBorder = HealthBorder
1200
1201		health.frequentUpdates = true
1202		health.colorDisconnected = true
1203		if C["unitframes"].showsmooth == true then
1204			health.Smooth = true
1205		end
1206		health.colorClass = true
1207		
1208		local healthBG = health:CreateTexture(nil, 'BORDER')
1209		healthBG:SetAllPoints()
1210		healthBG:SetTexture(0, 0, 0)
1211
1212		health.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1213		health.value:Point("LEFT", 2, 0)
1214		health.PostUpdate = T.PostUpdateHealth
1215				
1216		self.Health = health
1217		self.Health.bg = healthBG
1218		
1219		health.frequentUpdates = true
1220		if C["unitframes"].showsmooth == true then
1221			health.Smooth = true
1222		end
1223		
1224		if C["unitframes"].unicolor == true then
1225			health.colorDisconnected = false
1226			health.colorClass = false
1227			health:SetStatusBarColor(.150, .150, .150, 1)
1228			healthBG:SetVertexColor(0, 0, 0, 1)		
1229		else
1230			health.colorDisconnected = true
1231			health.colorClass = true
1232			health.colorReaction = true	
1233		end
1234	
1235		-- power
1236		local power = CreateFrame('StatusBar', nil, self)
1237		power:Size(200, 2)
1238		power:Point("TOP", health, "BOTTOM", 0, -7)
1239		power:SetStatusBarTexture(normTex)
1240		
1241		-- Border for Power
1242		local PowerBorder = CreateFrame("Frame", nil, power)
1243		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1244		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1245		PowerBorder:SetTemplate("Default")
1246		PowerBorder:CreateShadow("Default")
1247		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1248		self.PowerBorder = PowerBorder
1249		
1250		power.frequentUpdates = true
1251		power.colorPower = true
1252		if C["unitframes"].showsmooth == true then
1253			power.Smooth = true
1254		end
1255
1256		local powerBG = power:CreateTexture(nil, 'BORDER')
1257		powerBG:SetAllPoints(power)
1258		powerBG:SetTexture(normTex)
1259		powerBG.multiplier = 0.3
1260		
1261		power.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1262		power.value:Point("RIGHT", -2, 1)
1263		power.PreUpdate = T.PreUpdatePower
1264		power.PostUpdate = T.PostUpdatePower
1265				
1266		self.Power = power
1267		self.Power.bg = powerBG
1268		
1269		-- names
1270		local Name = health:CreateFontString(nil, "OVERLAY")
1271		Name:SetPoint("CENTER", health, "CENTER", 0, 1)
1272		Name:SetJustifyH("CENTER")
1273		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1274		Name:SetShadowColor(0, 0, 0)
1275		Name:SetShadowOffset(1.25, -1.25)
1276		
1277		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
1278		self.Name = Name
1279
1280		-- create debuff for arena units
1281		local debuffs = CreateFrame("Frame", nil, self)
1282		debuffs:SetHeight(26)
1283		debuffs:SetWidth(200)
1284		debuffs:Point('RIGHT', self, 'LEFT', -4, 0)
1285		debuffs.size = 26
1286		debuffs.num = 8
1287		debuffs.spacing = 2
1288		debuffs.initialAnchor = 'RIGHT'
1289		debuffs["growth-x"] = "LEFT"
1290		debuffs.PostCreateIcon = T.PostCreateAura
1291		debuffs.PostUpdateIcon = T.PostUpdateAura
1292		self.Debuffs = debuffs
1293		
1294		local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
1295		castbar:SetPoint("LEFT", 0, 0)
1296		castbar:SetPoint("RIGHT", -23, 0)
1297		castbar:SetPoint("BOTTOM", 0, -20)
1298		
1299		castbar:SetHeight(16)
1300		castbar:SetStatusBarTexture(normTex)
1301		castbar:SetFrameLevel(6)
1302		
1303		castbar.bg = CreateFrame("Frame", nil, castbar)
1304		castbar.bg:SetTemplate("Default")
1305		castbar.bg:CreateShadow("Default")
1306		castbar.bg:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1307		castbar.bg:Point("TOPLEFT", -2, 2)
1308		castbar.bg:Point("BOTTOMRIGHT", 2, -2)
1309		castbar.bg:SetFrameLevel(5)
1310		
1311		castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1312		castbar.time:Point("RIGHT", castbar, "RIGHT", -4, 0)
1313		castbar.time:SetTextColor(0, 4, 0)
1314		castbar.time:SetJustifyH("RIGHT")
1315		castbar.CustomTimeText = T.CustomCastTimeText
1316
1317		castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1318		castbar.Text:SetPoint("LEFT", castbar, "LEFT", 4, 0)
1319		castbar.Text:SetTextColor(0.3, 0.2, 1)
1320		castbar.Text:Width(100)
1321		castbar.Text:Height(12)
1322		
1323		castbar.CustomDelayText = T.CustomCastDelayText
1324		castbar.PostCastStart =T.PostCastStart
1325		castbar.PostChannelStart = T.PostCastStart
1326								
1327		castbar.button = CreateFrame("Frame", nil, castbar)
1328		castbar.button:Height(castbar:GetHeight()+4)
1329		castbar.button:Width(castbar:GetHeight()+4)
1330		castbar.button:Point("LEFT", castbar, "RIGHT", 5, 0)
1331		castbar.button:SetTemplate("Default")
1332		castbar.button:CreateShadow("Default")
1333		castbar.button:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1334		castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
1335		castbar.icon:Point("TOPLEFT", castbar.button, 2, -2)
1336		castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
1337		castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
1338
1339		self.Castbar = castbar
1340		self.Castbar.Time = castbar.time
1341		self.Castbar.Icon = castbar.icon
1342	end
1343	
1344	------------------------------------------------------------------------
1345	--	Focus target unit layout
1346	------------------------------------------------------------------------
1347
1348	if (unit == "focustarget") then
1349		-- health 
1350		local health = CreateFrame('StatusBar', nil, self)
1351		health:Height(18)
1352		health:SetPoint("TOPLEFT")
1353		health:SetPoint("TOPRIGHT")
1354		health:SetStatusBarTexture(normTex)
1355		
1356		-- Border for Health
1357		local HealthBorder = CreateFrame("Frame", nil, health)
1358		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1359		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1360		HealthBorder:SetTemplate("Default")
1361		HealthBorder:CreateShadow("Default")
1362		HealthBorder:SetFrameLevel(2)
1363		self.HealthBorder = HealthBorder
1364
1365		health.frequentUpdates = true
1366		health.colorDisconnected = true
1367		if C["unitframes"].showsmooth == true then
1368			health.Smooth = true
1369		end
1370		health.colorClass = true
1371		
1372		local healthBG = health:CreateTexture(nil, 'BORDER')
1373		healthBG:SetAllPoints()
1374		healthBG:SetTexture(0, 0, 0)
1375
1376		health.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1377		health.value:Point("LEFT", 2, 0)
1378		health.PostUpdate = T.PostUpdateHealth
1379				
1380		self.Health = health
1381		self.Health.bg = healthBG
1382		
1383		health.frequentUpdates = true
1384		if C["unitframes"].showsmooth == true then
1385			health.Smooth = true
1386		end
1387		
1388		if C["unitframes"].unicolor == true then
1389			health.colorDisconnected = false
1390			health.colorClass = false
1391			health:SetStatusBarColor(.150, .150, .150, 1)
1392			healthBG:SetVertexColor(0, 0, 0, 1)		
1393		else
1394			health.colorDisconnected = true
1395			health.colorClass = true
1396			health.colorReaction = true	
1397		end
1398	
1399		-- power
1400		local power = CreateFrame('StatusBar', nil, self)
1401		power:Size(200, 2)
1402		power:Point("TOP", health, "BOTTOM", 0, -7)
1403		power:SetStatusBarTexture(normTex)
1404		
1405		-- Border for Power
1406		local PowerBorder = CreateFrame("Frame", nil, power)
1407		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1408		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1409		PowerBorder:SetTemplate("Default")
1410		PowerBorder:CreateShadow("Default")
1411		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1412		self.PowerBorder = PowerBorder
1413		
1414		power.frequentUpdates = true
1415		power.colorPower = true
1416		if C["unitframes"].showsmooth == true then
1417			power.Smooth = true
1418		end
1419
1420		local powerBG = power:CreateTexture(nil, 'BORDER')
1421		powerBG:SetAllPoints(power)
1422		powerBG:SetTexture(normTex)
1423		powerBG.multiplier = 0.3
1424		
1425		power.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1426		power.value:Point("RIGHT", -2, 1)
1427		power.PreUpdate = T.PreUpdatePower
1428		power.PostUpdate = T.PostUpdatePower
1429				
1430		self.Power = power
1431		self.Power.bg = powerBG
1432		
1433		-- names
1434		local Name = health:CreateFontString(nil, "OVERLAY")
1435		Name:SetPoint("CENTER", health, "CENTER", 0, 1)
1436		Name:SetJustifyH("CENTER")
1437		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1438		Name:SetShadowColor(0, 0, 0)
1439		Name:SetShadowOffset(1.25, -1.25)
1440		
1441		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
1442		self.Name = Name
1443
1444		-- create debuff for arena units
1445		local debuffs = CreateFrame("Frame", nil, self)
1446		debuffs:SetHeight(26)
1447		debuffs:SetWidth(200)
1448		debuffs:Point('RIGHT', self, 'LEFT', -4, 0)
1449		debuffs.size = 26
1450		debuffs.num = 0
1451		debuffs.spacing = 2
1452		debuffs.initialAnchor = 'RIGHT'
1453		debuffs["growth-x"] = "LEFT"
1454		debuffs.PostCreateIcon = T.PostCreateAura
1455		debuffs.PostUpdateIcon = T.PostUpdateAura
1456		self.Debuffs = debuffs
1457		
1458		local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
1459		castbar:SetPoint("LEFT", 0, 0)
1460		castbar:SetPoint("RIGHT", -23, 0)
1461		castbar:SetPoint("BOTTOM", 0, -20)
1462		
1463		castbar:SetHeight(16)
1464		castbar:SetStatusBarTexture(normTex)
1465		castbar:SetFrameLevel(6)
1466		
1467		castbar.bg = CreateFrame("Frame", nil, castbar)
1468		castbar.bg:SetTemplate("Default")
1469		castbar.bg:CreateShadow("Default")
1470		castbar.bg:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1471		castbar.bg:Point("TOPLEFT", -2, 2)
1472		castbar.bg:Point("BOTTOMRIGHT", 2, -2)
1473		castbar.bg:SetFrameLevel(5)
1474		
1475		castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1476		castbar.time:Point("RIGHT", castbar, "RIGHT", -4, 0)
1477		castbar.time:SetTextColor(0, 4, 0)
1478		castbar.time:SetJustifyH("RIGHT")
1479		castbar.CustomTimeText = T.CustomCastTimeText
1480
1481		castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1482		castbar.Text:SetPoint("LEFT", castbar, "LEFT", 4, 0)
1483		castbar.Text:SetTextColor(0.3, 0.2, 1)
1484		castbar.Text:Width(100)
1485		castbar.Text:Height(12)
1486		
1487		castbar.CustomDelayText = T.CustomCastDelayText
1488		castbar.PostCastStart = T.PostCastStart
1489		castbar.PostChannelStart = T.PostCastStart
1490								
1491		castbar.button = CreateFrame("Frame", nil, castbar)
1492		castbar.button:Height(castbar:GetHeight()+4)
1493		castbar.button:Width(castbar:GetHeight()+4)
1494		castbar.button:Point("LEFT", castbar, "RIGHT", 5, 0)
1495		castbar.button:SetTemplate("Default")
1496		castbar.button:CreateShadow("Default")
1497		castbar.button:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1498		castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
1499		castbar.icon:Point("TOPLEFT", castbar.button, 2, -2)
1500		castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
1501		castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
1502
1503		self.Castbar = castbar
1504		self.Castbar.Time = castbar.time
1505		self.Castbar.Icon = castbar.icon
1506	end
1507
1508	------------------------------------------------------------------------
1509	--	Arena or boss units layout (both mirror'd)
1510	------------------------------------------------------------------------
1511	
1512	if (unit and unit:find("arena%d") and C["arena"].unitframes == true) or (unit and unit:find("boss%d") and C["unitframes"].showboss == true) then
1513		-- Right-click focus on arena or boss units
1514		self:SetAttribute("type2", "focus")
1515		
1516		-- health 
1517		local health = CreateFrame('StatusBar', nil, self)
1518		health:Height(18)
1519		health:SetPoint("TOPLEFT")
1520		health:SetPoint("TOPRIGHT")
1521		health:SetStatusBarTexture(normTex)
1522		
1523		-- Border for Health
1524		local HealthBorder = CreateFrame("Frame", nil, health)
1525		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1526		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1527		HealthBorder:SetTemplate("Default")
1528		HealthBorder:CreateShadow("Default")
1529		HealthBorder:SetFrameLevel(2)
1530		self.HealthBorder = HealthBorder
1531
1532		health.frequentUpdates = true
1533		health.colorDisconnected = true
1534		if C["unitframes"].showsmooth == true then
1535			health.Smooth = true
1536		end
1537		health.colorClass = true
1538		
1539		local healthBG = health:CreateTexture(nil, 'BORDER')
1540		healthBG:SetAllPoints()
1541		healthBG:SetTexture(0, 0, 0)
1542
1543		health.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1544		health.value:Point("LEFT", 2, 0)
1545		health.PostUpdate = T.PostUpdateHealth
1546				
1547		self.Health = health
1548		self.Health.bg = healthBG
1549		
1550		health.frequentUpdates = true
1551		if C["unitframes"].showsmooth == true then
1552			health.Smooth = true
1553		end
1554		
1555		if C["unitframes"].unicolor == true then
1556			health.colorDisconnected = false
1557			health.colorClass = false
1558			health:SetStatusBarColor(.150, .150, .150, 1)
1559			healthBG:SetVertexColor(0, 0, 0, 1)		
1560		else
1561			health.colorDisconnected = true
1562			health.colorClass = true
1563			health.colorReaction = true	
1564		end
1565	
1566		-- power
1567		local power = CreateFrame('StatusBar', nil, self)
1568		power:Size(200, 2)
1569		power:Point("TOP", health, "BOTTOM", 0, -7)
1570		power:SetStatusBarTexture(normTex)
1571		
1572		-- Border for Power
1573		local PowerBorder = CreateFrame("Frame", nil, power)
1574		PowerBorder:SetPoint("TOPLEFT", power, "TOPLEFT", -2, 2)
1575		PowerBorder:SetPoint("BOTTOMRIGHT", power, "BOTTOMRIGHT", 2, -2)
1576		PowerBorder:SetTemplate("Default")
1577		PowerBorder:CreateShadow("Default")
1578		PowerBorder:SetFrameLevel(power:GetFrameLevel() - 1)
1579		self.PowerBorder = PowerBorder
1580		
1581		power.frequentUpdates = true
1582		power.colorPower = true
1583		if C["unitframes"].showsmooth == true then
1584			power.Smooth = true
1585		end
1586
1587		local powerBG = power:CreateTexture(nil, 'BORDER')
1588		powerBG:SetAllPoints(power)
1589		powerBG:SetTexture(normTex)
1590		powerBG.multiplier = 0.3
1591		
1592		power.value = T.SetFontString(health, font,  C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1593		power.value:Point("RIGHT", -2, 0.5)
1594		power.PreUpdate = T.PreUpdatePower
1595		power.PostUpdate = T.PostUpdatePower
1596				
1597		self.Power = power
1598		self.Power.bg = powerBG
1599		
1600		-- names
1601		local Name = health:CreateFontString(nil, "OVERLAY")
1602		Name:SetPoint("CENTER", health, "CENTER", 0, 1)
1603		Name:SetJustifyH("CENTER")
1604		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1605		Name:SetShadowColor(0, 0, 0)
1606		Name:SetShadowOffset(1.25, -1.25)
1607		Name.frequentUpdates = 0.2
1608		
1609		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
1610		self.Name = Name
1611		
1612		if (unit and unit:find("boss%d")) then
1613			-- alt power bar
1614			local AltPowerBar = CreateFrame("StatusBar", nil, self.Health)
1615			AltPowerBar:SetFrameLevel(self.Health:GetFrameLevel() + 1)
1616			AltPowerBar:Height(2)
1617			AltPowerBar:SetStatusBarTexture(C.media.normTex)
1618			AltPowerBar:GetStatusBarTexture():SetHorizTile(false)
1619			AltPowerBar:SetStatusBarColor(1, 0, 0)
1620
1621			AltPowerBar:SetPoint("LEFT")
1622			AltPowerBar:SetPoint("RIGHT")
1623			AltPowerBar:SetPoint("TOP", self.Health, "TOP")
1624			
1625			AltPowerBar:SetBackdrop(backdrop)
1626			AltPowerBar:SetBackdropColor(0, 0, 0)
1627
1628			self.AltPowerBar = AltPowerBar
1629			
1630			-- create buff at left of unit if they are boss units
1631			local buffs = CreateFrame("Frame", nil, self)
1632			buffs:SetHeight(31)
1633			buffs:SetWidth(102)
1634			buffs:Point("TOPRIGHT", self, "TOPLEFT", -5, 2)
1635			buffs.size = 31
1636			buffs.num = 3
1637			buffs.spacing = 3
1638			buffs.initialAnchor = 'RIGHT'
1639			buffs["growth-x"] = "LEFT"
1640			buffs.PostCreateIcon = T.PostCreateAura
1641			buffs.PostUpdateIcon = T.PostUpdateAura
1642			self.Buffs = buffs
1643			
1644			-- because it appear that sometime elements are not correct.
1645			self:HookScript("OnShow", T.updateAllElements)
1646		end
1647
1648		-- create debuff for arena units
1649		local debuffs = CreateFrame("Frame", nil, self)
1650		debuffs:SetHeight(31)
1651		debuffs:SetWidth(102)
1652		debuffs:Point('TOPLEFT', self, 'TOPRIGHT', 5, 2)
1653		debuffs.size = 31
1654		debuffs.num = 3
1655		debuffs.spacing = 3
1656		debuffs.initialAnchor = 'LEFT'
1657		debuffs["growth-x"] = "RIGHT"
1658		debuffs.PostCreateIcon = T.PostCreateAura
1659		debuffs.PostUpdateIcon = T.PostUpdateAura
1660		self.Debuffs = debuffs
1661				
1662		-- trinket feature via trinket plugin
1663		if (C.arena.unitframes) and (unit and unit:find('arena%d')) then
1664			local Trinketbg = CreateFrame("Frame", nil, self)
1665			Trinketbg:SetHeight(31)
1666			Trinketbg:SetWidth(31)
1667			Trinketbg:Point("TOPRIGHT", self, "TOPLEFT", -5, 2)				
1668			Trinketbg:SetTemplate("Default")
1669			Trinketbg:CreateShadow("Default")
1670			Trinketbg:SetFrameLevel(0)
1671			self.Trinketbg = Trinketbg
1672			
1673			local Trinket = CreateFrame("Frame", nil, Trinketbg)
1674			Trinket:SetAllPoints(Trinketbg)
1675			Trinket:Point("TOPLEFT", Trinketbg, 2, -2)
1676			Trinket:Point("BOTTOMRIGHT", Trinketbg, -2, 2)
1677			Trinket:SetFrameLevel(1)
1678			Trinket.trinketUseAnnounce = true
1679			self.Trinket = Trinket
1680		end
1681		
1682		-- boss & arena frames cast bar!
1683		local castbar = CreateFrame("StatusBar", self:GetName().."CastBar", self)
1684		castbar:SetPoint("LEFT", 23, -1)
1685		castbar:SetPoint("RIGHT", 0, -1)
1686		castbar:SetPoint("BOTTOM", 0, -23)
1687
1688		castbar:SetHeight(16)
1689		castbar:SetStatusBarTexture(normTex)
1690		castbar:SetFrameLevel(6)
1691		
1692		castbar.bg = CreateFrame("Frame", nil, castbar)
1693		castbar.bg:SetTemplate("Default")
1694		castbar.bg:CreateShadow("Default")
1695		castbar.bg:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1696		castbar.bg:Point("TOPLEFT", -2, 2)
1697		castbar.bg:Point("BOTTOMRIGHT", 2, -2)
1698		castbar.bg:SetFrameLevel(5)
1699		
1700		castbar.time = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1701		castbar.time:Point("RIGHT", castbar, "RIGHT", -4, 0)
1702		castbar.time:SetTextColor(0, 4, 0)
1703		castbar.time:SetJustifyH("RIGHT")
1704		castbar.CustomTimeText = T.CustomCastTimeText
1705
1706		castbar.Text = T.SetFontString(castbar,font, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
1707		castbar.Text:Point("LEFT", castbar, "LEFT", 4, 0)
1708		castbar.Text:SetTextColor(0.3, 0.2, 1)
1709		castbar.Text:Width(100)
1710		castbar.Text:Height(10)
1711		
1712		castbar.CustomDelayText = T.CustomCastDelayText
1713		castbar.PostCastStart = T.PostCastStart
1714		castbar.PostChannelStart = T.PostCastStart
1715								
1716		castbar.button = CreateFrame("Frame", nil, castbar)
1717		castbar.button:Height(castbar:GetHeight()+4)
1718		castbar.button:Width(castbar:GetHeight()+4)
1719		castbar.button:Point("RIGHT", castbar, "LEFT",-5, 0)
1720		castbar.button:SetTemplate("Default")
1721		castbar.button:CreateShadow("Default")
1722		castbar.button:SetBackdropBorderColor(unpack(C["media"].bordercolor))
1723		castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
1724		castbar.icon:Point("TOPLEFT", castbar.button, T.Scale(2), T.Scale(-2))
1725		castbar.icon:Point("BOTTOMRIGHT", castbar.button, -2, 2)
1726		castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
1727
1728		self.Castbar = castbar
1729		self.Castbar.Time = castbar.time
1730		self.Castbar.Icon = castbar.icon
1731	end
1732
1733	------------------------------------------------------------------------
1734	--	Main tanks and Main Assists layout (both mirror'd)
1735	------------------------------------------------------------------------
1736	
1737	if (self:GetParent():GetName():match"TukuiMainTank" or self:GetParent():GetName():match"TukuiMainAssist") then
1738		-- Right-click focus on maintank or mainassist units
1739		self:SetAttribute("type2", "focus")
1740		
1741		-- health 
1742		local health = CreateFrame('StatusBar', nil, self)
1743		health:Height(20)
1744		health:SetPoint("TOPLEFT")
1745		health:SetPoint("TOPRIGHT")
1746		health:SetStatusBarTexture(normTex)
1747		
1748		local healthBG = health:CreateTexture(nil, 'BORDER')
1749		healthBG:SetAllPoints()
1750		healthBG:SetTexture(0, 0, 0)
1751		
1752		-- Border for HealthBar
1753		local HealthBorder = CreateFrame("Frame", nil, health)
1754		HealthBorder:SetPoint("TOPLEFT", health, "TOPLEFT", -2, 2)
1755		HealthBorder:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 2, -2)
1756		HealthBorder:SetTemplate("Default")
1757		HealthBorder:CreateShadow("Default")
1758		HealthBorder:SetFrameLevel(2)
1759		self.HealthBorder = HealthBorder
1760				
1761		self.Health = health
1762		self.Health.bg = healthBG
1763		
1764		health.frequentUpdates = true
1765		if C["unitframes"].showsmooth == true then
1766			health.Smooth = true
1767		end
1768		
1769		if C["unitframes"].unicolor == true then
1770			health.colorDisconnected = false
1771			health.colorClass = false
1772			health:SetStatusBarColor(.150, .150, .150, 1)
1773			healthBG:SetVertexColor(0, 0, 0, 1)
1774		else
1775			health.colorDisconnected = true
1776			health.colorClass = true
1777			health.colorReaction = true	
1778		end
1779		
1780		-- names
1781		local Name = health:CreateFontString(nil, "OVERLAY")
1782		Name:SetPoint("CENTER", health, "CENTER", 0, 1)
1783		Name:SetJustifyH("CENTER")
1784		Name:SetFont(font, C["datatext"].fontsize+1, "MONOCHROMEOUTLINE")
1785		Name:SetShadowColor(0, 0, 0)
1786		Name:SetShadowOffset(1.25, -1.25)
1787		
1788		self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
1789		self.Name = Name
1790	end
1791	
1792	return self
1793end
1794
1795------------------------------------------------------------------------
1796--	Default position of Tukui unitframes
1797------------------------------------------------------------------------
1798oUF:RegisterStyle('Tukui', Shared)
1799T.Player = 230
1800T.Target  = 230
1801T.ToT = 130
1802T.Pet = 130
1803T.Focus = 115 
1804T.Focustarget = 115
1805T.Boss = 200
1806T.Pettarget = 130
1807
1808-----------------------------------------------------------------------
1809-- Unitframe Spawn
1810-----------------------------------------------------------------------
1811
1812local player = oUF:Spawn('player', "TukuiPlayer")
1813local target = oUF:Spawn('target', "TukuiTarget")
1814local tot = oUF:Spawn('targettarget', "TukuiTargetTarget")
1815local pet = oUF:Spawn('pet', "TukuiPet")
1816local focus = oUF:Spawn('focus', "TukuiFocus")
1817
1818-- Sizes
1819player:Size(T.Player, player.Health:GetHeight() + player.Power:GetHeight() + player.panel:GetHeight() + 6)
1820target:Size(T.Target, target.Health:GetHeight() + target.Power:GetHeight() + target.panel:GetHeight() + 6)
1821tot:Size(T.ToT, tot.Health:GetHeight() + tot.Power:GetHeight() + tot.panel:GetHeight() + 6)
1822pet:Size(T.Pet, pet.Health:GetHeight() + pet.Power:GetHeight() + pet.panel:GetHeight() + 6)	
1823focus:Size(200, 25)
1824
1825local f = CreateFrame("Frame")
1826f:RegisterEvent("PLAYER_ENTERING_WORLD")
1827f:SetScript("OnEvent", function(self, event, addon)
1828	player:ClearAllPoints()
1829	target:ClearAllPoints()
1830	tot:ClearAllPoints()
1831	pet:ClearAllPoints()
1832	focus:ClearAllPoints()
1833if IsAddOnLoaded("Tukui_Raid") then
1834
1835	--[ DPS ]--
1836		player:Point("TOP", UIParent, "BOTTOM", -170 , 260)
1837		target:Point("TOP", UIParent, "BOTTOM", 170, 260)
1838		tot:Point("TOPRIGHT", TukuiTarget, "BOTTOMRIGHT", 0, -20)
1839		pet:Point("TOPLEFT", TukuiPlayer, "BOTTOMLEFT", 0, -20)
1840		focus:Point("TOP", UIParent, "BOTTOM", -450, 602)
1841elseif IsAddOnLoaded("Tukui_Raid_Healing") then
1842
1843	--[ HEAL ]--
1844		player:Point("TOP", UIParent, "BOTTOM", -312 , 350)
1845		target:Point("TOP", UIParent, "BOTTOM", 312, 350)
1846		tot:Point("TOPRIGHT", TukuiTarget, "BOTTOMRIGHT", 0, -25)
1847		pet:Point("TOPLEFT", TukuiPlayer, "BOTTOMLEFT", 0, -25)
1848		focus:Point("TOP", UIParent, "BOTTOM", -450, 602)
1849	else
1850	
1851	--[ NONE ]--
1852		player:Point("TOP", UIParent, "BOTTOM", -309 , 350)
1853		target:Point("TOP", UIParent, "BOTTOM", 309, 350)
1854		tot:Point("TOPRIGHT", TukuiTarget, "BOTTOMRIGHT", 0, -25)
1855		pet:Point("TOPLEFT", TukuiPlayer, "BOTTOMLEFT", 0, -25)
1856		focus:Point("TOP", UIParent, "BOTTOM", -450, 602)	
1857	end
1858end)
1859
1860-- pettarget
1861if C["unitframes"].pettarget == true then
1862local pettarget = oUF:Spawn('pettarget', "TukuiPetTarget")
1863pettarget:SetPoint("BOTTOMRIGHT", player, "TOPRIGHT", 0,5)
1864pettarget:Size(128, 26)
1865end	
1866
1867-- focus target
1868if C.unitframes.showfocustarget then
1869	local focustarget = oUF:Spawn("focustarget", "TukuiFocusTarget")
1870	focustarget:SetPoint("TOP", TukuiFocus, "BOTTOM", 0 , -35)
1871	focustarget:Size(200, 29)
1872end
1873
1874if C.arena.unitframes then
1875	local arena = {}
1876	for i = 1, 5 do
1877		arena[i] = oUF:Spawn("arena"..i, "TukuiArena"..i)
1878		if i == 1 then
1879			arena[i]:SetPoint("TOP", UIParent, "BOTTOM", 500, 550)
1880		else
1881			arena[i]:SetPoint("BOTTOM", arena[i-1], "TOP", 0, 35)
1882		end
1883		arena[i]:Size(200, 27)
1884	end	
1885end
1886
1887if C["unitframes"].showboss then
1888	for i = 1,MAX_BOSS_FRAMES do
1889		local t_boss = _G["Boss"..i.."TargetFrame"]
1890		t_boss:UnregisterAllEvents()
1891		t_boss.Show = T.dummy
1892		t_boss:Hide()
1893		_G["Boss"..i.."TargetFrame".."HealthBar"]:UnregisterAllEvents()
1894		_G["Boss"..i.."TargetFrame".."ManaBar"]:UnregisterAllEvents()
1895	end
1896end
1897
1898	local boss = {}
1899	for i = 1, MAX_BOSS_FRAMES do
1900		boss[i] = oUF:Spawn("boss"..i, "TukuiBoss"..i)
1901		if i == 1 then
1902			boss[i]:SetPoint("TOP", UIParent, "BOTTOM", 500, 550)
1903		else
1904			boss[i]:SetPoint('BOTTOM', boss[i-1], 'TOP', 0, 35)               
1905		end
1906		boss[i]:Size(200, 27)	
1907end
1908
1909local assisttank_width = 100
1910local assisttank_height  = 20
1911if C["unitframes"].maintank == true then
1912	local tank = oUF:SpawnHeader('TukuiMainTank', nil, 'raid',
1913		'oUF-initialConfigFunction', ([[
1914			self:SetWidth(%d)
1915			self:SetHeight(%d)
1916		]]):format(assisttank_width, assisttank_height),
1917		'showRaid', true,
1918		'groupFilter', 'MAINTANK',
1919		'yOffset', 7,
1920		'point' , 'BOTTOM',
1921		'template', 'oUF_TukuiMtt'
1922	)
1923	tank:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
1924end
1925 
1926if C["unitframes"].mainassist == true then
1927	local assist = oUF:SpawnHeader("TukuiMainAssist", nil, 'raid',
1928		'oUF-initialConfigFunction', ([[
1929			self:SetWidth(%d)
1930			self:SetHeight(%d)
1931		]]):format(assisttank_width, assisttank_height),
1932		'showRaid', true,
1933		'groupFilter', 'MAINASSIST',
1934		'yOffset', 7,
1935		'point' , 'BOTTOM',
1936		'template', 'oUF_TukuiMtt'
1937	)
1938	if C["unitframes"].maintank == true then
1939		assist:SetPoint("TOPLEFT", TukuiMainTank, "BOTTOMLEFT", 2, -50)
1940	else
1941		assist:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
1942	end
1943end
1944
1945-- this is just a fake party to hide Blizzard frame if no Tukui raid layout are loaded.
1946local party = oUF:SpawnHeader("oUF_noParty", nil, "party", "showParty", true)
1947
1948------------------------------------------------------------------------
1949-- Right-Click on unit frames menu. 
1950-- Doing this to remove SET_FOCUS eveywhere.
1951-- SET_FOCUS work only on default unitframes.
1952-- Main Tank and Main Assist, use /maintank and /mainassist commands.
1953------------------------------------------------------------------------
1954
1955-- Hunter Dismiss Pet Taint (Blizzard issue)
1956local PET_DISMISS = "PET_DISMISS"
1957if T.myclass == "HUNTER" then PET_DISMISS = nil end
1958
1959do
1960	UnitPopupMenus["SELF"] = { "PVP_FLAG", "LOOT_METHOD", "LOOT_THRESHOLD", "OPT_OUT_LOOT_TITLE", "LOOT_PROMOTE", "DUNGEON_DIFFICULTY", "RAID_DIFFICULTY", "RESET_INSTANCES", "RAID_TARGET_ICON", "SELECT_ROLE", "CONVERT_TO_PARTY", "CONVERT_TO_RAID", "LEAVE", "CANCEL" };
1961	UnitPopupMenus["PET"] = { "PET_PAPERDOLL", "PET_RENAME", "PET_ABANDON", PET_DISMISS, "CANCEL" };
1962	UnitPopupMenus["PARTY"] = { "MUTE", "UNMUTE", "PARTY_SILENCE", "PARTY_UNSILENCE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "PROMOTE", "PROMOTE_GUIDE", "LOOT_PROMOTE", "VOTE_TO_KICK", "UNINVITE", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "SELECT_ROLE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
1963	UnitPopupMenus["PLAYER"] = { "WHISPER", "INSPECT", "INVITE", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
1964	UnitPopupMenus["RAID_PLAYER"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "SELECT_ROLE", "RAID_LEADER", "RAID_PROMOTE", "RAID_DEMOTE", "LOOT_PROMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" };
1965	UnitPopupMenus["RAID"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "RAID_LEADER", "RAID_PROMOTE", "RAID_MAINTANK", "RAID_MAINASSIST", "RAID_TARGET_ICON", "LOOT_PROMOTE", "RAID_DEMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "CANCEL" };
1966	UnitPopupMenus["VEHICLE"] = { "RAID_TARGET_ICON", "VEHICLE_LEAVE", "CANCEL" }
1967	UnitPopupMenus["TARGET"] = { "RAID_TARGET_ICON", "CANCEL" }
1968	UnitPopupMenus["ARENAENEMY"] = { "CANCEL" }
1969	UnitPopupMenus["FOCUS"] = { "RAID_TARGET_ICON", "CANCEL" }
1970	UnitPopupMenus["BOSS"] = { "RAID_TARGET_ICON", "CANCEL" }
1971end
1972
1973--UNITFRAME LINES FOR PLAYER AND TARGET FRAME
1974
1975-- Unitframe Lines for Player Frame
1976local line = CreateFrame("Frame", "Tukuiline", TukuiPlayer)
1977Tukuiline:CreatePanel("Default", 250, 2, "CENTER", player, "CENTER", 0, 14)
1978line:SetFrameLevel(2)
1979line:SetFrameStrata("BACKGROUND")
1980
1981local line2 = CreateFrame("Frame", "Tukuiline2", TukuiPlayer)
1982Tukuiline2:CreatePanel("Default", 250, 2, "BOTTOM", player, "BOTTOM", 0, -2)
1983line2:SetFrameLevel(2)
1984line2:SetFrameStrata("BACKGROUND")
1985
1986local line3 = CreateFrame("Frame", "Tukuiline3", TukuiPlayer)
1987Tukuiline3:CreatePanel("Default", 2, 38, "RIGHT", player, "LEFT", -10, -4)
1988line3:SetFrameLevel(2)
1989line3:SetFrameStrata("BACKGROUND")
1990
1991local line4 = CreateFrame("Frame", "Tukuiline4", TukuiPlayer)
1992Tukuiline4:CreatePanel("Default", 2, 38, "LEFT", player, "RIGHT", 10, -4)
1993line4:SetFrameLevel(2)
1994line4:SetFrameStrata("BACKGROUND")
1995
1996-- Unitframe Lines for Target Frame
1997local line5 = CreateFrame("Frame", "Tukuiline5", TukuiTarget)
1998Tukuiline5:CreatePanel("Default", 250, 2, "CENTER", target, "CENTER", 0, 14)
1999line5:SetFrameLevel(2)
2000line5:SetFrameStrata("BACKGROUND")
2001
2002local line6 = CreateFrame("Frame", "Tukuiline6", TukuiTarget)
2003Tukuiline6:CreatePanel("Default", 250, 2, "BOTTOM", target, "BOTTOM", 0, -2)
2004line6:SetFrameLevel(2)
2005line6:SetFrameStrata("BACKGROUND")
2006
2007local line7 = CreateFrame("Frame", "Tukuiline7", TukuiTarget)
2008Tukuiline7:CreatePanel("Default", 2, 38, "RIGHT", target, "LEFT", -10, -4)
2009line7:SetFrameLevel(2)
2010line7:SetFrameStrata("BACKGROUND")
2011
2012local line8 = CreateFrame("Frame", "Tukuiline8", TukuiTarget)
2013Tukuiline8:CreatePanel("Default", 2, 38, "LEFT", target, "RIGHT", 10, -4)
2014line8:SetFrameLevel(2)
2015line8:SetFrameStrata("BACKGROUND")