Scrap (Junk Seller)

Scrap (Junk Seller)

21M Downloads

[Enhancement] Report items destroyed and keep total

b-morgan opened this issue ยท 0 comments

commented

Please consider including the following patch to Scrap_Cleaner.lua, perhaps with an option to turn it on or off. This patch prints a message when an item is destroyed with its value and updates and prints a total value of items destroyed with a slash command to clear the total.

I find this useful when farming to decide when to quit and return to a vendor when my bags are full.

--- D:/WoWNew/Scrap_Cleaner/Scrap_Cleaner.lua	Thu Jan 16 23:37:40 2020
+++ D:/WoWNew2/Scrap_Cleaner/Scrap_Cleaner.lua	Fri Jan 03 06:31:12 2020
@@ -16,6 +16,21 @@
 --]]
 
 local Cleaner = Scrap:NewModule('Cleaner')
+local totalValue = Cleaner.totalValue
+totalValue = 0
+
+SLASH_SCRAPCLEAN1 = "/scrapclean"
+SLASH_SCRAPCLEAN2 = "/sc"
+SlashCmdList["SCRAPCLEAN"] = function(msg)
+	if msg then
+		if msg == "total" then
+			print("Scrap_Cleaner total= "..GetMoneyString(totalValue))
+		elseif msg == "clear" then
+			totalValue = 0
+			print("Scrap_Cleaner total cleared")
+		end
+	end
+end
 
 function Cleaner:OnEnable()
 	self:RegisterEvent('ITEM_UNLOCKED', 'OnEvent')
@@ -56,6 +71,12 @@
 
 	if bestBag and bestSlot then
 		PickupContainerItem(bestBag, bestSlot)
+				local infoType, info1, info2 = GetCursorInfo()
+				if info2 then
+					totalValue = totalValue + bestValue
+					print("|cf0f00000You destroy loot: |r"..info2..
+						",  "..GetMoneyString(bestValue)..",  "..GetMoneyString(totalValue))
+				end
 		DeleteCursorItem()
 	end
 end