Update for Dragonflight bag API changes

This commit is contained in:
Andrew Tomaka 2022-11-17 21:03:27 -05:00
parent 6cfb35ebc5
commit 13224b547c
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -125,11 +125,11 @@ function events:PLAYER_UPDATE_RESTING(...)
end end
function ATMe.announceKey() function ATMe.announceKey()
for bag = 0, NUM_BAG_SLOTS do for bag = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag)do for slot = 1, C_ContainerGetContainerNumSlots(bag)do
itemID = GetContainerItemID(bag, slot) itemID = C_Container.GetContainerItemID(bag, slot)
if GetContainerItemID(bag, slot) == ATMe.keyItemID then if C_Container.GetContainerItemID(bag, slot) == ATMe.keyItemID then
local link = GetContainerItemLink(bag, slot) local link = C_Container.GetContainerItemLink(bag, slot)
SendChatMessage(link, "PARTY") SendChatMessage(link, "PARTY")
return return
@ -171,14 +171,19 @@ end
function ATMe.sellGrayItems() function ATMe.sellGrayItems()
sellTotal = 0 sellTotal = 0
for bag = 0, NUM_BAG_SLOTS do for bag = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag) do for slot = 1, C_Container.GetContainerNumSlots(bag) do
local _, count, _, quality, _, _, link = GetContainerItemInfo(bag, slot) local item = C_Container.GetContainerItemInfo(bag, slot)
local count = item and item.stackCount
local quality = item and item.quality
local link = item and item.hyperlink
if quality and quality == 0 then if quality and quality == 0 then
local price = select(11, GetItemInfo(link)) local price = select(11, GetItemInfo(link))
sellTotal = sellTotal + (price * count) sellTotal = sellTotal + (price * count)
print("Selling "..count.."x"..link) print("Selling "..count.."x"..link)
UseContainerItem(bag, slot) C_Container.UseContainerItem(bag, slot)
end end
end end
end end