Advertisement
Guest User

Coldkil - layout.lua

a guest
Jul 3rd, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 28.66 KB | None | 0 0
  1. --[[-------------------------------------------------------------------------
  2. Coldkil unitframes layout - now with 138% more awesomeness
  3. ---------------------------------------------------------------------------]]
  4.  
  5. --get the addon namespace
  6. local addon, ns = ...
  7.  
  8. --get the config values
  9. local cfg = ns.cfg
  10. local focuscfg = ns.cfg.focus
  11. local layout = ns.cfg.layout
  12.  
  13. -- get the library
  14. local lib = ns.lib
  15.  
  16. -------------------------------------------------------------
  17. --      Local variables
  18. -------------------------------------------------------------
  19. local _TEXTURE = cfg.tex
  20. local blankTex = cfg.texblank
  21. local font = cfg.font
  22. local smalls = cfg.fontsize
  23. local myClass = lib.getClass('player')
  24. local pp = lib.scale
  25.  
  26. -------------------------------------------------------------
  27. --      Unit Frames Layout
  28. -------------------------------------------------------------
  29. local Shared = function(self, unit, isSingle)
  30.     self.menu = lib.menu
  31.  
  32.     self:SetScript("OnEnter", UnitFrame_OnEnter)
  33.     self:SetScript("OnLeave", UnitFrame_OnLeave)
  34.  
  35.     -- XXX: Change to AnyUp when RegisterAttributeDriver doesn't cause clicks
  36.     -- to get incorrectly eaten.
  37.     self:RegisterForClicks"AnyDown"
  38.    
  39.     -- enable our colors
  40.     self.colors = colors
  41.    
  42.     if unit == "player" or unit == "target" then
  43.         self:SetSize(200, 30)
  44.     elseif unit == "focus" or unit == "pet" or unit == "targettarget" then
  45.         self:SetSize(60, 5)
  46.     elseif unit == "party" then
  47.         self:SetSize(150, 20)
  48.     else
  49.         self:SetSize(35, 32)
  50.     end
  51.    
  52.     ------------------------------------------------------------
  53.     --  Shared things we want on different unitframes
  54.     ------------------------------------------------------------   
  55.     local panelhp = CreateFrame("Frame",nil,self)
  56.     panelhp:SetFrameLevel(5)
  57.     local panelpow = CreateFrame("Frame",nil,self)
  58.     panelpow:SetFrameLevel(5)
  59.     local over = CreateFrame("Frame",nil,self)
  60.     self.Panelhp = panelhp
  61.     self.Panelpow = panelpow
  62.     self.over = over
  63.    
  64.     -- test self size
  65.     --self:SetBackdrop(backdrop)
  66.     --self:SetBackdropColor(0,1,0,.5)
  67.     --self:SetFrameLevel(10)
  68.    
  69.     -- Health Bar
  70.     local Health = CreateFrame("StatusBar", nil, self)
  71.     Health:SetFrameLevel(3)
  72.     Health:SetStatusBarTexture(_TEXTURE)
  73.     local HealthBackground = Health:CreateTexture(nil, "BORDER")
  74.     HealthBackground:SetTexture(_TEXTURE)
  75.     Health.bg = HealthBackground
  76.     local shadowH = CreateFrame("Frame", nil, Health)
  77.     shadowH:SetFrameLevel(3)
  78.     shadowH:SetPoint("TOPLEFT", Health, "TOPLEFT", -1, 1)
  79.     shadowH:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", 1, -1)
  80.     shadowH:SetBackdrop(backdrop)
  81.     shadowH:SetBackdropColor(0, 0, 0, 0)
  82.     shadowH:SetBackdropBorderColor(0, 0, 0, 1)
  83.     Health.frequentUpdates = true
  84.     Health.Smooth = true
  85.     Health.PostUpdate = lib.PostUpdateHealth
  86.     self.Health = Health
  87.     -- HP text/tag
  88.     local HealthPoints = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  89.     local HPper = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  90.     local hptag = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  91.     hptag:SetText("HP")
  92.     self:Tag(HealthPoints, '[dead][offline][classic:health]')
  93.     Health.value = HealthPoints
  94.     Health.valueper = HPper
  95.     Health.tag = hptag
  96.    
  97.     -- Power Bar
  98.     local Power = CreateFrame("StatusBar", nil, self)
  99.     Power:SetFrameLevel(3)
  100.     Power:SetStatusBarTexture(_TEXTURE)
  101.     local PowerBackground = Power:CreateTexture(nil, "BORDER")
  102.     PowerBackground:SetTexture(_TEXTURE)
  103.     local shadowP = CreateFrame("Frame", nil, Power)
  104.     shadowP:SetFrameLevel(3)
  105.     shadowP:SetPoint("TOPLEFT", Power, "TOPLEFT", -1, 1)
  106.     shadowP:SetPoint("BOTTOMRIGHT", Power, "BOTTOMRIGHT", 1, -1)
  107.     shadowP:SetBackdrop(backdrop)
  108.     shadowP:SetBackdropColor(.6, .6, .6, .25)
  109.     shadowP:SetBackdropBorderColor(0, 0, 0, 1)
  110.     Power.bg = PowerBackground
  111.     Power.frequentUpdates = true
  112.     Power.Smooth = true
  113.     self.Power = Power
  114.     -- Power text/tag
  115.     local PowerPoints = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  116.     local powtag = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  117.     Power.value = PowerPoints
  118.     Power.tag = powtag
  119.     Power.PostUpdate = lib.PostUpdatePower
  120.    
  121.     --Portrait
  122.     local portrait = CreateFrame("PlayerModel", self:GetName().."_Portrait", self)
  123.     portrait:SetFrameLevel(4)
  124.     self.Portrait = portrait
  125.    
  126.     -- Castbar
  127.     local Castbar = CreateFrame("StatusBar", nil, self)
  128.     Castbar:SetStatusBarTexture(_TEXTURE)      
  129.     Castbar:SetFrameLevel(2)
  130.     Castbar.PostCastStart = lib.CheckCast
  131.     Castbar.PostChannelStart = lib.CheckChannel
  132.     local CBshadow = CreateFrame("Frame", nil, Castbar)
  133.     CBshadow:SetFrameLevel(2)
  134.     CBshadow:SetPoint("TOPLEFT", Castbar, "TOPLEFT", -1, 1)
  135.     CBshadow:SetPoint("BOTTOMRIGHT", Castbar, "BOTTOMRIGHT", 1, -1)
  136.     CBshadow:SetBackdrop(backdrop)
  137.     CBshadow:SetBackdropColor(.1,.1,.1,.9)
  138.     CBshadow:SetBackdropBorderColor(0, 0, 0, 1)
  139.     -- Castbar Text
  140.     Castbar.time = lib.SetFontString(Castbar, font, smalls, "OUTLINE, MONOCHROME")
  141.     Castbar.Text = lib.SetFontString(Castbar, font, smalls, "OUTLINE, MONOCHROME")
  142.     self.Castbar = Castbar
  143.     self.Castbar.Time = Castbar.time
  144.    
  145.     -- Name, Level, Classiication
  146.     Name = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  147.     Level = lib.SetFontString(panelhp, font, smalls, "OUTLINE, MONOCHROME")
  148.     self:Tag(Name, '[name]')
  149.     self:Tag(Level, '[level][shortclassification][difficulty]')
  150.     self.Level = Level
  151.     self.Name = Name
  152.    
  153.     -- Buffs/Debuffs frames (defined here, so if you want you can create them for other unitframes, atm target only)
  154.     local Buffs = CreateFrame("Frame", nil, self)
  155.     Buffs.PostCreateIcon = lib.PostCreateAura
  156.     Buffs.PostUpdateIcon = lib.PostUpdateAura
  157.     self.Buffs = Buffs
  158.     local Debuffs = CreateFrame("Frame", nil, self)
  159.     Debuffs.PostCreateIcon = lib.PostCreateAura
  160.     Debuffs.PostUpdateIcon = lib.PostUpdateAura
  161.     self.Debuffs = Debuffs
  162.    
  163.     -------------------------------------------------------------
  164.     --      Player Layout
  165.     -------------------------------------------------------------
  166.     if unit == "player" then   
  167.  
  168.         Health:SetPoint("TOPLEFT", self, "TOPLEFT")
  169.         Health:SetPoint("TOPRIGHT", self, "TOPRIGHT")
  170.         Health:SetHeight(16)
  171.         HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  172.         HealthBackground:SetPoint("TOPRIGHT", Health, "TOPRIGHT")
  173.         HealthBackground:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT")
  174.  
  175.         portrait:SetPoint("TOPLEFT", Health, "TOPLEFT")
  176.         portrait:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT")
  177.         portrait:SetAlpha(.25) 
  178.        
  179.         panelhp:SetPoint("LEFT", Health, "LEFT", -3.5, 5)
  180.         panelhp:SetSize(75,13)
  181.         panelhp:SetBackdrop(backdrop)
  182.         panelhp:SetBackdropColor(.6,.6,.6)
  183.         panelhp:SetBackdropBorderColor(0,0,0)
  184.         HealthPoints:SetPoint("RIGHT", panelhp, "RIGHT", pp(.5), pp(1))
  185.         HealthPoints:SetJustifyH"RIGHT"
  186.  
  187.         Power:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT")
  188.         Power:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
  189.         Power:SetHeight(8)
  190.         PowerBackground:SetPoint("LEFT", Power:GetStatusBarTexture(), "RIGHT")
  191.         PowerBackground:SetPoint("TOPRIGHT", Power, "TOPRIGHT")
  192.         PowerBackground:SetPoint("BOTTOMRIGHT", Power, "BOTTOMRIGHT")
  193.         PowerPoints:SetPoint("LEFT", panelhp, "LEFT", pp(2), pp(1))
  194.  
  195.        
  196.         Castbar:SetPoint("LEFT", self, "LEFT", -4, -4)
  197.         Castbar:SetPoint("RIGHT", self, "RIGHT", 4, -4)
  198.         Castbar:SetHeight(13)
  199.         Castbar.time:SetPoint("TOPRIGHT", Power, "BOTTOMRIGHT", 3, -3)
  200.         Castbar.time:SetJustifyH"RIGHT"
  201.         Castbar.Text:SetPoint("TOPLEFT", Power, "BOTTOMLEFT", 0, -3)
  202.         Castbar.Text:SetPoint("TOPRIGHT", Power, "BOTTOMRIGHT", -30, -3)
  203.         Castbar.safezone = Castbar:CreateTexture(nil, "ARTWORK")
  204.         Castbar.safezone:SetTexture(_TEXTURE)
  205.         Castbar.safezone:SetVertexColor(0.89, 0.31, 0.31, 0.6)
  206.         Castbar.SafeZone = Castbar.safezone
  207.        
  208.         -- holy power / soul shards
  209.         if (myClass == "WARLOCK" or myClass == "PALADIN") then
  210.             local bars = CreateFrame("Frame", nil, self)
  211.             bars:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", -2, 1)
  212.             bars:SetSize(60, 12)
  213.             bars:SetFrameLevel(6)
  214.        
  215.             for i = 1, 3 do                
  216.                 bars[i]=CreateFrame("StatusBar", self:GetName().."_Shard"..i, self)
  217.                 bars[i]=lib.SetFontString(bars, font, smalls, "OUTLINE, MONOCHROME")
  218.                 bars[i]:SetSize(20, 12)
  219.                
  220.                 if i == 1 then
  221.                     bars[i]:SetPoint("LEFT", bars)
  222.                 else
  223.                     bars[i]:SetPoint("LEFT", bars[i-1], "RIGHT", 1, 0)
  224.                 end    
  225.            
  226.                 if myClass == "WARLOCK" then
  227.                     bars[i]:SetText("Sh")
  228.                     bars[i]:SetJustifyH"RIGHT"
  229.                     bars[i]:SetTextColor(1, 0, 1)
  230.                     bars.Override = UpdateShards               
  231.                     self.SoulShards = bars
  232.                 else
  233.                     bars[i]:SetText("Ho")
  234.                     bars[i]:SetJustifyH"RIGHT"
  235.                     bars[i]:SetTextColor(228/255,225/255,16/255)
  236.                     bars.Override = UpdateHoly
  237.                     self.HolyPower = bars              
  238.                 end
  239.             end
  240.         end
  241.        
  242.         if myClass == "DRUID" then         
  243.             local eclipseBar = CreateFrame('Frame', nil, self)
  244.             eclipseBar:SetPoint("BOTTOM", Health, "TOP", 0, 5)
  245.             eclipseBar:SetSize(self:GetWidth()+2, 11)
  246.             eclipseBar:SetFrameLevel(5)
  247.             eclipseBar:SetFrameStrata"MEDIUM"
  248.             eclipseBar:SetBackdrop(backdrop)
  249.             eclipseBar:SetBackdropColor(.6,.6,.6,0)
  250.             eclipseBar:SetBackdropBorderColor(0,0,0)
  251.                    
  252.             local lunarBar = CreateFrame('StatusBar', nil, eclipseBar)
  253.             lunarBar:SetPoint('LEFT', eclipseBar, 'LEFT', 1, 0)
  254.             lunarBar:SetSize(eclipseBar:GetWidth()-2, eclipseBar:GetHeight()-2)
  255.             lunarBar:SetStatusBarTexture(_TEXTURE)
  256.             lunarBar:SetStatusBarColor(.30, .52, .90, .7)
  257.             eclipseBar.LunarBar = lunarBar
  258.  
  259.             local solarBar = CreateFrame('StatusBar', nil, eclipseBar)
  260.             solarBar:SetPoint('LEFT', lunarBar:GetStatusBarTexture(), 'RIGHT', 0, 0)
  261.             solarBar:SetSize(eclipseBar:GetWidth()-2, eclipseBar:GetHeight()-2)
  262.             solarBar:SetStatusBarTexture(_TEXTURE)
  263.             solarBar:SetStatusBarColor(.80, .82,  .30, .7)
  264.             eclipseBar.SolarBar = solarBar
  265.            
  266.             self.EclipseBar = eclipseBar
  267.         end
  268.        
  269.         if layout.pbuffs then  
  270.             Buffs:SetPoint("RIGHT", self, "LEFT", -3, 0)
  271.             Buffs:SetWidth(200)
  272.             Buffs:SetHeight(17)
  273.             Buffs.initialAnchor = "RIGHT"
  274.             Buffs["growth-x"] = "LEFT"
  275.             Buffs["growth-y"] = "DOWN"
  276.             Buffs.size = 26
  277.             Buffs.num = 6
  278.             Buffs.spacing = 3
  279.             Buffs.onlyShowPlayer = true
  280.         end
  281.        
  282.         if layout.pdebuffs then
  283.             if not layout.healer then
  284.                 Debuffs:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", -1, 20)
  285.                 Debuffs:SetWidth(250)
  286.                 Debuffs:SetHeight(20)
  287.                 Debuffs.initialAnchor = "RIGHT"
  288.                 Debuffs["growth-x"] = "RIGHT"
  289.                 Debuffs["growth-y"] = "UP"
  290.                 Debuffs.size = 26
  291.                 Debuffs.num = 25
  292.                 Debuffs.spacing = 3
  293.             else   
  294.                 Debuffs:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", -1, -10)
  295.                 Debuffs:SetWidth(250)
  296.                 Debuffs:SetHeight(20)
  297.                 Debuffs.initialAnchor = "LEFT"
  298.                 Debuffs["growth-x"] = "LEFT"
  299.                 Debuffs["growth-y"] = "DOWN"
  300.                 Debuffs.size = 26
  301.                 Debuffs.num = 25
  302.                 Debuffs.spacing = 3
  303.             end
  304.         end
  305.        
  306.         local ricon = panelhp:CreateTexture(nil, "OVERLAY")
  307.         ricon:SetTexture([[Interface\AddOns\oUF_Coldkil\textures\raidicons.blp]])
  308.         ricon:SetSize(22,22)
  309.         ricon:SetPoint("CENTER", panelhp, "BOTTOM", 0, pp(-3))
  310.         self.RaidIcon = ricon
  311.        
  312.         -- AltPowerPar, the one that appears for ryolith and other mundane things like DMF
  313.         PlayerPowerBarAlt:SetParent(UIParent)
  314.         PlayerPowerBarAlt:SetFrameStrata("MEDIUM")
  315.         PlayerPowerBarAlt:SetFrameLevel(3)
  316.         PlayerPowerBarAlt:SetClampedToScreen(false)
  317.         PlayerPowerBarAlt:ClearAllPoints()
  318.         PlayerPowerBarAlt.ClearAllPoints = function() end
  319.         PlayerPowerBarAlt:SetPoint("TOP", UIParent, "TOP", 0, -170)
  320.         PlayerPowerBarAlt.SetPoint = function() end
  321.        
  322.         -- Ghost Button Fix
  323.         GhostFrame:SetParent(UIParent)
  324.         GhostFrame:SetFrameStrata("MEDIUM")
  325.         GhostFrame:SetFrameLevel(3)
  326.         GhostFrame:SetClampedToScreen(false)
  327.         GhostFrame:ClearAllPoints()
  328.         GhostFrame.ClearAllPoints = function() end
  329.         GhostFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", -5, 0)
  330.         GhostFrame.SetPoint = function() end
  331.        
  332.        
  333.         -- new timer of the DMF dailies DOESN'T WORK WTF HOW THE HELL I'M SUPPOSED TO MAKE THINGS LOOK PRETTY MY MOM SAYS I'M SPECIAL
  334.         --[[BuffTimer1:SetParent(UIParent)
  335.         BuffTimer1:SetFrameStrata("MEDIUM")
  336.         BuffTimer1:SetFrameLevel(3)
  337.         BuffTimer1:SetClampedToScreen(false)
  338.         BuffTimer1:ClearAllPoints()
  339.         BuffTimer1.ClearAllPoints = function() end
  340.         BuffTimer1:SetPoint("TOP", UIParent, "TOP", 0, -180)
  341.         BuffTimer1.SetPoint = function() end]]
  342.        
  343.     end
  344.    
  345.     -------------------------------------------------------------
  346.     --      Target Layout
  347.     -------------------------------------------------------------
  348.     if unit == "target" then
  349.         Health:SetPoint("TOPLEFT", self, "TOPLEFT")
  350.         Health:SetPoint("TOPRIGHT", self, "TOPRIGHT")
  351.         Health:SetHeight(16)
  352.         HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  353.         HealthBackground:SetPoint("TOPRIGHT", Health, "TOPRIGHT")
  354.         HealthBackground:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT")
  355.  
  356.         portrait:SetPoint("TOPLEFT", Health, "TOPLEFT")
  357.         portrait:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT")
  358.         portrait:SetAlpha(.25) 
  359.        
  360.         panelhp:SetPoint("RIGHT", Health, "RIGHT", 4, 5)
  361.         panelhp:SetSize(75,13)
  362.         panelhp:SetBackdrop(backdrop)
  363.         panelhp:SetBackdropColor(.6,.6,.6)
  364.         panelhp:SetBackdropBorderColor(0,0,0)
  365.         HealthPoints:SetPoint("RIGHT", panelhp, "RIGHT", 0, pp(1))
  366.         HPper:SetPoint("LEFT", panelhp, "LEFT", 2.5, pp(1))
  367.         HPper:SetJustifyH"RIGHT"
  368.  
  369.         Power:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT")
  370.         Power:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
  371.         Power:SetHeight(8)
  372.         PowerBackground:SetPoint("LEFT", Power:GetStatusBarTexture(), "RIGHT")
  373.         PowerBackground:SetPoint("TOPRIGHT", Power, "TOPRIGHT")
  374.         PowerBackground:SetPoint("BOTTOMRIGHT", Power, "BOTTOMRIGHT")
  375.        
  376.         Name:SetPoint("BOTTOMLEFT", Health, "BOTTOMLEFT", 2.5, 2.5)
  377.         Name:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", -65, 2.5)
  378.  
  379.         Castbar:SetPoint("LEFT", self, "LEFT", -4, -4)
  380.         Castbar:SetPoint("RIGHT", self, "RIGHT", 4, -4)
  381.         Castbar:SetHeight(13)
  382.         Castbar.time:SetPoint("TOPLEFT", Power, "BOTTOMLEFT", 0, -3)
  383.         Castbar.Text:SetPoint("TOPRIGHT", Power, "BOTTOMRIGHT", 0, -3)
  384.         Castbar.Text:SetPoint("TOPLEFT", Power, "BOTTOMLEFT", 30, -3)
  385.         Castbar.Text:SetJustifyH"RIGHT"
  386.        
  387.         if layout.tbuffs then
  388.             if not layout.healer then  
  389.                 Buffs:SetPoint("TOPLEFT", panelhp, "TOPRIGHT", 3, 0)
  390.                 Buffs:SetSize(200, 26)
  391.                 Buffs.initialAnchor = "LEFT"
  392.                 Buffs.size = 26
  393.                 Buffs.num = 6
  394.                 Buffs.spacing = 3
  395.             else
  396.                 Buffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", -1, 20)
  397.                 Buffs:SetWidth(200)
  398.                 Buffs:SetHeight(17)
  399.                 Buffs.initialAnchor = "LEFT"
  400.                 Buffs["growth-y"] = "UP"
  401.                 Buffs.size = 26
  402.                 Buffs.num = 9
  403.                 Buffs.spacing = 3
  404.                 Buffs.onlyShowPlayer = true
  405.             end
  406.         end
  407.        
  408.         if layout.tdebuffs then
  409.             if not layout.healer then
  410.                 Debuffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", -1, 20)
  411.                 Debuffs:SetWidth(250)
  412.                 Debuffs:SetHeight(20)
  413.                 Debuffs.initialAnchor = "LEFT"
  414.                 Debuffs["growth-y"] = "UP"
  415.                 Debuffs.size = 26
  416.                 Debuffs.num = 10
  417.                 Debuffs.spacing = 3
  418.                 Debuffs.onlyShowPlayer = true
  419.             else
  420.                 Debuffs:SetPoint("RIGHT", self, "LEFT", -3, 0)
  421.                 Debuffs:SetWidth(200)
  422.                 Debuffs:SetHeight(17)
  423.                 Debuffs.initialAnchor = "RIGHT"
  424.                 Debuffs["growth-x"] = "LEFT"
  425.                 Debuffs["growth-y"] = "DOWN"
  426.                 Debuffs.size = 26
  427.                 Debuffs.num = 6
  428.                 Debuffs.spacing = 3
  429.             end
  430.         end
  431.        
  432.         -- rogue combo points (now with more druid love!)
  433.         if (myClass == "ROGUE" or myClass == "DRUID") and unit == "target" then
  434.             local CPoints = {}
  435.             CPoints.unit = PlayerFrame.unit
  436.    
  437.             local combobar = CreateFrame("Frame", nil, self)
  438.             combobar:SetSize(95, 12)
  439.             combobar:SetPoint("BOTTOMRIGHT", ColdPlayer.Health, "BOTTOMRIGHT", 4, 1)
  440.             combobar:Hide()
  441.             combobar:SetFrameLevel(6)
  442.        
  443.             if myClass == "DRUID" then
  444.                 combobar:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
  445.                 combobar:SetScript("OnEvent", function()
  446.                     local currentform = GetShapeshiftForm()
  447.                     if currentform == 3 then
  448.                         combobar:Show()
  449.                     else
  450.                         combobar:Hide()
  451.                     end
  452.                     end)
  453.             else
  454.             combobar:Show()
  455.             end
  456.    
  457.             for i = 1, 5 do
  458.             CPoints[i] = lib.SetFontString(combobar, font, smalls, "OUTLINE, MONOCHROME")
  459.             CPoints[i]:SetSize(20, 12)
  460.             CPoints[i]:SetText("c"..i)
  461.    
  462.                 if i == 1 then
  463.                     CPoints[i]:SetSize(18, 12)
  464.                     CPoints[i]:SetPoint("LEFT", combobar)
  465.                     CPoints[i]:SetTextColor(1, 0, 0)
  466.                 else
  467.                     CPoints[i]:SetPoint("LEFT", CPoints[i-1], "RIGHT", 0, 0)
  468.                 end
  469.             end
  470.             CPoints[2]:SetTextColor(1, .5, 0)
  471.             CPoints[3]:SetTextColor(1, 1, 0)
  472.             CPoints[4]:SetTextColor(.5, 1, 0)
  473.             CPoints[5]:SetTextColor(0, 1, 0)
  474.        
  475.             self.CPoints = CPoints
  476.         end
  477.        
  478.         local ricon = panelhp:CreateTexture(nil, "OVERLAY")
  479.         ricon:SetTexture([[Interface\AddOns\oUF_Coldkil\textures\raidicons.blp]])
  480.         ricon:SetSize(22,22)
  481.         ricon:SetPoint("CENTER", panelhp, "BOTTOM", 0, pp(-3))
  482.         self.RaidIcon = ricon
  483.     end
  484.    
  485.     -------------------------------------------------------------
  486.     --      Pet, ToT, Focus layout
  487.     -------------------------------------------------------------
  488.     if unit == "focus" or unit == "pet" or unit == "targettarget" then
  489.         if focuscfg.extended and unit == "focus" then
  490.           self:SetSize(130, 30)
  491.        
  492.           panelhp:SetSize(55, 13)
  493.           panelhp:SetPoint("RIGHT", Health, "RIGHT", 4, 5)
  494.           panelhp:SetBackdrop(backdrop)
  495.           panelhp:SetBackdropColor(.6,.6,.6)
  496.           panelhp:SetBackdropBorderColor(0,0,0)
  497.        
  498.           portrait:SetPoint("TOPLEFT", Health, "TOPLEFT", 0, -1)
  499.           portrait:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", 0, 1)
  500.           portrait:SetAlpha(.25)
  501.        
  502.           Health:SetPoint("TOPLEFT", self, "TOPLEFT")
  503.           Health:SetPoint("TOPRIGHT", self, "TOPRIGHT")
  504.           Health:SetHeight(16)
  505.           HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  506.           HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  507.           HealthBackground:SetHeight(Health:GetHeight())
  508.           HealthPoints:SetPoint("TOPRIGHT", panelhp, "TOPRIGHT", 0, 2)
  509.           HealthPoints:SetJustifyH"RIGHT"
  510.           HPper:SetPoint("LEFT", panelhp, "LEFT", 0, 1)
  511.                
  512.           Power:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT")
  513.           Power:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
  514.           Power:SetHeight(8)
  515.           PowerBackground:SetPoint("LEFT", Power:GetStatusBarTexture(), "RIGHT")
  516.           PowerBackground:SetPoint("RIGHT", Power, "RIGHT")
  517.           PowerBackground:SetHeight(Power:GetHeight())
  518.          
  519.           Castbar:SetPoint("LEFT", self, "LEFT", -4, -4)
  520.           Castbar:SetPoint("RIGHT", self, "RIGHT", 4, -4)
  521.           Castbar:SetHeight(13)
  522.           Castbar.time:SetPoint("TOPLEFT", Power, "BOTTOMLEFT", 0, -4)
  523.           Castbar.Text:SetPoint("TOPRIGHT", Power, "BOTTOMRIGHT", -2, -4)
  524.           Castbar.Text:SetPoint("TOPLEFT", Power, "BOTTOMLEFT", 30, -4)
  525.           Castbar.Text:SetJustifyH"RIGHT"
  526.        
  527.           Name:SetPoint("BOTTOMLEFT", Health, "BOTTOMLEFT", 3, 2)
  528.           Name:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", -55, 2)
  529.        
  530.         else
  531.         Health:SetPoint("TOPLEFT", self, "TOPLEFT")
  532.         Health:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
  533.         HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  534.         HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  535.         HealthBackground:SetAlpha(1)
  536.         HealthBackground:SetPoint("TOPRIGHT", self, "TOPRIGHT")
  537.         HealthBackground:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT")
  538.        
  539.         Name:SetPoint("LEFT", Health, "BOTTOMLEFT")
  540.         Name:SetPoint("RIGHT", Health, "BOTTOMRIGHT")
  541.         Name:SetJustifyH"CENTER"
  542.         end
  543.     end
  544.    
  545.     -------------------------------------------------------------
  546.     --      Party frames layout
  547.     -------------------------------------------------------------
  548.     if unit == "party" then
  549.         if layout.healer then
  550.             Health:SetSize(150, 20)
  551.             Health:SetPoint("TOP", self, "TOP")
  552.             HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  553.             HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  554.             HealthBackground:SetAlpha(1)
  555.             HealthBackground:SetHeight(Health:GetHeight())
  556.        
  557.             Power:SetSize(150, 2)
  558.             Power:SetPoint("TOP", Health, "BOTTOM", 0, -1)
  559.        
  560.             Name:SetPoint("LEFT", Health, "LEFT", 2, 0)
  561.             HealthPoints:SetPoint("LEFT", Health, "LEFT", 2, 0)
  562.         else
  563.             Health:SetSize(150, 20)
  564.             Health:SetPoint("TOP", self, "TOP")
  565.             HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  566.             HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  567.             HealthBackground:SetAlpha(1)
  568.             HealthBackground:SetHeight(Health:GetHeight())
  569.        
  570.             Power:SetSize(150, 3)
  571.             Power:SetPoint("TOP", Health, "BOTTOM", 0, -1)
  572.             Power.colorPower = true
  573.        
  574.             Name:SetPoint("LEFT", Health, "LEFT", 2, 0)
  575.             Name:SetPoint("RIGHT", Health, "RIGHT", -2, 0)
  576.         end
  577.        
  578.         if layout.ppdebuffs then
  579.             Debuffs:SetPoint("LEFT", self, "RIGHT", 5, -1)
  580.             Debuffs:SetWidth(180)
  581.             Debuffs:SetHeight(17)
  582.             Debuffs.initialAnchor = "LEFT"
  583.             Debuffs.size = 25
  584.             Debuffs.num = 6
  585.             Debuffs.spacing = 3
  586.         end
  587.        
  588.         Health.PostUpdate = lib.PostUpdateHealthPartyRaid
  589.        
  590.         local ricon = Health:CreateTexture(nil, "OVERLAY")
  591.         ricon:SetTexture([[Interface\AddOns\oUF_Coldkil\textures\raidicons.blp]])
  592.         ricon:SetSize(18,18)
  593.         ricon:SetPoint("CENTER", self, "TOP", 0, pp(-4))
  594.         self.RaidIcon = ricon
  595.        
  596.         local role = Health:CreateTexture(nil, "OVERLAY")
  597.         role:SetSize(18, 18)
  598.         role:SetPoint("RIGHT", self, "RIGHT", -5, -1)
  599.         self.LFDRole = role
  600.        
  601.         local range = {
  602.             insideAlpha = 1,
  603.             outsideAlpha = .5,
  604.         }
  605.         self.Range = range
  606.     end
  607.    
  608.     -------------------------------------------------------------
  609.     --      Raid frames layout
  610.     -------------------------------------------------------------
  611.     if unit == "raid" then
  612.         if layout.healer then
  613.             Health:SetSize(pp(37), pp(35))
  614.             Health:SetOrientation"VERTICAL"
  615.             Health:SetPoint("TOP", self, "TOP")
  616.             HealthBackground:SetPoint("BOTTOM", Health:GetStatusBarTexture(), "TOP")
  617.             HealthBackground:SetPoint("TOP", Health, "TOP")
  618.             HealthBackground:SetAlpha(1)
  619.             HealthBackground:SetWidth(Health:GetWidth())
  620.        
  621.             Power:SetSize(2, 35)
  622.             Power:SetOrientation("VERTICAL")
  623.             Power:SetPoint("RIGHT", Health, "LEFT", -1, 0)
  624.             Power.colorPower = true
  625.        
  626.             HealthPoints:SetPoint("CENTER", Health, "CENTER")
  627.             Name:SetPoint("CENTER", Health, "CENTER")
  628.             Name:SetJustifyH"CENTER"
  629.             self:Tag(Name, '[nameshort]')
  630.            
  631.             local ricon = Health:CreateTexture(nil, "OVERLAY")
  632.             ricon:SetTexture([[Interface\AddOns\oUF_Coldkil\textures\raidicons.blp]])
  633.             ricon:SetSize(9,9)
  634.             ricon:SetPoint("CENTER", self, "TOPRIGHT", 0, 0)
  635.             self.RaidIcon = ricon
  636.         else
  637.             self:SetSize(pp(95),pp(14))
  638.            
  639.             Health:SetSize(pp(95), pp(14))
  640.             Health:SetPoint("TOP", self, "TOP")
  641.             HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  642.             HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  643.             HealthBackground:SetAlpha(1)
  644.             HealthBackground:SetHeight(Health:GetHeight())
  645.    
  646.             Name:SetPoint("LEFT", Health, "LEFT", 2, 0)
  647.             Name:SetPoint("RIGHT", Health, "RIGHT", -2, 0)
  648.             self:Tag(Name, '[name]')
  649.  
  650.             local ricon = Health:CreateTexture(nil, "OVERLAY")
  651.             ricon:SetTexture([[Interface\AddOns\oUF_Coldkil\textures\raidicons.blp]])
  652.             ricon:SetSize(13,13)
  653.             ricon:SetPoint("CENTER", self, "RIGHT", 3, 0)
  654.             self.RaidIcon = ricon  
  655.         end
  656.  
  657.         Health.PostUpdate = lib.PostUpdateHealthPartyRaid
  658.            
  659.         local range = {
  660.         insideAlpha = 1,
  661.         outsideAlpha = .5,
  662.         }
  663.         self.Range = range 
  664.     end
  665.    
  666.     ----------------------------------------------------------------
  667.     --       Boss/Arena frames layout
  668.     ----------------------------------------------------------------
  669.     if (unit and unit:find("arena%d")) or (unit and unit:find("boss%d")) then
  670.         -- set focus with right-click
  671.         self:SetAttribute("type2", "focus")
  672.        
  673.         Health:SetSize(180, 20)
  674.         Health:SetPoint("TOP", self, "TOP")
  675.         HealthBackground:SetPoint("LEFT", Health:GetStatusBarTexture(), "RIGHT")
  676.         HealthBackground:SetPoint("RIGHT", Health, "RIGHT")
  677.         HealthBackground:SetAlpha(1)
  678.         HealthBackground:SetHeight(Health:GetHeight())
  679.         HPper:SetFont(font,smalls,"OUTLINE, MONOCHROME")
  680.         HPper:SetPoint("RIGHT", Health, "RIGHT", -1, 2)
  681.         HPper:SetJustifyH"RIGHT"
  682.        
  683.         Name:SetPoint("LEFT", Health, "LEFT", 2, 1)
  684.        
  685.         Power:SetSize(180, 3)
  686.         Power:SetPoint("TOP", Health, "BOTTOM", 0, -1)
  687.         PowerBackground:SetPoint("LEFT", Power:GetStatusBarTexture(), "RIGHT")
  688.         PowerBackground:SetPoint("RIGHT", Power, "RIGHT")
  689.         PowerBackground:SetAlpha(.2)
  690.         PowerBackground:SetHeight(Power:GetHeight())
  691.         Power.colorPower = true
  692.        
  693.         Castbar:SetPoint("TOP", self.Health, "BOTTOM", 0, -5)
  694.         Castbar:SetWidth(180)
  695.         Castbar.time:SetPoint("LEFT", Castbar, "LEFT", 2, 1)
  696.         Castbar.Text:SetPoint("RIGHT", Castbar, "RIGHT", -2, 1)
  697.         Castbar.Text:SetPoint("LEFT", Castbar, "LEFT", 30, 1)
  698.         Castbar.Text:SetJustifyH"RIGHT"
  699.     end
  700. end
  701.  
  702. oUF:RegisterStyle("Coldkil", Shared)
  703. ----------------------------------------------------------------------------------
  704. -- spawning various units
  705. ----------------------------------------------------------------------------------
  706.  
  707.     local player = oUF:Spawn('player', "ColdPlayer")
  708.     local pet = oUF:Spawn('pet', "ColdPet")
  709.     local target = oUF:Spawn('target', "ColdTarget")
  710.     local tot = oUF:Spawn('targettarget', "ColdToT")
  711.     local focus = oUF:Spawn('focus', "ColdFocus")
  712.    
  713.     if layout.healer then
  714.         player:SetPoint("BOTTOM", UIParent, "BOTTOM", -175, 240)
  715.         pet:SetPoint('TOPLEFT', player, 'BOTTOMLEFT', 0, -8)
  716.         target:SetPoint("BOTTOM", UIParent, "BOTTOM", -175, 300)
  717.         tot:SetPoint("LEFT", target, "RIGHT", 10, 2)
  718.         focus:SetPoint('TOPLEFT', target, 'BOTTOMLEFT', 0, -18)
  719.     else
  720.         player:SetPoint("BOTTOM", UIParent, "BOTTOM", -175, 240)
  721.         pet:SetPoint('TOPLEFT', player, 'TOPRIGHT', 4, 0)
  722.         target:SetPoint("BOTTOM", UIParent, "BOTTOM", 175, 240)
  723.         tot:SetPoint("TOPRIGHT", target, "TOPLEFT", -4, 0)
  724.         if focuscfg.extended then
  725.             focus:SetPoint('BOTTOM', UIParent, 'BOTTOM', 0, 200)
  726.         else
  727.             focus:SetPoint('BOTTOM', UIParent, 'BOTTOM', 0, 240)
  728.         end
  729.     end
  730.    
  731.     -- make frames draggable with /cm
  732.     lib.dragalize(player)
  733.     lib.dragalize(pet)
  734.     lib.dragalize(target)
  735.     lib.dragalize(tot)
  736.     lib.dragalize(focus)
  737.    
  738.     -- you cannot hide standard frames, the game won't let you, so i'm "removing" the button
  739.     player.btn:SetAlpha(0)
  740.     player.btn:SetScale(.0001)
  741.     target.btn:SetAlpha(0)
  742.     target.btn:SetScale(.0001)
  743.     pet.btn:SetAlpha(0)
  744.     pet.btn:SetScale(.0001)
  745.     tot.btn:SetAlpha(0)
  746.     tot.btn:SetScale(.0001)
  747.     focus.btn:SetAlpha(0)
  748.     focus.btn:SetScale(.0001)
  749.    
  750.     local arena = {}
  751.     for i = 1, 5 do
  752.         arena[i] = oUF:Spawn("arena"..i, "ColdArena"..i)
  753.         if i == 1 then
  754.             arena[i]:SetPoint("LEFT", UIParent, "CENTER", 300, 100)
  755.         else
  756.             arena[i]:SetPoint("TOP", arena[i-1], "BOTTOM", 0, -15)
  757.         end
  758.     end
  759.    
  760.     for i = 1,MAX_BOSS_FRAMES do
  761.         local c_boss = _G["Boss"..i.."TargetFrame"]
  762.         c_boss:UnregisterAllEvents()
  763.         c_boss.Show = function() return end
  764.         c_boss:Hide()
  765.         _G["Boss"..i.."TargetFrame".."HealthBar"]:UnregisterAllEvents()
  766.         _G["Boss"..i.."TargetFrame".."ManaBar"]:UnregisterAllEvents()
  767.     end
  768.  
  769.     local boss = {}
  770.     for i = 1, MAX_BOSS_FRAMES do
  771.         boss[i] = oUF:Spawn("boss"..i, "ColdBoss"..i)
  772.         if i == 1 then
  773.             boss[i]:SetPoint("LEFT", UIParent, "CENTER", 400, 150)
  774.         else
  775.             boss[i]:SetPoint('TOP', boss[i-1], 'BOTTOM', 0, -20)            
  776.         end
  777.     end
  778.    
  779.     local party = oUF:SpawnHeader("ColdParty", nil, "custom [@raid6,exists] hide;show",
  780.         'showParty', true,
  781.         'yOffset', -12,
  782.         'columnAnchorPoint', 'LEFT',
  783.         'columnSpacing', 15,
  784.  
  785.         'oUF-initialConfigFunction', [[
  786.             self:SetWidth(260)
  787.             self:SetHeight(48)
  788.         ]]
  789.     )
  790.     if layout.healer then
  791.         party:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 65, 240)
  792.     else
  793.         party:SetPoint("TOPLEFT", UIParent, "LEFT", 10, 10)
  794.     end
  795.     lib.dragalize(party)
  796.     party.btn:SetAlpha(0)
  797.     party.btn:SetScale(.0001)
  798.    
  799.     CompactRaidFrameContainer:Hide()
  800.     CompactRaidFrameManager:SetScale(.0001)
  801.     CompactRaidFrameManager:SetAlpha(0)
  802.     CompactRaidFrameManager:Hide()
  803.    
  804.   if layout.showraid then
  805.     local raidanchor = CreateFrame("Frame", "ColdRaidAnchor", UIParent)
  806.     if layout.healer then
  807.         local raid = oUF:SpawnHeader("ColdRaid", nil, "custom [@raid6,exists] show;hide",
  808.         'oUF-initialConfigFunction', [[
  809.             local header = self:GetParent()
  810.             self:SetWidth(35)
  811.             self:SetHeight(32)
  812.         ]],
  813.         "yOffset", -8,
  814.         "showParty", true,
  815.         "showPlayer", true,
  816.         "showRaid", true,
  817.         "groupFilter", "1,2,3,4,5,6,7,8",
  818.         "groupingOrder", "1,2,3,4,5,6,7,8",
  819.         "groupBy", "GROUP",
  820.         "maxColumns", 8,
  821.         "unitsPerColumn", 5,
  822.         "columnSpacing", 10,
  823.         "columnAnchorPoint", "LEFT"
  824.       )
  825.       raid:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 50, 230)
  826.       lib.dragalize(raid)
  827.       raid.btn:SetAlpha(0)
  828.       raid.btn:SetScale(.0001)
  829.     else
  830.         local raid = oUF:SpawnHeader("ColdRaid", nil, "custom [@raid6,exists] show;hide",
  831.         'oUF-initialConfigFunction', [[
  832.             local header = self:GetParent()
  833.             self:SetWidth(95)
  834.             self:SetHeight(14)
  835.         ]],
  836.         "yOffset", pp(-5),
  837.         "showParty", true,
  838.         "showPlayer", true,
  839.         "showRaid", true,
  840.         "groupFilter", "1,2,3,4,5,6,7,8",
  841.         "groupingOrder", "1,2,3,4,5,6,7,8",
  842.         "groupBy", "GROUP"
  843.       )
  844.       raid:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", pp(10), pp(172))
  845.       lib.dragalize(raid)
  846.       raid.btn:SetAlpha(0)
  847.       raid.btn:SetScale(.0001)
  848.     end
  849.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement