Advertisement
Guest User

ErrorCastBar2

a guest
Aug 19th, 2010
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.25 KB | None | 0 0
  1. local _, class = UnitClass('player')
  2. local texture = "Interface\\AddOns\\oUF_Aftermathh\\media\\Cabaret"
  3. local border = "Interface\\AddOns\\oUF_Aftermathh\\media\\border"
  4. local font = "Interface\\AddOns\\oUF_Aftermathh\\media\\font.ttf"
  5. local fontsize = 15
  6. local height, width = 27, 270
  7. local buffsize = 26
  8.  
  9. local CBSafezone = true
  10. local CBLatency = true
  11. local castBars = true
  12. local castsafeZone = true
  13. local playerOnlyDebuffs = true
  14.  
  15. RuneFrame:Hide()
  16.  
  17. local backdrop = {
  18.     bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
  19.     insets = {top = -1, left = -1, bottom = -1, right = -1},
  20. }
  21.  
  22. local menu = function(self)
  23.     local unit = self.unit:sub(1, -2)
  24.     local cunit = self.unit:gsub("(.)", string.upper, 1)
  25.  
  26.     if(unit == "party" or unit == "partypet") then
  27.         ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
  28.     elseif(_G[cunit.."FrameDropDown"]) then
  29.         ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
  30.     end
  31. end
  32.  
  33. -- Icon
  34. local updateRIcon = function(self, event)
  35.     local index = GetRaidTargetIndex(self.unit)
  36.     if(index) then
  37.         self.RIcon:SetText(ICON_LIST[index].."22|t")
  38.     else
  39.         self.RIcon:SetText()
  40.     end
  41. end
  42.  
  43. oUF.TagEvents['AfterRaidName'] = 'UNIT_NAME_UPDATE'
  44. oUF.Tags['AfterRaidName'] = function(unit)
  45.     local Name = string.sub(UnitName(unit), 1, 4)
  46.     return Name
  47. end
  48.  
  49. -- Health And Mana Value
  50. local function ShortenValue(value)
  51.     if(value >= 1e6) then
  52.         return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1')
  53.     elseif(value >= 1e4) then
  54.         return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1')
  55.     else
  56.         return value
  57.     end
  58. end
  59.  
  60. -- Health Function
  61. oUF.Tags['Afterhealth'] = function(unit)
  62.     local min, max = UnitHealth(unit), UnitHealthMax(unit)
  63.     local status = not UnitIsConnected(unit) and 'Offline' or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and 'Dead'
  64.  
  65.     if(status) then
  66.         return status
  67.     elseif(unit == 'target' and UnitCanAttack('player', unit)) then
  68.         return ('%s (%d|cffffffff%%|r)'):format(ShortenValue(min), min / max * 100)
  69.     elseif(unit == 'player' and min ~= max) then
  70.         return ('|cffffffff%d|r %d|cffffffff%%|r'):format(min - max, min / max * 100)
  71.     elseif(min ~= max) then
  72.         return ('%s |cffffffff/|r %s'):format(ShortenValue(min), ShortenValue(max))
  73.     else
  74.         return max
  75.     end
  76. end
  77. oUF.TagEvents["Afterhealth"] = "UNIT_HEALTH UNIT_MAXHEALTH"
  78.  
  79. -- Powerz!
  80. oUF.Tags['Afterpower'] = function(unit)
  81.     local power = UnitPower(unit)
  82.     if(power > 0 and not UnitIsDeadOrGhost(unit)) then
  83.         return power
  84.     end
  85. end
  86. oUF.TagEvents['Afterpower'] = oUF.TagEvents.missingpp
  87.  
  88. -- Druid Power
  89. local function UpdateDruidPower(self)
  90.     local bar = self.DruidPower
  91.     local num, str = UnitPowerType('player')
  92.     local min = UnitPower('player', (num ~= 0) and 0 or 3)
  93.     local max = UnitPowerMax('player', (num ~= 0) and 0 or 3)
  94.  
  95.     bar:SetMinMaxValues(0, max)
  96.  
  97.     if(min ~= max) then
  98.         bar:SetValue(min)
  99.         bar:SetAlpha(1)
  100.  
  101.         if(num ~= 0) then
  102.             bar:SetStatusBarColor(unpack(colors.power['MANA']))
  103.             bar.Text:SetFormattedText('%d - %d%%', min, math.floor(min / max * 100))
  104.         else
  105.             bar:SetStatusBarColor(unpack(colors.power['ENERGY']))
  106.             bar.Text:SetText()
  107.         end
  108.     else
  109.         bar:SetAlpha(0)
  110.         bar.Text:SetText()
  111.     end
  112. end
  113.  
  114. -- Aura
  115. local auraIcon = function(icons, button)
  116.     button.icon:SetTexCoord(0.03, 0.97, 0.03, 0.97)
  117.    
  118.     icons.showDebuffType = false
  119.     button.cd.noCooldownCount = false
  120.    
  121.     button.overlay:SetTexture(border)
  122.     button.overlay:SetTexCoord(0, 1, 0, 1)
  123.     button.overlay:ClearAllPoints()
  124.     button.overlay:SetPoint('TOPRIGHT', button, 1.35, 1.35)
  125.     button.overlay:SetPoint('BOTTOMLEFT', button, -1.35, -1.35)
  126.     button.overlay.Hide = function(self) self:SetVertexColor(0.35, 0.35, 0.35, 1) end
  127.    
  128.     button.cd:SetReverse()
  129.     button.cd:ClearAllPoints()
  130.     button.cd:SetPoint('TOPRIGHT', button.icon, 'TOPRIGHT', -1, -1)
  131.     button.cd:SetPoint('BOTTOMLEFT', button.icon, 'BOTTOMLEFT', 1, 1)
  132.    
  133.     button.count:SetFont('Interface\\Add0ns\\oUF_Aftermathh\\media\\ohy.tff', 16, 'OUTLINE')
  134.     button.count:ClearAllPoints()
  135.     button.count:SetPoint('BOTTOMRIGHT', 1, 1)
  136.    
  137.         if (not button.background) then
  138.         button.background = button:CreateTexture(nil, 'BACKGROUND')
  139.         button.background:SetPoint('TOPLEFT', button.icon, 'TOPLEFT', -4, 4)
  140.         button.background:SetPoint('BOTTOMRIGHT', button.icon, 'BOTTOMRIGHT', 4, -4)
  141.         button.background:SetTexture('Interface\\AddOns\\oUF_Aftermathh\\media\\borderBackground')
  142.         button.background:SetVertexColor(0, 0, 0, 1)
  143.     end
  144. end
  145.  
  146.     -- custom channeling function
  147.    
  148. local function UpdateChannelStart(self, event, unit, name, rank, text)
  149.     if (self.Castbar.Latency) then
  150.         self.Castbar.Latency:ClearAllPoints()
  151.         self.Castbar.Latency:SetPoint('LEFT', self.Castbar, 'BOTTOMLEFT', 1, -1)
  152.        
  153.         local _, _, ms = GetNetStats()
  154.         self.Castbar.Latency:SetText(ms..'ms')
  155.     end
  156.  
  157.     if (self.Castbar.SafeZone) then
  158.         self.Castbar.SafeZone:SetDrawLayer('ARTWORK')
  159.         self.Castbar.SafeZone:SetPoint('TOPLEFT', self.Castbar)
  160.         self.Castbar.SafeZone:SetPoint('BOTTOMLEFT', self.Castbar)
  161.     end
  162. end
  163.  
  164.     -- custom casting function
  165.    
  166. local function UpdateCastStart(self, event, unit, name, rank, text, castid)
  167.     if (self.Castbar.Latency and unit == 'player') then
  168.         self.Castbar.Latency:ClearAllPoints()
  169.         self.Castbar.Latency:SetPoint('RIGHT', self.Castbar, 'BOTTOMRIGHT', -1, -1)
  170.        
  171.         local _, _, ms = GetNetStats()
  172.         self.Castbar.Latency:SetText(ms..'ms')
  173.     end
  174.  
  175.     if (self.Castbar.SafeZone) then
  176.         self.Castbar.SafeZone:SetDrawLayer('BORDER')
  177.         self.Castbar.SafeZone:SetPoint('TOPRIGHT', self.Castbar)
  178.         self.Castbar.SafeZone:SetPoint('BOTTOMRIGHT', self.Castbar)
  179.     end
  180. end
  181.    
  182.  
  183. -- Style
  184. local func = function(self, unit)
  185.     self.colors = colors
  186.     self.menu = menu
  187.     self.ignoreHealComm = true
  188.  
  189.     self:EnableMouse(true)
  190.     self:SetScript("OnEnter", UnitFrame_OnEnter)
  191.     self:SetScript("OnLeave", UnitFrame_OnLeave)
  192.     self:RegisterForClicks"anyup"
  193.     self:SetAttribute("*type2", "menu")
  194.    
  195.     CreateBorder(self, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4)
  196.    
  197.     -- Health
  198.     local hp = CreateFrame"StatusBar"
  199.     if(unit == 'targettarget')then
  200.       hp:SetHeight(height*.85)
  201.     else
  202.       hp:SetHeight(height*.85)
  203.     end
  204.     hp:SetStatusBarTexture(texture)
  205.     -- Smooth
  206.     hp.Smooth = true
  207.    
  208.     hp:SetStatusBarColor(.25, .25, .25)
  209.     hp.frequentUpdates = true
  210.  
  211.     hp:SetParent(self)
  212.     hp:SetPoint"TOP"
  213.     hp:SetPoint"LEFT"
  214.     hp:SetPoint"RIGHT"
  215.  
  216.     local hpbg = hp:CreateTexture(nil, "BORDER")
  217.     hpbg:SetAllPoints(hp)
  218.     hpbg:SetTexture(0, 0, 0, 0.9)
  219.  
  220.     self:SetBackdrop(backdrop)
  221.     self:SetBackdropColor(0, 0, 0, 0.9)
  222.    
  223.     local hpp = hp:CreateFontString(nil, "OVERLAY")
  224.     hpp:SetFont(font, fontsize, 'OUTLINE')
  225.     hpp:SetPoint("RIGHT",hp, -2, 0)
  226.     self:Tag(hpp, '[raidcolor][Afterhealth]')
  227.    
  228.     if unit == "player" then
  229.     hpp:SetPoint("RIGHT",hp, -2, 0)
  230.     elseif unit == "target" then
  231.     hpp:SetPoint("RIGHT",hp, -2, 0)
  232.     elseif unit == "focus" or unit == "pet" or unit == "targettarget" then
  233.     hpp:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", 500000000, -500000000)
  234.     end
  235.  
  236.     hp.bg = hpbg
  237.     hp.value = hpp
  238.     self.Health = hp
  239.     self.OverrideUpdateHealth = updateHealth
  240.    
  241.     -- Power
  242.     if not(unit == 'targettarget') then
  243.       local pp = CreateFrame"StatusBar"
  244.       pp:SetHeight(height*.11)
  245.       pp:SetStatusBarTexture(texture)
  246.  
  247.       pp.frequentUpdates = true
  248.       pp.colorTapping = true
  249.       pp.colorHappiness = true
  250.       pp.colorClass = true
  251.       pp.colorReaction = true
  252.       -- Smooth
  253.       pp.Smooth = true
  254.  
  255.       pp:SetParent(self)
  256.       pp:SetPoint("BOTTOM")
  257.       pp:SetPoint("LEFT", .2, 0)
  258.       pp:SetPoint("RIGHT", -.2, 0)
  259.  
  260.       local ppbg = pp:CreateTexture(nil, "BORDER")
  261.       ppbg:SetAllPoints(pp)
  262.       ppbg:SetTexture(texture)
  263.       ppbg.multiplier = .3
  264.      
  265.       -- Power Text
  266.       local ppp = pp:CreateFontString(nil, "OVERLAY")
  267.       ppp:SetFont(font, fontsize, 'OUTLINE')
  268.       ppp:SetPoint("LEFT",hpp,"RIGHT", -265, 0)
  269.       self:Tag(ppp, '[raidcolor][Afterpower]')
  270.      
  271.       pp.value = ppp
  272.       pp.bg = ppbg
  273.       self.Power = pp
  274.       self.PostUpdatePower = updatePower
  275.      
  276.       else
  277.      
  278.       local pp = CreateFrame"StatusBar"
  279.       pp:SetHeight(height*.11)
  280.       pp:SetStatusBarTexture(texture)
  281.  
  282.       pp.frequentUpdates = true
  283.       pp.colorTapping = true
  284.       pp.colorHappiness = true
  285.       pp.colorClass = true
  286.       pp.colorReaction = true
  287.       -- Smooth
  288.       pp.Smooth = true
  289.  
  290.       pp:SetParent(self)
  291.       pp:SetPoint("BOTTOM")
  292.       pp:SetPoint("LEFT", .2, 0)
  293.       pp:SetPoint("RIGHT", -.2, 0)
  294.  
  295.       local ppbg = pp:CreateTexture(nil, "BORDER")
  296.       ppbg:SetAllPoints(pp)
  297.       ppbg:SetTexture(texture)
  298.      
  299.       -- Power Text
  300.       local ppp = pp:CreateFontString(nil, "OVERLAY")
  301.       ppp:SetFont(font, fontsize)
  302.       ppp:SetPoint("RIGHT",hpp,"LEFT",  50000, 0)
  303.       self:Tag(ppp, '[raidcolor][Afterpower]')
  304.      
  305.       pp.value = ppp
  306.       pp.bg = ppbg
  307.       self.Power = pp
  308.       self.PostUpdatePower = updatePower
  309.     end
  310.  
  311.     -- CastBar
  312.     if(castBars)then
  313.       if(unit == 'player' or unit == 'focus' or unit == 'target') then
  314.         self.Castbar = CreateFrame('StatusBar', nil, self)
  315.         self.Castbar:SetStatusBarTexture(texture)
  316.         self.Castbar:SetScale(1.139)
  317.         self.Castbar:SetStatusBarColor(0.659, 0.843, 1)
  318.        
  319.         CreateBorder(self.Castbar, 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
  320.        
  321.         self.Castbar.Bg = self.Castbar:CreateTexture(nil, "BACKGROUND")
  322.         self.Castbar.Bg:SetAllPoints(self.Castbar)
  323.         self.Castbar.Bg:SetTexture(texture)
  324.         self.Castbar.Bg:SetVertexColor(0, 0, 0, 0.6)
  325.        
  326.         if (unit == 'player') then
  327.             self.Castbar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 327, -55)
  328.             self.Castbar:SetHeight(25)
  329.             self.Castbar:SetWidth(309)
  330.             self.Castbar:SetParent(UIParent)
  331.          
  332.             if (CBSafezone) then
  333.                 self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, 'BORDER')
  334.                 self.Castbar.SafeZone:SetTexture('Interface\\Buttons\\WHITE8x8')
  335.                 self.Castbar.SafeZone:SetVertexColor(1, 0.5, 0, 1)
  336.             end
  337.  
  338.             if (CBLatency) then
  339.                 self.Castbar.Latency = self:CreateFontString(nil, 'ARTWORK')
  340.                 self.Castbar.Latency:SetFont(font, fontsize, 'OUTLINE')
  341.                 self.Castbar.Latency:SetParent(self.Castbar)
  342.                 self.Castbar.Latency:SetDrawLayer('OVERLAY')
  343.                 self.Castbar.Latency:SetVertexColor(0.6, 0.6, 0.6)
  344.                 self.Castbar.Latency:SetAlpha(1)
  345.             end
  346.  
  347.             self.PostCastStart = UpdateCastStart
  348.             self.PostChannelStart = UpdateChannelStart
  349.         end
  350.  
  351.         self.Castbar.CustomDelayText = function(self, duration)
  352.             self.Time:SetFormattedText('[|cffff0000-%.1f|r] %.1f/%.1f', self.delay, duration, self.max)
  353.         end
  354.  
  355.         self.Castbar.CustomTimeText = function(self, duration)
  356.             self.Time:SetFormattedText('%.1f/%.1f', duration, self.max)
  357.         end
  358.        
  359.         self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
  360.         self.Castbar.Time:SetFont(font, 13, 'OUTLINE')
  361.         self.Castbar.Time:SetPoint("RIGHT", self.Castbar, "RIGHT",  -2, 0)
  362.         self.Castbar.Time:SetParent(self.Castbar)
  363.         self.Castbar.Time:SetJustifyH('RIGHT')
  364.         self.Castbar.Time:SetParent(self.Castbar)
  365.        
  366.         self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY")
  367.         self.Castbar.Text:SetFont(font, 13, 'OUTLINE')
  368.         self.Castbar.Text:SetPoint("LEFT", self.Castbar, "LEFT", 2, 0)
  369.         self.Castbar.Text:SetHeight(fontsize)
  370.         self.Castbar.Text:SetWidth(250)
  371.         self.Castbar.Text:SetJustifyH"LEFT"
  372.         self.Castbar.Text:SetParent(self.Castbar)
  373.  
  374.         if (unit == 'focus') then
  375.         self.Castbar:SetPoint("CENTER", UIParent, "CENTER", -10, -10)
  376.         self.Castbar:SetWidth(260)
  377.         self.Castbar:SetHeight(25)
  378.         elseif (unit == 'target') then
  379.         self.Castbar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 141, 97)
  380.         self.Castbar:SetWidth(230)      
  381.         self.Castbar:SetHeight(26)
  382.         self.Castbar:SetParent(self)
  383.         end
  384. end  
  385.    
  386.  
  387.  -- mirrortimers --
  388.    
  389. for _, bar in pairs({
  390.     'MirrorTimer1',
  391.     'MirrorTimer2',
  392.     'MirrorTimer3',
  393. }) do  
  394.     for i, region in pairs({_G[bar]:GetRegions()}) do
  395.         if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
  396.             region:Hide()
  397.         end
  398.     end
  399.            
  400.     CreateBorder(_G[bar], 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
  401.  
  402.     _G[bar..'Border']:Hide()
  403.    
  404.     _G[bar]:SetParent(UIParent)
  405.     _G[bar]:SetScale(1.132)
  406.     _G[bar]:SetHeight(20)
  407.     _G[bar]:SetWidth(280)
  408.      
  409.     _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
  410.     _G[bar..'Background']:SetTexture('Interface\\Buttons\\WHITE8x8')
  411.     _G[bar..'Background']:SetAllPoints(bar)
  412.     _G[bar..'Background']:SetVertexColor(0, 0, 0, 0.5)
  413.        
  414.     _G[bar..'Text']:SetFont(CastingBarFrameText:GetFont(), 13)
  415.     _G[bar..'Text']:ClearAllPoints()
  416.     _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
  417.        
  418.     _G[bar..'StatusBar']:SetAllPoints(_G[bar])
  419. end
  420.    
  421.     -- Leader/MasterLoot Icon
  422.     if(unit == 'player') then
  423.       local leader = hp:CreateTexture(nil, "OVERLAY")
  424.       leader:SetHeight(16)
  425.       leader:SetWidth(16)
  426.       leader:SetPoint("BOTTOMLEFT", hp, "TOPLEFT", -5, -2)
  427.       leader:SetTexture"Interface\\GroupFrame\\UI-Group-LeaderIcon"
  428.       self.Leader = leader
  429.  
  430.       local masterlooter = hp:CreateTexture(nil, 'OVERLAY')
  431.       masterlooter:SetHeight(16)
  432.       masterlooter:SetWidth(16)
  433.       masterlooter:SetPoint('LEFT', leader, 'RIGHT')
  434.       self.MasterLooter = masterlooter
  435.     end
  436.    
  437.     -- Portraits
  438.     local portrait = CreateFrame("PlayerModel", nil, self)
  439.       portrait:SetBackdrop(backdrop)
  440.         portrait:SetBackdropColor(0, 0, 0, .9)
  441.         portrait:SetScript("OnShow", function(self) self:SetCamera(0) end)
  442.         portrait:SetWidth(height*3)
  443.         portrait:SetHeight(height*2)
  444.         portrait.type = "3D"
  445.         self.Portrait = portrait
  446.        
  447.     CreateBorder(portrait, 12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
  448.    
  449.     if unit == "player" then
  450.     portrait:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", -92, -26)
  451.     elseif unit == "target" then
  452.     portrait:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", 11, -26)
  453.     elseif unit == "focus" or unit == "pet" or unit == "targettarget" then
  454.     portrait:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", 500000000, -500000000)
  455.     end
  456.        
  457.     local pvp = hp:CreateTexture(nil, "OVERLAY")
  458.     pvp:SetPoint("BOTTOMRIGHT", hp, "TOPRIGHT", 18, -45)
  459.     pvp:SetHeight(28)
  460.     pvp:SetWidth(28)
  461.     self.PvP = pvp
  462.    
  463.     local LFDRole = hp:CreateTexture(nil, 'OVERLAY')
  464.     LFDRole:SetSize(16, 16)
  465.     LFDRole:SetPoint('LEFT', hp, 'RIGHT', -7, 12)
  466.     self.LFDRole = LFDRole
  467.    
  468.     local Combat = hp:CreateTexture(nil, 'OVERLAY')
  469.     Combat:SetSize(20, 20)
  470.     Combat:SetPoint('BOTTOMLEFT', hp, -10, -10)
  471.     self.Combat = Combat
  472.    
  473.     local ricon = hp:CreateFontString(nil, "OVERLAY")
  474.     ricon:SetFontObject(GameFontNormalSmall)
  475.     ricon:SetTextColor(1, 1, 1)
  476.     ricon:SetPoint("CENTER", hp, 0, 12)
  477.     ricon:SetHeight(24)
  478.     ricon:SetWidth(24)
  479.     self.RIcon = ricon
  480.     self:RegisterEvent("RAID_TARGET_UPDATE", updateRIcon)
  481.     table.insert(self.__elements, updateRIcon)
  482.    
  483.     -- Combo Points
  484.     if(unit=='target') then
  485.     local cpoints = self:CreateFontString(nil, 'OVERLAY')
  486.     cpoints:SetFont(font, 18, 'OUTLINE')
  487.     cpoints:SetPoint('RIGHT', self, 'LEFT', -10, 0)
  488.     cpoints:SetJustifyH('RIGHT')
  489.     self:Tag(cpoints, '[cpoints]')
  490.     end
  491.    
  492.     if(unit~='player')then
  493.     -- Name
  494.       local name = hp:CreateFontString(nil, "OVERLAY")
  495.       if(unit == "targettarget" or unit == "focus" or unit == "pet") then
  496.           name:SetPoint("CENTER")
  497.           name:SetWidth(150)
  498.         else
  499.           name:SetPoint("LEFT", hp, "LEFT", -2, 27)
  500.           name:SetJustifyH"LEFT"
  501.           name:SetWidth(300)
  502.       end
  503.       name:SetFont(font, fontsize, 'OUTLINE')
  504.       name:SetTextColor(1, 1, 1)
  505.       name:SetHeight(fontsize)
  506.       self.Info = name
  507.       if(unit == 'target')then
  508.         self:Tag(self.Info,'[difficulty][level][shortclassification] [raidcolor][name]')
  509.       else
  510.         self:Tag(self.Info,'[raidcolor][name]')
  511.       end
  512.     end
  513.    
  514.     -- Buffs
  515.     if(unit) then
  516.         local buffs = CreateFrame("Frame", nil, self)
  517.         buffs:SetHeight(buffsize)
  518.         buffs:SetWidth(width)
  519.         buffs.PostCreateIcon = auraIcon
  520.     if(unit == 'pet' or unit == 'focus' or unit == 'target') then      
  521.         buffs.initialAnchor = "TOPLEFT"
  522.         buffs["growth-y"] = "RIGHT"
  523.         buffs["growth-x"] = "DOWN"
  524.         buffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -2, -8)
  525.         buffs.size = 28
  526.         buffs.spacing = 3
  527.        
  528.     if(unit == "focus" or unit == "pet") then
  529.       buffs.num = 6
  530.     elseif(unit=="target") then
  531.       buffs.num = 9
  532.      else
  533.       buffs.num = 6
  534.   end
  535.       self.Buffs = buffs
  536. end    
  537.    
  538.     -- Debuffs
  539.     if(unit) then
  540.         local debuffs = CreateFrame("Frame", nil, self)
  541.         debuffs:SetHeight(width)
  542.         debuffs:SetWidth(width)
  543.         debuffs.PostCreateIcon = auraIcon
  544.       if(unit == 'pet'or unit == 'focus') then
  545.           debuffs:SetPoint("LEFT", self, "RIGHT", 7, 0)
  546.           debuffs["growth-x"] = "RIGHT"
  547.           debuffs.initialAnchor = "LEFT"
  548.       elseif(unit == 'player' or unit == 'targettarget') then
  549.           debuffs:SetPoint("LEFT", self, "RIGHT", 20, 5)
  550.           debuffs["growth-x"] = "RIGHT"
  551.           debuffs.initialAnchor = "LEFT"
  552.       else
  553.           debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -4, 27)
  554.           debuffs["growth-y"] = "UP"
  555.           debuffs.initialAnchor = "BOTTOMLEFT"
  556.           if(playerOnlyDebuffs)then
  557.             debuffs.onlyShowPlayer = true
  558.           end
  559.       end
  560.         debuffs.size = 32      
  561.         debuffs.spacing = 3
  562.       if(unit == "targettarget" or unit == "player") then
  563.       debuffs.num = 0
  564.     elseif(unit=="target") then
  565.       debuffs.num = 5
  566.      else
  567.       debuffs.num = 4
  568.   end
  569.         self.Debuffs = debuffs
  570. end
  571.  
  572.  
  573.     if(unit == 'player' and UnitLevel('player') ~= MAX_PLAYER_LEVEL) then
  574.         self.Resting = self.Power:CreateTexture(nil, 'OVERLAY')
  575.         self.Resting:SetHeight(18)
  576.         self.Resting:SetWidth(20)
  577.         self.Resting:SetPoint('BOTTOMLEFT', -8.5, -8.5)
  578.         self.Resting:SetTexture('Interface\\CharacterFrame\\UI-StateIcon')
  579.         self.Resting:SetTexCoord(0,0.5,0,0.421875)
  580.     end
  581.  
  582.     -- DebuffHidghtlight
  583.     self.DebuffHighlightBackdrop = false
  584.     self.DebuffHighlightFilter = true
  585.    
  586.     if(unit == 'player') then
  587.         if(IsAddOnLoaded('oUF_Swing')) then
  588.             self.Swing = CreateFrame('StatusBar', nil, self)
  589.             self.Swing:SetPoint('TOP', self, 'BOTTOM', 0, -10)
  590.             self.Swing:SetStatusBarTexture(texture)
  591.             self.Swing:SetStatusBarColor(1, 0.7, 0)
  592.             self.Swing:SetHeight(6)
  593.             self.Swing:SetWidth(width)
  594.             self.Swing:SetBackdrop(backdrop)
  595.             self.Swing:SetBackdropColor(0, 0, 0)
  596.  
  597.             self.Swing.Text = self.Swing:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
  598.             self.Swing.Text:SetPoint('CENTER', self.Swing)
  599.  
  600.             self.Swing.bg = self.Swing:CreateTexture(nil, 'BORDER')
  601.             self.Swing.bg:SetAllPoints(self.Swing)
  602.             self.Swing.bg:SetTexture(0.3, 0.3, 0.3)
  603.  
  604.             self.Swing.disableMelee = true
  605.             self.Swing.disableRanged = true
  606.         end
  607.  
  608.         if(IsAddOnLoaded('oUF_RuneBar') and class == 'DEATHKNIGHT') then
  609.             self.RuneBar = {}
  610.             for i = 1, 6 do
  611.                 self.RuneBar[i] = CreateFrame('StatusBar', nil, self)
  612.                 if(i == 1) then
  613.                     self.RuneBar[i]:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -8)
  614.                 else
  615.                     self.RuneBar[i]:SetPoint('TOPLEFT', self.RuneBar[i-1], 'TOPRIGHT', 5, 0)
  616.                 end
  617.                 self.RuneBar[i]:SetStatusBarTexture(texture)
  618.                 self.RuneBar[i]:SetHeight(10)
  619.                 self.RuneBar[i]:SetWidth(250/6 - 0.85)
  620.                 self.RuneBar[i]:SetBackdrop(backdrop)
  621.                 self.RuneBar[i]:SetBackdropColor(0, 0, 0)
  622.                 self.RuneBar[i]:SetMinMaxValues(0, 1)
  623.                
  624.                 CreateBorder(self.RuneBar[i], 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
  625.  
  626.                 self.RuneBar[i].bg = self.RuneBar[i]:CreateTexture(nil, 'BORDER')
  627.                 self.RuneBar[i].bg:SetAllPoints(self.RuneBar[i])
  628.                 self.RuneBar[i].bg:SetTexture(0.1, 0.1, 0.1)           
  629.             end
  630.         end
  631.        
  632.         if IsAddOnLoaded("oUF_TotemBar") and class == "SHAMAN" then
  633.             self.TotemBar = {}
  634.             self.TotemBar.Destroy = true
  635.             for i = 1, 4 do
  636.                 self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
  637.                 self.TotemBar[i]:SetHeight(33)
  638.                 self.TotemBar[i]:SetWidth(200/4 - 5)
  639.                 if (i == 1) then
  640.                     self.TotemBar[i]:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -1, 70)
  641.                 else
  642.                     self.TotemBar[i]:SetPoint("RIGHT", self.TotemBar[i-1], "LEFT", -10, 0)
  643.                 end
  644.                
  645.                 CreateBorder(self.TotemBar[i], 12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
  646.                
  647.                 self.TotemBar[i]:SetStatusBarTexture(texture)
  648.                 self.TotemBar[i]:SetBackdrop(backdrop)
  649.                 self.TotemBar[i]:SetBackdropColor(0,0,0,6)
  650.                 self.TotemBar[i]:SetMinMaxValues(0, 1)
  651.                
  652.                 self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
  653.                 self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
  654.                 self.TotemBar[i].bg:SetTexture(backdrop)
  655.                 self.TotemBar[i].bg.multiplier = 0.3       
  656.             end
  657.         end
  658.  
  659.        
  660.         if(IsAddOnLoaded('oUF_Experience')) then
  661.             self.Experience = CreateFrame('StatusBar', nil, self)
  662.             self.Experience:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -25)
  663.             self.Experience:SetStatusBarTexture(texture)
  664.             self.Experience:SetStatusBarColor(0,.7,1)
  665.             self.Experience:SetHeight(15)
  666.             self.Experience:SetWidth((unit == 'pet') and 150 or width)
  667.             self.Experience:SetBackdrop(backdrop)
  668.             self.Experience:SetBackdropColor(0, 0, 0)
  669.  
  670.             self.Experience.Tooltip = true
  671.  
  672.             CreateBorder(self.Experience, 11, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3)
  673.  
  674.             self.Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY')
  675.             self.Experience.Text:SetFont(font, fontsize, 'OUTLINE')
  676.             self.Experience.Text:SetPoint('CENTER', self.Experience)
  677.             self.Experience.bg = self.Experience:CreateTexture(nil, 'BORDER')
  678.             self.Experience.bg:SetAllPoints(self.Experience)
  679.             self.Experience.bg:SetTexture(0.25, 0.25, 0.25)
  680.         end
  681.  
  682.         if(class == 'DRUID') then
  683.             self.DruidPower = CreateFrame('StatusBar', nil, self)
  684.             self.DruidPower:SetPoint('BOTTOM', self.Power, 'TOP')
  685.             self.DruidPower:SetStatusBarTexture(texture)
  686.             self.DruidPower:SetHeight(1)
  687.             self.DruidPower:SetWidth(width)
  688.             self.DruidPower:SetAlpha(0)
  689.          
  690.             self.DruidPower.Text = self.DruidPower:CreateFontString(nil, 'OVERLAY')
  691.             self.DruidPower.Text:SetFont(font, fontsize, 'OUTLINE')
  692.             self.DruidPower.Text:SetPoint('CENTER', self.DruidPower)
  693.             self.DruidPower.Text:SetTextColor(unpack(colors.power['MANA']))
  694.  
  695.             self:RegisterEvent('UNIT_MANA', UpdateDruidPower)
  696.             self:RegisterEvent('UNIT_ENERGY', UpdateDruidPower)
  697.             self:RegisterEvent('PLAYER_LOGIN', UpdateDruidPower)
  698.         end
  699.  
  700.     end
  701.    
  702.     -- CombatFeedback
  703.     if not (unit == "player")then
  704.       local cbft = hp:CreateFontString(nil, "OVERLAY")
  705.       cbft:SetPoint("CENTER", self)
  706.       cbft:SetFont(font, 21)
  707.       cbft:SetShadowOffset(2, 2)
  708.       self.CombatFeedbackText = cbft
  709.       self.CombatFeedbackText.maxAlpha = 1
  710.     end
  711.  
  712.     if(not unit) then
  713.         self.Range = {
  714.             insideAlpha = 1,
  715.             outsideAlpha = 0.5,
  716.         }
  717.     end
  718.    
  719.     if(unit == "targettarget" or unit == "focus" or unit == "pet") then
  720.       self:SetAttribute('initial-height', height)
  721.       self:SetAttribute('initial-width', 150)
  722.     else
  723.       self:SetAttribute('initial-height', height)
  724.       self:SetAttribute('initial-width', width)
  725.     end
  726.  
  727.     self.disallowVehicleSwap = true
  728.  
  729.     return self
  730.  
  731. end end end
  732.    
  733. local function menu(self)
  734.     if(self.unit:match('party')) then
  735.         ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor')
  736.     else
  737.         FriendsDropDown.unit = self.unit
  738.         FriendsDropDown.id = self.id
  739.         FriendsDropDown.initialize = RaidFrameDropDown_Initialize
  740.         ToggleDropDownMenu(1, nil, FriendsDropDown, 'cursor')
  741.     end
  742. end
  743.  
  744. -- Raid Layout
  745.   local function raidlayout(self, unit)
  746.     self.menu = menu
  747.     self:RegisterForClicks('AnyUp')
  748.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  749.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  750.     self:SetAttribute('*type2', 'menu')
  751.     self:SetAttribute('initial-height', 38)
  752.     self:SetAttribute('initial-width', 42)
  753.    
  754.     CreateBorder(self, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4)
  755.    
  756.     self:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = -1.5, left = -1.5, bottom = -1.5, right = -1.5}})
  757.     self:SetBackdropColor(0, 0, 0, 0.8)
  758.  
  759.  -- DebuffHidghtlight
  760.     self.DebuffHighlightBackdrop = true
  761.     self.DebuffHighlightFilter = true
  762.  
  763. -- health bar
  764.     self.Health = CreateFrame('StatusBar', nil, self)
  765.     self.Health:SetStatusBarTexture(bartexture)
  766.     self.Health:SetHeight(10)
  767.     self.Health:SetParent(self)
  768.     self.Health:SetAllPoints(self)
  769.     self.Health.colorClass = true
  770.     self.Health:SetOrientation('HORIZONTAL')
  771.     self.Health:SetOrientation('VERTICAL')
  772.    
  773. -- health bar background
  774.     self.Health.bg = self.Health:CreateTexture(nil, 'BORDER')
  775.     self.Health.bg:SetAllPoints(self.Health)
  776.     self.Health.bg:SetTexture(bartexture)
  777.     self.Health.bg:SetAlpha(0.4)
  778.  
  779. -- name text
  780.     self.Name = self.Health:CreateFontString(nil, 'OVERLAY')
  781.     self.Name:SetPoint('TOP', 0, -1)
  782.     self.Name:SetFont(font, 11, 'OUTLINE')
  783.     self.Name:SetTextColor(1, 1, 1)
  784.     self:Tag(self.Name, '|cffffffff[AfterRaidName]|r')
  785.    
  786. -- ready check
  787.     self.ReadyCheck = self.Health:CreateTexture(nil, 'OVERLAY')
  788.     self.ReadyCheck:SetPoint('LEFT', self, -16, 0)
  789.     self.ReadyCheck:SetHeight(14)
  790.     self.ReadyCheck:SetWidth(14)
  791.    
  792. -- Raid Icon
  793.     self.RaidIcon = self.Health:CreateTexture(nil, 'OVERLAY')
  794.     self.RaidIcon:SetHeight(15)
  795.     self.RaidIcon:SetWidth(15)
  796.     self.RaidIcon:SetPoint('CENTER', self, 'CENTER')
  797.     self.RaidIcon:SetTexture('Interface\\TargetingFrame\\UI-RaidTargetingIcons')
  798.  
  799. -- range fading
  800.     self.Range = {
  801.         insideAlpha = 1,
  802.         outsideAlpha = 0.4,
  803.     }
  804.    
  805. -- smooth update support
  806.     self.Health.Smooth = true
  807.  
  808.     return self
  809.  
  810. end
  811.  
  812.  
  813. oUF:RegisterStyle('AftermathhRaid', raidlayout)
  814. oUF:SetActiveStyle('AftermathhRaid')
  815.  
  816. local raid = oUF:SpawnHeader(nil, nil, 'raid,party,solo',
  817.     'showPlayer', true,
  818.     'showSolo', true,
  819.     'showParty', true,
  820.     'showRaid', true,
  821.     'xoffset', 12,
  822.     'yOffset', -5,
  823.     'point', "LEFT",
  824.     'groupFilter', '1,2,3,4,5,6,7,8',
  825.     'groupingOrder', '1,2,3,4,5,6,7,8',
  826.     'groupBy', 'GROUP',
  827.     'maxColumns', 12,
  828.     'unitsPerColumn', 5,
  829.     'columnSpacing', 12,
  830.     'columnAnchorPoint', "TOP"
  831. )
  832. raid:SetPoint("TOPLEFT", UIParent, 10, -8)
  833.  
  834. oUF:RegisterStyle("Aftermathh", func)
  835. oUF:SetActiveStyle"Aftermathh"
  836.  
  837. local player = oUF:Spawn("player")
  838. player:SetPoint("BOTTOMLEFT", UIParent, 196, 182)
  839. local target = oUF:Spawn("target")
  840. target:SetPoint("BOTTOMRIGHT", UIParent, -237, 184)
  841. local tot = oUF:Spawn("targettarget")
  842. tot:SetPoint("RIGHT", UIParent, -75, -189)
  843. local pet = oUF:Spawn("pet")
  844. pet:SetPoint("LEFT", UIParent, 20, -81)
  845. local focus = oUF:Spawn("focus")
  846. focus:SetPoint("LEFT", UIParent, 20, -157)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement