Quantcast
WoWInterface - View Single Post - Inspect another's transmog info?
View Single Post
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