Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HQ9 Plus 46.44 KB | None | 0 0
  1. if not TukuiCF["unitframes"].enable == true then return end
  2.  
  3. ------------------------------------------------------------------------
  4. --  local variables
  5. ------------------------------------------------------------------------
  6.  
  7. local db = TukuiCF["unitframes"]
  8. local font1 = TukuiCF["media"].uffont
  9. local font2 = TukuiCF["media"].font
  10. local normTex = TukuiCF["media"].normTex
  11. local glowTex = TukuiCF["media"].glowTex
  12. local bubbleTex = TukuiCF["media"].bubbleTex
  13.  
  14. local backdrop = {
  15.     bgFile = TukuiCF["media"].blank,
  16.     insets = {top = -TukuiDB.mult, left = -TukuiDB.mult, bottom = -TukuiDB.mult, right = -TukuiDB.mult},
  17. }
  18.  
  19. ------------------------------------------------------------------------
  20. --  Layout
  21. ------------------------------------------------------------------------
  22.  
  23. local function Shared(self, unit)
  24.     -- set our own colors
  25.     self.colors = TukuiDB.oUF_colors
  26.    
  27.     -- register click
  28.     self:RegisterForClicks('AnyUp')
  29.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  30.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  31.    
  32.     -- menu? lol
  33.     self.menu = TukuiDB.SpawnMenu
  34.     self:SetAttribute('type2', 'menu')
  35.  
  36.     -- backdrop for every units
  37.     self:SetBackdrop(backdrop)
  38.     self:SetBackdropColor(0, 0, 0)
  39.    
  40.     -- border for all frames
  41.     local FrameBorder = CreateFrame("Frame", nil, self)
  42.     FrameBorder:SetPoint("TOPLEFT", self, "TOPLEFT", TukuiDB.Scale(-2), TukuiDB.Scale(2))
  43.     FrameBorder:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", TukuiDB.Scale(2), TukuiDB.Scale(-2))
  44.     TukuiDB.SetTemplate(FrameBorder)
  45.     FrameBorder:SetBackdropBorderColor(unpack(TukuiCF["media"].altbordercolor))
  46.     FrameBorder:SetFrameLevel(2)
  47.     self.FrameBorder = FrameBorder
  48.  
  49.     ------------------------------------------------------------------------
  50.     --  Player and Target units layout (mostly mirror'd)
  51.     ------------------------------------------------------------------------
  52.    
  53.     if (unit == "player" or unit == "target") then
  54.    
  55.         -- health bar
  56.         local health = CreateFrame('StatusBar', nil, self)
  57.         health:SetHeight(TukuiDB.Scale(34))
  58.         health:SetPoint("TOPLEFT")
  59.         health:SetPoint("TOPRIGHT")
  60.         health:SetStatusBarTexture(normTex)
  61.                
  62.         -- health bar background
  63.         local healthBG = health:CreateTexture(nil, 'BORDER')
  64.         healthBG:SetAllPoints()
  65.         healthBG:SetTexture(.1, .1, .1)
  66.    
  67.         health.value = TukuiDB.SetFontString(health, font1, 14, "THINOUTLINE")
  68.         health.value:SetPoint("RIGHT", health, "RIGHT", TukuiDB.Scale(-4), TukuiDB.Scale(1))
  69.         health.PostUpdate = TukuiDB.PostUpdateHealth
  70.                
  71.         self.Health = health
  72.         self.Health.bg = healthBG
  73.  
  74.         health.frequentUpdates = true
  75.         if db.showsmooth == true then
  76.             health.Smooth = true
  77.         end
  78.        
  79.         if db.unicolor == true then
  80.             health.colorTapping = false
  81.             health.colorDisconnected = false
  82.             health.colorClass = false
  83.             health:SetStatusBarColor(.3, .3, .3, 1)
  84.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  85.         else
  86.             health.colorDisconnected = true
  87.             health.colorTapping = true 
  88.             health.colorClass = true
  89.             health.colorReaction = true        
  90.         end
  91.  
  92.         -- power
  93.         local power = CreateFrame('StatusBar', nil, self)
  94.         power:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, TukuiDB.Scale(-1)+(-TukuiDB.mult*2))
  95.         power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, TukuiDB.Scale(-1)+(-TukuiDB.mult*2))
  96.         power:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 0)
  97.         power:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
  98.         power:SetStatusBarTexture(normTex)
  99.        
  100.         -- border between health and power
  101.         self.HealthBorder = CreateFrame("Frame", nil, power)
  102.         self.HealthBorder:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -TukuiDB.mult)
  103.         self.HealthBorder:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  104.         self.HealthBorder:SetPoint("BOTTOMLEFT", power, "TOPLEFT", 0, TukuiDB.mult)
  105.         self.HealthBorder:SetPoint("BOTTOMRIGHT", power, "TOPRIGHT", 0, TukuiDB.mult)
  106.         TukuiDB.SetTemplate(self.HealthBorder)
  107.         self.HealthBorder:SetBackdropBorderColor(unpack(TukuiCF["media"].altbordercolor))
  108.        
  109.         local powerBG = power:CreateTexture(nil, 'BORDER')
  110.         powerBG:SetAllPoints(power)
  111.         powerBG:SetTexture(normTex)
  112.         powerBG.multiplier = 0.3
  113.        
  114.         power.value = TukuiDB.SetFontString(health, font1, 14, "THINOUTLINE")
  115.         power.value:SetPoint("LEFT", health, "LEFT", TukuiDB.Scale(4), TukuiDB.Scale(1))
  116.         power.PreUpdate = TukuiDB.PreUpdatePower
  117.         power.PostUpdate = TukuiDB.PostUpdatePower
  118.                
  119.         self.Power = power
  120.         self.Power.bg = powerBG
  121.        
  122.         power.frequentUpdates = true
  123.         power.colorDisconnected = true
  124.  
  125.         if db.showsmooth == true then
  126.             power.Smooth = true
  127.         end
  128.        
  129.         if db.unicolor == true then
  130.             power.colorTapping = true
  131.             power.colorClass = true
  132.             powerBG.multiplier = 0.1               
  133.         else
  134.             power.colorPower = true
  135.         end
  136.  
  137.         -- portraits
  138.         if (db.charportrait == true) then
  139.             local portrait = CreateFrame("PlayerModel", nil, self)
  140.             portrait:SetFrameLevel(8)
  141.             if TukuiDB.lowversion then
  142.                 portrait:SetHeight(51)
  143.             else
  144.                 portrait:SetHeight(57)
  145.             end
  146.             portrait:SetWidth(33)
  147.             portrait:SetAlpha(1)
  148.             if unit == "player" then
  149.                 health:SetPoint("TOPLEFT", 34,0)
  150.                 health:SetPoint("TOPRIGHT")
  151.                 power:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -TukuiDB.mult)
  152.                 power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  153.                 panel:SetPoint("TOPLEFT", power, "BOTTOMLEFT", 0, -TukuiDB.mult)
  154.                 panel:SetPoint("TOPRIGHT", power, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  155.                 portrait:SetPoint("TOPLEFT", health, "TOPLEFT", -34,0)
  156.             elseif unit == "target" then
  157.                 health:SetPoint("TOPRIGHT", -34,0)
  158.                 health:SetPoint("TOPLEFT")
  159.                 power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  160.                 power:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -TukuiDB.mult)
  161.                 panel:SetPoint("TOPRIGHT", power, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  162.                 panel:SetPoint("TOPLEFT", power, "BOTTOMLEFT", 0, -TukuiDB.mult)
  163.                 portrait:SetPoint("TOPRIGHT", health, "TOPRIGHT", 34,0)
  164.             end
  165.             table.insert(self.__elements, TukuiDB.HidePortrait)
  166.             self.Portrait = portrait
  167.         end
  168.  
  169.         if (unit == "player") then
  170.             -- combat icon
  171.             local Combat = health:CreateTexture(nil, "OVERLAY")
  172.             Combat:SetHeight(TukuiDB.Scale(19))
  173.             Combat:SetWidth(TukuiDB.Scale(19))
  174.             Combat:SetPoint("LEFT",0,1)
  175.             Combat:SetVertexColor(0.69, 0.31, 0.31)
  176.             self.Combat = Combat
  177.  
  178.             -- custom info (low mana warning)
  179.             FlashInfo = CreateFrame("Frame", "FlashInfo", self)
  180.             FlashInfo:SetScript("OnUpdate", TukuiDB.UpdateManaLevel)
  181.             FlashInfo.parent = self
  182.             FlashInfo:SetToplevel(true)
  183.             FlashInfo:SetAllPoints(panel)
  184.             FlashInfo.ManaLevel = TukuiDB.SetFontString(FlashInfo, font1, 14)
  185.             FlashInfo.ManaLevel:SetPoint("CENTER", panel, "CENTER", 0, 1)
  186.             self.FlashInfo = FlashInfo
  187.            
  188.             -- pvp status text
  189.             local status = TukuiDB.SetFontString(health, font1, 14, "THINOUTLINE")
  190.             status:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  191.             status:SetTextColor(0.69, 0.31, 0.31, 0)
  192.             self.Status = status
  193.             self:Tag(status, "[pvp]")
  194.            
  195.             -- script for pvp status and low mana
  196.             self:SetScript("OnEnter", function(self) FlashInfo.ManaLevel:Hide() status:SetAlpha(1) UnitFrame_OnEnter(self) end)
  197.             self:SetScript("OnLeave", function(self) FlashInfo.ManaLevel:Show() status:SetAlpha(0) UnitFrame_OnLeave(self) end)
  198.            
  199.             -- leader icon
  200.             local Leader = health:CreateTexture(nil, "OVERLAY")
  201.             Leader:SetHeight(TukuiDB.Scale(14))
  202.             Leader:SetWidth(TukuiDB.Scale(14))
  203.             Leader:SetPoint("TOPLEFT", TukuiDB.Scale(2), TukuiDB.Scale(8))
  204.             self.Leader = Leader
  205.            
  206.             -- master looter
  207.             local MasterLooter = health:CreateTexture(nil, "OVERLAY")
  208.             MasterLooter:SetHeight(TukuiDB.Scale(14))
  209.             MasterLooter:SetWidth(TukuiDB.Scale(14))
  210.             self.MasterLooter = MasterLooter
  211.             self:RegisterEvent("PARTY_LEADER_CHANGED", TukuiDB.MLAnchorUpdate)
  212.             self:RegisterEvent("PARTY_MEMBERS_CHANGED", TukuiDB.MLAnchorUpdate)
  213.                        
  214.             -- the threat bar on info left panel ? :P
  215.             if (db.showthreat == true) then
  216.                 local ThreatBar = CreateFrame("StatusBar", self:GetName()..'_ThreatBar', TukuiInfoLeft)
  217.                 ThreatBar:SetFrameLevel(5)
  218.                 ThreatBar:SetPoint("TOPLEFT", TukuiInfoLeft, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  219.                 ThreatBar:SetPoint("BOTTOMRIGHT", TukuiInfoLeft, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  220.              
  221.                 ThreatBar:SetStatusBarTexture(normTex)
  222.                 ThreatBar:GetStatusBarTexture():SetHorizTile(false)
  223.                 ThreatBar:SetBackdrop(backdrop)
  224.                 ThreatBar:SetBackdropColor(0, 0, 0, 0)
  225.            
  226.                 ThreatBar.Text = TukuiDB.SetFontString(ThreatBar, font1, 14)
  227.                 ThreatBar.Text:SetPoint("RIGHT", ThreatBar, "RIGHT", TukuiDB.Scale(-30), 0 )
  228.        
  229.                 ThreatBar.Title = TukuiDB.SetFontString(ThreatBar, font1, 14)
  230.                 ThreatBar.Title:SetText(tukuilocal.unitframes_ouf_threattext)
  231.                 ThreatBar.Title:SetPoint("LEFT", ThreatBar, "LEFT", TukuiDB.Scale(30), 0 )
  232.                      
  233.                 ThreatBar.bg = ThreatBar:CreateTexture(nil, 'BORDER')
  234.                 ThreatBar.bg:SetAllPoints(ThreatBar)
  235.                 ThreatBar.bg:SetTexture(0.1,0.1,0.1)
  236.            
  237.                 ThreatBar.useRawThreat = false
  238.                 self.ThreatBar = ThreatBar
  239.             end
  240.            
  241.             -- experience bar on player via mouseover for player currently levelling a character
  242.             if TukuiDB.level ~= MAX_PLAYER_LEVEL then
  243.                 local Experience = CreateFrame("StatusBar", self:GetName().."_Experience", self)
  244.                 Experience:SetStatusBarTexture(normTex)
  245.                 Experience:SetStatusBarColor(0, 0.4, 1, .8)
  246.                 Experience:SetBackdrop(backdrop)
  247.                 Experience:SetBackdropColor(unpack(TukuiCF["media"].backdropcolor))
  248.                 Experience:SetWidth(power:GetWidth() - TukuiDB.Scale(4))
  249.                 Experience:SetHeight(power:GetHeight() - TukuiDB.Scale(4))
  250.                 Experience:SetPoint("TOPLEFT", power, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  251.                 Experience:SetPoint("BOTTOMRIGHT", power, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  252.                 Experience:SetFrameLevel(10)
  253.                 Experience:SetAlpha(0)             
  254.                 Experience:HookScript("OnEnter", function(self) self:SetAlpha(1) end)
  255.                 Experience:HookScript("OnLeave", function(self) self:SetAlpha(0) end)
  256.                 Experience.Tooltip = true                      
  257.                 Experience.Rested = CreateFrame('StatusBar', nil, self)
  258.                 Experience.Rested:SetParent(Experience)
  259.                 Experience.Rested:SetAllPoints(Experience)
  260.                 Resting = Experience:CreateTexture(nil, "OVERLAY")
  261.                 Resting:SetHeight(28)
  262.                 Resting:SetWidth(28)
  263.                 if TukuiDB.myclass == "SHAMAN" or TukuiDB.myclass == "DEATHKNIGHT" then
  264.                     Resting:SetPoint("LEFT", -18, 76)
  265.                 else
  266.                     Resting:SetPoint("LEFT", -18, 68)
  267.                 end
  268.                 Resting:SetTexture([=[Interface\CharacterFrame\UI-StateIcon]=])
  269.                 Resting:SetTexCoord(0, 0.5, 0, 0.421875)
  270.                 self.Experience = Experience
  271.             end
  272.            
  273.             -- reputation bar for max level character
  274.             if TukuiDB.level == MAX_PLAYER_LEVEL then
  275.                 local Reputation = CreateFrame("StatusBar", self:GetName().."_Reputation", self)
  276.                 Reputation:SetStatusBarTexture(normTex)
  277.                 Reputation:SetBackdrop(backdrop)
  278.                 Reputation:SetBackdropColor(unpack(TukuiCF["media"].backdropcolor))
  279.                 Reputation:SetWidth(power:GetWidth() - TukuiDB.Scale(4))
  280.                 Reputation:SetHeight(power:GetHeight() - TukuiDB.Scale(4))
  281.                 Reputation:SetPoint("TOPLEFT", power, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  282.                 Reputation:SetPoint("BOTTOMRIGHT", power, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  283.                 Reputation:SetFrameLevel(10)
  284.                 Reputation:SetAlpha(0)
  285.  
  286.                 Reputation:HookScript("OnEnter", function(self) self:SetAlpha(1) end)
  287.                 Reputation:HookScript("OnLeave", function(self) self:SetAlpha(0) end)
  288.  
  289.                 Reputation.PostUpdate = TukuiDB.UpdateReputationColor
  290.                 Reputation.Tooltip = true
  291.                 self.Reputation = Reputation
  292.             end
  293.            
  294.             -- show druid mana when shapeshifted in bear, cat or whatever
  295.             if TukuiDB.myclass == "DRUID" then
  296.                 CreateFrame("Frame"):SetScript("OnUpdate", function() TukuiDB.UpdateDruidMana(self) end)
  297.                 local DruidMana = TukuiDB.SetFontString(health, font1, 14)
  298.                 DruidMana:SetTextColor(1, 0.49, 0.04)
  299.                 self.DruidMana = DruidMana
  300.             end
  301.  
  302.             -- deathknight runes
  303.             if TukuiDB.myclass == "DEATHKNIGHT" and db.runebar == true then
  304.                 -- rescale top shadow border
  305.                 self.shadow:SetPoint("TOPLEFT", TukuiDB.Scale(-4), TukuiDB.Scale(13))
  306.  
  307.                 local Runes = CreateFrame("Frame", nil, self)
  308.                 Runes:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, TukuiDB.Scale(1))
  309.                 Runes:SetHeight(TukuiDB.Scale(8))
  310.                 if TukuiDB.lowversion then
  311.                     Runes:SetWidth(TukuiDB.Scale(186))
  312.                 else
  313.                     Runes:SetWidth(TukuiDB.Scale(250))
  314.                 end
  315.                 Runes:SetBackdrop(backdrop)
  316.                 Runes:SetBackdropColor(0, 0, 0)
  317.  
  318.                 for i = 1, 6 do
  319.                     Runes[i] = CreateFrame("StatusBar", self:GetName().."_Runes"..i, self)
  320.                     Runes[i]:SetHeight(TukuiDB.Scale(8))
  321.                     if TukuiDB.lowversion then
  322.                         Runes[i]:SetWidth(TukuiDB.Scale(181) / 6)
  323.                     else
  324.                         Runes[i]:SetWidth(TukuiDB.Scale(245) / 6)
  325.                     end
  326.                     if (i == 1) then
  327.                         Runes[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, TukuiDB.Scale(1))
  328.                     else
  329.                         Runes[i]:SetPoint("TOPLEFT", Runes[i-1], "TOPRIGHT", TukuiDB.Scale(1), 0)
  330.                     end
  331.                     Runes[i]:SetStatusBarTexture(normTex)
  332.                     Runes[i]:GetStatusBarTexture():SetHorizTile(false)
  333.                 end
  334.  
  335.                 self.Runes = Runes
  336.             end
  337.            
  338.             -- shaman totem bar
  339.             if TukuiDB.myclass == "SHAMAN" and db.totemtimer == true then
  340.                 -- rescale top shadow border
  341.                 self.shadow:SetPoint("TOPLEFT", TukuiDB.Scale(-4), TukuiDB.Scale(13))
  342.                
  343.                 local TotemBar = {}
  344.                 TotemBar.Destroy = true
  345.                 for i = 1, 4 do
  346.                     TotemBar[i] = CreateFrame("StatusBar", self:GetName().."_TotemBar"..i, self)
  347.                     if (i == 1) then
  348.                        TotemBar[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, TukuiDB.Scale(1))
  349.                     else
  350.                        TotemBar[i]:SetPoint("TOPLEFT", TotemBar[i-1], "TOPRIGHT", TukuiDB.Scale(1), 0)
  351.                     end
  352.                     TotemBar[i]:SetStatusBarTexture(normTex)
  353.                     TotemBar[i]:SetHeight(TukuiDB.Scale(8))
  354.                     if TukuiDB.lowversion then
  355.                         TotemBar[i]:SetWidth(TukuiDB.Scale(183) / 4)
  356.                     else
  357.                         TotemBar[i]:SetWidth(TukuiDB.Scale(247) / 4)
  358.                     end
  359.                     TotemBar[i]:SetBackdrop(backdrop)
  360.                     TotemBar[i]:SetBackdropColor(0, 0, 0)
  361.                     TotemBar[i]:SetMinMaxValues(0, 1)
  362.  
  363.                     TotemBar[i].bg = TotemBar[i]:CreateTexture(nil, "BORDER")
  364.                     TotemBar[i].bg:SetAllPoints(TotemBar[i])
  365.                     TotemBar[i].bg:SetTexture(normTex)
  366.                     TotemBar[i].bg.multiplier = 0.3
  367.                 end
  368.                 self.TotemBar = TotemBar
  369.             end
  370.         end
  371.        
  372.         if (unit == "target") then
  373.             -- Unit name on target
  374.             local Name = health:CreateFontString(nil, "OVERLAY")
  375.             Name:SetPoint("LEFT", health, "LEFT", TukuiDB.Scale(4), TukuiDB.Scale(1))
  376.             Name:SetJustifyH("LEFT")
  377.             Name:SetFont(font1, 12)
  378.             Name:SetShadowColor(0, 0, 0)
  379.             Name:SetShadowOffset(1.25, -1.25)
  380.  
  381.             self:Tag(Name, '[Tukui:getnamecolor][Tukui:namelong] [Tukui:diffcolor][level] [shortclassification]')
  382.             self.Name = Name
  383.            
  384.             -- combo points on target
  385.             local CPoints = {}
  386.             CPoints.unit = PlayerFrame.unit
  387.             for i = 1, 5 do
  388.                 CPoints[i] = health:CreateTexture(nil, "OVERLAY")
  389.                 CPoints[i]:SetHeight(TukuiDB.Scale(12))
  390.                 CPoints[i]:SetWidth(TukuiDB.Scale(12))
  391.                 CPoints[i]:SetTexture(bubbleTex)
  392.                 if i == 1 then
  393.                     if TukuiDB.lowversion then
  394.                         CPoints[i]:SetPoint("TOPRIGHT", TukuiDB.Scale(15), TukuiDB.Scale(1.5))
  395.                     else
  396.                         CPoints[i]:SetPoint("TOPLEFT", TukuiDB.Scale(-15), TukuiDB.Scale(1.5))
  397.                     end
  398.                     CPoints[i]:SetVertexColor(0.69, 0.31, 0.31)
  399.                 else
  400.                     CPoints[i]:SetPoint("TOP", CPoints[i-1], "BOTTOM", TukuiDB.Scale(1))
  401.                 end
  402.             end
  403.             CPoints[2]:SetVertexColor(0.69, 0.31, 0.31)
  404.             CPoints[3]:SetVertexColor(0.65, 0.63, 0.35)
  405.             CPoints[4]:SetVertexColor(0.65, 0.63, 0.35)
  406.             CPoints[5]:SetVertexColor(0.33, 0.59, 0.33)
  407.             self.CPoints = CPoints
  408.             self:RegisterEvent("UNIT_COMBO_POINTS", TukuiDB.UpdateCPoints)
  409.         end
  410.  
  411.         if (unit == "target" and db.targetauras) or (unit == "player" and db.playerauras) then
  412.             local buffs = CreateFrame("Frame", nil, self)
  413.             local debuffs = CreateFrame("Frame", nil, self)
  414.            
  415.             if TukuiDB.myclass == "SHAMAN" or TukuiDB.myclass == "DEATHKNIGHT" and db.playerauras then
  416.                 if TukuiDB.lowversion then
  417.                     buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 34)
  418.                 else
  419.                     buffs:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 40)
  420.                 end
  421.             else
  422.                 if TukuiDB.lowversion then
  423.                     buffs:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 26)
  424.                 else
  425.                     buffs:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 32)
  426.                 end
  427.             end
  428.            
  429.             if TukuiDB.lowversion then
  430.                 buffs:SetHeight(21.5)
  431.                 buffs:SetWidth(186)
  432.                 buffs.size = 21.5
  433.                 buffs.num = 8
  434.                
  435.                 debuffs:SetHeight(21.5)
  436.                 debuffs:SetWidth(186)
  437.                 debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", 0, 2)
  438.                 debuffs.size = 21.5
  439.                 debuffs.num = 24
  440.             else               
  441.                 buffs:SetHeight(26)
  442.                 buffs:SetWidth(252)
  443.                 buffs.size = 26
  444.                 buffs.num = 9
  445.                
  446.                 debuffs:SetHeight(26)
  447.                 debuffs:SetWidth(252)
  448.                 debuffs:SetPoint("BOTTOMLEFT", buffs, "TOPLEFT", -2, 2)
  449.                 debuffs.size = 26
  450.                 debuffs.num = 27
  451.             end
  452.                        
  453.             buffs.spacing = 2
  454.             buffs.initialAnchor = 'TOPLEFT'
  455.             buffs.PostCreateIcon = TukuiDB.PostCreateAura
  456.             buffs.PostUpdateIcon = TukuiDB.PostUpdateAura
  457.             self.Buffs = buffs 
  458.                        
  459.             debuffs.spacing = 2
  460.             debuffs.initialAnchor = 'TOPRIGHT'
  461.             debuffs["growth-y"] = "UP"
  462.             debuffs["growth-x"] = "LEFT"
  463.             debuffs.PostCreateIcon = TukuiDB.PostCreateAura
  464.             debuffs.PostUpdateIcon = TukuiDB.PostUpdateAura
  465.             self.Debuffs = debuffs
  466.         end
  467.  
  468.         -- gcd bar
  469.         if (db.gcdcastbar == true) then
  470.        
  471.             self.GCD = CreateFrame("StatusBar", self:GetName().."_GCD", self)
  472.             self.GCD:SetHeight(4)
  473.             self.GCD:SetWidth(240)
  474.             self.GCD:SetStatusBarTexture(normTex)
  475.             self.GCD:SetFrameLevel(6)
  476.             self.GCD:SetPoint("CENTER", UIParent, "CENTER", 0, -162)
  477.             self.GCD:SetStatusBarColor(0.55, 0.57, 0.61)
  478.            
  479.             self.GCD.bg = CreateFrame("Frame", nil, self.GCD)
  480.             TukuiDB.SetTemplate(self.GCD.bg)
  481.             self.GCD.bg:SetPoint("TOPLEFT", TukuiDB.Scale(-2), TukuiDB.Scale(2))
  482.             self.GCD.bg:SetPoint("BOTTOMRIGHT", TukuiDB.Scale(2), TukuiDB.Scale(-2))
  483.             self.GCD.bg:SetFrameLevel(5)
  484.             TukuiDB.CreateShadow(self.GCD.bg)
  485.            
  486.         end
  487.  
  488.         -- cast bar for player and target
  489.         if (db.unitcastbar == true) then
  490.             -- castbar of player and target
  491.            
  492.             local castbar = CreateFrame("StatusBar", self:GetName().."_Castbar", self)
  493.             castbar:SetHeight(TukuiDB.Scale(20))
  494.             castbar:SetWidth(TukuiDB.Scale(240))
  495.             castbar:SetStatusBarTexture(normTex)
  496.             castbar:SetFrameLevel(6)
  497.             if unit == "player" then
  498.                 castbar:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 280)
  499.             elseif unit == "target" then
  500.                 castbar:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 312)
  501.             end
  502.            
  503.             castbar.bg = CreateFrame("Frame", nil, castbar)
  504.             TukuiDB.SetTemplate(castbar.bg)
  505.             castbar.bg:SetPoint("TOPLEFT", TukuiDB.Scale(-2), TukuiDB.Scale(2))
  506.             castbar.bg:SetPoint("BOTTOMRIGHT", TukuiDB.Scale(2), TukuiDB.Scale(-2))
  507.             castbar.bg:SetFrameLevel(5)
  508.             TukuiDB.CreateShadow(castbar.bg)
  509.            
  510.             castbar.CustomTimeText = TukuiDB.CustomCastTimeText
  511.             castbar.CustomDelayText = TukuiDB.CustomCastDelayText
  512.             castbar.PostCastStart = TukuiDB.CheckCast
  513.             castbar.PostChannelStart = TukuiDB.CheckChannel
  514.  
  515.             castbar.time = TukuiDB.SetFontString(castbar, font1, 14)
  516.             castbar.time:SetPoint("RIGHT", castbar, "RIGHT", TukuiDB.Scale(-4), TukuiDB.Scale(1))
  517.             castbar.time:SetTextColor(0.84, 0.75, 0.65)
  518.             castbar.time:SetJustifyH("RIGHT")
  519.  
  520.             castbar.Text = TukuiDB.SetFontString(castbar, font1, 14)
  521.             castbar.Text:SetPoint("LEFT", castbar, "LEFT", TukuiDB.Scale(4), TukuiDB.Scale(1))
  522.             castbar.Text:SetTextColor(0.84, 0.75, 0.65)
  523.            
  524.             if db.cbicons == true then
  525.                 castbar.button = CreateFrame("Frame", nil, castbar)
  526.                 castbar.button:SetHeight(TukuiDB.Scale(26))
  527.                 castbar.button:SetWidth(TukuiDB.Scale(26))
  528.                 TukuiDB.SetTemplate(castbar.button)
  529.                 TukuiDB.CreateShadow(castbar.button)
  530.  
  531.                 castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
  532.                 castbar.icon:SetPoint("TOPLEFT", castbar.button, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  533.                 castbar.icon:SetPoint("BOTTOMRIGHT", castbar.button, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  534.                 castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
  535.             end
  536.            
  537.             -- cast bar latency on player
  538.             if unit == "player" and db.cblatency == true then
  539.                 castbar.safezone = castbar:CreateTexture(nil, "ARTWORK")
  540.                 castbar.safezone:SetTexture(normTex)
  541.                 castbar.safezone:SetVertexColor(0.69, 0.31, 0.31, 0.75)
  542.                 castbar.SafeZone = castbar.safezone
  543.             end
  544.                    
  545.             self.Castbar = castbar
  546.             self.Castbar.Time = castbar.time
  547.             self.Castbar.Icon = castbar.icon
  548.         end
  549.        
  550.         -- add combat feedback support
  551.         if db.combatfeedback == true then
  552.             local CombatFeedbackText
  553.             if TukuiDB.lowversion then
  554.                 CombatFeedbackText = TukuiDB.SetFontString(health, font1, 12, "OUTLINE")
  555.             else
  556.                 CombatFeedbackText = TukuiDB.SetFontString(health, font1, 14, "OUTLINE")
  557.             end
  558.             CombatFeedbackText:SetPoint("CENTER", 0, 1)
  559.             CombatFeedbackText.colors = {
  560.                 DAMAGE = {0.69, 0.31, 0.31},
  561.                 CRUSHING = {0.69, 0.31, 0.31},
  562.                 CRITICAL = {0.69, 0.31, 0.31},
  563.                 GLANCING = {0.69, 0.31, 0.31},
  564.                 STANDARD = {0.84, 0.75, 0.65},
  565.                 IMMUNE = {0.84, 0.75, 0.65},
  566.                 ABSORB = {0.84, 0.75, 0.65},
  567.                 BLOCK = {0.84, 0.75, 0.65},
  568.                 RESIST = {0.84, 0.75, 0.65},
  569.                 MISS = {0.84, 0.75, 0.65},
  570.                 HEAL = {0.33, 0.59, 0.33},
  571.                 CRITHEAL = {0.33, 0.59, 0.33},
  572.                 ENERGIZE = {0.31, 0.45, 0.63},
  573.                 CRITENERGIZE = {0.31, 0.45, 0.63},
  574.             }
  575.             self.CombatFeedbackText = CombatFeedbackText
  576.         end
  577.        
  578.         -- player aggro
  579.         if db.playeraggro == true then
  580.             table.insert(self.__elements, TukuiDB.UpdateThreat)
  581.             self:RegisterEvent('PLAYER_TARGET_CHANGED', TukuiDB.UpdateThreat)
  582.             self:RegisterEvent('UNIT_THREAT_LIST_UPDATE', TukuiDB.UpdateThreat)
  583.             self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', TukuiDB.UpdateThreat)
  584.         end
  585.        
  586.         -- fixing vehicle/player frame when exiting an instance while on a vehicle
  587.         self:RegisterEvent("UNIT_PET", TukuiDB.updateAllElements)
  588.                    
  589.         -- set width and height of player and target
  590.         self:SetAttribute('initial-width', TukuiDB.Scale(246))
  591.         self:SetAttribute('initial-height', TukuiDB.Scale(40))
  592.     end
  593.    
  594.     ------------------------------------------------------------------------
  595.     --  Target of Target unit layout
  596.     ------------------------------------------------------------------------
  597.    
  598.     if (unit == "targettarget") then
  599.         -- create panel if higher version
  600.         local panel = CreateFrame("Frame", nil, self)
  601.         if not TukuiDB.lowversion then
  602.             TukuiDB.CreatePanel(panel, 129, 17, "BOTTOM", self, "BOTTOM", 0, TukuiDB.Scale(0))
  603.             panel:SetFrameLevel(2)
  604.             panel:SetFrameStrata("MEDIUM")
  605.             panel:SetBackdropBorderColor(unpack(TukuiCF["media"].altbordercolor))
  606.             self.panel = panel
  607.         end
  608.        
  609.         -- health bar
  610.         local health = CreateFrame('StatusBar', nil, self)
  611.         health:SetHeight(TukuiDB.Scale(18))
  612.         health:SetPoint("TOPLEFT")
  613.         health:SetPoint("TOPRIGHT")
  614.         health:SetStatusBarTexture(normTex)
  615.        
  616.         local healthBG = health:CreateTexture(nil, 'BORDER')
  617.         healthBG:SetAllPoints()
  618.         healthBG:SetTexture(.1, .1, .1)
  619.        
  620.         self.Health = health
  621.         self.Health.bg = healthBG
  622.        
  623.         health.frequentUpdates = true
  624.         if db.showsmooth == true then
  625.             health.Smooth = true
  626.         end
  627.        
  628.         if db.unicolor == true then
  629.             health.colorDisconnected = false
  630.             health.colorClass = false
  631.             health:SetStatusBarColor(.3, .3, .3, 1)
  632.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  633.         else
  634.             health.colorDisconnected = true
  635.             health.colorClass = true
  636.             health.colorReaction = true        
  637.         end
  638.        
  639.         -- Unit name
  640.         local Name = health:CreateFontString(nil, "OVERLAY")
  641.         if TukuiDB.lowversion then
  642.             Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  643.             Name:SetFont(font1, 12, "OUTLINE")
  644.         else
  645.             Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  646.             Name:SetFont(font1, 12)
  647.         end
  648.         Name:SetJustifyH("CENTER")
  649.  
  650.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium]')
  651.         self.Name = Name
  652.        
  653.         if db.totdebuffs == true and TukuiDB.lowversion ~= true then
  654.             local debuffs = CreateFrame("Frame", nil, health)
  655.             debuffs:SetHeight(20)
  656.             debuffs:SetWidth(127)
  657.             debuffs.size = 20
  658.             debuffs.spacing = 2
  659.             debuffs.num = 6
  660.  
  661.             debuffs:SetPoint("TOPLEFT", health, "TOPLEFT", -0.5, 24)
  662.             debuffs.initialAnchor = "TOPLEFT"
  663.             debuffs["growth-y"] = "UP"
  664.             debuffs.PostCreateIcon = TukuiDB.PostCreateAura
  665.             debuffs.PostUpdateIcon = TukuiDB.PostUpdateAura
  666.             self.Debuffs = debuffs
  667.         end
  668.        
  669.         -- width and height of target of target
  670.         if TukuiDB.lowversion then
  671.             self:SetAttribute("initial-height", TukuiDB.Scale(18))
  672.             self:SetAttribute("initial-width", TukuiDB.Scale(186))
  673.         else
  674.             self:SetAttribute("initial-height", TukuiDB.Scale(36))
  675.             self:SetAttribute("initial-width", TukuiDB.Scale(129))
  676.         end
  677.     end
  678.    
  679.     ------------------------------------------------------------------------
  680.     --  Pet unit layout
  681.     ------------------------------------------------------------------------
  682.    
  683.     if (unit == "pet") then
  684.         -- create panel if higher version
  685.         local panel = CreateFrame("Frame", nil, self)
  686.         if not TukuiDB.lowversion then
  687.             TukuiDB.CreatePanel(panel, 129, 17, "BOTTOM", self, "BOTTOM", 0, TukuiDB.Scale(0))
  688.             panel:SetFrameLevel(2)
  689.             panel:SetFrameStrata("MEDIUM")
  690.             panel:SetBackdropBorderColor(unpack(TukuiCF["media"].altbordercolor))
  691.             self.panel = panel
  692.         end
  693.        
  694.         -- health bar
  695.         local health = CreateFrame('StatusBar', nil, self)
  696.         health:SetHeight(TukuiDB.Scale(13))
  697.         health:SetPoint("TOPLEFT")
  698.         health:SetPoint("TOPRIGHT")
  699.         health:SetStatusBarTexture(normTex)
  700.                
  701.         self.Health = health
  702.         self.Health.bg = healthBG
  703.        
  704.         local healthBG = health:CreateTexture(nil, 'BORDER')
  705.         healthBG:SetAllPoints()
  706.         healthBG:SetTexture(.1, .1, .1)
  707.        
  708.         health.frequentUpdates = true
  709.         if db.showsmooth == true then
  710.             health.Smooth = true
  711.         end
  712.        
  713.         if db.unicolor == true then
  714.             health.colorDisconnected = false
  715.             health.colorClass = false
  716.             health:SetStatusBarColor(.3, .3, .3, 1)
  717.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  718.         else
  719.             health.colorDisconnected = true
  720.             health.colorClass = true
  721.             health.colorReaction = true
  722.             if TukuiDB.myclass == "HUNTER" then
  723.                 health.colorHappiness = true
  724.             end
  725.         end
  726.        
  727.         -- power
  728.         local power = CreateFrame('StatusBar', nil, self)
  729.         power:SetHeight(TukuiDB.Scale(4))
  730.         power:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -TukuiDB.mult)
  731.         power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  732.         power:SetStatusBarTexture(normTex)
  733.        
  734.         power.frequentUpdates = true
  735.         power.colorPower = true
  736.         if db.showsmooth == true then
  737.             power.Smooth = true
  738.         end
  739.  
  740.         local powerBG = power:CreateTexture(nil, 'BORDER')
  741.         powerBG:SetAllPoints(power)
  742.         powerBG:SetTexture(normTex)
  743.         powerBG.multiplier = 0.3
  744.                
  745.         self.Power = power
  746.         self.Power.bg = powerBG
  747.                
  748.         -- Unit name
  749.         local Name = health:CreateFontString(nil, "OVERLAY")
  750.         if TukuiDB.lowversion then
  751.             Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  752.             Name:SetFont(font1, 12, "OUTLINE")
  753.         else
  754.             Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  755.             Name:SetFont(font1, 12)
  756.         end
  757.         Name:SetJustifyH("CENTER")
  758.  
  759.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium] [Tukui:diffcolor][level]')
  760.         self.Name = Name
  761.        
  762.         if (db.unitcastbar == true) then
  763.             -- castbar of player and target
  764.             local castbar = CreateFrame("StatusBar", self:GetName().."_Castbar", self)
  765.             castbar:SetStatusBarTexture(normTex)
  766.            
  767.             if not TukuiDB.lowversion then
  768.                 castbar.bg = castbar:CreateTexture(nil, "BORDER")
  769.                 castbar.bg:SetAllPoints(castbar)
  770.                 castbar.bg:SetTexture(normTex)
  771.                 castbar.bg:SetVertexColor(0.15, 0.15, 0.15)
  772.                 castbar:SetFrameLevel(6)
  773.                 castbar:SetPoint("TOPLEFT", panel, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  774.                 castbar:SetPoint("BOTTOMRIGHT", panel, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  775.                
  776.                 castbar.CustomTimeText = TukuiDB.CustomCastTimeText
  777.                 castbar.CustomDelayText = TukuiDB.CustomCastDelayText
  778.                 castbar.PostCastStart = TukuiDB.CheckCast
  779.                 castbar.PostChannelStart = TukuiDB.CheckChannel
  780.  
  781.                 castbar.time = TukuiDB.SetFontString(castbar, font1, 12)
  782.                 castbar.time:SetPoint("RIGHT", panel, "RIGHT", TukuiDB.Scale(-4), TukuiDB.Scale(1))
  783.                 castbar.time:SetTextColor(0.84, 0.75, 0.65)
  784.                 castbar.time:SetJustifyH("RIGHT")
  785.  
  786.                 castbar.Text = TukuiDB.SetFontString(castbar, font1, 12)
  787.                 castbar.Text:SetPoint("LEFT", panel, "LEFT", 4, 1)
  788.                 castbar.Text:SetTextColor(0.84, 0.75, 0.65)
  789.                
  790.                 self.Castbar = castbar
  791.                 self.Castbar.Time = castbar.time
  792.             end
  793.         end
  794.        
  795.         -- update pet name, this should fix "UNKNOWN" pet names on pet unit.
  796.         self:RegisterEvent("UNIT_PET", TukuiDB.UpdatePetInfo)
  797.        
  798.         -- width and height of pet
  799.         if TukuiDB.lowversion then
  800.             self:SetAttribute("initial-height", TukuiDB.Scale(18))
  801.             self:SetAttribute("initial-width", TukuiDB.Scale(186))
  802.         else
  803.             self:SetAttribute("initial-height", TukuiDB.Scale(36))
  804.             self:SetAttribute("initial-width", TukuiDB.Scale(129))
  805.         end
  806.     end
  807.  
  808.  
  809.     ------------------------------------------------------------------------
  810.     --  Focus unit layout
  811.     ------------------------------------------------------------------------
  812.    
  813.     if (unit == "focus") then
  814.        
  815.         -- create health bar
  816.         local health = CreateFrame('StatusBar', nil, self)
  817.         health:SetPoint("TOPLEFT")
  818.         health:SetPoint("BOTTOMRIGHT")
  819.         health:SetStatusBarTexture(normTex)
  820.         health:GetStatusBarTexture():SetHorizTile(false)
  821.        
  822.         local healthBG = health:CreateTexture(nil, 'BORDER')
  823.         healthBG:SetAllPoints()
  824.         healthBG:SetTexture(.1, .1, .1)
  825.        
  826.         health.value = TukuiDB.SetFontString(health, font1, 14, "OUTLINE")
  827.         health.value:SetPoint("RIGHT", health, "RIGHT", TukuiDB.Scale(-4), TukuiDB.Scale(1))
  828.         health.PostUpdate = TukuiDB.PostUpdateHealth
  829.        
  830.         self.Health = health
  831.         self.Health.bg = healthBG
  832.        
  833.         health.frequentUpdates = true
  834.         if db.showsmooth == true then
  835.             health.Smooth = true
  836.         end
  837.        
  838.         if db.unicolor == true then
  839.             health.colorDisconnected = false
  840.             health.colorClass = false
  841.             health:SetStatusBarColor(.3, .3, .3, 1)
  842.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  843.         else
  844.             health.colorDisconnected = true
  845.             health.colorClass = true
  846.             health.colorReaction = true
  847.         end
  848.        
  849.         -- Unit name
  850.         local Name = health:CreateFontString(nil, "OVERLAY")
  851.         Name:SetPoint("LEFT", health, "LEFT", TukuiDB.Scale(4), TukuiDB.Scale(1))
  852.         Name:SetJustifyH("LEFT")
  853.         Name:SetFont(font1, 14, "OUTLINE")
  854.         Name:SetShadowColor(0, 0, 0)
  855.         Name:SetShadowOffset(1.25, -1.25)
  856.  
  857.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:namelong] [Tukui:diffcolor][level] [shortclassification]')
  858.         self.Name = Name
  859.        
  860.         self:SetAttribute("initial-height", TukuiInfoRight:GetHeight() - TukuiDB.Scale(4))
  861.         self:SetAttribute("initial-width", TukuiInfoRight:GetWidth() - TukuiDB.Scale(4))
  862.  
  863.         -- create focus debuff feature
  864.         if db.focusdebuffs == true then
  865.             local debuffs = CreateFrame("Frame", nil, self)
  866.             debuffs:SetHeight(26)
  867.             debuffs:SetWidth(TukuiCF["panels"].tinfowidth - 10)
  868.             debuffs.size = 26
  869.             debuffs.spacing = 2
  870.             debuffs.num = 40
  871.                        
  872.             debuffs:SetPoint("TOPRIGHT", self, "TOPRIGHT", 2, 38)
  873.             debuffs.initialAnchor = "TOPRIGHT"
  874.             debuffs["growth-y"] = "UP"
  875.             debuffs["growth-x"] = "LEFT"
  876.            
  877.             debuffs.PostCreateIcon = TukuiDB.PostCreateAura
  878.             debuffs.PostUpdateIcon = TukuiDB.PostUpdateAura
  879.             self.Debuffs = debuffs
  880.         end
  881.        
  882.         -- focus cast bar in the center of the screen
  883.         if db.unitcastbar == true then
  884.             local castbar = CreateFrame("StatusBar", self:GetName().."_Castbar", self)
  885.             castbar:SetHeight(TukuiDB.Scale(20))
  886.             castbar:SetWidth(TukuiDB.Scale(240))
  887.             castbar:SetStatusBarTexture(normTex)
  888.             castbar:SetFrameLevel(6)
  889.             castbar:SetPoint("CENTER", UIParent, "CENTER", 0, 250)     
  890.            
  891.             castbar.bg = CreateFrame("Frame", nil, castbar)
  892.             TukuiDB.SetTemplate(castbar.bg)
  893.             castbar.bg:SetPoint("TOPLEFT", TukuiDB.Scale(-2), TukuiDB.Scale(2))
  894.             castbar.bg:SetPoint("BOTTOMRIGHT", TukuiDB.Scale(2), TukuiDB.Scale(-2))
  895.             castbar.bg:SetFrameLevel(5)
  896.             TukuiDB.CreateShadow(castbar.bg)
  897.            
  898.             castbar.time = TukuiDB.SetFontString(castbar, font1, 14)
  899.             castbar.time:SetPoint("RIGHT", castbar, "RIGHT", TukuiDB.Scale(-4), TukuiDB.Scale(1))
  900.             castbar.time:SetTextColor(0.84, 0.75, 0.65)
  901.             castbar.time:SetJustifyH("RIGHT")
  902.             castbar.CustomTimeText = CustomCastTimeText
  903.  
  904.             castbar.Text = TukuiDB.SetFontString(castbar, font1, 14)
  905.             castbar.Text:SetPoint("LEFT", castbar, "LEFT", 4, 1)
  906.             castbar.Text:SetTextColor(0.84, 0.75, 0.65)
  907.            
  908.             castbar.CustomDelayText = TukuiDB.CustomCastDelayText
  909.             castbar.PostCastStart = TukuiDB.CheckCast
  910.             castbar.PostChannelStart = TukuiDB.CheckChannel
  911.            
  912.             if db.cbicons == true then
  913.                 castbar.button = CreateFrame("Frame", nil, castbar)
  914.                 castbar.button:SetHeight(TukuiDB.Scale(40))
  915.                 castbar.button:SetWidth(TukuiDB.Scale(40))
  916.                 castbar.button:SetPoint("CENTER", 0, TukuiDB.Scale(50))
  917.                 TukuiDB.SetTemplate(castbar.button)
  918.  
  919.                 castbar.icon = castbar.button:CreateTexture(nil, "ARTWORK")
  920.                 castbar.icon:SetPoint("TOPLEFT", castbar.button, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  921.                 castbar.icon:SetPoint("BOTTOMRIGHT", castbar.button, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  922.                 castbar.icon:SetTexCoord(0.08, 0.92, 0.08, .92)
  923.                
  924.                 TukuiDB.CreateShadow(castbar.button)
  925.             end
  926.  
  927.             self.Castbar = castbar
  928.             self.Castbar.Time = castbar.time
  929.             self.Castbar.Icon = castbar.icon
  930.         end
  931.     end
  932.    
  933.     ------------------------------------------------------------------------
  934.     --  Focus target unit layout
  935.     ------------------------------------------------------------------------
  936.  
  937.     -- not done lol?
  938.     if (unit == "focustarget") then
  939.         -- create panel if higher version
  940.         local panel = CreateFrame("Frame", nil, self)
  941.         TukuiDB.CreatePanel(panel, 129, 17, "BOTTOM", self, "BOTTOM", 0, TukuiDB.Scale(0))
  942.         panel:SetFrameLevel(2)
  943.         panel:SetFrameStrata("MEDIUM")
  944.         panel:SetBackdropBorderColor(unpack(TukuiCF["media"].altbordercolor))
  945.         self.panel = panel
  946.        
  947.         -- health bar
  948.         local health = CreateFrame('StatusBar', nil, self)
  949.         health:SetHeight(TukuiDB.Scale(18))
  950.         health:SetPoint("TOPLEFT")
  951.         health:SetPoint("TOPRIGHT")
  952.         health:SetStatusBarTexture(normTex)
  953.        
  954.         local healthBG = health:CreateTexture(nil, 'BORDER')
  955.         healthBG:SetAllPoints()
  956.         healthBG:SetTexture(.1, .1, .1)
  957.        
  958.         self.Health = health
  959.         self.Health.bg = healthBG
  960.        
  961.         health.frequentUpdates = true
  962.         if db.showsmooth == true then
  963.             health.Smooth = true
  964.         end
  965.        
  966.         if db.unicolor == true then
  967.             health.colorDisconnected = false
  968.             health.colorClass = false
  969.             health:SetStatusBarColor(.3, .3, .3, 1)
  970.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  971.         else
  972.             health.colorDisconnected = true
  973.             health.colorClass = true
  974.             health.colorReaction = true        
  975.         end
  976.        
  977.         -- Unit name
  978.         local Name = health:CreateFontString(nil, "OVERLAY")
  979.         Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  980.         Name:SetFont(font1, 12)
  981.         Name:SetJustifyH("CENTER")
  982.  
  983.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:namemedium] [Tukui:diffcolor][level]')
  984.         self.Name = Name
  985.        
  986.         -- width and height of target of target
  987.         self:SetAttribute("initial-height", TukuiDB.Scale(36))
  988.         self:SetAttribute("initial-width", TukuiDB.Scale(129))
  989.     end
  990.  
  991.     ------------------------------------------------------------------------
  992.     --  Arena or boss units layout (both mirror'd)
  993.     ------------------------------------------------------------------------
  994.    
  995.     if (unit and unit:find("arena%d") and TukuiCF["arena"].unitframes == true) or (unit and unit:find("boss%d") and db.showboss == true) then
  996.         -- Right-click focus on arena or boss units
  997.         self:SetAttribute("type2", "focus")
  998.        
  999.         -- health
  1000.         local health = CreateFrame('StatusBar', nil, self)
  1001.         health:SetHeight(TukuiDB.Scale(22))
  1002.         health:SetPoint("TOPLEFT")
  1003.         health:SetPoint("TOPRIGHT")
  1004.         health:SetStatusBarTexture(normTex)
  1005.  
  1006.         health.frequentUpdates = true
  1007.         health.colorDisconnected = true
  1008.         if db.showsmooth == true then
  1009.             health.Smooth = true
  1010.         end
  1011.         health.colorClass = true
  1012.        
  1013.         local healthBG = health:CreateTexture(nil, 'BORDER')
  1014.         healthBG:SetAllPoints()
  1015.         healthBG:SetTexture(.1, .1, .1)
  1016.  
  1017.         health.value = TukuiDB.SetFontString(health, font1,12, "OUTLINE")
  1018.         health.value:SetPoint("LEFT", TukuiDB.Scale(2), TukuiDB.Scale(1))
  1019.         health.PostUpdate = TukuiDB.PostUpdateHealth
  1020.                
  1021.         self.Health = health
  1022.         self.Health.bg = healthBG
  1023.        
  1024.         health.frequentUpdates = true
  1025.         if db.showsmooth == true then
  1026.             health.Smooth = true
  1027.         end
  1028.        
  1029.         if db.unicolor == true then
  1030.             health.colorDisconnected = false
  1031.             health.colorClass = false
  1032.             health:SetStatusBarColor(.3, .3, .3, 1)
  1033.             healthBG:SetVertexColor(.1, .1, .1, 1)     
  1034.         else
  1035.             health.colorDisconnected = true
  1036.             health.colorClass = true
  1037.             health.colorReaction = true
  1038.         end
  1039.    
  1040.         -- power
  1041.         local power = CreateFrame('StatusBar', nil, self)
  1042.         power:SetHeight(TukuiDB.Scale(6))
  1043.         power:SetPoint("TOPLEFT", health, "BOTTOMLEFT", 0, -TukuiDB.mult)
  1044.         power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 0, -TukuiDB.mult)
  1045.         power:SetStatusBarTexture(normTex)
  1046.        
  1047.         power.frequentUpdates = true
  1048.         power.colorPower = true
  1049.         if db.showsmooth == true then
  1050.             power.Smooth = true
  1051.         end
  1052.  
  1053.         local powerBG = power:CreateTexture(nil, 'BORDER')
  1054.         powerBG:SetAllPoints(power)
  1055.         powerBG:SetTexture(normTex)
  1056.         powerBG.multiplier = 0.3
  1057.        
  1058.         power.value = TukuiDB.SetFontString(health, font1, 12, "OUTLINE")
  1059.         power.value:SetPoint("RIGHT", TukuiDB.Scale(-2), TukuiDB.Scale(1))
  1060.         power.PreUpdate = TukuiDB.PreUpdatePower
  1061.         power.PostUpdate = TukuiDB.PostUpdatePower
  1062.                
  1063.         self.Power = power
  1064.         self.Power.bg = powerBG
  1065.        
  1066.         -- names
  1067.         local Name = health:CreateFontString(nil, "OVERLAY")
  1068.         Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  1069.         Name:SetJustifyH("CENTER")
  1070.         Name:SetFont(font1, 12, "OUTLINE")
  1071.         Name:SetShadowColor(0, 0, 0)
  1072.         Name:SetShadowOffset(1.25, -1.25)
  1073.        
  1074.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:namelong]')
  1075.         self.Name = Name
  1076.        
  1077.         -- trinket feature via trinket plugin
  1078.         if (TukuiCF.arena.unitframes) and (unit and unit:find('arena%d')) then
  1079.             local Trinketbg = CreateFrame("Frame", nil, self)
  1080.             Trinketbg:SetHeight(29)
  1081.             Trinketbg:SetWidth(29)
  1082.             Trinketbg:SetPoint("LEFT", self, "RIGHT", 4, 0)
  1083.             TukuiDB.SetTemplate(Trinketbg)
  1084.             Trinketbg:SetFrameLevel(0)
  1085.             self.Trinketbg = Trinketbg
  1086.            
  1087.             local Trinket = CreateFrame("Frame", nil, Trinketbg)
  1088.             Trinket:SetAllPoints(Trinketbg)
  1089.             Trinket:SetPoint("TOPLEFT", Trinketbg, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  1090.             Trinket:SetPoint("BOTTOMRIGHT", Trinketbg, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  1091.             Trinket:SetFrameLevel(1)
  1092.             Trinket.trinketUseAnnounce = true
  1093.             self.Trinket = Trinket
  1094.         end
  1095.        
  1096.         self:SetAttribute("initial-height", TukuiDB.Scale(29))
  1097.         self:SetAttribute("initial-width", TukuiDB.Scale(200))
  1098.     end
  1099.  
  1100.     ------------------------------------------------------------------------
  1101.     --  Main tanks and Main Assists layout (both mirror'd)
  1102.     ------------------------------------------------------------------------
  1103.    
  1104.     if(self:GetParent():GetName():match"oUF_MainTank" or self:GetParent():GetName():match"oUF_MainAssist") then
  1105.         -- Right-click focus on maintank or mainassist units
  1106.         self:SetAttribute("type2", "focus")
  1107.        
  1108.         -- health
  1109.         local health = CreateFrame('StatusBar', nil, self)
  1110.         health:SetHeight(TukuiDB.Scale(20))
  1111.         health:SetPoint("TOPLEFT")
  1112.         health:SetPoint("TOPRIGHT")
  1113.         health:SetStatusBarTexture(normTex)
  1114.        
  1115.         local healthBG = health:CreateTexture(nil, 'BORDER')
  1116.         healthBG:SetAllPoints()
  1117.         healthBG:SetTexture(.1, .1, .1)
  1118.                
  1119.         self.Health = health
  1120.         self.Health.bg = healthBG
  1121.        
  1122.         health.frequentUpdates = true
  1123.         if db.showsmooth == true then
  1124.             health.Smooth = true
  1125.         end
  1126.        
  1127.         if db.unicolor == true then
  1128.             health.colorDisconnected = false
  1129.             health.colorClass = false
  1130.             health:SetStatusBarColor(.3, .3, .3, 1)
  1131.             healthBG:SetVertexColor(.1, .1, .1, 1)
  1132.         else
  1133.             health.colorDisconnected = true
  1134.             health.colorClass = true
  1135.             health.colorReaction = true
  1136.         end
  1137.        
  1138.         -- names
  1139.         local Name = health:CreateFontString(nil, "OVERLAY")
  1140.         Name:SetPoint("CENTER", health, "CENTER", 0, TukuiDB.Scale(1))
  1141.         Name:SetJustifyH("CENTER")
  1142.         Name:SetFont(font1, 12, "OUTLINE")
  1143.         Name:SetShadowColor(0, 0, 0)
  1144.         Name:SetShadowOffset(1.25, -1.25)
  1145.        
  1146.         self:Tag(Name, '[Tukui:getnamecolor][Tukui:nameshort]')
  1147.         self.Name = Name
  1148.            
  1149.         self:SetAttribute("initial-height", TukuiDB.Scale(20))
  1150.         self:SetAttribute("initial-width", TukuiDB.Scale(100))   
  1151.     end
  1152.  
  1153.     ------------------------------------------------------------------------
  1154.     --  Features we want for all units at the same time
  1155.     ------------------------------------------------------------------------
  1156.    
  1157.     -- here we create an invisible frame for all element we want to show over health/power.
  1158.     -- because we can only use self here, and self is under all elements.
  1159.     local InvFrame = CreateFrame("Frame", nil, self)
  1160.     InvFrame:SetFrameStrata("HIGH")
  1161.     InvFrame:SetFrameLevel(5)
  1162.     InvFrame:SetAllPoints()
  1163.    
  1164.     -- symbols, now put the symbol on the frame we created above.
  1165.     local RaidIcon = InvFrame:CreateTexture(nil, "OVERLAY")
  1166.     RaidIcon:SetTexture("Interface\\AddOns\\Tukui\\media\\textures\\raidicons.blp") -- thx hankthetank for texture
  1167.     RaidIcon:SetHeight(20)
  1168.     RaidIcon:SetWidth(20)
  1169.     RaidIcon:SetPoint("TOP", 0, 8)
  1170.     self.RaidIcon = RaidIcon
  1171.    
  1172.     return self
  1173. end
  1174.  
  1175. ------------------------------------------------------------------------
  1176. --  Default position of Tukui unitframes
  1177. ------------------------------------------------------------------------
  1178.  
  1179. -- for lower reso
  1180. local adjustXY = 0
  1181. local totdebuffs = 0
  1182. if TukuiDB.lowversion then adjustXY = 24 end
  1183. if db.totdebuffs then totdebuffs = 24 end
  1184.  
  1185. oUF:RegisterStyle('Tukz', Shared)
  1186.  
  1187. oUF:SetActiveStyle('Tukz')
  1188. oUF:Spawn('player', "oUF_Tukz_player"):SetPoint("BOTTOMLEFT", TukuiActionBarBackground, "TOPLEFT", 2,10+adjustXY)
  1189. oUF:Spawn('focus', "oUF_Tukz_focus"):SetPoint("CENTER", TukuiInfoRight, "CENTER")
  1190. oUF:Spawn('target', "oUF_Tukz_target"):SetPoint("BOTTOMRIGHT", TukuiActionBarBackground, "TOPRIGHT", -2,10+adjustXY)
  1191.  
  1192. if TukuiDB.lowversion then
  1193.     oUF:Spawn("targettarget", "oUF_Tukz_targettarget"):SetPoint("BOTTOMRIGHT", TukuiActionBarBackground, "TOPRIGHT", 0,10)
  1194.     oUF:Spawn("pet", "oUF_Tukz_pet"):SetPoint("BOTTOMLEFT", TukuiActionBarBackground, "TOPLEFT", 0,10)
  1195. else
  1196.     oUF:Spawn('pet', "oUF_Tukz_pet"):SetPoint("BOTTOM", TukuiActionBarBackground, "TOP", 0,49+totdebuffs)
  1197.     oUF:Spawn('targettarget', "oUF_Tukz_targettarget"):SetPoint("BOTTOM", TukuiActionBarBackground, "TOP", 0,10)
  1198. end
  1199. if db.showfocustarget == true then oUF:Spawn("focustarget", "oUF_Tukz_focustarget"):SetPoint("BOTTOM", 0, 224) end
  1200.  
  1201.  
  1202. if TukuiCF.arena.unitframes then
  1203.     local arena = {}
  1204.     for i = 1, 5 do
  1205.         arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
  1206.         if i == 1 then
  1207.             arena[i]:SetPoint("BOTTOMLEFT", TukuiInfoRight, "TOPLEFT", 0, 350)
  1208.         else
  1209.             arena[i]:SetPoint("BOTTOM", arena[i-1], "TOP", 0, 10)
  1210.         end
  1211.     end
  1212. end
  1213.  
  1214. if db.showboss then
  1215.     for i = 1,MAX_BOSS_FRAMES do
  1216.         local t_boss = _G["Boss"..i.."TargetFrame"]
  1217.         t_boss:UnregisterAllEvents()
  1218.         t_boss.Show = TukuiDB.dummy
  1219.         t_boss:Hide()
  1220.         _G["Boss"..i.."TargetFrame".."HealthBar"]:UnregisterAllEvents()
  1221.         _G["Boss"..i.."TargetFrame".."ManaBar"]:UnregisterAllEvents()
  1222.     end
  1223.  
  1224.     local boss = {}
  1225.     for i = 1, MAX_BOSS_FRAMES do
  1226.         boss[i] = oUF:Spawn("boss"..i, "oUF_Boss"..i)
  1227.         if i == 1 then
  1228.             boss[i]:SetPoint("BOTTOMLEFT", TukuiInfoRight, "TOPLEFT", 0, 350)
  1229.         else
  1230.             boss[i]:SetPoint('BOTTOM', boss[i-1], 'TOP', 0, 10)            
  1231.         end
  1232.     end
  1233. end
  1234.  
  1235. if db.maintank == true then
  1236.     local tank = oUF:SpawnHeader("oUF_MainTank", nil, 'raid, party, solo',
  1237.         "showRaid", true, "groupFilter", "MAINTANK", "yOffset", 5, "point" , "BOTTOM",
  1238.         "template", "oUF_tukzMtt"
  1239.     )
  1240.     tank:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  1241. end
  1242.  
  1243. if db.mainassist == true then
  1244.     local assist = oUF:SpawnHeader("oUF_MainAssist", nil, 'raid, party, solo',
  1245.         "showRaid", true, "groupFilter", "MAINASSIST", "yOffset", 5, "point" , "BOTTOM",
  1246.         "template", "oUF_tukzMtt"
  1247.     )
  1248.     assist:SetPoint("CENTER", UIParent, "CENTER", 0, -100)
  1249. end
  1250.  
  1251. local party = oUF:SpawnHeader("oUF_noParty", nil, "party", "showParty", true)
  1252.  
  1253. ------------------------------------------------------------------------
  1254. --  Just a command to test buffs/debuffs alignment
  1255. ------------------------------------------------------------------------
  1256.  
  1257. local testui = TestUI or function() end
  1258. TestUI = function()
  1259.     testui()
  1260.     UnitAura = function()
  1261.         -- name, rank, texture, count, dtype, duration, timeLeft, caster
  1262.         return 'penancelol', 'Rank 2', 'Interface\\Icons\\Spell_Holy_Penance', random(5), 'Magic', 0, 0, "player"
  1263.     end
  1264.     if(oUF) then
  1265.         for i, v in pairs(oUF.units) do
  1266.             if(v.UNIT_AURA) then
  1267.                 v:UNIT_AURA("UNIT_AURA", v.unit)
  1268.             end
  1269.         end
  1270.     end
  1271. end
  1272. SlashCmdList.TestUI = TestUI
  1273. SLASH_TestUI1 = "/testui"
  1274.  
  1275. ------------------------------------------------------------------------
  1276. -- Right-Click on unit frames menu.
  1277. -- Doing this to remove SET_FOCUS eveywhere.
  1278. -- SET_FOCUS work only on default unitframes.
  1279. -- Main Tank and Main Assist, use /maintank and /mainassist commands.
  1280. ------------------------------------------------------------------------
  1281.  
  1282. do
  1283.     UnitPopupMenus["SELF"] = { "PVP_FLAG", "LOOT_METHOD", "LOOT_THRESHOLD", "OPT_OUT_LOOT_TITLE", "LOOT_PROMOTE", "DUNGEON_DIFFICULTY", "RAID_DIFFICULTY", "RESET_INSTANCES", "RAID_TARGET_ICON", "LEAVE", "CANCEL" };
  1284.     UnitPopupMenus["PET"] = { "PET_PAPERDOLL", "PET_RENAME", "PET_ABANDON", "PET_DISMISS", "CANCEL" };
  1285.     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", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
  1286.     UnitPopupMenus["PLAYER"] = { "WHISPER", "INSPECT", "INVITE", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
  1287.     UnitPopupMenus["RAID_PLAYER"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "WHISPER", "INSPECT", "ACHIEVEMENTS", "TRADE", "FOLLOW", "DUEL", "RAID_TARGET_ICON", "RAID_LEADER", "RAID_PROMOTE", "RAID_DEMOTE", "LOOT_PROMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "RAF_SUMMON", "RAF_GRANT_LEVEL", "CANCEL" }
  1288.     UnitPopupMenus["RAID"] = { "MUTE", "UNMUTE", "RAID_SILENCE", "RAID_UNSILENCE", "BATTLEGROUND_SILENCE", "BATTLEGROUND_UNSILENCE", "RAID_LEADER", "RAID_PROMOTE", "LOOT_PROMOTE", "RAID_DEMOTE", "RAID_REMOVE", "PVP_REPORT_AFK", "CANCEL" }
  1289.     UnitPopupMenus["VEHICLE"] = { "RAID_TARGET_ICON", "VEHICLE_LEAVE", "CANCEL" }
  1290.     UnitPopupMenus["TARGET"] = { "RAID_TARGET_ICON", "CANCEL" }
  1291.     UnitPopupMenus["ARENAENEMY"] = { "CANCEL" }
  1292.     UnitPopupMenus["FOCUS"] = { "RAID_TARGET_ICON", "CANCEL" }
  1293.     UnitPopupMenus["BOSS"] = { "RAID_TARGET_ICON", "CANCEL" }
  1294. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement