I am trying to get my addon to print the message "You have Berserking" to chat whenever you pickup the Berserking BUFF in WSG, AB, or EotS. Same with the restoration buff.
The annoying part is I am trying to do this by COMBAT_LOG_EVENT_UNFILTERED
It worked fine for the Speed BUFF in the battleground but from what I noticed when I took a combat log of the battleground I was in that Berserking and Restoration do not output anything to the combat log or I am very blind.
Would be nice if someone could enlighten me on maybe another way of doing this it would be greatly appreciated.
local BUFF_BERSERKING =GetSpellInfo(23505)
local hasBerserking
local addon = CreateFrame("Frame")
addon:RegisterEvent("UNIT_AURA")
addon:SetScript("OnEvent", function(self, event, unit)
if UnitBuff("player", BUFF_BERSERKING) then
-- You have Berserking
if hasBerserking then
-- You already had Berserking and didn't just gain it
else
-- You just gained it
print("You have Berserking!")
hasBerserking = true
end
else
if hasBerserking then
-- You had Berserking, and now it's gone
hasBerserking = false
else
-- You didn't have Berserking, and you still don't have it
end
end
end)
Could definitely be condensed, but I left it big to illustrate the various scenarios.
Ok ran into a problem with using this method. It is good at picking up the buff berserking from battlegrounds however it compares the name of the spell and not the spellId even though you used the spellId for the battleground buff. So if a troll uses his racial it will also print the message.
I am trying to get my addon to print the message "You have Berserking" to chat whenever you pickup the Berserking BUFF in WSG, AB, or EotS. Same with the restoration buff.
The annoying part is I am trying to do this by COMBAT_LOG_EVENT_UNFILTERED
It worked fine for the Speed BUFF in the battleground but from what I noticed when I took a combat log of the battleground I was in that Berserking and Restoration do not output anything to the combat log or I am very blind.
Would be nice if someone could enlighten me on maybe another way of doing this it would be greatly appreciated.
Sorry if this was posted in the wrong section.
Could definitely be condensed, but I left it big to illustrate the various scenarios.
The spell id was only used in that example to get the localized name of the buff.
I use Power Auras for spell procs / buffs / ... http://www.wowinterface.com/downloads/info14291-PowerAurasClassic.html