WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   API not updating inside Events (https://www.wowinterface.com/forums/showthread.php?t=58678)

Bakkon 04-05-21 02:21 PM

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

Xrystal 04-05-21 03:22 PM

Does this sound like what is happening to your numbers ?

https://us.forums.blizzard.com/en/wo...-values/253725

SDPhantom 04-06-21 12:54 AM

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.



Quote:

Originally Posted by Xrystal (Post 338808)
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.

Bakkon 04-06-21 12:29 PM

Quote:

Originally Posted by Xrystal (Post 338808)
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

Quote:

Originally Posted by SDPhantom (Post 338818)
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.

SDPhantom 04-06-21 02:54 PM

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.

Bakkon 04-06-21 03:07 PM

Quote:

Originally Posted by SDPhantom (Post 338823)
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??

Simba 04-06-21 07:24 PM

Quote:

Originally Posted by Bakkon (Post 338824)
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 :)


All times are GMT -6. The time now is 10:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI