BattlePetCount NG

BattlePetCount NG

12k Downloads

PR: Fix for the missing count for newer pet items

tflo opened this issue · 1 comments

commented

[This Issue belongs to this PR. You find additional info there.]

I was wondering why BPC was not showing me the count of collected pets for the newer pet items (for example Miloh, Scout, Petal, etc.).

When I looked at the files, it became clear: BPC uses a fix table (addon.Item2Species in CritterItems.lua) to associate a species ID with an item ID. The newer items/species simply weren't added to this table.

So I guess I have good news for you (and for us users):

During BfA, Blizz added a new function to the API: GetPetInfoByItemID

Amongst many other things, this function also returns the species ID that is associated with the item, and we can get the species ID like this:

local speciesID = select(13, C_PetJournal.GetPetInfoByItemID(itemid))

I was unaware of this function too, and discovered it only recently in the context of another addon.

This makes the whole Item2Species table obsolete, and you don't have to worry about adding new IDs to a list ever again.

I have posted a pull request for this.

Thanks for considering,

– Tom

commented

I have merged the PR, will make a new release for 10.2 in a few days, once I get time to test it.