Thread Tools Display Modes
06-19-16, 07:19 AM   #1
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Get itemAppearanceModID from item link?

Does anyone know get/parse the itemAppearanceModID from an item link?

GetInventoryItemID returns it for equipped items, but I need to get it from a link. (wowprogramming doesn't list it, only found it because @p3lim posted about it here)

Some sample links (yes they are Legion links, but itemAppearanceModID already exists in WoD):

Heroic gloves:
|cffa335ee|Hitem:124154::130219::::::103:63:4:5:2:564:566:531:::|h[Gloves of the Arcanic Conclave]|h|r
itemAppearanceModID: 1

Crated bracers, 6x upgraded:
|cffa335ee|Hitem:114814::::::::103:63:4:13:3:618:537:80:531:::|h[Hexweave Bracers of the Peerless]|h|r
itemAppearanceModID: 8
  Reply With Quote
06-19-16, 11:23 AM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Don't think you can.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
06-21-16, 12:05 AM   #3
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by Lombra View Post
Don't think you can.
Tested all the item-relevant functions but none of them returned the itemAppearanceModID :/

Can someone please move this thread to the Legion forum?

I need it for PlayerHasTransmog:

Lua Code:
  1. C_TransmogCollection.PlayerHasTransmog(itemID[, itemAppearanceModID])

Edit:

I didn't really raid in WoD, but from my tests with my limited items available I got:

0: Normal
1: Heroc
3: Mythic
8: Crafted item with 6 upgrades

for i=1,18 do print(select(2,GetInventoryItemID("player", i)), GetInventoryItemLink("player", i)); end
Will copy some materials later to the Beta realm to test id with all upgrade stages...

Last edited by sezz : 06-21-16 at 12:14 AM.
  Reply With Quote
06-21-16, 07:07 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
What are you going to do with it? How are you going to use it? You could plausibly "reverse engineer" the wardrobe data to get what you want. I seem to recall itemAppearanceMod being rather unreliable. Inconsistent across different items, but I'm not entirely sure.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
06-21-16, 12:35 PM   #5
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by Lombra View Post
What are you going to do with it? How are you going to use it?
Blizzards adds TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN only to item tooltips when the player can equip it. When playing on a mage for example there's no indicator if the appearance is already known on plate/mail/leather items - PlayerHasTransmog works accountwide and for all items.

I also use it for selling known transmog boe items, mailing unknown items and things like that.

Originally Posted by Lombra View Post
You could plausibly "reverse engineer" the wardrobe data to get what you want. I seem to recall itemAppearanceMod being rather unreliable. Inconsistent across different items, but I'm not entirely sure.
True, but caching all availble appearances (~3300 only for items available to my shaman) seems like overkill to me for the simple stuff I'm trying to do And I don't see a way to get ALL items, it's just mail on a shaman for armor.

Last edited by sezz : 06-21-16 at 12:38 PM.
  Reply With Quote
06-21-16, 02:18 PM   #6
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by sezz View Post
PlayerHasTransmog works accountwide and for all items.
Ah, that's neat.

After some brief testing I may have been mistaken about appearance ID being unreliable. I might have been thinking of when I wanted to map them to bonus IDs, which are different for each expansion or something. Mythic Siege of Orgrimmar bonus ID is different than Warlords of Draenor mythic. Would be great if we could get these appearance IDs confirmed.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
06-21-16, 02:40 PM   #7
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
The same IDs seem to be used for Siege of Orgrimmar items. Crafted WoD items starts at 6. Stage 3 through 6 looks the same, so it makes sense that stage 6 is ID 8.

Edit: Ok here's a less-than-ideal thing that might do. :P You can create a dummy dressup frame, try on an item and then do model:GetSlotTransmogSources(slot)! This gives you the wardrobe source ID for that particular item. (plus a second return value 0 for the few items I tried) You can then use that with C_TransmogCollection.GetAppearanceInfoBySource.
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 06-21-16 at 03:06 PM.
  Reply With Quote
06-22-16, 02:29 AM   #8
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by Lombra View Post
Ok here's a less-than-ideal thing that might do. :P You can create a dummy dressup frame, try on an item and then do model:GetSlotTransmogSources(slot)! This gives you the wardrobe source ID for that particular item. (plus a second return value 0 for the few items I tried) You can then use that with C_TransmogCollection.GetAppearanceInfoBySource.
Interesting, I tried that and found out that Blizzard adds TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN to item tooltips even if they don't have a usable appearance (appearanceIsUsable = false, tested it with crafted 715+ itemlevel crafted cloth armor), but C_TransmogCollection.GetAppearanceInfoBySource still returns nil for cloth on my demon hunter and shaman.

I created a thread on the beta forums, maybe Blizzard listens. If not, we can still parse the item link and hope they never change the IDs for heroic/mythic/crafted upgrades
  Reply With Quote
06-22-16, 07:19 AM   #9
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by sezz View Post
[...] C_TransmogCollection.GetAppearanceInfoBySource still returns nil for cloth on my demon hunter and shaman.
That is unfortunate. What about C_TransmogCollection.GetAppearanceSourceInfo? That returns some stuff. The fifth return value is a boolean unknown to me. Can't find any reference to it, but it looks like it could be "isOwned". The very small sample size of three of my items tested with this pointed towards it being so.

Also, I'm stupid. Since you do need to map the bonus IDs to appearance mod IDs, it will be unreliable/inconsistent, after all. :P

I'm in need of this, as well. I would much prefer not having to involve the annoying bonus IDs.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
06-23-16, 06:27 AM   #10
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by Lombra View Post
What about C_TransmogCollection.GetAppearanceSourceInfo?
This is what I've found in the UI source:

Lua Code:
  1. local categoryID, appearanceVisualID, canEnchant, texture, isCollected, itemLink, appearanceLink, unknownNumber = C_TransmogCollection.GetAppearanceSourceInfo(appearanceSourceID);

It seems to work well when inspecting other players or with items on the AH

This is the code I used for testing, will do some tests later on other characters when I'm back:

Lua Code:
  1. -- Lua API
  2. local strfind, strmatch, tonumber, select = string.find, string.match, tonumber, select;
  3.  
  4. -- WoW API/Constants
  5. local IsDressableItem, GetItemInfo = IsDressableItem, GetItemInfo;
  6. local TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN, TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN = TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN, TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN;
  7.  
  8. -- Text
  9. local tooltipAppearanceUnusable = "You can't collect this appearance";
  10. local tooltipSuffix = " (*)"; -- Makes it easier to tell if Blizzard added the text or we did...
  11.  
  12. -----------------------------------------------------------------------------
  13. -- Hidden DressUpModel
  14. -- TODO: Use C_TransmogCollection.PlayerHasTransmog(itemID[, itemAppearanceModID]) when Blizzard finally decides to give us access to itemAppearanceModID for all items.
  15. -----------------------------------------------------------------------------
  16.  
  17. local model = CreateFrame("DressUpModel");
  18. local lastItem, lastResult;
  19.  
  20. -- I'm not sure if invisible frames impact game performance, resizing it just in case...
  21. -- Can't :Hide() the frame, because it doesn't seem to "equip" items when hidden.
  22. model:SetSize(1, 1);
  23.  
  24. local PlayerHasTransmog = function(item)
  25.     if (not model.isPlayer) then
  26.         model:SetUnit("player");
  27.         model:Undress();
  28.         model.isPlayer = true;
  29.     end
  30.  
  31.     if (lastItem and lastItem == item) then
  32.         -- Tooltip update, reuse last results
  33.         return lastResult;
  34.     end
  35.  
  36.     local isCollected = false;
  37.  
  38.     model:TryOn(item);
  39.  
  40.     -- TODO: Get correct slot using GetItemInfo
  41.     for i = 1, 18 do
  42.         local appearanceSourceID = model:GetSlotTransmogSources(i);
  43.         if (appearanceSourceID and appearanceSourceID > 0) then
  44.             isCollected = select(5, C_TransmogCollection.GetAppearanceSourceInfo(appearanceSourceID)) or false;
  45.             break;
  46.         end
  47.     end
  48.  
  49.     model:Undress();
  50.  
  51.     -- Cache results, TODO: Update it on transmog event, if there is one?
  52.     lastItem = item;
  53.     lastResult = isCollected;
  54.  
  55.     return isCollected;
  56. end
  57.  
  58. -----------------------------------------------------------------------------
  59. -- Tooltip hooks
  60. -----------------------------------------------------------------------------
  61.  
  62. local OnTooltipSetItemHook = function(self)
  63.     local _, itemLink = self:GetItem();
  64.     if (not itemLink) then return; end
  65.  
  66.     local itemID = tonumber(strmatch(itemLink, "item:(%d+)"));
  67.     if (not itemID) then return; end
  68.  
  69.     local isDressable = IsDressableItem(itemID);
  70.     local _, _, canBeSource, noSourceReason = C_Transmog.GetItemInfo(itemID);
  71.     if (not isDressable or not canBeSource) then
  72.         if (noSourceReason and noSourceReason == "INVALID_SOURCE") then
  73.             self:AddLine(tooltipAppearanceUnusable..tooltipSuffix, 255/255, 170/255, 126/255);
  74.         end
  75.         return;
  76.     end
  77.  
  78.     local equipSlot = select(9, GetItemInfo(itemLink));
  79.     if (equipSlot == "INVTYPE_NECK" or equipSlot == "INVTYPE_FINGER" or equipSlot == "INVTYPE_TRINKET") then return; end
  80.  
  81.     if (PlayerHasTransmog(itemLink)) then
  82.         self:AddLine(TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN..tooltipSuffix, 170/255, 255/255, 126/255);
  83.     else
  84.         -- Check if Blizzard already added the text to the tooltip,
  85.         -- they only add it to items equippable by the current class.
  86.         local found = false;
  87.         local tooltipName = self:GetName();
  88.         local numLines = self:NumLines();
  89.  
  90.         for i = numLines, 1, -1 do
  91.             local frame = _G[tooltipName.."TextLeft"..i];
  92.             if (frame) then
  93.                 local text = frame:GetText();
  94.                 if (text and text == TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN) then
  95.                     found = true;
  96.                     break;
  97.                 end
  98.             end
  99.         end
  100.  
  101.         if (not found) then
  102.             self:AddLine(TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN..tooltipSuffix, 136/255, 170/255, 255/255);
  103.         end
  104.     end
  105. end
  106.  
  107. GameTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);
  108. ItemRefTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);
  109. ItemRefShoppingTooltip1:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);
  110. ItemRefShoppingTooltip2:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);
  111. ShoppingTooltip1:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);
  112. ShoppingTooltip2:HookScript("OnTooltipSetItem", OnTooltipSetItemHook);

Originally Posted by Lombra View Post
Since you do need to map the bonus IDs to appearance mod IDs, it will be unreliable/inconsistent, after all. :P

I'm in need of this, as well. I would much prefer not having to involve the annoying bonus IDs.
Old bonus IDs are known I think, but I'd rather have a solution that doesn's need updating everytime they decide to add new ones.
  Reply With Quote
06-23-16, 07:13 AM   #11
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Ah, must've missed that. Awesome!

Seems like a useful addon if it does what I think. I'm always uncertain of what it means when there's no info in the tooltip...
__________________
Grab your sword and fight the Horde!
  Reply With Quote
01-04-17, 09:19 AM   #12
Aadä
A Murloc Raider
Join Date: Oct 2016
Posts: 7
Since last year, does Blizzard now allows us to get itemAppearanceModID number or not ?
I don't see how figuring out itemAppearanceModID for staged items without testing inputs manually which is not ideal at all
I know the number starts at 0, but I'm not even sure what's the limit, 8 ? 12 ?
  Reply With Quote
01-04-17, 01:13 PM   #13
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Yes. You can now retrieve the modifier ID using C_TransmogCollection.GetItemInfo.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
01-04-17, 04:49 PM   #14
Aadä
A Murloc Raider
Join Date: Oct 2016
Posts: 7
thanks.
though /dump C_TransmogCollection.GetItemInfo("shift clicked item") doesn't seem to return anything looking like the researched number. it should probably be a number lower than 10

also I can't seem to understand the behaviour of some items, especially the different versions of gear found in wod dungeons, like [Legguards of Burning Focus] from Mythic (id 109809 for every items called like that), if you go into the dungeon journal and link it in the script, it'll show empty result, only for the mythic versions

like, if you have the mythic version and you type /dump C_TransmogCollection.PlayerHasTransmog(109809,0) it'll show true, replace 0 by anything between 1 and 10, it'll always show false

how is that possible ? how does the game successfully prints missingTransmogSourceInItemTooltips with a different value for each version ?

does that mean PlayerHasTransmog is not the only function a collector will need to check ?
or maybe PlayerHasTransmog use a combination of item id+item version+another number to determine if a given item is a unique wardrobe entry

I suppose they didn't planned to get a transmog system when making wod judging by the mess : P

Last edited by Aadä : 01-04-17 at 07:25 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Get itemAppearanceModID from item link?


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