Thread Tools Display Modes
04-05-21, 02:21 PM   #1
Bakkon
A Defias Bandit
Join Date: Apr 2021
Posts: 3
API not updating inside Events

hey guys

i was made a simple mod to see my mana regeneration but its not updating the value properly

Lua Code:
  1. if event == "UNIT_AURA" then
  2. local base, cast = GetManaRegen()  
  3. base = base * 2
  4. print("mp2 : ", base)

the value isn't updating properly. its like one step behind. when i trigger it by applying an aura i get the old value when the aura is on and when the aura is off i get the value as if it was on

how could i fix this ??

im trying this on classic

tyvm
  Reply With Quote
04-05-21, 03:22 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Does this sound like what is happening to your numbers ?

https://us.forums.blizzard.com/en/wo...-values/253725
__________________
  Reply With Quote
04-06-21, 12:54 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I don't have a way to test currently, but it sounds like you're not using the correct event. Stat changes usually trigger off their own event(s). UNIT_AURA merely signals that the list of buffs has changed, not necessarily that the server has applied any effects of said buffs yet.



Originally Posted by Xrystal View Post
Does this sound like what is happening to your numbers ?

https://us.forums.blizzard.com/en/wo...-values/253725
That's talking about something entirely different. The reported issue being the function no longer returning separate normal and "while casting" MP5 values and instead, giving the MP5 that's applied currently as both values.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
04-06-21, 12:29 PM   #4
Bakkon
A Defias Bandit
Join Date: Apr 2021
Posts: 3
Originally Posted by Xrystal View Post
Does this sound like what is happening to your numbers ?

https://us.forums.blizzard.com/en/wo...-values/253725
hi Xrystal. no im having a different issue. i actually found a way to fix the one mentioned in the link you sent

Originally Posted by SDPhantom View Post
I don't have a way to test currently, but it sounds like you're not using the correct event. Stat changes usually trigger off their own event(s). UNIT_AURA merely signals that the list of buffs has changed, not necessarily that the server has applied any effects of said buffs yet.
hi SDP

i have checked out all the stat related events, there are a few such as melee/ranged attack power, defense and such but no specific event for mana regen. how would i update mana regen then? like i said it does update with unit_aura but it starts lagging behind, being like 1 step back every time the value changes.
  Reply With Quote
04-06-21, 02:54 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
PaperDollFrame seems to just register all the stat events including UNIT_AURA and flag an update through OnUpdate.

https://www.townlong-yak.com/framexm...lFrame.lua#383
https://www.townlong-yak.com/framexm...lFrame.lua#397



I'm only seeing UNIT_RESISTANCE fire from toggling Mage Armor on Classic. I don't know of any similar spells on Retail that I can test this with to see if it's just disabled on Classic or if Blizzard is piggybacking off other stats updating.

Note: Mage armor does have a resistance component, so watching only that isn't ideal either.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
04-06-21, 03:07 PM   #6
Bakkon
A Defias Bandit
Join Date: Apr 2021
Posts: 3
Originally Posted by SDPhantom View Post
PaperDollFrame seems to just register all the stat events including UNIT_AURA and flag an update through OnUpdate.

https://www.townlong-yak.com/framexm...lFrame.lua#383
https://www.townlong-yak.com/framexm...lFrame.lua#397



I'm only seeing UNIT_RESISTANCE fire from toggling Mage Armor on Classic. I don't know of any similar spells on Retail that I can test this with to see if it's just disabled on Classic or if Blizzard is piggybacking off other stats updating.

Note: Mage armor does have a resistance component, so watching only that isn't ideal either.
dang... should i just drop the events and use onupdate with a throttle??
  Reply With Quote
04-06-21, 07:24 PM   #7
Simba
A Defias Bandit
 
Simba's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 2
Originally Posted by Bakkon View Post
dang... should i just drop the events and use onupdate with a throttle??
You could do that, yes. You can also calculate the regen manually, from the spirit formulas as base mana is only regenerated from spirit in Classic. (eg. Priest regen is spirit / 4 + 12.5). That is what the API seem to do anyway. Tier set bonuses, enchants, mp5 and other sources aren't even included in the API, so either way you'd have to add them manually if you care that much.
Then you can use UNIT_AURA and UNIT_STATS, should work just fine

Last edited by Simba : 04-10-21 at 04:32 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » API not updating inside Events

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off