GetTalentInfo returns nil when zoning into time-walking dungeons, arena, battleground
So, one of my addon has a frame that listens to ACTIVE_TALENT_GROUP_CHANGED event which calls GetTalentInfo to check whether the specific talent is selected or not when its fired.
I honestly dunno why, but GetTalentInfo seems to be returning a nil value when the player zones into time-walking dungeons, arena and battleground.
Here's a code snippet:
Both, objectA and objectB are hidden when I enter those zones and I'll have to reload ui to see them again :confused:
(This function is the only part where it manages those objects' visibility)
What would be causing this and would there be any possible solutions?
In my rather limmited experience with WoW events, they tend to fire more often than we expect. i.e. when you don't expect them to. And sometimes they don't fire when it would be logical (at least according to our expectations) for them to. Zoneing in and out of instances are moments when this often happens.
So, if I understood correctly, you're only calling GetTalentInfo upon ACTIVE_TALENT_GROUP_CHANGED, right?
I'm guessing maybe that event is fireing in between PLAYER_LEAVING_WORLD and PLAYER_ENTERING_WORLD, making the access to talents unavailable in that period. It may be that they become available again on PLAYER_ENTERING_WORLD (and you'd expect ACTIVE_TALENT_GROUP_CHANGED to fire again but it doesn't).
I have tested nothing of the above, it's just guess-work!. But you could try this:
So, you are saying that it's like:
PLAYER_LEAVING_WORLD → ACTIVE_TALENT_GROUP_CHANGED → PLAYER_ENTERING_WORLD ?
If so, my question is why is it not causing an issue when you join random dungeons or raids :confused:?
It's probably a race condition; the two events are actually fired simultaneously, but in practice one of them has to be handled before the other since the UI is single-threaded and can only do one thing at a time. It could also be that the events are fired in a different order for different types of instances. Without being able to look at the C code that fires the events, there's no way for us to know which is the case.
Fortunately, we don't need to know -- just use aallkkaa's solution. It will run your "check talents and update frame visibility" function on both events, so it won't matter which order they fire in.
For now, I'll stick with aallkkaa's solution :)
Thank you guys!!
|All times are GMT -6. The time now is 08:35 AM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI