WoWInterface - View Single Post - Getting links for uncollected pets and mounts
View Single Post
06-14-21, 10:42 PM   #1
A Chromatic Dragonspawn
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 167
Getting links for uncollected pets and mounts

Hi all

I am trying to print the links for pets and mounts that I have not yet collected by clicking on them in the Collections journal.

I can add "onclick" functions on the scroll buttons that prints the details of the selected pet yet if it is not collected I cannot seem to get the link.

There are API calls that are meant to return the current pet GUID however on uncollected pets they return nil.

Here is the chunk;
Lua Code:
  1. local petIndex = 0
  2. while true do
  3.     petIndex = petIndex + 1
  4.     local buttonName = "PetJournalListScrollFrameButton" .. petIndex
  5.     local button = _G[buttonName]
  6.     if not button then break end
  7.     button:HookScript("OnClick",
  8.     function(self)
  10.         print("*****************************************************")
  11.         print("*****************************************************")
  13.         print("PetButton\nindex =", self.index, "\nspeciesID =", self.speciesID, "\npetID =", self.petID, "\n**********************")
  15.         local petID, speciesID, owned, customName, level, favorite, isRevoked, speciesName, icon, petType, companionID, tooltip, description, isWild, canBattle, isTradeable, isUnique, obtainable = C_PetJournal.GetPetInfoByIndex(self.index)
  17.         print("GetPetInfoByIndex\npetID -", petID, "\nspeciesID -", speciesID, "\nspeciesName -",speciesName, "\ncompanionID -",companionID, "\ntooltip -",tooltip, "\ndescription -",description, "\n **********************")
  19.         local speciesName, speciesIcon, petType, companionID, tooltipSource, tooltipDescription, isWild, canBattle, isTradeable, isUnique, obtainable, creatureDisplayID = C_PetJournal.GetPetInfoBySpeciesID(self.speciesID)
  21.         print("C_PetJournal.GetPetInfoBySpeciesID\nspeciesName -", speciesName, "\npetType -", petType, "\ncompanionID -",companionID, "\ntooltipSource -",tooltipSource, "\ntooltipDescription -",tooltipDescription, "\ndescription -",description, "\ncreatureDisplayID", creatureDisplayID, "\n **********************")
  23.         local speciesId, petGUID = C_PetJournal.FindPetIDByName(speciesName)
  25.         print("C_PetJournal.FindPetIDByName\nspeciesId -", speciesId, "\npetGUID -", petGUID)
  27.         print("*****************************************************")
  28.         print("*****************************************************")
  30.         end)
  31.     end

And these are the results;

I have not been able to get the links no matter what I have tried.

Is there another way to get mount and pet links, or is this totally hidden from us by Blizz?
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
  Reply With Quote