Quantcast
how to get a visibleItemID from transmog - WoWInterface
Thread Tools Display Modes
04-09-18, 03:00 AM   #1
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
how to get a visibleItemID from transmog

I'm looking around Transmogrification_Functions for a replacement API for GetTransmogrifySlotInfo().
I think that C_Transmog.GetSlotVisualInfo() will get me the name or itemID of the selected item, but when I
try to get the info by using print(C_Transmog.GetSlotInfo(1)) i get the following error
Code:
3x SX_WallpaperKit_v.2\setup.lua:135: Usage: GetSlotInfo(slot, type)
[C]: in function `GetSlotInfo'
SX_WallpaperKit_v.2\setup.lua:135: in function <SX_WallpaperKit_v.2\setup.lua:132>

Locals:
(*temporary) = 1
(*temporary) = nil
now I have no idea what to put in as type


my plan was to do this until I found out that GetTransmogrifySlotInfo() was removed:
Lua Code:
  1. *** CREATING MAINFRAME AND OTHER STUFF HERE ***
  2.  
  3. local gearEditBox = CreateFrame("EditBox",nil,mainFrame,"InputBoxTemplate")
  4. gearEditBox:SetSize(128,32)
  5. gearEditBox:SetPoint("BOTTOM")
  6. gearEditBox:IsNumeric()
  7. gearEditBox:SetText("|cffff0000 NO GEAR LIST ")
  8. gearEditBox:SetJustifyH("CENTER")
  9. gearEditBox:SetAutoFocus(false)
  10.  
  11. local copyGearList = CreateFrame("BUTTON", nil, gearEditBox)
  12. copyGearList:SetSize(16, 16)
  13. copyGearList:SetPoint("BOTTOM", gearEditBox, "TOP")
  14. copyGearList:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
  15. copyGearList:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
  16.  
  17.  
  18. local gearList = {}
  19.  
  20. copyGearList:SetScript("OnMouseUp", function(self, button)
  21.    
  22.     gearList = table.wipe(gearList)
  23.  
  24.     for slotId = 1,19 do
  25.         local canTransmogrify = select(2, GetTransmogrifySlotInfo(slotId))
  26.         local visibleItemID = select(6, GetTransmogrifySlotInfo(slotId))
  27.  
  28.         if canTransmogrify then
  29.             if slotId == 19 then
  30.                 table.insert(gearList, "[ "..slotId.."] = ".. visibleItemID)
  31.             else
  32.                 table.insert(gearList, "[ "..slotId.."] = ".. visibleItemID..", ")
  33.             end
  34.         end
  35.     end
  36.  
  37.     gearEditBox:SetText(gearList)
  38.     print("|cff6699FFSX |cffffff00WallpaperKit|r: Gear list copied")
  39. end)
  Reply With Quote
04-09-18, 04:10 AM   #2
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 65
After looking at what you are trying to don't I think that function won't be much help but I found some that are. If you use the following function you can get the appliedSourceID.

local baseSourceID, baseVisualID, appliedSourceID, appliedVisualID, pendingSourceID, pendingVisualID, hasPendingUndo = C_Transmog.GetSlotVisualInfo(1, LE_TRANSMOG_TYPE_APPEARANCE)

And then you can use it with the C_TransmogCollection.GetSourceInfo(sourceID) function to get the infomation about that item.

Here are some example results.

C_Transmog.GetSlotVisualInfo(1,0)
baseSourceID: 77510
baseVisualID: 27544
appliedSourceID: 86281
appliedVisualID: 33368
pendingSourceID: 0
pendingVisualID: 0
hasPendingUndo: false

C_TransmogCollection.GetSourceInfo(86281)
[1]={
sourceType=1,
invType=2,
visualID=33368,
isCollected=true,
sourceID=86281,
isHideVisual=false,
itemID=147165,
itemModID=1,
categoryID=1,
name="Hood of Blind Absolution",
quality=4
}
__________________
Thomas aka Urnn

Last edited by thomasjohnshannon : 04-09-18 at 07:42 AM. Reason: Better advice.
  Reply With Quote
04-09-18, 11:08 AM   #3
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
Thank you so much for pointing me in the right direction and giving me the answer :P

now I have this:
Lua Code:
  1. local gearEditBox = CreateFrame("EditBox",nil,UIParent,"InputBoxTemplate")
  2. gearEditBox:SetSize(configFrame:GetWidth()/4.4,32)
  3. gearEditBox:SetPoint("TOPLEFT",12,-118)
  4. gearEditBox:IsNumeric()
  5. gearEditBox:SetText("|cffff0000 RIGHT-CLICK ME! ")
  6. gearEditBox:SetJustifyH("CENTER")
  7. gearEditBox:SetAutoFocus(false)
  8.  
  9. gearEditBox:HookScript("OnEnter", function(self)
  10.     GameTooltip:SetOwner(self,"ANCHOR_TOP")
  11.     GameTooltip:AddLine("Copy this text to the character.lua located at: ", 1,1,1)
  12.     GameTooltip:AddLine("Interface/AddOns/"..addon, 1,1,1)
  13.     GameTooltip:AddLine(" ")
  14.     GameTooltip:AddDoubleLine("right-click", "Sets the text in the editbox to the equipment", 1,1,1, 1,1,0)
  15.     GameTooltip:AddDoubleLine("ctrl + a", "marks all text", 1,1,1, 1,1,0)
  16.     GameTooltip:AddDoubleLine("ctrl + c", "copy the marked text", 1,1,1, 1,1,0)
  17.     GameTooltip:Show()
  18. end)
  19.  
  20. gearEditBox:HookScript("OnLeave", function()
  21.     GameTooltip:Hide()
  22. end)
  23.  
  24. local gearList = {}
  25. local visibleItemID = 0
  26.  
  27. gearEditBox:SetScript("OnMouseUp", function(self, button)
  28.     if button == "RightButton" then
  29.         gearList = table.wipe(gearList)
  30.        
  31.         for slotID = 1,19 do
  32.             if slotID == 2 or slotID == 11 or slotID == 12 or slotID == 13 or slotID == 14 or slotID == 18 then else
  33.                 local isTransmogrified = C_Transmog.GetSlotInfo(slotID, 0)
  34.                 if isTransmogrified then
  35.                     visibleItemID = C_TransmogCollection.GetSourceInfo(select(3, C_Transmog.GetSlotVisualInfo(slotID,0))).itemID
  36.                     if select(7, C_Transmog.GetSlotInfo(slotID, 0)) then visibleItemID = "nil" end
  37.                 else
  38.                     visibleItemID = GetInventoryItemID("player", slotID)
  39.                     if visibleItemID == nil then visibleItemID = "nil" end
  40.                 end
  41.                 if visibleItemID then
  42.                     if slotID == 19 then
  43.                         table.insert(gearList, "[ "..slotID.."] = ".. visibleItemID)
  44.                     else
  45.                         table.insert(gearList, "[ "..slotID.."] = ".. visibleItemID..", ")
  46.                     end
  47.                 end
  48.                
  49.             end
  50.         end
  51.     gearEditBox:SetText(unpack(gearList))
  52.    
  53.     --print(unpack(gearList))
  54.    
  55.     print("|cff6699FFSX |cffffff00WallpaperKit|r: Gear list printed in editbox")
  56.        
  57.     end
  58. end)
  59.  
  60. gearEditBox:SetScript("OnEnterPressed",function(s)
  61.  
  62.     gearEditBox:ClearFocus()
  63. -- local isTransmogrified, hasPending, isPendingCollected, canTransmogrify, cannotTransmogrifyReason, hasUndo, isHideVisual, texture = C_Transmog.GetSlotInfo(slotID, transmogType)
  64. end)
and it works great, except it only prints the first line of the table into the editBox, any help on how I can print the entire table into the editBox?

Last edited by saxitoxin : 04-09-18 at 11:15 AM.
  Reply With Quote
04-09-18, 05:36 PM   #4
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 65
Instead of just unpacking the table this method seems to work just fine.

Lua Code:
  1. local fullList = ""
  2. for k, v in pairs(gearList) do
  3.     fullList = fullList..v
  4. end
  5. gearEditBox:SetText(fullList)
__________________
Thomas aka Urnn
  Reply With Quote
04-09-18, 11:27 PM   #5
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
again thanks alot!
I thought about just using a string insted of a table, but I forgot about using the double dot .. instead I treated it like a number with pluss sign -_-


if I may ask one last question, where/how did you find those commands or what it is called?
  Reply With Quote
04-09-18, 11:48 PM   #6
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 65
If you are talking about C_Transmog.GetSlotInfo and such I just looked up how Blizzard does things in their code. You can export the code that Blizzard uses for the UI with a console command.

1) On the Battle.net launcher go to Options.
2) Select Game Settings
3) Check "Additional command line arguments" and then type in "-console".
4) Then go to the character selection screen and hit tilda (~).
5) Enter "exportInterfaceFiles code".

All the files will go into folders in "C:\Program Files (x86)\World of Warcraft" or where ever you have the game installed. After that you can remove the console command.

You can also export a lot of the art with "exportInterfaceFiles art". But you can expect it to cause your game to lag out. You will need BLPView to be able to see the art in Windows Explorer.

Sites like this one also can help compare how things change from patch to patch.
__________________
Thomas aka Urnn

Last edited by thomasjohnshannon : 04-09-18 at 11:51 PM. Reason: Added BLPView link.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » how to get a visibleItemID from transmog

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