Closed Dairyman closed 3 years ago
How is this different from the current C_PetJournal.GetNumCollectedInfo
method other than using the tooltip:SetGuildBankItem() instead of pulling the itemlink from the button first and using that? As far as I understand, both of these methods should yield the exact same results.
if itemLink:match("|H(.-):") == "battlepet" then -- Check if item is Caged Battlepet (dummy item 82800)
local _, battlepetId = strsplit(":", itemLink)
if C_PetJournal.GetNumCollectedInfo(battlepetId) > 0 then
if db.debug and not knownTable[itemLink] then Print("%d - BattlePet: %s %d", itemId, battlepetId, C_PetJournal.GetNumCollectedInfo(battlepetId)) end
knownTable[itemLink] = true -- Mark as known for later use
return true -- Battlepet is collected
end
return false -- Battlepet is uncollected... or something went wrong
end
The itemLink
from the GuildBank is the dummy one ("item:82800::::::::60:102:::::::::"
) which has no information.
That's why the need to call GameTooltip:SetGuildBankItem()
, to get the speciesID
.
Oh yes, now I remember working on this back in the days and how stupid the system is. I'll see what I can come up with.
Sorry for taking so long (had ton of stuff IRL going on), but I have combined your suggestion with the way how I handle caged battlepets in the New AH -hook. I hope this works out of the box, but I don't want to close this issue yet just in case. If this doesn't work, I'll just update the addon to be more close to your original suggestion.
Don't hesitate to let me know if you have any other suggestions/bug fixes for this or other aspects of the addon.
Need to use itemID
the texture in the GuildBank is from the Pet itself, e.g:
if itemLink and strmatch(itemLink, "item:82800" then -- Inv_box_petcarrier_01 (BattlePet, itemId 82800)
Then it works.
Changed the addon to use itemId
instead of texture
in GBank, hope it works for real this time!
Works now 🎉.
Snippet which checks if the item is a cage and when yes checks if any pet of this species is learned.
Edit: Use
GetNumCollectedInfo
instead ofGetOwnedBattlePetString