Thread Tools Display Modes
10-14-23, 03:18 PM   #1
fullmoon_sulfuras
A Fallenroot Satyr
Join Date: Dec 2019
Posts: 21
GetCompanionInfo("MOUNT") broken for WotLK Classic 3.4.3?

GetCompanionInfo seems broken when getting mount information on WotLK 3.4.3. The following snippet works:

Lua Code:
  1. for i=1,GetNumCompanions("CRITTER") do
  2.     local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i);
  3.     print(creatureID, creatureSpellID, creatureName, icon, issummoned)
  4. end

However, this returns all nil values:

Lua Code:
  1. for i=1,GetNumCompanions("MOUNT") do
  2.     local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("MOUNT", i);
  3.     print(creatureID, creatureSpellID, creatureName, icon, issummoned)
  4. end

My addon's code is very similar to the snippet above and used to work fine until 3.4.3.

The odd thing is that in Interface_Wrath/FrameXML/PetPaperDollFrame.lua there's:

Lua Code:
  1. function PetPaperDollFrame_OnLoad (self)
  2.     self:RegisterEvent("PET_UI_UPDATE");
  3.     self:RegisterEvent("PET_BAR_UPDATE");
  4.  
  5.     ...
  6.  
  7.     PetPaperDollFrameCompanionFrame.mode = "CRITTER";
  8.     PetPaperDollFrameCompanionFrame.idMount = GetCompanionInfo("MOUNT", 1);


Any ideas are more than welcome! Thanks!!

Last edited by fullmoon_sulfuras : 10-14-23 at 03:47 PM.
  Reply With Quote
10-14-23, 06:38 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 6,007
I suspect this is one of those areas where they pulled in the retail version of the Collections system rather than grab out the old classic version.

I'm gonna see if I can simulate that for loop with the new functionality in 3.4.3 but I've not touched this part of the API before so in the mean time ... here's the warcraft.wiki ( formerly known as wowpedia rofl ) for what I think they have replaced it with.

https://warcraft.wiki.gg/wiki/World_...PI#Collections


Yep, this seems to be working as I thought. Here's the lua and toc for a quick test addon

Lua Code:
  1. local function CheckMounts()
  2.     local mountIDs = C_MountJournal.GetMountIDs()
  3.    
  4.     for i = 1, #mountIDs do
  5.         local name, spellID, icon, isActive, isUsable, sourceType, isFavorite, isFactionSpecific, faction, shouldHideOnChar, isCollected, mountID = C_MountJournal.GetMountInfoByID(i)
  6.         print(mountID,name,isCollected,sourceType,spellID,icon,isActive)
  7.     end
  8. end
  9.  
  10. local function OnEvent(self,event,...)    
  11.     if event == "ADDON_LOADED" then
  12.         CheckMounts()
  13.     elseif event == "PLAYER_LOGIN" then
  14.         --CheckMounts()
  15.     end
  16. end
  17.  
  18. local f = CreateFrame("Frame")
  19. f:RegisterEvent("ADDON_LOADED")
  20. f:RegisterEvent("PLAYER_LOGIN")
  21. f:SetScript("OnEvent",OnEvent)


Lua Code:
  1. ## Interface: 30403
  2. ## Version: v0.0.1
  3. ## Title: Collection Info Test
  4. ## Notes: Testing Collection Info functionality
  5. ## Author: Xrystal
  6. ## SavedVariables:
  7. ## Dependencies: Blizzard_Collections
  8. ## OptionalDeps:
  9. ## IconTexture:
  10. ## DefaultState: Enabled
  11. ## LoadOnDemand: 0
  12.  
  13. CollectionInfoTest.lua
__________________


All Level 70 Characters:
Demon Warlock
Resto Druid
Disc Priest
Resto Shaman
Survival Hunter
Augment Evoker
Frost Mage
Vengence Demon Hunter
Rogue ( was subtlety )

Brewmaster Monk (TR)
Prot Paladin (TR)
Blood Death Knight ( TR)

As you can see I am missing a warrior

And .. I don't have all the allied races covered. Time Runner time when it happens again


Last edited by Xrystal : 10-14-23 at 06:53 PM.
  Reply With Quote
10-15-23, 09:22 PM   #3
fullmoon_sulfuras
A Fallenroot Satyr
Join Date: Dec 2019
Posts: 21
Thanks to your post, I was able to fix my addon!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetCompanionInfo("MOUNT") broken for WotLK Classic 3.4.3?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off