WoW API so called events -> need help
I'm slowlly starting to run out of patience (and options)...
Today when i was programing pet xp bar addon i encountered another problem with WoW API events.
I was programing part responsible for showing hiding exp bar and seting proper exp values in status bar. So first i looked for events which fire when player summons pet and when pet exp changes. I found two such events "PLAYER_PET_CHANGED" and "UNIT_PET_EXPERIENCE".
Then i programed proper functions and everything was looking perfectly fine, but actually wasn't even half fine. After few tests and tons of relogs i learned that:
"PLAYER_PET_CHANGED" event fires like 5 times when you log to game (and your pet is curently with you). Which is fine, _but_ every time when i get "PLAYER_PET_CHANGED" event and i check for exp values using:
Onevent function fragment:
so basicaly there is pet but it has no exp...
Well so i said ok... maybe it was bad event to use... so i checked "UNIT_PET_EXPERIENCE"
Now most funny thing... it also fires few times when you log (with your pet) but again every time xp values are equal 0 ... But if i check for exp manualy (using proper test function) sec after everything is loaded i get good xp values...
Now... i understand that there is some problem with timings, but can anyone explain me why those events fire so many times when loading/loging but actually they seem to be false informing you that pet already is loaded, and that pet exp was already set on proper values...
And 2nd request, anyone have idea how to do it properly? (ie show pet exp bar same sec when ui is loaded and user already see his pet frame) By properly i mean using events bacause i already found indirect way (i show/update pet exp bar when pet action bar shows and it seem working fine for now but i don't think it is the way it should be...)
Anny help will be appreciated :)
BTW sorry for my funny english... i hope it is understandable
|All times are GMT -6. The time now is 04:43 AM.|
vBulletin © 2017, Jelsoft Enterprises Ltd