From c2bdcb1a631eef62d2b97a5a1c87a6f782f4c69d Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 19 Aug 2014 19:20:05 +0200 Subject: [PATCH] Add support for Rogue's Anticipation talent in cpoints tag --- elements/tags.lua | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/elements/tags.lua b/elements/tags.lua index da61eee..d50f08b 100644 --- a/elements/tags.lua +++ b/elements/tags.lua @@ -142,7 +142,14 @@ tags.Methods['p3lim:pet'] = function() end end -tags.Events['p3lim:cpoints'] = 'UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED' +local isRogue = (select(2, UnitClass('player'))) == 'ROGUE' +if(isRogue) then + tags.SharedEvents.UNIT_AURA = true + tags.Events['p3lim:cpoints'] = 'UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED UNIT_AURA' +else + tags.Events['p3lim:cpoints'] = 'UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED' +end + tags.Methods['p3lim:cpoints'] = function() local points if(UnitHasVehicleUI('player')) then @@ -151,11 +158,31 @@ tags.Methods['p3lim:cpoints'] = function() points = GetComboPoints('player', 'target') end - if(points == 5) then - return '|cffcc3333' .. points .. '|r' - elseif(points == 4) then - return '|cffff6600' .. points .. '|r' - elseif(points > 0) then - return '|cffffcc00' .. points .. '|r' + local anticipation + if(isRogue) then + for index = 1, 40 do + local _, _, _, count, _, _, _, _, _, _, spellID = UnitAura('player', index, 'HELPFUL') + if(spellID and spellID == 115189 and count and count > 0) then + anticipation = count + break + elseif(not spellID) then + break + end + end + end + + local prefix = '' + if(anticipation) then + prefix = anticipation .. ' ' + end + + if(points > 0 or anticipation) then + if(points == 5) then + return prefix .. '|cffcc3333' .. points .. '|r' + elseif(points == 4) then + return prefix .. '|cffff6600' .. points .. '|r' + else + return prefix .. '|cffffcc00' .. points .. '|r' + end end end -- 1.7.9.5