Closed joevt closed 11 years ago
Another reason to check for nil petGUID: what if the user doesn't have 3 pets yet? I haven't tested that case since I'd have to use a new account because pets are account wide. Is there a way to remove a pet from a slot?
I have added a check for the nil value. Will be in next update.
I moved the texture update to the 1 sec timer frame instead, because I realized events:PET_JOURNAL_LIST_UPDATE was unreliable for some people, and I found the reason was that some do not get the event every second. I found in my setup the event was actually triggered by the add-on ArkInventory. When I disabled this add-on events:PET_JOURNAL_LIST_UPDATE almost never fired, which was not good. But all this is fixed now.
The case with not having three pets I will not worry too much about. It is such a rare case. I am not sure if you can make a team with just one or two pets. I tried but with no luck, and I really do not see the point :)
I get the error below when I first login to WoW. It doesn't appear to happen when I do /reloadui.
The fix is to check petGUID for nil value after the call to C_PetJournal.GetPetLoadOutInfo in events:PET_JOURNAL_LIST_UPDATE.
Another issue is that events:PET_JOURNAL_LIST_UPDATE seems to be called once per second. That's not a big problem since once per second is not very frequent. If it can't be fixed and SetTexture or SetText takes any amount of time, then maybe cache petGUID for each slot and don't call SetTexture and SetText unless the petGUID changed.