Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 30.28 KB | None | 0 0
  1. local _, ns = ...
  2. local oUF = ns.oUF or oUF
  3.  
  4. local FONT = [=[Interface\AddOns\oUF_P3lim\pixel.ttf]=]
  5. local TEXTURE = [=[Interface\ChatFrame\ChatFrameBackground]=]
  6. local BACKDROP = {
  7.     bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
  8. }
  9. local function round(val, decimal)
  10.   if (decimal) then
  11.     return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
  12.   else
  13.     return math.floor(val+0.5)
  14.   end
  15. end
  16.  
  17. local UnitSpecific = {
  18.     player = function(self)
  19.         self:SetWidth(250)
  20.        
  21.         local ht = CreateFrame('Button', 'PlayerHealthTextFrame', self)
  22.             ht:SetSize(50,10)
  23.             ht:SetPoint('LEFT', self, 'RIGHT', 5, 2)
  24.             ht:EnableMouse(false)
  25.             ht:RegisterEvent('PLAYER_ENTERING_WORLD')
  26.             ht:RegisterUnitEvent('UNIT_HEALTH', 'player', 'vehicle')
  27.             ht:RegisterUnitEvent('UNIT_ENTERED_VEHICLE', 'player')
  28.             ht:RegisterUnitEvent('UNIT_EXITED_VEHICLE', 'player')
  29.    
  30.         local htt = ht:CreateFontString('PlayerHealthText', 'OVERLAY')
  31.             htt:SetAllPoints(true)
  32.             htt:SetFont(FONT, 11, 'OUTLINE')
  33.             htt:SetJustifyH('LEFT')
  34.         local hcur1, hmax1, r1, g1
  35.         ht:SetScript('OnEvent', function(self, event, unit)
  36.             if UnitIsGhost('player') then
  37.                 return htt:SetText('|cffb40000Ghost')
  38.             elseif UnitIsDead('player') then
  39.                 return htt:SetText('|cffb40000Dead')
  40.             elseif (event == 'PLAYER_ENTERING_WORLD' and UnitInVehicle('player')) or event == 'UNIT_ENTERED_VEHICLE' then
  41.                 ht:UnregisterEvent('UNIT_HEALTH')
  42.                 ht:RegisterUnitEvent('UNIT_HEALTH', 'vehicle')
  43.                 hcur1, hmax1 = UnitHealth('vehicle'), UnitHealthMax('vehicle')
  44.             elseif event == 'PLAYER_ENTERING_WORLD' or event == 'UNIT_EXITED_VEHICLE' then
  45.                 ht:UnregisterEvent('UNIT_HEALTH')
  46.                 ht:RegisterUnitEvent('UNIT_HEALTH', 'player')
  47.                 hcur1, hmax1 = UnitHealth('player'), UnitHealthMax('player')
  48.             elseif (event == 'UNIT_HEALTH' and UnitInVehicle('player')) then
  49.                 hcur1, hmax1 = UnitHealth('vehicle'), UnitHealthMax('vehicle')
  50.             elseif event == 'UNIT_HEALTH' then
  51.                 hcur1, hmax1 = UnitHealth('player'), UnitHealthMax('player')
  52.             end
  53.            
  54.             if hcur1 < hmax1 then
  55.                 hr1, hg1 = 180, 0
  56.             else
  57.                 hr1, hg1 = 0, 180
  58.             end
  59.            
  60.             if hcur1 >= 1000000 then
  61.                 hcur1 = format('%.1fm', hcur1 / 1000000)
  62.             elseif hcur1 >= 1000 then
  63.                 hcur1 = format('%.0fk', hcur1 / 1000)
  64.             end
  65.             htt:SetFormattedText('|cff%02x%02x%02x%s', hr1, hg1, 0, hcur1)
  66.         end)
  67.        
  68.         local htp = CreateFrame('Button', 'PlayerHealthPercentageTextFrame', self)
  69.             htp:SetSize(50,10)
  70.             htp:SetPoint('RIGHT', self, 'LEFT', -5, 2)
  71.             htp:EnableMouse(false)
  72.             htp:RegisterEvent('PLAYER_ENTERING_WORLD')
  73.             htp:RegisterUnitEvent('UNIT_HEALTH', 'player', 'vehicle')
  74.             htp:RegisterUnitEvent('UNIT_ENTERED_VEHICLE', 'player')
  75.             htp:RegisterUnitEvent('UNIT_EXITED_VEHICLE', 'player')
  76.            
  77.         local htpt = htp:CreateFontString('PlayerHealthPercentageText', 'OVERLAY')
  78.             htpt:SetAllPoints(true)
  79.             htpt:SetFont(FONT, 11, 'OUTLINE')
  80.             htpt:SetJustifyH('RIGHT')
  81.            
  82.         htp:SetScript('OnEvent', function(self, event, unit)
  83.             local hcur2, hmax2 = UnitHealth('player'), UnitHealthMax('player')
  84.             local hr2, hg2
  85.             if (event == 'PLAYER_ENTERING_WORLD' and UnitInVehicle('player')) or event == 'UNIT_ENTERED_VEHICLE' then
  86.                 htp:UnregisterEvent('UNIT_HEALTH')
  87.                 htp:RegisterUnitEvent('UNIT_HEALTH', 'vehicle')
  88.                 hcur2, hmax2 = UnitHealth('vehicle'), UnitHealthMax('vehicle')
  89.             elseif event == 'PLAYER_ENTERING_WORLD' or event == 'UNIT_EXITED_VEHICLE' then
  90.                 htp:UnregisterEvent('UNIT_HEALTH')
  91.                 htp:RegisterUnitEvent('UNIT_HEALTH', 'player')
  92.                 hcur2, hmax2 = UnitHealth('player'), UnitHealthMax('player')
  93.             elseif event == 'UNIT_HEALTH' and UnitInVehicle('player') then
  94.                 hcur2 = UnitHealth('vehicle')
  95.                 hmax2 = UnitHealthMax('vehicle')
  96.             elseif event == 'UNIT_HEALTH' then
  97.                 hcur2 = UnitHealth('player')
  98.                 hmax2 = UnitHealthMax('player')
  99.             end
  100.            
  101.             if hcur2/hmax2 < 0.35 then
  102.                 hr2, hg2 = 180, 0
  103.             else
  104.                 hr2, hg2 = 0, 180
  105.             end
  106.             local a = round(100*(hcur2/hmax2))
  107.             htpt:SetFormattedText('|cff%02x%02x%02x%s'..'%%', hr2, hg2, 0, a)
  108.         end)
  109.        
  110.         local pt = CreateFrame('Button', 'PlayerPowerTextFrame', self)
  111.             pt:SetSize(40,10)
  112.             pt:SetPoint('BOTTOMLEFT', self, 'BOTTOMRIGHT', 5, 0)
  113.             pt:EnableMouse(false)
  114.             pt:RegisterEvent('PLAYER_ENTERING_WORLD')
  115.             pt:RegisterUnitEvent('UNIT_POWER_FREQUENT', 'player', 'vehicle')
  116.             pt:RegisterUnitEvent('UNIT_ENTERED_VEHICLE', 'player')
  117.             pt:RegisterUnitEvent('UNIT_EXITED_VEHICLE', 'player')
  118.             pt:RegisterUnitEvent('UNIT_MODEL_UPDATE', 'player')
  119.            
  120.         local ptt = pt:CreateFontString('PlayerPowerText', 'OVERLAY')
  121.             ptt:SetAllPoints(true)
  122.             ptt:SetFont(FONT, 11, 'OUTLINE')
  123.             ptt:SetJustifyH('LEFT')
  124.  
  125.         local pcur
  126.         local pr, pg, pb
  127.         local playerpowertype = select(2,UnitPowerType('player'))
  128.         pt:SetScript('OnEvent', function(self, event, unit)
  129.             if event == 'UNIT_ENTERED_VEHICLE' or (event == 'PLAYER_ENTERING_WORLD' and UnitInVehicle('player')) then
  130.                 pt:UnregisterEvent('UNIT_POWER_FREQUENT')
  131.                 pt:RegisterUnitEvent('UNIT_POWER_FREQUENT', 'vehicle')
  132.                 playerpowertype = select(2,UnitPowerType('vehicle'))
  133.                 pcur = UnitPower('vehicle')
  134.             elseif event == 'PLAYER_ENTERING_WORLD' or event == 'UNIT_EXITED_VEHICLE' then
  135.                 pt:UnregisterEvent('UNIT_POWER_FREQUENT')
  136.                 pt:RegisterUnitEvent('UNIT_POWER_FREQUENT', 'player')
  137.                 playerpowertype = select(2,UnitPowerType('player'))
  138.                 pcur = UnitPower('player')
  139.             elseif event == 'UNIT_POWER_FREQUENT' and UnitInVehicle('player') then
  140.                 pcur = UnitPower('vehicle')
  141.             elseif event == 'UNIT_POWER_FREQUENT' then
  142.                 pcur = UnitPower('player')
  143.             elseif event == 'UNIT_MODEL_UPDATE' then   
  144.                 local playerpowertype = select(2,UnitPowerType('player'))
  145.             end
  146.            
  147.             if playerpowertype and pcur > 0 then
  148.                 if playerpowertype == 'MANA' then
  149.                     pr, pg, pb = 0, 100, 255
  150.                     if pcur >= 1000000 then
  151.                         format('%.1fm', pcur / 1000000)
  152.                     elseif pcur >= 1000 then
  153.                         pcur = format('%.0fk', pcur / 1000)
  154.                     end
  155.                 elseif playerpowertype == 'FOCUS' then
  156.                     pr, pg, pb = 255, 128, 65
  157.                 elseif playerpowertype == 'ENERGY' then
  158.                     pr, pg, pb = 255, 255, 0
  159.                 elseif playerpowertype == 'RUNIC_POWER' then
  160.                     pr, pg, pb = 0, 209, 255
  161.                 else
  162.                     pr, pg, pb = 255, 0, 0
  163.                 end
  164.                 ptt:SetFormattedText('|cff%02x%02x%02x%s', pr, pg, pb, pcur)
  165.             else
  166.                 ptt:SetText('')
  167.             end
  168.         end)
  169.        
  170.         local BuffBars = CreateFrame('Frame', 'PlayerBuffBarFrame', self)
  171.             BuffBars:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 18)
  172.             BuffBars:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', -20, 18)
  173.             BuffBars.fontFile, BuffBars.fontOutline = FONT, 'OUTLINE'
  174.             self.BuffBars = BuffBars
  175.             BuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, casterUnit, _, _, spellID, _, _, _, _, _)
  176.                 if spellID == 2823          --deadly poison
  177.                     or spellID == 108211    --leeching poison
  178.                     or spellID == 5761      --mind-numbing poison
  179.                     or spellID == 3408      --crippling poison
  180.                     or spellID == 8679      --wound poison
  181.                     or spellID == 108215    --paralytic poison
  182.                     or spellID == 5171      --slice and dice
  183.                     or spellID == 84745     --shallow insight
  184.                     or spellID == 84746     --moderate insight
  185.                     or spellID == 84747     --deep insight
  186.                     or spellID == 1784      --stealth
  187.                     or spellID == 115191    --subterfuge stealth
  188.                     or spellID == 13877     --blade flurry
  189.                     or spellID == 13750     --adrenaline rush
  190.                     or spellID == 121471    --shadow blades
  191.                     or spellID == 120032    --dancing steel
  192.                     or spellID == 105697    --virmen's bite
  193.                     or spellID == 126734    --gloves
  194.                     or spellID == 1966      --feint
  195.                     or spellID == 73651     --recuperate
  196.                     or spellID == 148903    --trinket
  197.                     or spellID == 146308    --trinket
  198.                     or spellID == 31224     --cloak of shadows
  199.                     or spellID == 114206    --skull banner
  200.                     or spellID == 120676    --stormlash totem
  201.                     or spellID == 80353     --time warp
  202.                     or spellID == 90355     --ancient hysteria
  203.                     or spellID == 2983      --sprint
  204.                     or spellID == 137573    --burst of speed
  205.                     or spellID == 54861     --nitro boosts
  206.                     or spellID == 5277      --evasion
  207.                     or spellID == 74001     --combat readiness
  208.                     or spellID == 74002     --combat insight
  209.                     or spellID == 114842    --shadow walk
  210.                     or spellID == 114018    --shroud of concealment
  211.                     or spellID == 32182     --heroism
  212.                     or spellID == 146555    --drums of rage
  213.                     or spellID == 76089     --virmens bite
  214.                     or spellID == 129159    --blackguards buff
  215.                     or spellID == 32645     --envenom
  216.                     or spellID == 31665     --Master of subtlety
  217.                     or spellID == 126707    --pvp proc trinket
  218.                     or spellID == 126690    --onuse pvp trinket
  219.                     or spellID == 115192    --subterfuge
  220.                     or spellID == 51713     --shadowdance
  221.                 then
  222.                     return true
  223.                 elseif casterUnit == 'vehicle' then
  224.                     return true
  225.                 else
  226.                     return false
  227.                 end
  228.             end
  229.            
  230.         local DebuffBars = CreateFrame("Frame", 'PlayerDebuffBarFrame', self)
  231.             DebuffBars:SetPoint('TOPLEFT', 'rABS_MultiBarRight', 'BOTTOMLEFT', 0, 0)
  232.             DebuffBars:SetPoint('TOPRIGHT', 'rABS_MultiBarRight', 'BOTTOMRIGHT', -20, 0)
  233.             DebuffBars.growDown = true
  234.             DebuffBars.dispelTypeColors = true
  235.             DebuffBars.fontFile, DebuffBars.fontOutline = FONT, 'OUTLINE'
  236.             self.DebuffBars = DebuffBars
  237.             DebuffBars.customFilter = function(_, _, name, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _)
  238.                 if name ~= 'Recently Mass Resurrected' then
  239.                     return true
  240.                 end
  241.             end
  242.            
  243.         local cf = CreateFrame('Button', 'PlayerCombatStatusFrame', self)
  244.             cf:SetSize(3,8)
  245.             cf:SetPoint('TOPLEFT', self, 'TOPLEFT', 7,0)
  246.             cf:RegisterEvent('PLAYER_ENTERING_WORLD')
  247.             cf:RegisterEvent('PLAYER_REGEN_DISABLED')
  248.             cf:RegisterEvent('PLAYER_REGEN_ENABLED')
  249.        
  250.         local ct = cf:CreateTexture('PlayerCombatStatusTexture', 'OVERLAY')
  251.         ---------------------------------------------------------------------------
  252.         ---------------------------------------------------------------------------
  253.         ---------------------------------------------------------------------------
  254.         ---------------------------------------------------------------------------
  255.         ---------------------------------------------------------------------------
  256.         ---------------------------------------------------------------------------
  257.             ct:SetTexture('Interface\AddOns\oUF_Skaarj\Media\F1_StatusBox_Bar')
  258.             ct:SetTexture(1,0,0)
  259.             ct:SetAllPoints(true)
  260.        
  261.         cf:SetScript('OnEvent', function(self, event, unit)
  262.             if event == 'PLAYER_REGEN_DISABLED' then
  263.                 ct:Show()
  264.             elseif event == 'PLAYER_REGEN_ENABLED' then
  265.                 ct:Hide()
  266.             elseif event == 'PLAYER_ENTERING_WORLD' then
  267.                 if UnitAffectingCombat('player') then
  268.                     ct:Show()
  269.                 else
  270.                     ct:Hide()
  271.                 end
  272.             end
  273.         end)
  274.        
  275.         local rf = CreateFrame('Button', 'PlayerRestingStatusFrame', self)
  276.             rf:SetSize(3,8)
  277.             rf:SetPoint('TOPLEFT', self, 'TOPLEFT', 12, 0)
  278.             rf:RegisterEvent('PLAYER_ENTERING_WORLD')
  279.             rf:RegisterEvent('PLAYER_UPDATE_RESTING')
  280.    
  281.         local rt = rf:CreateTexture('PlayerRestingStatusTexture', 'OVERLAY')
  282.         ---------------------------------------------------------------------------
  283.         ---------------------------------------------------------------------------
  284.         ---------------------------------------------------------------------------
  285.         ---------------------------------------------------------------------------
  286.         ---------------------------------------------------------------------------
  287.         ---------------------------------------------------------------------------
  288.             rt:SetTexture('Interface\AddOns\oUF_Skaarj\Media\F1_StatusBox_Bar')
  289.             rt:SetTexture(0.41, 0.8, 0.94)
  290.             rt:SetAllPoints(true)
  291.        
  292.         rf:SetScript('OnEvent', function(self, event, unit)
  293.             if IsResting() then
  294.                 rt:Show()
  295.             else
  296.                 rt:Hide()
  297.             end
  298.         end)
  299.        
  300.         local laf = CreateFrame('Button', 'PlayerLeaderAssistFrame', self)
  301.             laf:SetSize(3,8)
  302.             laf:SetPoint('TOPLEFT', self, 'TOPLEFT', 2, 0)
  303.             laf:RegisterEvent('GROUP_ROSTER_UPDATE')
  304.             laf:RegisterEvent('PARTY_LEADER_CHANGED')
  305.             laf:RegisterEvent('PLAYER_ENTERING_WORLD')
  306.            
  307.         local lat = laf:CreateTexture('PlayerLeaderAssistStatusTexture', 'OVERLAY')
  308.         ---------------------------------------------------------------------------
  309.         ---------------------------------------------------------------------------
  310.         ---------------------------------------------------------------------------
  311.         ---------------------------------------------------------------------------
  312.         ---------------------------------------------------------------------------
  313.         ---------------------------------------------------------------------------
  314.             lat:SetTexture('Interface\AddOns\oUF_Skaarj\Media\F1_StatusBox_Bar')
  315.             lat:SetTexture(1, 1, 0)
  316.             lat:SetAllPoints(true)
  317.            
  318.         laf:SetScript('OnEvent', function(self, event, unit)
  319.             if UnitIsGroupLeader('player') or UnitIsRaidOfficer('player') then
  320.                 lat:Show()
  321.             else
  322.                 lat:Hide()
  323.             end
  324.         end)
  325.     end,
  326.     target = function(self)
  327.         self:SetWidth(250)
  328.         local ht = CreateFrame('Button', 'TargetHealthTextFrame', self)
  329.             ht:SetSize(50,10)
  330.             ht:SetPoint('RIGHT', self, 'LEFT', -5, 2)
  331.             ht:EnableMouse(false)
  332.             ht:RegisterEvent('PLAYER_TARGET_CHANGED')
  333.             ht:RegisterUnitEvent('UNIT_HEALTH', 'target')
  334.             ht:RegisterUnitEvent('UNIT_CONNECTION', 'target')
  335.    
  336.         local htt = ht:CreateFontString('TargetHealthText', 'OVERLAY')
  337.             htt:SetAllPoints(true)
  338.             htt:SetFont(FONT, 11, 'OUTLINE')
  339.             htt:SetJustifyH('RIGHT')
  340.    
  341.         ht:SetScript('OnEvent', function(self, event, unit)
  342.             local hcur, hmax = UnitHealth('target'), UnitHealthMax('target')
  343.             local r, g, l
  344.             if not UnitIsConnected('target') then
  345.                 htt:SetFormattedText('|cff%02x%02x%02xD/C', 180, 0, 0)
  346.             elseif UnitIsDead('target') then
  347.                 htt:SetFormattedText('|cff%02x%02x%02xDead', 180, 0, 0)
  348.             elseif UnitIsGhost('target') then
  349.                 htt:SetFormattedText('|cff%02x%02x%02xGhost', 180, 0, 0)
  350.             else
  351.                 if hcur < hmax then
  352.                     r, g = 180, 0
  353.                 else
  354.                     r, g = 0, 180
  355.                 end
  356.                 if hcur >= 1000000 then
  357.                     l = 'm'
  358.                     hcur = round(hcur/1000000, 1)
  359.                 elseif hcur >= 1000 then
  360.                     l = 'k'
  361.                     hcur = round(hcur/1000)
  362.                 else
  363.                     l = ''
  364.                 end
  365.                 htt:SetFormattedText('|cff%02x%02x%02x%s'..l, r, g, 0, hcur)
  366.             end
  367.         end)
  368.        
  369.         local pt = CreateFrame('Button', 'TargetPowerTextFrame', self)
  370.             pt:SetSize(45,10)
  371.             pt:SetPoint('BOTTOMRIGHT', self, 'BOTTOMLEFT', -5, 0)
  372.             pt:EnableMouse(false)
  373.             pt:RegisterEvent('PLAYER_TARGET_CHANGED')
  374.             pt:RegisterUnitEvent('UNIT_POWER_FREQUENT', 'target')
  375.            
  376.         local ptt = pt:CreateFontString('TargetPowerText', 'OVERLAY')
  377.             ptt:SetAllPoints(true)
  378.             ptt:SetFont(FONT, 11, 'OUTLINE')
  379.             ptt:SetJustifyH('RIGHT')
  380.  
  381.         pt:SetScript('OnEvent', function(self, event, unit)
  382.             local a = select(2,UnitPowerType('target'))
  383.             local pcur = UnitPower('target')
  384.             if a and pcur > 0 then
  385.                 local r, g, b, l
  386.                 if a == 'MANA' then
  387.                     r, g, b = 0, 100, 255
  388.                     if pcur >= 1000000 then
  389.                         pcur = round(pcur/1000000, 1)
  390.                         l = 'm'
  391.                     elseif pcur >= 1000 then
  392.                         pcur = round(pcur/1000)
  393.                         l = 'k'
  394.                     else
  395.                         l = ''
  396.                     end
  397.                 elseif a == 'FOCUS' then
  398.                     r, g, b, l = 255, 128, 65, ''
  399.                 elseif a == 'ENERGY' then
  400.                     r, g, b, l = 255, 255, 0, ''
  401.                 elseif a == 'RUNIC_POWER' then
  402.                     r, g, b, l = 0, 209, 255, ''
  403.                 elseif a == 'POWER_TYPE_FEL_ENERGY' then
  404.                     r, g, b, l = 166, 161, 89, ''
  405.                 else
  406.                     r, g, b, l = 255, 0, 0, ''
  407.                 end
  408.                 ptt:SetFormattedText('|cff%02x%02x%02x%d'..l, r, g, b, pcur)
  409.             else
  410.                 ptt:SetText('')
  411.             end
  412.         end)
  413.        
  414.         local htp = CreateFrame('Button', 'TargetHealthPercentageTextFrame', self)
  415.             htp:SetSize(50,15)
  416.             htp:SetPoint('LEFT', self, 'RIGHT', 5, 2)
  417.             htp:EnableMouse(false)
  418.             htp:RegisterEvent('PLAYER_TARGET_CHANGED')
  419.             htp:RegisterUnitEvent('UNIT_HEALTH', 'target')
  420.            
  421.         local htpt = htp:CreateFontString('TargetHealthPercentageText', 'OVERLAY')
  422.             htpt:SetAllPoints(true)
  423.             htpt:SetFont(FONT, 11, 'OUTLINE')
  424.             htpt:SetJustifyH('LEFT')
  425.            
  426.         htp:SetScript('OnEvent', function(self, event, unit)
  427.             local hcur, hmax = UnitHealth('target'), UnitHealthMax('target')
  428.             local r, g
  429.             if hcur/hmax < 0.35 then
  430.                 r, g = 180, 0
  431.             else
  432.                 r, g = 0, 180
  433.             end
  434.             local a = round(100*(hcur/hmax))
  435.             htpt:SetFormattedText('|cff%02x%02x%02x%s'..'%%', r, g, 0, a)
  436.         end)
  437.        
  438.         local BuffBars = CreateFrame('Frame', 'TargetBuffBarFrame', self)
  439.             BuffBars:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 20, 18)
  440.             BuffBars:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 18)
  441.             self.BuffBars = BuffBars
  442.             BuffBars.fontFile, BuffBars.fontOutline = FONT, 'OUTLINE'
  443.             BuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, _, _, _, spellID, _, _, _, _, _)
  444.                 if spellID == 97341 or      --Guild Champion
  445.                     spellID == 93339 or     --champion
  446.                     spellID == 93828 or     --silvermoon champion
  447.                     spellID == 93341 or     --hyjal champion
  448.                     spellID == 93347 or     --therazane champion
  449.                     spellID == 97340 or     --Guild Champion
  450.                     spellID == 93811 or     --Exodar Champion
  451.                     spellID == 93816 or     --Gilnean Champion
  452.                     spellID == 72968 or     --Precious's Ribbon
  453.                     spellID == 130609 or    --Valor of the Ancients
  454.                     spellID == 93806 or     --Darnassus Champion
  455.                     spellID == 93368 or     --Wildhammer Champion
  456.                     spellID == 93337 or     --Ramkahen Champion
  457.                     spellID == 126434 or    --Tushui Champion
  458.                     spellID == 57822 or     --Wyrmrest Champion
  459.                     spellID == 93821 or     --Gnomergan Champion
  460.                     spellID == 142234 or    --Brawling Champion (toot toot)
  461.                     spellID == 142239 or    --Brawling Champion (gorgeous)
  462.                     spellID == 142242 or    --Brawling Champion (south seas)
  463.                     spellID == 142243 or    --Brawling Champion (splat)
  464.                     spellID == 142244 or    --Brawling Champion (bruce)
  465.                     spellID == 161780 or    --Gaze of the Black Prince
  466.                     spellID == 128943 or    --Cyclonic Inspiration
  467.                     spellID == 142246 or    --Brawling Champion (rockpaperscissors)
  468.                     spellID == 142247 or    --Brawling Champion (blingtrong)
  469.                     spellID == 143625 or    --Brawling Champion (rank 10)
  470.                     spellID == 93805 or     --Ironforge Champion
  471.                     spellID == 25780 or     --righteous fury
  472.                     spellID == 17619 or     --Alchemist Stone
  473.                     spellID == 93795        --Stormwind Champion
  474.                 then
  475.                     return false
  476.                 else
  477.                     return true
  478.                 end
  479.             end
  480.        
  481.         local DebuffBars = CreateFrame("Frame", 'TargetDebuffBarFrame', self)
  482.             DebuffBars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -40)
  483.             DebuffBars:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 20, -40)
  484.             self.DebuffBars = DebuffBars
  485.             DebuffBars.growDown = true
  486.             DebuffBars.fontFile, DebuffBars.fontOutline = FONT, 'OUTLINE'
  487.             DebuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, casterUnit, _, _, spellID, _, _, _, _, _)
  488.                 if casterUnit == 'player' then
  489.                     if spellID == 2818          --deadly poison
  490.                         or spellID == 93068     --master poisoner
  491.                         or spellID == 112961    -- leeching poison
  492.                     then
  493.                         return false
  494.                     else
  495.                         return true
  496.                     end
  497.                 elseif casterUnit == 'vehicle' then
  498.                         return true
  499.                 else
  500.                     return false
  501.                 end
  502.             end
  503.        
  504.         local nm = CreateFrame('Button', 'TargetNameTextFrame', self)
  505.             nm:SetSize(200,10)
  506.             nm:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -5)
  507.             nm:EnableMouse(false)
  508.             nm:RegisterEvent('PLAYER_TARGET_CHANGED')
  509.             nm:RegisterUnitEvent('UNIT_LEVEL', 'target')
  510.             nm:RegisterUnitEvent('UNIT_NAME_UPDATE', 'target')
  511.            
  512.         local nmt = nm:CreateFontString('TargetNameText', 'OVERLAY')
  513.             nmt:SetAllPoints(true)
  514.             nmt:SetFont(FONT, 11, 'OUTLINE')
  515.             nmt:SetJustifyH('RIGHT')
  516.        
  517.         nm:SetScript('OnEvent', function(self, event, unit)
  518.             local name, level =  UnitName('target'), UnitLevel('target')
  519.             local levelmax = GetMaxPlayerLevel()
  520.             local levelcolor = {}
  521.             local class, classfn = UnitClass('target')
  522.             local colorname = RAID_CLASS_COLORS[classfn]
  523.             if not name then
  524.                 nmt:SetText('')
  525.             elseif not colorname then
  526.                 colorname = 255, 0, 0
  527.             else
  528.                 if level <= 0 then
  529.                     level = '??'
  530.                     levelcolor.r, levelcolor.g, levelcolor.b = 1, 1, 1
  531.                 elseif level == levelmax then
  532.                     levelcolor.r, levelcolor.g, levelcolor.b = 1, 1, 1
  533.                 else
  534.                     levelcolor = GetQuestDifficultyColor(level)
  535.                 end
  536.                 nmt:SetFormattedText('|cff%02x%02x%02x%s '..'|cff%02x%02x%02x%s',255*levelcolor.r, 255*levelcolor.g, 255*levelcolor.b, level, 255*colorname.r, 255*colorname.g, 255*colorname.b, name)
  537.             end
  538.         end)
  539.        
  540.         local cr = CreateFrame('Button', 'TargetRareFrame', self)
  541.             cr:SetSize(3,8)
  542.             cr:SetPoint('TOPLEFT', self, 'TOPLEFT', 7, 0)
  543.             cr:EnableMouse(false)
  544.             cr:RegisterEvent('PLAYER_TARGET_CHANGED')
  545.             cr:RegisterUnitEvent('UNIT_CLASSIFICATION_CHANGED', 'target')
  546.         local crt = cr:CreateTexture('TargetRareStatusTexture', 'OVERLAY')
  547.         ---------------------------------------------------------------------------
  548.         ---------------------------------------------------------------------------
  549.         ---------------------------------------------------------------------------
  550.         ---------------------------------------------------------------------------
  551.         ---------------------------------------------------------------------------
  552.         ---------------------------------------------------------------------------
  553.             crt:SetTexture('Interface\AddOns\oUF_Skaarj\Media\F1_StatusBox_Bar')
  554.             crt:SetTexture(.75, .75, .75)
  555.             crt:SetAllPoints(true)
  556.         cr:SetScript('OnEvent', function(self, event, unit)
  557.             local classification = UnitClassification('target')
  558.             if classification == 'rare' or classification == 'rareelite' then
  559.                 crt:Show()
  560.             else
  561.                 crt:Hide()
  562.             end
  563.         end)
  564.        
  565.         local ce = CreateFrame('Button', 'TargetEliteFrame', self)
  566.             ce:SetSize(3,8)
  567.             ce:SetPoint('TOPLEFT', self, 'TOPLEFT', 2, 0)
  568.             ce:EnableMouse(false)
  569.             ce:RegisterEvent('PLAYER_TARGET_CHANGED')
  570.             ce:RegisterUnitEvent('UNIT_CLASSIFICATION_CHANGED', 'target')
  571.         local cet = ce:CreateTexture('TargetEliteStatusTexture', 'OVERLAY')
  572.         ---------------------------------------------------------------------------
  573.         ---------------------------------------------------------------------------
  574.         ---------------------------------------------------------------------------
  575.         ---------------------------------------------------------------------------
  576.         ---------------------------------------------------------------------------
  577.         ---------------------------------------------------------------------------
  578.             cet:SetTexture('Interface\AddOns\oUF_Skaarj\Media\F1_StatusBox_Bar')
  579.             cet:SetTexture(.8, .63, .21)
  580.             cet:SetAllPoints(true)
  581.         ce:SetScript('OnEvent', function(self, event, unit)
  582.             local classification = UnitClassification('target')
  583.             if classification == 'elite' or classification == 'rareelite' then
  584.                 cet:Show()
  585.             else
  586.                 cet:Hide()
  587.             end
  588.         end)
  589.            
  590.         local qf = CreateFrame('Button', 'TargetQuestTextureFrame', self)
  591.             qf:SetSize(10,10)
  592.             qf:SetPoint('CENTER', self, 'TOP', 0, 0)
  593.             qf:EnableMouse(false)
  594.             qf:RegisterEvent('PLAYER_TARGET_CHANGED')
  595.            
  596.         local qft = qf:CreateFontString('TargetQuestTexture', 'OVERLAY')
  597.             qft:SetAllPoints(true)
  598.             qft:SetFont(FONT, 20, 'OUTLINEMONOCHROME')
  599.             qft:SetJustifyH('CENTER')
  600.            
  601.         qf:SetScript('OnEvent', function(self, event, unit)
  602.             if UnitIsQuestBoss('target') then
  603.                 qft:SetFormattedText('|cff%02x%02x%02x!', 255,255,0)
  604.             else
  605.                 qft:SetText('')
  606.             end
  607.         end)
  608.     end,
  609.     party = function(self)
  610.         local Name = self.Health:CreateFontString(nil, 'OVERLAY')
  611.         Name:SetPoint('CENTER', 0, 0)
  612.         Name:SetFont(FONT, 11, 'OUTLINEMONOCHROME')
  613.         self:Tag(Name, '[raidcolor][name:short]')
  614.  
  615.         local ReadyCheck = self.Health:CreateTexture(nil, 'OVERLAY')
  616.         ReadyCheck:SetPoint('TOPRIGHT', self, 'TOPRIGHT', -3, -3)
  617.         ReadyCheck:SetSize(14, 14)
  618.         self.ReadyCheck = ReadyCheck
  619.        
  620.         self.Health:SetAllPoints()
  621.     end,
  622.     boss = function(self)
  623.         self:SetSize(126, 19)
  624.         self.Health:SetAllPoints()
  625.         self:Tag(self.HealthValue, '[p3lim:percent]')
  626.     end,
  627.     arena = function(self)
  628.         self:SetSize(126, 19)
  629.         self:Tag(self.HealthValue, '[p3lim:percent]')
  630.         self.Health:SetHeight(17)
  631.     end
  632. }
  633. UnitSpecific.raid = UnitSpecific.party
  634.  
  635. local function Shared(self, unit)
  636.     unit = unit:match('(boss)%d?$') or unit:match('(arena)%d?$') or unit
  637.    
  638.     self:RegisterForClicks('AnyUp')
  639.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  640.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  641.  
  642.     self:SetBackdrop(BACKDROP)
  643.     self:SetBackdropColor(0, 0, 0)
  644.    
  645.     local Health = CreateFrame('StatusBar', nil, self)
  646.     Health:SetStatusBarTexture(TEXTURE)
  647.     Health:SetStatusBarColor(0.2, 0.2, 0.2)
  648.     Health.frequentUpdates = true
  649.     self.Health = Health
  650.    
  651.     local HealthBG = Health:CreateTexture(nil, 'BORDER')
  652.     HealthBG:SetAllPoints()
  653.     HealthBG:SetTexture(.55, .1, .1)
  654.    
  655.     if(unit == 'player' or unit == 'target' or unit == 'arena') then
  656.         local Power = CreateFrame('StatusBar', nil, self)
  657.         Power:SetPoint('BOTTOMRIGHT')
  658.         Power:SetPoint('BOTTOMLEFT')
  659.         Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  660.         Power:SetStatusBarTexture(TEXTURE)
  661.         Power.frequentUpdates = true
  662.         self.Power = Power
  663.  
  664.         Power.colorClass = true
  665.         Power.colorClassNPC = true
  666.         Power.colorClassPet = true
  667.  
  668.         local PowerBG = Power:CreateTexture(nil, 'BORDER')
  669.         PowerBG:SetAllPoints()
  670.         PowerBG:SetTexture(TEXTURE)
  671.         PowerBG.multiplier = 1/3
  672.         Power.bg = PowerBG
  673.  
  674.         if(unit ~= 'arena') then
  675.             self:SetHeight(34)
  676.             Health:SetHeight(31)
  677.         end
  678.  
  679.         local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
  680.         RaidIcon:SetPoint('TOP', self, 0, 8)
  681.         RaidIcon:SetSize(16, 16)
  682.         self.RaidIcon = RaidIcon
  683.  
  684.         Health:SetPoint('TOPRIGHT')
  685.         Health:SetPoint('TOPLEFT')
  686.     end
  687.  
  688.     if(unit ~= 'player' and unit ~= 'party' and unit ~= 'raid') then
  689.         local Name = Health:CreateFontString(nil, 'OVERLAY')
  690.         Name:SetPoint('LEFT', 2, 0)
  691.         Name:SetPoint('RIGHT', HealthValue, 'LEFT')
  692.         Name:SetFont(FONT, 11, 'OUTLINE')
  693.         Name:SetJustifyH('LEFT')
  694.         self:Tag(Name, '[p3lim:color][name][ |cff0090ff>rare<|r]')
  695.     end
  696.  
  697.     if(unit ~= 'party' and unit ~= 'raid' and unit ~= 'boss') then
  698.         if(unit == 'focus' or unit == 'targettarget') then
  699.             Health:SetAllPoints()
  700.             self:SetSize(90, 31)
  701.             local Name = Health:CreateFontString(nil, 'OVERLAY')
  702.                 Name:SetPoint('CENTER', 0, 0)
  703.                 Name:SetFont(FONT, 11, 'OUTLINE')
  704.                 self:Tag(Name, '[raidcolor][name:short]')
  705.         end
  706.     end
  707.  
  708.     if(UnitSpecific[unit]) then
  709.         return UnitSpecific[unit](self)
  710.     end
  711. end
  712.  
  713. oUF:RegisterStyle('P3lim', Shared)
  714. oUF:Factory(function(self)
  715.     self:SetActiveStyle('P3lim')
  716.     self:Spawn('player'):SetPoint('CENTER', -345, -36)
  717.     self:Spawn('focus'):SetPoint('TOPRIGHT', oUF_P3limPlayer, 'TOPLEFT', -40, 0)
  718.     self:Spawn('target'):SetPoint('CENTER', 345, -36)
  719.     self:Spawn('targettarget'):SetPoint('TOPLEFT', oUF_P3limTarget, 'TOPRIGHT', 40, 0)
  720.     self:SpawnHeader('P3lim_Party', nil,
  721.                     'custom [@raid6, exists] hide; [group:party] show; [group:raid] show; hide',
  722.                     'showPlayer', true,
  723.                     'showSolo', false,
  724.                     'showParty', true,
  725.                     'showRaid', false,
  726.                     'point', 'TOP',
  727.                     'yOffset', -3,
  728.                     'xOffset', 0,
  729.                     'oUF-initialConfigFunction', [[
  730.                     self:SetHeight(72)
  731.                     self:SetWidth(120)
  732.                     ]]):SetPoint('TOPRIGHT', 'rABS_MultiBarRight', 'BOTTOMLEFT', -5, -60)
  733.     self:SpawnHeader('P3lim_Raid', nil,
  734.                     'custom [@raid6,exists] show; hide',
  735.                     'showPlayer', true,
  736.                     'showSolo', false,
  737.                     'showParty', false,
  738.                     'showRaid', true,
  739.                     'point', 'TOP',
  740.                     'yOffset', -1,
  741.                     'xOffset', 0,
  742.                     "columnSpacing", 2,
  743.                     "columnAnchorPoint", "LEFT",
  744.                     "groupFilter",        "1,2,3,4,5,6,7,8",
  745.                     "groupBy",            "GROUP",
  746.                     "groupingOrder",      "1,2,3,4,5,6,7,8",
  747.                     "sortMethod",         "INDEX",
  748.                     "maxColumns",         8,
  749.                     "unitsPerColumn",     5,
  750.                     'oUF-initialConfigFunction', [[
  751.                     self:SetHeight(35)
  752.                     self:SetWidth(85)
  753.                     ]]):SetPoint('BOTTOM', UIParent, 'BOTTOM', 0, 1)
  754.                    
  755.        
  756.     --self:SpawnHeader(nil, nil, 'custom [group:party] show; [@raid3,exists] show; [@raid26,exists] hide; hide','showParty', true, 'showRaid', true, 'showPlayer', true, 'yOffset', -6,
  757.         --'oUF-initialConfigFunction',
  758.         --  [[self:SetHeight(16)
  759.             --self:SetWidth(126)]]):SetPoint('TOP', Minimap, 'BOTTOM', 0, -10)
  760.  
  761.     for index = 1, 5 do
  762.         local boss = self:Spawn('boss' .. index)
  763.         local arena = self:Spawn('arena' .. index)
  764.  
  765.         if(index == 1) then
  766.             boss:SetPoint('TOP', oUF_P3limRaid or Minimap, 'BOTTOM', 0, -20)
  767.             arena:SetPoint('TOP', oUF_P3limRaid or Minimap, 'BOTTOM', 0, -20)
  768.         else
  769.             boss:SetPoint('TOP', _G['oUF_P3limBoss' .. index - 1], 'BOTTOM', 0, -6)
  770.             arena:SetPoint('TOP', _G['oUF_P3limArena' .. index - 1], 'BOTTOM', 0, -6)
  771.         end
  772.  
  773.         local blizz = _G['Boss' .. index .. 'TargetFrame']
  774.         blizz:UnregisterAllEvents()
  775.         blizz:Hide()
  776.     end
  777. end)
  778.  
  779. local preperationFrames = {}
  780. for index = 1, 5 do
  781.     local Frame = CreateFrame('Frame', 'oUF_P3limArenaPreperation' .. index, UIParent)
  782.     Frame:SetSize(126, 19)
  783.     Frame:SetBackdrop(BACKDROP)
  784.     Frame:SetBackdropColor(0, 0, 0)
  785.     Frame:Hide()
  786.  
  787.     local Health = Frame:CreateTexture(nil, 'BACKGROUND')
  788.     Health:SetPoint('TOPRIGHT')
  789.     Health:SetPoint('TOPLEFT')
  790.     Health:SetHeight(17)
  791.     Health:SetTexture(1/6, 1/6, 2/7)
  792.  
  793.     local Power = Frame:CreateTexture(nil, 'BACKGROUND')
  794.     Power:SetPoint('BOTTOMRIGHT')
  795.     Power:SetPoint('BOTTOMLEFT')
  796.     Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  797.     Frame.Power = Power
  798.  
  799.     local Spec = Frame:CreateFontString(nil, 'OVERLAY')
  800.     Spec:SetPoint('LEFT', Health, 2, 0)
  801.     Spec:SetFont(FONT, 11, 'OUTLINE')
  802.     Spec:SetJustifyH('LEFT')
  803.     Frame.Spec = Spec
  804.  
  805.     preperationFrames[index] = Frame
  806. end
  807.  
  808. local PreperationHandler = CreateFrame('Frame')
  809. PreperationHandler:RegisterEvent('PLAYER_LOGIN')
  810. PreperationHandler:RegisterEvent('ARENA_OPPONENT_UPDATE')
  811. PreperationHandler:RegisterEvent('ARENA_PREP_OPPONENT_SPECIALIZATIONS')
  812. PreperationHandler:SetScript('OnEvent', function(self, event)
  813.     if(event == 'PLAYER_LOGIN') then
  814.         for index = 1, 5 do
  815.             if(index == 1) then
  816.                 preperationFrames[index]:SetPoint('TOP', oUF_P3limRaid or Minimap, 'BOTTOM', 0, -20)
  817.             else
  818.                 preperationFrames[index]:SetPoint('TOP', preperationFrames[index - 1], 'BOTTOM', 0, -6)
  819.             end
  820.         end
  821.     elseif(event == 'ARENA_OPPONENT_UPDATE') then
  822.         for index = 1, 5 do
  823.             preperationFrames[index]:Hide()
  824.         end
  825.     else
  826.         for index = 1, GetNumArenaOpponentSpecs() do
  827.             local Frame = preperationFrames[index]
  828.  
  829.             local specID = GetArenaOpponentSpec(index)
  830.             if(specID and specID > 0) then
  831.                 local _, name, _, _, _, _, class = GetSpecializationInfoByID(specID)
  832.                 local r, g, b, colorStr = RAID_CLASS_COLORS[class]
  833.  
  834.                 Frame.Spec:SetFormattedText('|c%s%s|r', colorStr, name)
  835.                 Frame.Power:SetTexture(r, g, b)
  836.             else
  837.                 Frame.Spec:SetText('Unknown')
  838.                 Frame.Power:SetTexture(1, 1, 1)
  839.             end
  840.  
  841.             Frame:Show()
  842.         end
  843.     end
  844. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement