Thread Tools Display Modes
06-27-16, 09:43 PM   #1
AmiYuy
A Fallenroot Satyr
 
AmiYuy's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 22
Question C_TransmogCollection Missing Source Help

TorelTwiddler is coding an addon that adds a line to item tooltips to tell you if you have learned a transmog appearance (Can I Mog It? - Trying to get it on here...but it's being difficult for some reason).

So far we've found what we need from existing functions, but can't find the one that will tell us if the item is eligible for "You've collected this appearance, but not from this item". This tooltip is available in the game through CVar missingTransmogSourceInItemTooltips and C_TransmogCollection.GetShowMissingSourceInItemTooltips, but there doesn't seem to be a function in C_TransmogCollection that provides this information. Or if there is, we're missing it or how to use it.

We have tried almost all of the C_TransmogCollection functions and PlayerKnowsSource in particular but it returns seemingly inconsistent information.

PlayerHasTransmog(ItemID) returns whether the player has the transmog from that item only, but doesn't include if it has been learned from a different item, so the result is that the addon thinks the appearance hasn't been learned at all.

We're looking for something like:
PlayerHasTransmogAppearance(itemID) - returns bool of whether the player has the transmog appearance, regardless if this is the exact item it came from

or something like these two example functions (so we can make our own)

GetAppearance(itemID) - returns the visualID of the item
PlayerHasTransmogByAppearance(visualID) - returns bool of whether the the player has the transmog appearance

or instructions for where this data is stored (if it's stored client side).

So does what we're looking for exist and we're missing it? Is there an easier way of getting what we need?
 
06-28-16, 01:14 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
This is probably more complicated than it needs to be.
Lua Code:
  1. local InventorySlots = {
  2.     ['INVTYPE_HEAD'] = 1,
  3.     ['INVTYPE_NECK'] = 2,
  4.     ['INVTYPE_SHOULDER'] = 3,
  5.     ['INVTYPE_BODY'] = 4,
  6.     ['INVTYPE_CHEST'] = 5,
  7.     ['INVTYPE_ROBE'] = 5,
  8.     ['INVTYPE_WAIST'] = 6,
  9.     ['INVTYPE_LEGS'] = 7,
  10.     ['INVTYPE_FEET'] = 8,
  11.     ['INVTYPE_WRIST'] = 9,
  12.     ['INVTYPE_HAND'] = 10,
  13.     ['INVTYPE_CLOAK'] = 15,
  14.     ['INVTYPE_WEAPON'] = 16,
  15.     ['INVTYPE_SHIELD'] = 17,
  16.     ['INVTYPE_2HWEAPON'] = 16,
  17.     ['INVTYPE_WEAPONMAINHAND'] = 16,
  18.     ['INVTYPE_RANGED'] = 16,
  19.     ['INVTYPE_RANGEDRIGHT'] = 16,
  20.     ['INVTYPE_WEAPONOFFHAND'] = 17,
  21.     ['INVTYPE_HOLDABLE'] = 17,
  22.     -- ['INVTYPE_TABARD'] = 19,
  23. }
  24.  
  25. local model = CreateFrame('DressUpModel')
  26. function GetItemAppearance(itemLink)
  27.     local itemID, _, _, slotName = GetItemInfoInstant(itemLink)
  28.     if itemLink == itemID then
  29.         itemLink = 'item:' .. itemID
  30.     end
  31.     local slot = InventorySlots[slotName]
  32.     if not slot or not IsDressableItem(itemLink) then return end
  33.     model:SetUnit('player')
  34.     model:Undress()
  35.     model:TryOn(itemLink, slot)
  36.     local sourceID = model:GetSlotTransmogSources(slot)
  37.     if sourceID then
  38.         local categoryID, appearanceID, canEnchant, texture, isCollected, itemLink = C_TransmogCollection.GetAppearanceSourceInfo(sourceID)
  39.         return appearanceID, isCollected, sourceID
  40.     end
  41. end
  42.  
  43. function PlayerHasAppearance(appearanceID)
  44.     local sources = C_TransmogCollection.GetAppearanceSources(appearanceID)
  45.     if sources then
  46.         for i, source in pairs(sources) do
  47.             if source.isCollected then
  48.                 return true
  49.             end
  50.         end
  51.     end
  52. end
  53.  
  54. function PlayerCanCollectAppearance(appearanceID)
  55.     local sources = C_TransmogCollection.GetAppearanceSources(appearanceID)
  56.     if sources then
  57.         for i, source in pairs(sources) do
  58.             if C_TransmogCollection.PlayerCanCollectSource(source.sourceID) then
  59.                 return true
  60.             end
  61.         end
  62.     end
  63. end
  64.  
  65. function CanTransmogItem(itemLink)
  66.     local itemID = GetItemInfoInstant(itemLink)
  67.     if itemID then
  68.         local canBeChanged, noChangeReason, canBeSource, noSourceReason = C_Transmog.GetItemInfo(itemID)
  69.         return canBeSource, noSourceReason
  70.     end
  71. end

Last edited by semlar : 07-04-16 at 10:31 AM.
 
06-28-16, 02:20 AM   #3
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Ketho View Post
That looks nice~ Bit unrelated, but does using a DressUpModel also help against the caching problem?

Never mind, it has nothing to do with a DressUpModel... I'll move my question to its own topic

Last edited by Ketho : 06-28-16 at 02:24 AM.
 
06-28-16, 08:49 PM   #4
AmiYuy
A Fallenroot Satyr
 
AmiYuy's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 22
Originally Posted by semlar View Post
This is probably more complicated than it needs to be.
Thank you very much semlar! That worked great and actually helped clear up part of another lingering problem with some Heroic/Mythic/Crafted items saying they weren't known, although not all.

The still broken items seem to be ones with multiple versions of the same name and item number. We're not sure if it's something we're doing wrong or the game is.

PlayerHasTransmog = false:
  • Wayfaring Shoulderguards of the Peerless-5 of 6 (116187) - 3 appearance options in the wardrobe
  • Shrediron's Shredder of the Peerless-4 of 6 (109168) - 3 appearance options in the wardrobe
  • Bonetooth Longbow-Heroic (110037) - 2 appearance options in the wardrobe

PlayerHasTransmog = true:
  • Cybergenetic Mechshades of the Peerless-4 of 6 (109173) - 1 appearance option in the wardrobe
  • Kor'kron Hand Canon-Heroic (103953) - 3 appearance options in the wardrobe
  • Chestguard of the Siegemaker-Warforged(113982) - 4 appearance options in the wardrobe

Any ideas?
 
06-28-16, 10:42 PM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I went ahead and edited my original post with an updated version that should correctly support items which have the same item ID but different appearances as long as you supply it with the full item link.

It will still work with just item IDs, but will only return information about the base item if you don't give it the link.

Last edited by semlar : 06-28-16 at 11:38 PM.
 
06-28-16, 11:42 PM   #6
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
http://www.wowinterface.com/forums/s...ad.php?t=53734

Problem is that most methods in C_TransmogCollection only work for items the current character can equip. :/
 
06-29-16, 12:32 AM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by sezz View Post
http://www.wowinterface.com/forums/s...ad.php?t=53734

Problem is that most methods in C_TransmogCollection only work for items the current character can equip. :/
Ah you came up with the same solution I did, but C_TransmogCollection.GetAppearanceSourceInfo actually does return information for items you can't equip on the current character whereas C_TransmogCollection.GetAppearanceInfoBySource does not.

That simplifies things because it also tells you whether you've collected the appearance, I'll update my post to use that instead.

One thing I noticed is that this doesn't necessarily return information the first time you call it. It seems to be because the model won't equip the item if it hasn't been cached, so it may be necessary to cache the item and issue a callback when it's available, but that shouldn't be an issue if you're just adding text to the item's tooltip since the tooltip won't populate if the item hasn't been cached yet.

Last edited by semlar : 06-29-16 at 12:49 AM.
 
06-29-16, 03:23 AM   #8
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by semlar View Post
Ah you came up with the same solution I did, but C_TransmogCollection.GetAppearanceSourceInfo actually does return information for items you can't equip on the current character whereas C_TransmogCollection.GetAppearanceInfoBySource does not.
Yep, but it currently only returns sourceIsCollected, not appearanceIsCollected.

I also just noticed that there's now C_TransmogCollection.SetShowMissingSourceInItemTooltips, enabling this adds TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN to all uncollected appearances (even for plate items when I'm on a Demon Hunter) and it also adds TRANSMOGRIFY_TOOLTIP_ITEM_UNKNOWN_APPEARANCE_KNOWN when the appearance is known but we learned it from another item, which is pretty awesome

Edit: Forgot to mention, DressUpModel.GetSlotTransmogSources doesn't work for tabards (19).

Last edited by sezz : 06-29-16 at 05:46 AM.
 
06-29-16, 03:59 AM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by sezz View Post
Yep, but it currently only returns sourceIsCollected, not appearanceIsCollected.
I see, I guess that makes sense.

Sounds like we'll still have to iterate over all of the sources for an appearance if we want to check whether we've collected it.
 
06-29-16, 09:54 PM   #10
TorelTwiddler
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 3
Hi semlar and sezz,

Thanks for the code snippets! It looks like the main issues we were having with "alternate source" items is resolved now.

Our next issue is that there are legendary items, such as the Runestaff of Nordrassil (http://legion.wowhead.com/item=71085...-of-nordrassil) that are supposed to be non-transmoggable, but it's showing as transmoggable but not learned yet. Is that another thing that you may know how to get around?

Thanks again!
 
06-29-16, 10:28 PM   #11
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by TorelTwiddler View Post
Our next issue is that there are legendary items, such as the Runestaff of Nordrassil (http://legion.wowhead.com/item=71085...-of-nordrassil) that are supposed to be non-transmoggable, but it's showing as transmoggable but not learned yet. Is that another thing that you may know how to get around?
I added a PlayerCanCollectAppearance function which should theoretically only return information if it's possible to acquire the appearance, let me know if it doesn't work though.
 
07-01-16, 08:41 PM   #12
TorelTwiddler
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 3
Originally Posted by semlar View Post
I added a PlayerCanCollectAppearance function which should theoretically only return information if it's possible to acquire the appearance, let me know if it doesn't work though.
So there are two issues I'm trying to solve:

1. Some equipable items are not transmoggable by anyone, but I don't know how to determine if it is or not.
2. My current method of determining if an item is transmoggable by anyone or not has localization issues (specifically I use a mapping to the Weapon type name).

Unfortunately, PlayerCanCollectSource doesn't work for 1, and is inconsistent for 2.

In the addon I am trying to differentiate between something that cannot be learned on this character, and something that cannot be learned at all. C_TransmogCollection.PlayerCanCollectSource seems to (usually) correctly return if the item can be collected by this character, but I would also need to know if it is transmoggable by anyone. For example, the Runestaff of Nordrassil returns false for PlayerCanCollectSource, but I also need to know if it's transmoggable at all (which it is not).

I am checking for transmoggablility by checking the item type against a localized mapping of item type (weapons use "Bows", "Guns", etc., armor uses "INVTYPE_LEGS", "INVTYPE_BODY", etc.) to Transmog Category (found using C_TransmogCollection.GetCategoryInfo for the category numbers) and plugging it into C_TransmogCollection.IsCategoryValidForItem. This works very consistently with two problems, 1. localization, 2. doesn't work on some very specific items (Runestaff for example).

C_TransmogCollection.PlayerCanCollectSource and C_TransmogCollection.PlayerKnowsSource seem to return inconsistent results. For example, changing the addon logic to use PlayerCanCollectSource (like in your code snippet) breaks tabards (none seem to have a source) and fishing poles (all seem to have a source, but they are not transmoggable), and the brewfest steins (not transmoggable).

GitHub link if you'd like to see the code. I also made a branch that integrates your latest function: https://github.com/TorelTwiddler/CanIMogIt

I really appreciate your help in figuring out the issues we've been running into. I wish Blizzard put out actual docs for their API!

Thanks again!
 
07-01-16, 11:03 PM   #13
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by TorelTwiddler View Post
I am checking for transmoggablility by checking the item type against a localized mapping of item type (weapons use "Bows", "Guns", etc., armor uses "INVTYPE_LEGS", "INVTYPE_BODY", etc.) to Transmog Category (found using C_TransmogCollection.GetCategoryInfo for the category numbers) and plugging it into C_TransmogCollection.IsCategoryValidForItem. This works very consistently with two problems, 1. localization, 2. doesn't work on some very specific items (Runestaff for example).
This doesn't appear to work on any item I've tried it with; all non-transmogrifiable items I checked still return the category that they would fall into based on their weapon type.

Localization wouldn't be a problem since you could just check the item against all 28 categories and see if any return true.

C_Transmog.GetItemInfo appears to return whether the item is a valid source for transmogrification, and what the error is (eg. "INVALID_SOURCE", "NO_STATS", "INVALID_TYPE") for the third and fourth values. I'm not sure about the first, if it's false then the second return is the error (eg. "NO_ITEM", "NOT_SOULBOUND", "INVALID_TYPE", "INVALID_TARGET").

The item must be cached for this to return valid information. If it's not cached, it returns "false, NO_ITEM".

For what it's worth, tabards do not return a source when equipped on a model, so the only way to support them would be to build your own database from C_TransmogCollection.GetCategoryAppearances(6) and C_TransmogCollection.GetAppearanceSources(visualID).

Last edited by semlar : 07-02-16 at 12:13 AM.
 
07-11-16, 08:18 PM   #14
TorelTwiddler
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 3
Got everything working now, thanks for your help! You can check out the addon here: http://www.wowinterface.com/download...o.php?id=24015
 
07-22-16, 05:47 PM   #15
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Did you guys actually get C_Transmog.GetItemInfo working then? I'm getting NO_ITEM for everything on live, including items from my bags, so it's not an issue of caching. The predecessor, GetItemTransmogrifyInfo, was also broken.
__________________
Grab your sword and fight the Horde!
 
07-22-16, 06:03 PM   #16
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Lombra View Post
Did you guys actually get C_Transmog.GetItemInfo working then? I'm getting NO_ITEM for everything on live, including items from my bags, so it's not an issue of caching. The predecessor, GetItemTransmogrifyInfo, was also broken.
It takes an item ID as an argument, but it appears to work fine on live.

eg. C_Transmog.GetItemInfo(2912) returns true, nil, true

If the item isn't cached you may need to call it a second time.

Last edited by semlar : 07-22-16 at 06:06 PM.
 
07-23-16, 04:59 AM   #17
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Right, that's what the issue was with the old function too I guess. Didn't try with item ID for my bag item. Think there might have been some issue with using item ID, because I stopped using it when it no longer worked with links... perhaps random stat items not working because of "no stats" when given only the item ID, but that at least seems to work now.
__________________
Grab your sword and fight the Horde!
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » C_TransmogCollection Missing Source Help

Thread Tools
Display Modes

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