Quantcast Determine if an item is soulbound - WoWInterface
Thread Tools Display Modes
11-04-18, 01:42 AM   #1
doofus
A Theradrim Guardian
Join Date: Feb 2018
Posts: 65
Determine if an item is soulbound

I am parsing the tooltip for gear in my bags, and for each item it tells me either "Binds when picked up" or "Binds when equipped". It does that on gear that's either used/soulbound or unused in the bags.

For "Binds when equipped" gear, is there a way to find if it has been used, ie has become soulbound?
  Reply With Quote
11-04-18, 02:07 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 726
Your tooltip should show it.
This is taken from my addon ...

Lua Code:
  1. local cTip = CreateFrame("GameTooltip","PrivTooltip",nil,"GameTooltipTemplate")
  2. local function IsSoulbound(bag, slot)
  3.     cTip:SetOwner(UIParent, "ANCHOR_NONE")
  4.     cTip:SetBagItem(bag, slot)
  5.     cTip:Show()
  6.     for i = 1,cTip:NumLines() do
  7.         if(_G[name.."TooltipTextLeft"..i]:GetText()==ITEM_SOULBOUND) then
  8.             cTip:Hide()
  9.             return true
  10.         end
  11.     end
  12.     cTip:Hide()
  13.     return false
  14. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
11-04-18, 03:33 AM   #3
doofus
A Theradrim Guardian
Join Date: Feb 2018
Posts: 65
Thanks, I need to try that.

Currently I am using ...

-- https://wow.gamepedia.com/API_GetCursorInfo
local infoType, cursorItemID, cursorItemLink = GetCursorInfo();

... because the item is on the cursor.

I am also using the "GET_ITEM_INFO_RECEIVED" event and the "CHAT_MSG_LOOT" messages to get hold of item strings, therefore the items may not in my bags at all.

Therefore for the tooltip I use

GameTooltip:SetOwner(UIParent,"ANCHOR_NONE");
GameTooltip:SetHyperlink(itemLink);
  Reply With Quote
11-04-18, 02:25 PM   #4
Kemayo
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 41
You can do this without tooltip scanning now, with the C_Item APIs:


Code:
C_Item.IsBound(ItemLocation:CreateFromBagAndSlot(bag, slot))
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Determine if an item is soulbound

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