UnitPower returns an integer
Even if it isn't really one.
Making a weakaura : I'm trying to track my astral power, and more importantly predict what it's going to be after my next cast. Lunar Strike gives 12 ap, 15 ap with Blessing of Elune (*1.25), 22.5 with BoE + Celestial Alignment (*1.25 *1.5).
So, even if my ap is in reality, say, 17.5, the game will only return me 17, and my prediction will be 39 (or 39.5) for my next BoE+CA buffed LS instead of 40. This is unwanted, since knowing whether I'll be at 39 or 40 is critical to predict if I'm going to be able to use Starsurge or not.
Right now, the only two choices I see to solve this are either entirely rewrite the AP calculation function to try and get an accurate float AP amount ... or count the number of times I've cast CA buffed LS and alternate between adding 22 and 23 ap to my current amount (and I'll also have to account for the fact that .5 ap can disappear if I cap out).
Obviously the second solution is the easiest (since there is only one source for gaining .5 ap - CA buffed LS - and one source for losing it - capping out -). But neither this one nor the first are entertaining to me.
Since I'm a complete novice at both programming and using WoW's API, I was hoping someone might have a magical solution for me that might save some hassle.
Thanks for taking the time to help :)
Use UnitPower's 3 arg to get unmodified values.
You can divide unmodified value by modifier later, when you need to do so.
Thanks, that worked perfectly ! :)
I've ran into another problem : at first I was just checking whether I was casting or not (at every frame). This worked fine but not only did I have a small problem with buffs falling off in the middle of a cast, I also thought I might optimize it by checking for combat log events. Now, it works fine, except when I start casting something and interrupt it in the following split second.
If I do that, the game sends me a SPELL_CAST_START, but no following SPELL_CAST_SUCCESS or SPELL_CAST_FAILED, so I'm still thinking I'm casting.
Now the only way I can figure out how to fix that is revert to my first implementation : check if I'm casting every frame.
Is that the only choice I have ?
Thanks for the help.
Edit : I didn't try looking for SPELL_CAST_INTERRUPTED, maybe that's what I was missing.
|All times are GMT -6. The time now is 07:53 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI