Thread Tools Display Modes
05-14-16, 02:13 PM   #1
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
Inspect another's transmog info?

Still new at this all so I can't tell if I just can't find the function I want, or if it doesn't exist, or if I'm not using the calls I have correctly...

I want to be able to get item info about another person's transmog gear.

In the default UI, if you inspect someone, hover over them, the game tooltip shows the "Transmogrified to:" entry and lists the name of the item. Looking into InspectPaperDollFrame.lua in the Blizzard_InspectUI it just uses GameTooltip:SetInventoryItem(InspectFrame.unit, self:GetID()) to do that. Looking at GameTooltip.lua from FrameXML though has no SetInventoryItem method that I can review to see how it does that.

Looking through the API listing, and I found GetTransmogrifySlotInfo, with works great for my own inventory but doesn't seem to take a 'unit' like all the other GetInventory* calls so I can't use it during an inspect?

Will I have to do that tooltip scraping thing others have mentioned and then look up the inventory info based on the name of the item pulled from the tooltip? Seems like there should be a better way.

Thanks for any pointers.

In you're curious here is the code that dumps your own transmog info.
Lua Code:
  1. transmogSlots = { InspectHeadSlot, InspectShoulderSlot, InspectBackSlot, InspectChestSlot, InspectWristSlot, InspectHandsSlot, InspectWaistSlot, InspectLegsSlot, InspectFeetSlot, InspectMainHandSlot, InspectSecondaryHandSlot }
  2.  
  3. unit = "player"
  4.  
  5. for i, slot in ipairs(transmogSlots) do
  6.    slotId = slot:GetID()
  7.    local isTransmogrified, canTransmogrify, cannotTransmogrifyReason, hasPending, hasUndo, visibleItemID, textureName = GetTransmogrifySlotInfo(slotId)
  8.    if isTransmogrified then
  9.       local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(visibleItemID)
  10.       print (format("Slot %s is transmogrified to %s. %s", slotId, link))
  11.    end
  12.    
  13. end
  Reply With Quote
05-14-16, 02:57 PM   #2
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
So I used some code I found at this link: http://us.battle.net/wow/en/forum/topic/8481388146 for scanning tooltips. Got the name of the inventory item, works on me.

Tried it on a guy next to me, worked. Super!
Tried it on the next guy next me to me. Failed. Hmm... why is that nil... turns out GetItemInfo(itemName) only works if I own the gear :-(

Guess I'm out of luck going that route too

Code if it helps at all... excuse the sloppiness of it.

Lua Code:
  1. CreateFrame( "GameTooltip", "MyScanningTooltip", nil, "GameTooltipTemplate" ); -- Tooltip name cannot be nil
  2.  
  3. local function ScanTooltipOfUnitSlotForTransmog(unit,slot)
  4.    local tooltip = MyScanningTooltip
  5.    local isTransmogrified = false
  6.    local itemName = nil
  7.    tooltip:SetOwner( WorldFrame, "ANCHOR_NONE" ); -- does a ClearLines() already
  8.    tooltip:SetInventoryItem(unit,slot)
  9.    for i=1,MyScanningTooltip:NumLines() do
  10.       local left = _G["MyScanningTooltipTextLeft"..i]:GetText()
  11.       if left then
  12.          if isTransmogrified then
  13.             -- The line after the Transmog header has been found will be the name
  14.             -- might have to parse Illusion: Hidden
  15.             itemName = left
  16.             break -- return isTransmogrified, itemName
  17.          end
  18.          
  19.          if left == "Transmogrified to:" then -- Deal with localization - any better patterns to match?
  20.             isTransmogrified = true
  21.          end
  22.       end
  23.    end
  24.    return isTransmogrified, itemName
  25. end
  26.  
  27. transmogSlots = { InspectHeadSlot, InspectShoulderSlot, InspectBackSlot, InspectChestSlot, InspectWristSlot, InspectHandsSlot, InspectWaistSlot, InspectLegsSlot, InspectFeetSlot, InspectMainHandSlot, InspectSecondaryHandSlot }
  28.  
  29. -- Inspect the target manually before you try unless you've targetted yourself
  30. unit = "playertarget"
  31.  
  32.  
  33. for i, slot in ipairs(transmogSlots) do
  34.    slotId = slot:GetID()
  35.    
  36.    local isTransmogrified, itemName = ScanTooltipOfUnitSlotForTransmog(unit,slotId)
  37.    if isTransmogrified then
  38.       local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemName)
  39.       if link then
  40.          -- Can't call by itemName unless I have it in my bags... ugh!
  41.          print (format("Slot %s is transmogrified to %s.", slotId, link))
  42.       else
  43.          print (format("Slot %s is transmogrified to %s", slotId, itemName))
  44.       end
  45.    end
  46. end
  Reply With Quote
05-14-16, 02:57 PM   #3
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Yes, you have to use tooltip scanning, which isn't going to be at all reliable. Can you even get item info via name if you don't have the item?
__________________
Grab your sword and fight the Horde!
  Reply With Quote
05-14-16, 02:58 PM   #4
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
Originally Posted by Lombra View Post
Yes, you have to use tooltip scanning, which isn't going to be at all reliable. Can you even get item info via name if you don't have the item?
Not that I can see

How responsive is the wow ui team for requesting new api calls? Maybe with all the wardrobe stuff happening for legion they'd give us one that could work? Best place for that would be on the official forums you think?

Last edited by Hiketeia : 05-14-16 at 03:05 PM.
  Reply With Quote
05-14-16, 04:28 PM   #5
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Never messed with the inspection API, but shouldn't you be registering for INSPECT_READY()? Inspections are throttled at the server end, which might explain why you get it once, followed by nil values.

I'd even cache units and compare if you have them already before you call InspectUnit().

Last edited by myrroddin : 05-14-16 at 04:30 PM. Reason: caching?
  Reply With Quote
05-14-16, 05:20 PM   #6
TOM_RUS
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 95
In legion you can use C_TransmogCollection.GetInspectSources that returns some values (i've no idea if those are transmogged values or base). It seems that blizz is planning to use that API, but currently that part isn't finished. Those values than can be passed to C_TransmogCollection.GetAppearanceSourceInfo. You may try and see what you can get out of it.
  Reply With Quote
05-14-16, 05:44 PM   #7
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
myrroddin, thanks for the suggestion on INSPECT_READY. I was going to do that in the full code, just trying to do a proof of concept now. The nil was on the item call, it had the correct name already. The goal is to try into the inspection frame and trigger off its load.

TOM_RUS, good to know there is some stuff already available in Legion even if it is unclear the extent. I don't have beta access yet myself. I tried googling around for those api calls you mention and didn't turn anything up. Where did you find them? Is there a wiki, or github someplace that has the legion interface source posted?
  Reply With Quote
05-14-16, 06:04 PM   #8
TOM_RUS
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 95
Originally Posted by Hiketeia View Post
Where did you find them? Is there a wiki, or github someplace that has the legion interface source posted?
Yes Blizzard_InspectUI here: https://github.com/tomrus88/Blizzard....lua#L171-L184

At bottom there's dead code that never called. I think it was used in earlier builds, but not anymore... But API itself still returns "something".

Actually, that ViewButton was removed very recently.

Last edited by TOM_RUS : 05-14-16 at 06:07 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Inspect another's transmog info?

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