Transmog/Wardrobe LUA function help needed
Hey guys, hoping to get some help from someone far smarter than I regarding some LUA code I'm trying to write. Two specific questions regarding the transmog wardrobe UI and how to make changes to my set's mogged items (prior to hitting "Accept").
How can I create a table of known transmog item IDs for a certain slot? For example, I want to create an array where each entry in the array is the six-digit item ID of a Plate Helm that I am currently able to transmog. Once I have that six-digit ID, what is the best/simplest way to apply the mog for that Item ID on to the Wardrobe window, so I can apply the mog or save it as an outfit? Any help would be greatly appreciated. I've been scouring the web today and found limited success on these two items. Thanks!!! |
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 = {} 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). |
Quote:
Code:
local button = CreateFrame("Button", "ClownSuitButton", WardrobeTransmogFrame.Inset,"UIPanelButtonTemplate") 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. |
I think you need only change tempHelm to tempHelm[1].sourceID.
Don't change LE_TRANSMOG_TYPE_APPEARANCE in SetPending. That value is meant to indicate whether it's an "appearance" (item) or an "illusion" (enchant). The first parameter is traditional inventory slot ID; not wardrobe category ID. In both cases that happens to be 1 for helm though, so you're good. |
Almost got it! I can print the link item at the end and get an ingame link for the helm... just can't seem to actively set it as the "on deck" or pending mog (mimicing the action of clicking on a helm). I can't seem to get C_Transmog.SetPending(1, LE_TRANSMOG_TYPE_APPEARANCE, itemID) to work. Everything else seems to work fine, but it's not *actually* setting it, even if I feed in a direct itemID such as 28180 .
Code:
local button = CreateFrame("Button", "ClownSuitButton", WardrobeTransmogFrame.Inset,"UIPanelButtonTemplate") |
You have to use the source ID. Item ID won't work.
|
Quote:
edit: I solved my issue... as you mentioned and I ignored to my peril wardrobe slot != item slot. Working on it :) |
New issue... I've dialed in the randomize buttons so that I can do any individual button, but there's a catch. The individual buttons (shoulder, helm, etc) work totally perfect... ***IF*** that slot is currently selected as the active mog slot in the wardrobe interface. If it is not, or if I try to do multiple pieces at once (using the transmog all slots button) then each one may or may not function. I can't quite figure out what's causing it, but my guess is that it has to do with the for loop at the bottom of my code that checks if an matching sourceID is known and then uses that one if it is. I get the feeling that section is causing the issue, but can't figure out how/why. Any great advice?
Code:
-- BUTTON CODE |
Not sure. One possible error could be that your known appearances aren't necessarily the knownMogCount first ones in the listOfArmors. I would say that's likely. Other than that I can only recommend debugging the values passed to SetPending, then you could manually verify that it's getting valid arguments.
|
Do you know if there's a command I can use to select a certain slot in the transmog wardrobe interface, replicating the action of clicking on the slot I want to display known mogs for?
I'm thinking if I append this to the start of the setSlotToClown function it might resolve the issue. |
Quote:
Note that you should search for a parent/container frame like PaperDollFrame, not a numbered child frame like PaperDollFrameItemSlot42, since those frames are often created in ways that mean their final name doesn't appear literally in the code. Once you find the frame, just look to see what happens in its OnClick handler. |
One problem with that is that there exists only those 15 or so frames to click that you see at any one time. There is not a frame for each appearance. So to "click" an item that isn't on the current page would require some additional hacks. Not sure if there is a less annoying way.
I would not recommend depending on the UI either way. It's better to work as close to the API as possible. You could create a new table where you include all collected appearances and then pick randomly from that. |
Quote:
|
Yeah, should have quoted. That was not directed at you. Didn't refresh before posting!
|
Thanks for the ideas guys. I'll look into creating tables rather than the direction I'm using now. Hopefully that will resolve things.
I really wish I understood what was causing my current method to interfere if that slot isn't the active one. It SHOULD work as is in my mind. The check to ensure it's using a known source ID works if it's the active slot, but I can't for the life of me find out what causes the interference when it's not selected. It's bothering me. I'll keep at it... Thanks! |
All times are GMT -6. The time now is 12:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI