Advertisement
khanggaroo

Trinket+Combat Tracker!

Apr 21st, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.00 KB | None | 0 0
  1. -- Trinket and Combat Arena Tracker! Credits Syncrow on AJ forums, www.arenajunkies.com/topic/237770-in-combat-script-for-arenaframes-with-trinket/
  2.  
  3. LoadAddOn("Blizzard_ArenaUI")
  4. for i = 1, 5 do
  5. --(( TRINKET TRACKER ))--
  6.                 _G["TR"..i] = CreateFrame("Frame",nil,_G["ArenaEnemyFrame"..i])
  7.                 _G["TR"..i]:SetSize(25,25)
  8.                 _G["TR"..i]:SetPoint("RIGHT",15,0)
  9.                 _G["TR"..i].t = _G["TR"..i]:CreateTexture(nil,BORDER)
  10.                 _G["TR"..i].t:SetAllPoints()
  11.                 _G["TR"..i].t:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01")
  12.                 _G["TR"..i].c = CreateFrame("Cooldown",nil,_G["TR"..i])
  13.                 _G["TR"..i].c:SetAllPoints(_G["TR"..i])
  14.                 _G["TR"..i]:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
  15.                 _G["TR"..i].unit = "arena"..i
  16.                 _G["TR"..i].timecheck = 0
  17.  
  18.  
  19.                 _G["TR"..i]:SetScript("OnEvent", function(self,event,unit,_,_,_,spellID)
  20.                           local unitID = _G["TR"..i].unit
  21.                           if unitID == unit then
  22.                                          if spellID == 59752 or spellID == 42292 then
  23.                                                         SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY")
  24.                                                         self.c:SetCooldown(GetTime(),120)
  25.                                                         self.timecheck = GetTime()
  26.                                          elseif spellID == 7744 then
  27.                                                         SendChatMessage("WotF used by: "..GetUnitName(unitID, true), "PARTY")
  28.                                                         if GetTime() - self.timecheck > 90 then
  29.                                                                    self.c:SetCooldown(GetTime(),30)
  30.                                                         elseif self.timecheck == 0 then
  31.                                                                    self.c:SetCooldown(GetTime(),30)
  32.                                                         end
  33.                                          end
  34.                           end
  35.            end)
  36.  
  37. --(( COMBAT TRACKER ))--
  38.  
  39.                 _G["CT"..i] = CreateFrame("Frame",nil,_G["ArenaEnemyFrame"..i])
  40.                 _G["CT"..i]:SetSize(15,15)
  41.                 _G["CT"..i]:SetPoint("LEFT",_G["TR"..i],"RIGHT",2,0)
  42.                 _G["CT"..i].t = _G["CT"..i]:CreateTexture(nil,BORDER)
  43.                 _G["CT"..i].t:SetAllPoints()
  44.                 _G["CT"..i].t:SetTexture("Interface\\Icons\\ABILITY_DUALWIELD")
  45.                 _G["CT"..i]:SetAlpha(0)
  46.                 _G["CT"..i]:SetScript("OnUpdate", function(self)
  47.                                 if UnitAffectingCombat("arena"..i) then
  48.                                                 self:SetAlpha(1)
  49.                                 else
  50.                                                 self:SetAlpha(0)
  51.                                 end
  52.                 end)
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement