Quantcast

bugfixes, money earned can be shown in tooltip

ckaotik [01-11-10 - 11:44]
bugfixes, money earned can be shown in tooltip
Filename
Broker_Garbage.toc
core.lua
deDE.lua
enUS.lua
options.lua
diff --git a/Broker_Garbage.toc b/Broker_Garbage.toc
index dc1ad6c..e6dab94 100644
--- a/Broker_Garbage.toc
+++ b/Broker_Garbage.toc
@@ -8,7 +8,7 @@
 ## Notes: Full bags no more! Find your least valuable item .. and destroy it!
 ## Notes-deDE: Endlich wieder Platz! Finde dein billigstes Item ... und zerstöre es.
 ## Author: ckaotik
-## Version: 3.3v4
+## Version: 3.3v8
 ## X-Category: Inventory
 ## X-Credits: GarbageFu, Tekkub

diff --git a/core.lua b/core.lua
index a6e960f..9ba6e27 100644
--- a/core.lua
+++ b/core.lua
@@ -21,29 +21,29 @@ BrokerGarbage.defaultSettings = {
 	dropQuality = 0,
 	exclude = {},
 	include = {},
+	forceVendorPrice = {},		-- TODO options
+	autoSellList = {},			-- TODO options
 	showMoney = 2,
 	autoSellToVendor = true,
+	showAutoSellIcon = true,
 	autoRepairAtVendor = true,
+	neverRepairGuildBank = false,
 	tooltipMaxHeight = 220,
 	tooltipNumItems = 10,
 	moneyLostByDeleting = 0,
-	neverRepairGuildBank = false,
+	showLost = true,
+	moneyEarned = 0,
+	showEarned = true,
+	showWarnings = true,		-- TODO options
 }

--- check for settings
-if not BG_GlobalDB then BG_GlobalDB = {} end
-for key, value in pairs(BrokerGarbage.defaultSettings) do
-	if BG_GlobalDB[key] == nil then
-		BG_GlobalDB[key] = value
-	end
-end
-
 -- internal locals
 local debug = false
 local locked = false
 local loaded = false
 local sellValue = 0
 local cost = 0
+local lastReminder = time()

 BrokerGarbage.tt = nil

@@ -58,7 +58,7 @@ local function eventHandler(self, event, ...)
 	elseif (locked or cost ~=0) and event == "PLAYER_MONEY" then
 		-- regular unlock

-		-- wrong player_money event
+		-- wrong player_money event (resulting from repair, not sell)
 		-- testing: add a span for wich we recognize this one as repair bill
 		if sellValue ~= 0 and cost ~= 0 and ((-1)*sellValue <= cost+2 and (-1)*sellValue >= cost-2) then
 			BrokerGarbage:Debug("Not yet ... Waiting for actual money change.")
@@ -98,11 +98,32 @@ local function eventHandler(self, event, ...)

 		BrokerGarbage:ScanInventory()

-	elseif event == "PLAYER_ENTERING_WORLD" or event == "BAG_UPDATE" then
-		-- don't bother calculating while selling stuff
+	elseif event == "PLAYER_ENTERING_WORLD" then
+		local warnings = {}
+
+		-- check for settings
+		if not BG_GlobalDB then BG_GlobalDB = {} end
+		for key, value in pairs(BrokerGarbage.defaultSettings) do
+			BrokerGarbage:Debug("Testing key, value", key, value)
+			if BG_GlobalDB[key] == nil then
+				BrokerGarbage:Debug("key not existant", key)
+				BG_GlobalDB[key] = value
+			end
+		end
+
+		if not locked and loaded then
+			warnings = BrokerGarbage:ScanInventory()
+		end
+
+		for _,text in pairs(warnings) do
+			BrokerGarbage:Print("|cfff0000Warning:|r ", text)
+		end
+
+	elseif event == "BAG_UPDATE" then
 		if not locked and loaded then
 			BrokerGarbage:ScanInventory()
 		end
+
 	end
 end

@@ -114,8 +135,61 @@ frame:RegisterEvent("MERCHANT_CLOSED")
 frame:RegisterEvent("PLAYER_MONEY")
 frame:RegisterEvent("PLAYER_ENTERING_WORLD")
 frame:RegisterEvent("BAG_UPDATE")
+
 frame:SetScript("OnEvent", eventHandler)

+local orig_MerchantFrame_UpdateRepairButtons = MerchantFrame_UpdateRepairButtons
+function MerchantFrame_UpdateRepairButtons(...)
+	orig_MerchantFrame_UpdateRepairButtons(...)
+
+	if not BG_GlobalDB.showAutoSellIcon then
+		-- resets guild repair icon
+		MerchantGuildBankRepairButton:ClearAllPoints()
+		MerchantGuildBankRepairButton:SetPoint("LEFT", MerchantRepairAllButton, "RIGHT", 4, 0)
+
+		if _G["BrokerGarbage_SellIcon"] then
+			BrokerGarbage_SellIcon:Hide()
+		end
+		return
+	end
+
+	local iconbutton
+	-- show auto-sell icon on vendor frame
+	if not _G["BrokerGarbage_SellIcon"] then
+		iconbutton = CreateFrame("Button", "BrokerGarbage_SellIcon", MerchantBuyBackItemItemButton)
+		iconbutton:SetWidth(36); iconbutton:SetHeight(36)
+		iconbutton:SetNormalTexture("Interface\\Icons\\achievement_bg_returnxflags_def_wsg")
+		iconbutton:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
+		iconbutton:SetScript("OnClick", BrokerGarbage.AutoSell)
+		iconbutton:SetScript("OnEnter", function(self)
+			GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+			GameTooltip:SetText(BrokerGarbage.locale.autoSellTooltip, nil, nil, nil, nil, true)
+		end)
+		iconbutton:SetScript("OnLeave", function() GameTooltip:Hide() end)
+	else
+		iconbutton = _G["BrokerGarbage_SellIcon"]
+	end
+
+	if CanMerchantRepair() then
+		if CanGuildBankRepair() then
+			MerchantGuildBankRepairButton:ClearAllPoints()
+			MerchantGuildBankRepairButton:SetPoint("BOTTOMRIGHT", MerchantBuyBackItemItemButton, "BOTTOMLEFT", -22, 4)
+			MerchantRepairAllButton:SetPoint("BOTTOMRIGHT", MerchantGuildBankRepairButton, "BOTTOMLEFT", -4, 0)
+			iconbutton:SetPoint("BOTTOMRIGHT", MerchantRepairItemButton, "BOTTOMLEFT", -4, 1)
+			iconbutton:SetWidth(30); iconbutton:SetHeight(30)
+		else
+			iconbutton:SetWidth(36); iconbutton:SetHeight(36)
+			iconbutton:SetPoint("BOTTOMRIGHT", MerchantRepairItemButton, "BOTTOMLEFT", -4, 0)
+		end
+
+		iconbutton:Show()
+	else
+		iconbutton:SetPoint("BOTTOMRIGHT", MerchantBuyBackItemItemButton, "BOTTOMLEFT", -18, 0)
+		iconbutton:Show()
+	end
+	MerchantRepairText:Hide()
+end
+
 loaded = true

 -- Helper functions
@@ -124,6 +198,13 @@ function BrokerGarbage:Print(text)
 	DEFAULT_CHAT_FRAME:AddMessage("|cffee6622Broker_Garbage|r "..text)
 end

+function BrokerGarbage:Warning(text)
+	if showWarnings and time() - lastReminder >= 5 then
+		BrokerGarbage:Print("|cfff0000Warning:|r ", text)
+		lastReminder = time()
+	end
+end
+
 function BrokerGarbage:Debug(...)
   if debug then
 	BrokerGarbage:Print("! "..string.join(", ", tostringall(...)))
@@ -200,8 +281,52 @@ function BrokerGarbage:Count(table)
   return i
 end

-function BrokerGarbage:ResetMoneyLost()
-	BG_GlobalDB.moneyLostByDeleting = 0
+function BrokerGarbage:ResetMoney(which)
+	if which == 0 then
+		BG_GlobalDB.moneyLostByDeleting = 0
+	elseif which == 1 then
+		BG_GlobalDB.moneyEarned = 0
+	end
+end
+
+function BrokerGarbage:CanDisenchant(itemLink)
+	if (itemLink) then
+		local _, _, quality, level, _, _, _, count, slot = GetItemInfo(itemLink)
+
+		-- stackables are not DE-able
+		if quality and quality >= 2 and
+			string.find(slot, "INVTYPE") and not string.find(slot, "BAG")
+			and (not count or count == 1) then
+
+			-- can we DE ourselves?
+			local enchanting = GetSpellInfo(7411)
+			if IsUsableSpell(enchanting) then
+				local skill
+				for i=1, GetNumSkillLines() do
+					local name, _, _, skillRank, _, _, _, _, _, _, _, _, _ = GetSkillLineInfo(i)
+					if name == enchanting then
+						skill = skillRank
+						break
+					end
+				end
+
+				local requiredSkill = 5*5*math.ceil(level/5)-100
+				-- fix low-level items
+				if requiredSkill <= 0 then
+					requiredSkill = 1
+				end
+
+				if skill >= requiredSkill then
+					return true
+				end
+				-- if skill is too low, still check if we can send it
+			end
+
+			-- so we can't DE, but can we send it to someone who may? i.e. is the item soulbound?
+
+		end
+	end
+	return false
 end

 -- basic functionality from here
@@ -240,11 +365,22 @@ function BrokerGarbage:Tooltip(wut)
 			BrokerGarbage:FormatMoney(cheapList[i].value))
 		BrokerGarbage.tt:SetLineScript(lineNum, "OnMouseDown", BrokerGarbage.OnClick, cheapList[i])
 	end
+	if lineNum == nil then
+		BrokerGarbage.tt:AddLine(BrokerGarbage.locale.noItems, '', '')
+	end

 	-- add useful(?) information
-	BrokerGarbage.tt:AddSeparator(2)
-	BrokerGarbage.tt:AddLine(BrokerGarbage.locale.moneyLost, '', BrokerGarbage:FormatMoney(BG_GlobalDB.moneyLostByDeleting))
-
+	if (BG_GlobalDB.showLost and BG_GlobalDB.moneyLostByDeleting ~= 0)
+		or (BG_GlobalDB.showEarned and BG_GlobalDB.moneyEarned ~= 0) then
+		BrokerGarbage.tt:AddSeparator(2)
+
+		if BG_GlobalDB.moneyLostByDeleting ~= 0 then
+			BrokerGarbage.tt:AddLine(BrokerGarbage.locale.moneyLost, '', BrokerGarbage:FormatMoney(BG_GlobalDB.moneyLostByDeleting))
+		end
+		if BG_GlobalDB.moneyEarned ~= 0 then
+			BrokerGarbage.tt:AddLine(BrokerGarbage.locale.moneyEarned, '', BrokerGarbage:FormatMoney(BG_GlobalDB.moneyEarned))
+		end
+	end

 	-- Use smart anchoring code to anchor the tooltip to our frame
 	BrokerGarbage.tt:SmartAnchorTo(wut)
@@ -274,11 +410,12 @@ end
 -- onClick function for when you ... click
 function BrokerGarbage:OnClick(itemTable, button)
 	BrokerGarbage:Debug("Click!", button)
+	BrokerGarbage:Debug("Table", itemTable, itemTable.itemID)

-	if itemTable.data.label == "Garbage" then
-		cheapList = BrokerGarbage:GetCheapest()
-		itemTable = cheapList[1] or nil
-	end
+	-- handle LDB clicks seperately
+	if not itemTable.itemID or type(itemTable.itemID) ~= "number" then
+		itemTable = BrokerGarbage.cheapestItem
+	end

 	-- handle different clicks
 	if itemTable and IsShiftKeyDown() then
@@ -312,34 +449,46 @@ function BrokerGarbage:GetItemValue(itemLink, count)
 	local vendorPrice = select(11,GetItemInfo(itemLink))
 	local auctionPrice, disenchantPrice, temp

+	if vendorPrice == 0 then vendorPrice = nil end
 	if not count then count = GetItemCount(itemLink, false, false) end

-	-- gray items on the AH? yeah, right ... shortcut here
-	if select(3,GetItemInfo(itemLink)) == 0 then return vendorPrice*count end
-
-	-- TODO: set "always use vendor price"
+	-- gray items on the AH / forced vendor price
+	if select(3,GetItemInfo(itemLink)) == 0 or BG_GlobalDB.forceVendorPrice[itemID] then
+		return vendorPrice and vendorPrice*count or nil
+	end

 	-- calculate auction value
 	-- TODO: update/support more
 	if IsAddOnLoaded("Auctionator") then
 		auctionPrice = Atr_GetAuctionBuyout(itemLink)
 		disenchantPrice = Atr_GetDisenchantValue(itemLink)
+
+	elseif IsAddOnLoaded("AuctionLite") then
+		auctionPrice = AuctionLite:GetAuctionValue(itemLink)
+		disenchantPrice = AuctionLite:GetDisenchantValue(itemLink)
+
+	elseif IsAddOnLoaded("WOWEcon_PriceMod")  then
+		auctionPrice = Wowecon.API.GetAuctionPrice_ByLink(itemLink, Wowecon.API.SERVER_PRICE)
+
+		disenchantPrice = 0
+		local DeData = Wowecon.API.GetDisenchant_ByLink(itemLink)
+		for i,data in pairs(DeData) do
+			disenchantPrice = disenchantPrice + (Wowecon.API.GetAuctionPrice_ByLink(data[1], Wowecon.API.SERVER_PRICE) * data[3])
+		end

 	elseif IsAddOnLoaded("Auc-Advanced") then
 		auctionPrice = AucAdvanced.API.GetMarketValue(itemLink)
-
+		-- TODO: get enchantrix values
+
 	else
 		auctionPrice = GetAuctionBuyout and GetAuctionBuyout(itemLink) or nil
-		if not auctionPrice then
-			-- BrokerGarbage:Print("No auction values available!")
-		end
+		disenchantPrice = GetDisenchantValue and GetDisenchantValue(itemLink) or nil
+
+		-- no auctionPrice => no auction addon loaded
 	end

-	-- TODO: also use DE price when an item is NOT soulbound
-	-- can enchant & disenchantPrice & item is at least green & equippable
-	local enchanting = GetSpellInfo(7411)
-	if IsUsableSpell(enchanting) and disenchantPrice and
-			select(3,GetItemInfo(itemLink)) >= 2 and string.find(select(9,GetItemInfo(itemLink)), "INVTYPE") then
+	-- DE items might be worth more than auction selling
+	if BrokerGarbage:CanDisenchant(itemID) then
 		auctionPrice = (disenchantPrice > auctionPrice) and disenchantPrice or auctionPrice
 	end

@@ -356,6 +505,7 @@ function BrokerGarbage:GetItemValue(itemLink, count)
 			temp = 0
 		end

+		-- return highest price found
 		if vendorPrice > temp then
 			return vendorPrice * count
 		else
@@ -383,6 +533,7 @@ end
 function BrokerGarbage:ScanInventory()
 	BrokerGarbage.inventory = {}
 	local cheapestItem
+	local warnings = {}

 	for container = 0,4 do
 		for slot = 1, GetContainerNumSlots(container) do
@@ -392,16 +543,19 @@ function BrokerGarbage:ScanInventory()
 				local _,count,locked,_,_,canOpen,itemLink = GetContainerItemInfo(container, slot)
 				local quality = select(3,GetItemInfo(itemID))

-				if canOpen and showSpam then
-					BrokerGarbage:Print(format(BrokerGarbage.locale.openPlease, select(2,GetItemInfo(itemID))))
+				if canOpen and showWarnings then
+					tinsert(warnings, format(BrokerGarbage.locale.openPlease,
+						select(2,GetItemInfo(itemID))))
 				end

-				if quality and (quality <= BG_GlobalDB.dropQuality or BG_GlobalDB.include[itemID])
-				  and not BG_GlobalDB.exclude[itemID] then
-				  --and not BrokerGarbage:Find(BG_GlobalDB.exclude, itemID) then
+				if quality and
+					(quality <= BG_GlobalDB.dropQuality or BG_GlobalDB.include[itemID])
+					and not BG_GlobalDB.exclude[itemID] then
+
 					local value = BrokerGarbage:GetItemValue(itemLink,count)
-					if BG_GlobalDB.include[itemID] then value = 1 end
-					if value ~= 0 then
+					-- make included items appear in tooltip list
+					if BG_GlobalDB.include[itemID] and not value then value = 0 end
+					if value then
 						local currentItem = {
 							bag = container,
 							slot = slot,
@@ -422,10 +576,17 @@ function BrokerGarbage:ScanInventory()
 	end

 	if cheapestItem then
-		LDB.text = select(2,GetItemInfo(cheapestItem.itemID)).."x".. cheapestItem.count .." (".. BrokerGarbage:FormatMoney(cheapestItem.value) ..")"
+		LDB.text = format("%sx%d (%s)",
+			select(2,GetItemInfo(cheapestItem.itemID)),
+			cheapestItem.count,
+			BrokerGarbage:FormatMoney(cheapestItem.value))
+		BrokerGarbage.cheapestItem = cheapestItem
 	else
 		LDB.text = BrokerGarbage.locale.label
+		BrokerGarbage.cheapestItem = nil
 	end
+
+	return warnings
 end

 -- returns the n cheapest items in your bags
@@ -456,18 +617,21 @@ end
 -- special functionality
 -- ---------------------------------------------------------
 -- when at a merchant this will clear your bags of junk (gray quality)
-function BrokerGarbage:AutoSell()
-	if BG_GlobalDB.autoSellToVendor then
+function BrokerGarbage:AutoSell(self)
+	if BG_GlobalDB.autoSellToVendor or self == _G["BrokerGarbage_SellIcon"] then
 		local i = 1
 		sellValue = 0
 		for _, itemTable in pairs(BrokerGarbage.inventory) do
-			if (itemTable.quality == 0 and not BrokerGarbage:Find(BG_GlobalDB.exclude, itemTable.itemID))
-			  or BG_GlobalDB.include[itemTable.itemID] then
+			if (itemTable.quality == 0
+				and not BrokerGarbage:Find(BG_GlobalDB.exclude, itemTable.itemID))
+				or (BG_GlobalDB.include[itemTable.itemID] and itemTable.value ~= 0) then
+
 				if i == 1 then
 					BrokerGarbage:Debug("locked")
 					locked = true
 				end
 				sellValue = sellValue + itemTable.value
+				BG_GlobalDB.moneyEarned = BG_GlobalDB.moneyEarned + itemTable.value
 				UseContainerItem(itemTable.bag, itemTable.slot)
 				i = i+1
 			end
@@ -493,12 +657,18 @@ end

 -- Wishlist
 -- ---------------------------------------------------------
--- Notice: When trying to stop BG from auto selling/repairing, hold Shift when adressing a merchant
+-- make "autosell" list - e.g. mages selling dropped water/food [quickfix: use include list] - sell list (like include, only always sells)
+-- include types on character specific settings
 -- show lootable containers in your bag! make "open items" not as spammy
--- increase/decrease loot treshold with mousewheel
+-- increase/decrease loot treshold with mousewheel on LDB
 -- restack if necessary
--- force vendor price (food and stuff extremely overprice in the AH)
--- make "autosell" list - e.g. mages selling dropped water/food [quickfix: use include list]
-
--- local selectiveLooting = false
--- local askWhenDeleting = true, askWhenDeletingTreshold
\ No newline at end of file
+-- force vendor price (food and stuff extremely overpriced in the AH) on some items
+-- manually set item price
+-- include list: set value / use value
+-- ask before deleting / treshold
+-- search list frames (similar to gnomishvendorshrinker)
+-- fubar_garbagefu: Soulbound, Quest, Bind on Pickup, Bind on Equip/Use.
+-- types: Normal Food, Bonus Food, Stat Food, Conjured Bread, Raw Food, Bread, Fish, percent food/water, combi food/drink....
+-- ignore special bags
+-- drop-beyond-treshold: only keep 5 soulshards
+-- feature: selective looting (only crafting materials, greens+ , ...)
\ No newline at end of file
diff --git a/deDE.lua b/deDE.lua
index dd2ff51..b21c03b 100644
--- a/deDE.lua
+++ b/deDE.lua
@@ -24,18 +24,31 @@ BrokerGarbage.locale = {
 	headerRightClick = "Rechts-Klick \195\182ffnet Optionen",
 	headerShiftClick = "SHIFT-Klick: Zerst\195\182ren",
 	headerCtrlClick = "STRG-Klick: Behalten",
-	moneyLost = "Geld verloren:",
+	moneyLost = "Gold verloren:",
+	moneyEarned = "Gold verdient:",
+	noItems = "Keine Items zum L\195\182schen.",
+
+	autoSellTooltip = "Graue Items verkaufen.",

 	-- Options Frame
 	subTitle = "M\195\182chtest du einmal nicht automatisch verkaufen / reparieren? \nHalte SHIFT gedr\195\188ckt, wenn du den H\195\164ndler ansprichst!",
 	autoSellTitle = "Automatisch Verkaufen",
 	autoSellText = "Wenn ausgew\195\164hlt, werden graue Gegenst\195\164nde automatisch beim H\195\164ndler verkauft.",

+	showAutoSellIconTitle = "Icon anzeigen",
+	showAutoSellIconText = "Wenn ausgew\195\164hlt, wird bei H\195\164ndlern ein Icon zum automatischen Verkaufen angezeigt.",
+
 	autoRepairTitle = "Automatisch Reparieren",
 	autoRepairText = "Wenn ausgew\195\164hlt, wird deine Ausr\195\188stung automatisch repariert wenn m\195\182glich.",

 	autoRepairGuildTitle = "Reparatur selbst zahlen",
-	autoRepairGuildText = "Wenn ausgew\195\164hlt wird Broker_Garbage nicht auf Gildenkosten reparieren.",
+	autoRepairGuildText = "Wenn ausgew\195\164hlt, wird Broker_Garbage nicht auf Gildenkosten reparieren.",
+
+	showLostTitle = "'Verlorenes Gold' zeigen",
+	showLostText = "Wenn ausgew\195\164hlt, wird im Tooltip die Zeile 'Verlorenes Gold' gezeigt.",
+
+	showEarnedTitle = "'Verdientes Gold' zeigen",
+	showEarnedText = "Wenn ausgew\195\164hlt, wird im Tooltip die Zeile 'Verdientes Gold' gezeigt.",

 	dropQualityTitle = "Item Qualit\195\164t",
 	dropQualityText = "W\195\164hle, bis zu welcher Qualit\195\164t Items zum L\195\182schen vorgeschlagen werden. Standard: Schlecht (0)",
@@ -55,6 +68,9 @@ BrokerGarbage.locale = {
 	resetMoneyLost = "'Verlorenes Geld' leeren",
 	resetMoneyLostText = "Klicke um die Statistik 'Verlorenes Geld' zur\195\188ckzusetzen.",

+	resetMoneyEarned = "'Verdientes Geld' leeren",
+	resetMoneyEarnedText = "Klicke um die Statistik 'Verdientes Geld' zur\195\188ckzusetzen.",
+
 	emptyExcludeList = "Ausschlussliste leeren",
 	emptyExcludeListText = "Klicke um deine Ausschlussliste zu leeren.",

diff --git a/enUS.lua b/enUS.lua
index dd0e105..79b2b13 100644
--- a/enUS.lua
+++ b/enUS.lua
@@ -19,18 +19,31 @@ BrokerGarbage.locale = {
 	headerShiftClick = "SHIFT-Click: Destroy",
 	headerCtrlClick = "CTRL-Click: Keep",
 	moneyLost = "Money Lost:",
+	moneyEarned = "Money Earned:",
+	noItems = "No items to delete.",
+
+	autoSellTooltip = "Sell gray items.",

 	-- Options Frame
 	subTitle = "Don't want to auto-sell/repair? \nHold Shift when adressing the merchant!",
 	autoSellTitle = "Auto Sell",
 	autoSellText = "Toggles whether to automatically sell your gray items when at a vendor.",

+	showAutoSellIconTitle = "Show Icon",
+	showAutoSellIconText = "Toggles whether to show an icon to manually auto-sell when at a vendor.",
+
 	autoRepairTitle = "Auto Repair",
 	autoRepairText = "Toggles whether to automatically repair your gear when at a vendor.",

 	autoRepairGuildTitle = "No Guild Repair",
 	autoRepairGuildText = "If selected, Broker_Garbage will never try to repair using the guild bank's money",

+	showLostTitle = "Show Money Lost",
+	showLostText = "Toggles whether to show the tooltip line 'Money Lost'.",
+
+	showEarnedTitle = "Show Money Earned",
+	showEarnedText = "Toggles whether to show the tooltip line 'Money Earned'.",
+
 	dropQualityTitle = "Drop Quality",
 	dropQualityText = "Select up to which treshold items may be listed as deletable. Default: Poor (0)",

@@ -49,6 +62,9 @@ BrokerGarbage.locale = {
 	resetMoneyLost = "Reset Money Lost Data",
 	resetMoneyLostText = "Click to reset the amount of money lost by deleting items.",

+	resetMoneyEarned = "Reset Money Earned Data",
+	resetMoneyEarnedText = "Click to reset the amount of money earned by auto-selling items.",
+
 	emptyExcludeList = "Empty Exclude List",
 	emptyExcludeListText = "Click to clear your exclude list.",

diff --git a/options.lua b/options.lua
index e8cb21a..0b606be 100644
--- a/options.lua
+++ b/options.lua
@@ -15,6 +15,7 @@ BrokerGarbage.options = CreateFrame("Frame", "BrokerGarbageOptionsFrame", Interf
 BrokerGarbage.options.name = addonName
 BrokerGarbage.options:Hide()

+-- list options panel
 BrokerGarbage.listOptions = CreateFrame("Frame", "BrokerGarbageOptionsFrame", InterfaceOptionsFramePanelContainer)
 BrokerGarbage.listOptions.name = BrokerGarbage.locale.LOTitle
 BrokerGarbage.listOptions.parent = addonName
@@ -25,6 +26,7 @@ BrokerGarbage.listButtons = {
 	exclude = {},
 }

+-- show me!
 BrokerGarbage.options:SetScript("OnShow", function(frame)

 	local title, subtitle = LibStub("tekKonfig-Heading").new(BrokerGarbage.options, addonName, BrokerGarbage.locale.subTitle)
@@ -34,9 +36,18 @@ BrokerGarbage.options:SetScript("OnShow", function(frame)
 	autosell:SetChecked(BG_GlobalDB.autoSellToVendor)
 	local checksound = autosell:GetScript("OnClick")
 	autosell:SetScript("OnClick", function(checksound)
-		checksound(checksound)
+		checksound(autosell)
 		BG_GlobalDB.autoSellToVendor = not BG_GlobalDB.autoSellToVendor
 	end)
+
+	local autosellicon = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showAutoSellIconTitle, "TOPLEFT", autosell, "BOTTOMLEFT", 14, 0)
+	autosellicon.tiptext = BrokerGarbage.locale.showAutoSellIconText
+	autosellicon:SetChecked(BG_GlobalDB.showAutoSellIcon)
+	local checksound = autosellicon:GetScript("OnClick")
+	autosellicon:SetScript("OnClick", function(autosellicon)
+		checksound(autosellicon)
+		BG_GlobalDB.showAutoSellIcon = not BG_GlobalDB.showAutoSellIcon
+	end)

 	local autorepair = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.autoRepairTitle, "LEFT", autosell, "LEFT", 200, 0)
 	autorepair.tiptext = BrokerGarbage.locale.autoRepairText
@@ -47,7 +58,7 @@ BrokerGarbage.options:SetScript("OnShow", function(frame)
 		BG_GlobalDB.autoRepairAtVendor = not BG_GlobalDB.autoRepairAtVendor
 	end)

-	local guildrepair = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.autoRepairGuildTitle, "TOPLEFT", autorepair, "BOTTOMLEFT", 0, 0)
+	local guildrepair = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.autoRepairGuildTitle, "TOPLEFT", autorepair, "BOTTOMLEFT", 14, 0)
 	guildrepair.tiptext = BrokerGarbage.locale.autoRepairGuildText
 	guildrepair:SetChecked(BG_GlobalDB.neverRepairGuildBank)
 	local checksound = guildrepair:GetScript("OnClick")
@@ -55,8 +66,26 @@ BrokerGarbage.options:SetScript("OnShow", function(frame)
 		checksound(guildrepair)
 		BG_GlobalDB.neverRepairGuildBank = not BG_GlobalDB.neverRepairGuildBank
 	end)
+
+	local showlost = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showLostTitle, "TOPLEFT", autosellicon, "BOTTOMLEFT", -14, -10)
+	showlost.tiptext = BrokerGarbage.locale.showLostText
+	showlost:SetChecked(BG_GlobalDB.showLost)
+	local checksound = showlost:GetScript("OnClick")
+	showlost:SetScript("OnClick", function(showlost)
+		checksound(showlost)
+		BG_GlobalDB.showLost = not BG_GlobalDB.showLost
+	end)
+
+	local showearned = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showEarnedTitle, "LEFT", showlost, "LEFT", 200, 0)
+	showearned.tiptext = BrokerGarbage.locale.showEarnedText
+	showearned:SetChecked(BG_GlobalDB.showEarned)
+	local checksound = showearned:GetScript("OnClick")
+	showearned:SetScript("OnClick", function(showearned)
+		checksound(showearned)
+		BG_GlobalDB.showEarned = not BG_GlobalDB.showEarned
+	end)

-	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.options, BrokerGarbage.locale.dropQualityTitle, 0, 6, "TOPLEFT", autosell, "BOTTOMLEFT", 2, -50)
+	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.options, BrokerGarbage.locale.dropQualityTitle, 0, 6, "TOPLEFT", showlost, "BOTTOMLEFT", 2, -50)
 	quality.tiptext = BrokerGarbage.locale.dropQualityText
 	quality:SetWidth(200)
 	quality:SetValueStep(1);
@@ -126,7 +155,15 @@ BrokerGarbage.options:SetScript("OnShow", function(frame)
 	resetmoneylost.tiptext = BrokerGarbage.locale.resetMoneyLostText
 	resetmoneylost:SetWidth(150) resetmoneylost:SetHeight(18)
 	resetmoneylost:SetScript("OnClick", function()
-		BrokerGarbage:ResetMoneyLost()
+		BrokerGarbage:ResetMoney(0)
+	end)
+
+	local resetmoneyearned = LibStub("tekKonfig-Button").new_small(BrokerGarbage.options, "TOPLEFT", resetmoneylost, "BOTTOMLEFT", 0, 0)
+	resetmoneyearned:SetText(BrokerGarbage.locale.resetMoneyEarned)
+	resetmoneyearned.tiptext = BrokerGarbage.locale.resetMoneyEarnedText
+	resetmoneyearned:SetWidth(150) resetmoneyearned:SetHeight(18)
+	resetmoneyearned:SetScript("OnClick", function()
+		BrokerGarbage:ResetMoney(1)
 	end)

 	-- ----------------------------------