Auto Sell Grey & Repair

Auto Sell Grey & Repair

258k Downloads

Upgrade suggestion

Melethrion opened this issue ยท 4 comments

commented

Hey there,

with the new function I'd suggest an update from bagslot-iteration to C_MerchantFrame.SellAllJunkItems() - which would surpass the limited count on items able to be sold at once when using the iteration method and thus would sell all greys at once.

Cheers

commented

Will have to rework how we get the total value of sold items as the new function does not return this information. Will have to use gold in bag before selling - gold in bag after selling I think?

commented

nah, i tried it, you can keep everything except how you sell tiems. just let it still iterate through the junk to count the value then sell via command after that loop, like:

-- Auto Sell Grey Items
totalPrice = 0	
for myBags = 0,4 do
	for bagSlots = 1, C_Container.GetContainerNumSlots(myBags) do
		CurrentItemLink = C_Container.GetContainerItemLink(myBags, bagSlots)
		if CurrentItemLink then
			_, _, itemRarity, _, _, _, _, _, _, _, itemSellPrice = GetItemInfo(CurrentItemLink)
			itemInfo = C_Container.GetContainerItemInfo(myBags, bagSlots)
			if itemRarity == 0 and itemSellPrice ~= 0 then
				totalPrice = totalPrice + (itemSellPrice * itemInfo.stackCount)
				--C_Container.UseContainerItem(myBags, bagSlots)
				--PickupMerchantItem()
			end
		end
	end
end
if totalPrice ~= 0 then
	C_MerchantFrame.SellAllJunkItems() -- here
	DEFAULT_CHAT_FRAME:AddMessage("Items were sold for "..GetCoinTextureString(totalPrice), 255, 255, 255)
end

etc.

commented

thinking about it, of course you could as well just minimize the code to the new command and dump the loop by just comparing the two mentioned values of gold in bags. i was actually being lazy. :D but this as a first step would at least finally get rid of that hidden cap of 12 or so items that do sell at the most if bags are really cluttered...

p.s.: great. now i've got to resist the urge to just do that as well. it's itching. a lot. >.<

commented

Sounds like you should just make a PR =P