Identify items on refund cooldown
Hi all
I am the author of a small addon Aardvark. I am trying to find a way to identify those items in my bags that can be sold back to the vendor for a full refund. Right now my addon sells items listed on player curated sell list. The issue is that items that have a value but are still within their refund time cannot be sold but the sell function equips the item instead. "You may sell this item to a vendor within 1 hour and 50 min for a full refund" Is there a way to identify items in my bag that are currently on their refund cooldown? |
Iterate your items and then scan the tooltip one each one. When you find a matching string REFUND_TIME_REMAINING then you have found your item.
https://www.townlong-yak.com/framexm...balStrings.lua Line 12151. |
Hi myrroddin
Thanks for your help. Unfortuantley when I scan the item tooltip I still cannot see the refund string. This is the code I use to scan the tooltip; Quote:
This is the output; Is there a step that I am missing or is there another way that will allow me to identify an item that is on the refund cooldown? |
Try using GetRegions:
Lua Code:
|
Hi Kanegasi
Thanks for that, unfortunately GetRegions returns the same info. My code; Code:
local scantip = CreateFrame("GameTooltip", "MyScanningTooltip", nil, "GameTooltipTemplate") |
I don't think an itemLink has refund information embedded in it. You will need to use an inventory function with bag, slot arguments to identify an exact item. My best guess is the 3rd return of GetContainerItemPurchaseInfo.
Code:
local money, itemCount, refundSec, currencyCount, hasEnchants = GetContainerItemPurchaseInfo(bag, slot, isEquipped) |
Hi Vrul
Thanks for suggesting the GetContainerItemPurchaseInfo unfortunately the returns are all coming back as nils, no matter if the boolean is true, false or empty. This is my code; Code:
for bag = 0, 4 do This one is really stumping me, any more suggestions would be fantastic. |
Hmm looking at function ContainerFrame_GetExtendedPriceString(itemButton, isEquipped, quantity) in https://github.com/tomrus88/Blizzard...ainerFrame.lua I am wondering if access to that information is restricted to when you are talking to a merchant ?
Try talking to a merchant and viewing that information then. |
Weird. Just to test I bought a 7th Legionnaire's Cloak. It didn't matter if I was at the vendor or flew away from town. The function returned: 8800000, 0, 7163, 0, false (obviously the 3rd return got smaller each time). The only things that returned nil were ones I could not sell back.
|
Hi Vrul
Thanks further testing. I have played with my chunk and finally got some sense out of it. This my working code; Lua Code:
This is the bag and the output; The strange outcomes are;
All in all a real bizarre output. I would like to get some better understanding of why the returns are all over the place but for now I am getting the result I need. Thanks to you all for your help. |
Quote:
money = How much copper the item can be returned for itemCount = The number of different items (tokens or such) the item can be returned for refundSec = How many seconds remain to be able to return the item for a refund currencyCount = The number of different currencies (from the currency tab) the item can be returned for You would then need to call GetContainerItemPurchaseItem or GetContainerItemPurchaseCurrency for each (1 to itemCount/currencyCount) to determine which items/currencies would be refunded. Quote:
|
Hi Vrul.
Sorry for the delayed response. Thanks for the further explanation, it does make sense. I really do love this community for the all the help and the detailed explanations. |
Are you trying to write a plugin for AdiBags that puts those items into a virtual group? Or is this intended to be agnostic to any other inventory AddOn?
|
Hi myrroddin
Aardvark is a stand alone sell, destroy and repair addon.:) |
All times are GMT -6. The time now is 04:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI