View Single Post
08-05-16, 07:49 PM   #3
greengoo
A Murloc Raider
Join Date: Aug 2016
Posts: 7
Originally Posted by Lombra View Post
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.

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).
First off, thank you so much for the response. Couple questions. Right now, I'm focusing on just the helm slot. So I'm using:

Code:
local button = CreateFrame("Button", "ClownSuitButton", WardrobeTransmogFrame.Inset,"UIPanelButtonTemplate")
	button:SetWidth(120)
	button:SetHeight(25)
	button:SetPoint("BOTTOMLEFT",450,0)
	button:RegisterForClicks("AnyUp")
	button:SetText("Clown Suit")
	button:SetScript("OnClick", function() clownHelm() end)
	button:SetFrameLevel(button:GetFrameLevel() + 1)

function clownHelm()
	C_TransmogCollection.ClearSearch() -- empties out the search trash to ensure we get a full list
	local knownMogCount = C_TransmogCollection.GetCategoryCollectedCount(1) -- Gets a count of how many helms are known
	local listOfHelms = C_TransmogCollection.GetCategoryAppearances(1) -- Creates a table of appearences (.visualID)
	local tempHelm = C_TransmogCollection.GetAppearanceSources(listOfHelms[10].visualID) -- Gets the .sourceID of item 10 on table
	C_Transmog.SetPending(1,LE_TRANSMOG_COLLECTION_TYPE_HEAD,tempHelm) -- Sets Pending head slot item to tempHelm

end

For now, I just want to apply one of the helms I know (I don't care which, the goal is to get a random int between 1 and knownMogCount and apply that, but for now it doesn't matter so I'm using 10). However, I feel like I'm not getting from the .visualID to the .sourceID I need to use C_Transmog.SetPending. I'm also a bit unsure on the SetPending parameters, if I'm using them correctly. Can you expand a little bit on that? How can I extract the necessary sourceID from the "listOfHelms" item I've created?


I feel like I'm close but as I mentioned, I'm early in my learning.

Last edited by greengoo : 08-05-16 at 08:06 PM.
  Reply With Quote