Hi,
C_TransmogCollection.GetCategoryAppearances(category) gives you a table of "appearances" (basically item models) The appearance tables contain a key
.visualID. The visual ID can then be used with
C_TransmogCollection.GetAppearanceSources(visualID) to get all the items using the model in question. (a source refers to an item) Similarly, the source tables contain a key
.sourceID, (basically another item ID) which you then can use with
C_TransmogCollection.GetAppearanceSourceInfo(sourceID) (sixth return) to get the item link. Extract the item ID from that.
Code:
local availableItems = {}
for i, appearance in ipairs(C_TransmogCollection.GetCategoryAppearances(LE_TRANSMOG_COLLECTION_TYPE_HEAD)) do
for i, source in ipairs(C_TransmogCollection.GetAppearanceSources(appearance.visualID)) do
local _, _, _, _, _, link = C_TransmogCollection.GetAppearanceSourceInfo(source.sourceID)
local itemID = GetItemInfoInstant(link)
tinsert(availableItems, itemID)
end
end
Available category IDs here:
https://www.townlong-yak.com/framexm....lua/diff#1445
A few things to note. C_TransmogCollection.GetAppearanceSourceInfo is for some reason very slow. (edit: well, maybe it's not particularly slow and there just are a lot of sources) Calling it for every source in the wardrobe takes several seconds. Also, using item ID might not be a good idea as a single item ID can have several appearances depending on whether it's normal, heroic, etc version of the item. I recommend using the full link or, if possible, even the source ID.
To apply transmog, use
C_Transmog.SetPending(slotID, LE_TRANSMOG_TYPE_APPEARANCE, sourceID).