From 42f27f355d21a2146a167fd2f963403dc8c6face Mon Sep 17 00:00:00 2001 From: atomaka Date: Sun, 21 Feb 2021 16:44:11 +0000 Subject: [PATCH] Provide more detailed info when selling (#12) --- MyAddon.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index d8bf2ed..6686649 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -153,15 +153,21 @@ function MyAddon.needsRepair() end function MyAddon.sellGrayItems() + sellTotal = 0 for bag = 0, NUM_BAG_SLOTS do for slot = 1, GetContainerNumSlots(bag) do - local name = GetContainerItemLink(bag, slot) - if name and string.find(name, "ff9d9d9d") then - print("Selling "..name) + local _, count, _, quality, _, _, link = GetContainerItemInfo(bag, slot) + if quality and quality == 0 then + local price = select(11, GetItemInfo(link)) + sellTotal = sellTotal + (price * count) + print("Selling "..count.."x"..link) UseContainerItem(bag, slot) end end end + if sellTotal ~= 0 then + print("Made "..GetCoinTextureString(sellTotal)) + end end function MyAddon.amTankInParty()