soulbound and in collection check

This commit is contained in:
Anch
2023-10-28 20:40:56 +13:00
parent 442e74f557
commit 5499501fd8
2 changed files with 17 additions and 2 deletions
+16 -1
View File
@@ -149,6 +149,21 @@ function PM:UNIT_SPELLCAST_SUCCEEDED(event, arg1, arg2)
PM:RemoveItem(arg2) PM:RemoveItem(arg2)
end end
local cTip = CreateFrame("GameTooltip","cTooltip",nil,"GameTooltipTemplate")
local function IsSoulbound(bag, slot)
cTip:SetOwner(UIParent, "ANCHOR_NONE")
cTip:SetBagItem(bag, slot)
cTip:Show()
for i = 1,cTip:NumLines() do
if(_G["cTooltipTextLeft"..i]:GetText()==ITEM_SOULBOUND) then
return true
end
end
cTip:Hide()
return false
end
-- returns true, if player has item with given ID in inventory or bags and it's not on cooldown -- returns true, if player has item with given ID in inventory or bags and it's not on cooldown
function PM:HasItem(itemID) function PM:HasItem(itemID)
local item, found, id local item, found, id
@@ -179,7 +194,7 @@ function PM:RemoveItem(arg2)
for _, item in ipairs(items) do for _, item in ipairs(items) do
if arg2 == item[2] then if arg2 == item[2] then
local found, bag, slot = PM:HasItem(item[1]) local found, bag, slot = PM:HasItem(item[1])
if found then if found and C_VanityCollection.IsCollectionItemOwned(item[1]) and IsSoulbound(bag, slot) then
PickupContainerItem(bag, slot) PickupContainerItem(bag, slot)
DeleteCursorItem() DeleteCursorItem()
end end
+1 -1
View File
@@ -7,6 +7,6 @@
## X-Category: Profession ## X-Category: Profession
## X-OptionsFrame: ProfessionMenuOptionsFrame ## X-OptionsFrame: ProfessionMenuOptionsFrame
## DefaultState: enabled ## DefaultState: enabled
## Version: 0.9 ## Version: 0.10
embeds.xml embeds.xml