View Single Post
06-14-21, 10:42 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
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)
  9.  
  10.         print("*****************************************************")
  11.         print("*****************************************************")
  12.  
  13.         print("PetButton\nindex =", self.index, "\nspeciesID =", self.speciesID, "\npetID =", self.petID, "\n**********************")
  14.  
  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)
  16.  
  17.         print("GetPetInfoByIndex\npetID -", petID, "\nspeciesID -", speciesID, "\nspeciesName -",speciesName, "\ncompanionID -",companionID, "\ntooltip -",tooltip, "\ndescription -",description, "\n **********************")
  18.  
  19.         local speciesName, speciesIcon, petType, companionID, tooltipSource, tooltipDescription, isWild, canBattle, isTradeable, isUnique, obtainable, creatureDisplayID = C_PetJournal.GetPetInfoBySpeciesID(self.speciesID)
  20.  
  21.         print("C_PetJournal.GetPetInfoBySpeciesID\nspeciesName -", speciesName, "\npetType -", petType, "\ncompanionID -",companionID, "\ntooltipSource -",tooltipSource, "\ntooltipDescription -",tooltipDescription, "\ndescription -",description, "\ncreatureDisplayID", creatureDisplayID, "\n **********************")
  22.  
  23.         local speciesId, petGUID = C_PetJournal.FindPetIDByName(speciesName)
  24.  
  25.         print("C_PetJournal.FindPetIDByName\nspeciesId -", speciesId, "\npetGUID -", petGUID)
  26.  
  27.         print("*****************************************************")
  28.         print("*****************************************************")
  29.  
  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."
Fizzlemizz
  Reply With Quote