Quantcast WoWInterface - View Single Post - code to check player for buff
View Single Post
03-08-12, 07:49 PM   #4
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Mar 2012
Posts: 3
Hmmmm ... I think I wasnt specific enough in the original question ...

The addon I have done is up and running on wow interface ( http://www.wowinterface.com/download...enseStats.html )
It is working fine, apart from the fact that it assumes you have no buffs currently when it does all the calculations to output your CTC.
If you get a buff that you can select from the dropdowns, then effectively the buff is added twice to the calculations (these are the only buffs available that will affect your Combat Table Coverage (well, apart from different ranks and the myriad of food buffs that give lower stat rating boosts, but that would need a list faaaaaaar too long to factor into the equations) ....

Heres a pastebin of the lua as it stands:

the issue I am running into is the UpdateBuffStats()
from line 336 to line 349

I want to check the player to see if he has any of the buffs you can select in the addon to see your raid buffed stats currently applied, and if so, to change the output of the UpdateBuffStats()

As it stands, the lines in question are :
    local food, strength, stat

    local function UpdateBuffStats()
        BuffStrengthAdjust = strength.StrengthValue + food.StrengthValue
        BuffParryAdjust =  food.ParryValue
        BuffDodgeAdjust =  food.DodgeValue
        BuffMasteryAdjust = food.MasteryValue
        BuffMultiplierAdjust = stat.BuffValue

        PAPERDOLL_STATINFO["TOTALAVOIDANCE"].updateFunc(Frame1, "player")
        PAPERDOLL_STATINFO["COMBATTABLE"].updateFunc(Frame2, "player")
I need to check if the player has these buffs (it will need to be by spellId as the well fed buffs all return the name 'Well Fed' even though they give different stats .... (stupid way of blizzard doing this IMO)

"Mark of the Wild" = 79061
"Blessing of Kings" = 79063
"Horn of Winter" = 57330
"Battle Shout" = 6673
"Well Fed" = 87554  --Dodge food Buff
"Well Fed" = 87555   --Parry Food Buff
"Well Fed" = 87549   --Mastery Food Buff
"Well Fed" = 87545   --Strength Food Buff
I know WHAT I need to do, but cant, for the life of me incorporate it into the addon.....
Once getting the spellId of all buffs currently on the player (using spellId = UnitAura("player",i) ), the current values for BuffStrengthAdjust, BuffParryAdjust, BuffDodgeAdjust, BuffMasteryAdjust and BufMultiplierAdjust would need to be worked out in the following way:

if  (spellId ~= 79061 and spellId ~= 79063) then BuffMultiplierAdjust = stat.BuffValue else BuffMultiplierAdjust = 1

if  spellId ~= 87549 then BuffMasteryAdjust = food.MasteryValue else BuffMasteryAdjust = 0

if  spellId ~= 87554 then BuffDodgeAdjust = food.DodgeValue else BuffDodgeAdjust = 0

if spellId ~= 87555 then BuffParryAdjust = food.ParryValue else BuffParryAdjust = 0

--this next formula is a bit more complex as there are 3 combinations :(  

if  (spellId ~= 57330 and spellId ~= 6673 and spellId ~= 87545) then BuffStrengthAdjust = strength.StrengthValue + food.StrengthValue
else if (spellId = 57330 or spellId = 6673) and spellId ~= 87545 then BuffStrengthAdjust = food.StrengthValue
else if (spellId ~= 57330 and spellId ~= 6637) and spellId = 87545 then BuffStrengthAdjust = strength.StrengthValue
I have no feckin idea how to get this lot into the lua to factor in the current buffs when working out the new stat values ( I actually DID get it working once, but the values didnt update if the buff disappeared (like Battle shout with its 2 minute cooldown), but much to my chagrin, this poxy village suffered a power cut at that time and I lost the file )

I may be going about this in totally the wrong way, as it may be simpler to factor in the Current buffs when you are selecting the raid buffs from the dropdown menu (though that would be complicated when choosing from the list of food buffs )

  Reply With Quote