Quantcast

Sell icon improved. Options bug fixed

ckaotik [03-07-10 - 12:59]
Sell icon improved. Options bug fixed
Filename
core.lua
deDE.lua
enUS.lua
options.lua
readme.txt
diff --git a/core.lua b/core.lua
index ff4266c..9434486 100644
--- a/core.lua
+++ b/core.lua
@@ -51,7 +51,7 @@ BrokerGarbage.defaultGlobalSettings = {
 	showLost = true,
 	showEarned = true,
 	LDBformat = "%1$sx%2$d (%3$s)",
-	-- showWarnings = true,		-- TODO options
+	-- showWarnings = true,		-- TODO
 	showSource = false,
 }

@@ -73,7 +73,7 @@ BrokerGarbage.defaultLocalSettings = {
 local debug = false
 local locked = false
 local loaded = false
-local sellValue = 0
+local sellValue = 0		-- represents the actual value that we sold stuff for, opposed to BrokerGarbage.toSellValue which shows the maximum we could sell - imagine someone closing the merchant window. sellValue will then hold the real value we're interested in
 local cost = 0
 local lastReminder = time()

@@ -115,6 +115,7 @@ local function eventHandler(self, event, ...)
 		end

 		sellValue = 0
+		BrokerGarbage.toSellValue = 0
 		cost = 0
 		locked = false
 		BrokerGarbage:Debug("lock released")
@@ -126,6 +127,7 @@ local function eventHandler(self, event, ...)
 		sellValue = 0
 		cost = 0
 		locked = false
+		BrokerGarbage.toSellValue = 0
 		BrokerGarbage:Debug("lock released")

 		BrokerGarbage:ScanInventory()
@@ -181,7 +183,13 @@ function MerchantFrame_UpdateRepairButtons(...)
 		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)
+			local tiptext
+			if BrokerGarbage.toSellValue and BrokerGarbage.toSellValue ~= 0 then
+				tiptext = format(BrokerGarbage.locale.autoSellTooltip, BrokerGarbage:FormatMoney(BrokerGarbage.toSellValue))
+			else
+				tiptext = BrokerGarbage.locale.reportNothingToSell
+			end
+			GameTooltip:SetText(tiptext, nil, nil, nil, nil, true)
 		end)
 		iconbutton:SetScript("OnLeave", function() GameTooltip:Hide() end)
 	else
@@ -197,7 +205,7 @@ function MerchantFrame_UpdateRepairButtons(...)
 			iconbutton:SetWidth(30); iconbutton:SetHeight(30)
 		else
 			iconbutton:SetWidth(36); iconbutton:SetHeight(36)
-			iconbutton:SetPoint("BOTTOMRIGHT", MerchantRepairItemButton, "BOTTOMLEFT", -4, 0)
+			iconbutton:SetPoint("BOTTOMRIGHT", MerchantRepairItemButton, "BOTTOMLEFT", -2, 0)
 		end

 		iconbutton:Show()
@@ -207,10 +215,12 @@ function MerchantFrame_UpdateRepairButtons(...)
 	end
 	MerchantRepairText:Hide()

-	iconbutton:Enable()
-	_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(false)
+	if BrokerGarbage.toSellValue and BrokerGarbage.toSellValue ~= 0 then
+		_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(false)
+	else
+		_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(true)
+	end
 end
-
 loaded = true

 -- Helper functions
@@ -220,7 +230,7 @@ function BrokerGarbage:Print(text)
 end

 function BrokerGarbage:Warning(text)
-	if showWarnings and time() - lastReminder >= 5 then
+	if BG_GlobalDB.showWarnings and time() - lastReminder >= 5 then
 		BrokerGarbage:Print("|cfff0000Warning:|r ", text)
 		lastReminder = time()
 	end
@@ -674,6 +684,7 @@ end
 -- scans your inventory for possible junk items and updates LDB display
 function BrokerGarbage:ScanInventory()
 	BrokerGarbage.inventory = {}
+	BrokerGarbage.toSellValue = 0
 	local cheapestItem, freeSlots
 	local warnings = {}

@@ -694,7 +705,7 @@ function BrokerGarbage:ScanInventory()
 					local _,count,locked,_,_,canOpen,itemLink = GetContainerItemInfo(container, slot)
 					local quality = select(3,GetItemInfo(itemID))

-					if canOpen and showWarnings then
+					if canOpen and BG_GlobalDB.showWarnings then
 						tinsert(warnings, format(BrokerGarbage.locale.openPlease,
 							select(2,GetItemInfo(itemID))))
 					end
@@ -736,7 +747,15 @@ function BrokerGarbage:ScanInventory()
 							force = true
 							source = "|cFF8C1717I"	-- overwrites former value, I as in "include"
 						end
+
 						if value then
+							-- save if we have something sellable
+							if quality == 0
+								or BG_GlobalDB.autoSellList[itemID] or BG_LocalDB.autoSellList[itemID] then
+								BrokerGarbage:Debug("Added for selling:", itemID, GetItemInfo(itemID) or "")
+								BrokerGarbage.toSellValue = BrokerGarbage.toSellValue + value
+							end
+
 							local currentItem = {
 								bag = container,
 								slot = slot,
@@ -832,7 +851,7 @@ end
 -- ---------------------------------------------------------
 -- when at a merchant this will clear your bags of junk (gray quality) and items on your autoSellList
 function BrokerGarbage:AutoSell()
-	if BG_GlobalDB.autoSellToVendor or self == _G["BrokerGarbage_SellIcon"] then
+	if BG_GlobalDB.autoSellToVendor or self == _G["BrokerGarbage_SellIcon"] then
 		local i = 1
 		sellValue = 0
 		for _, itemTable in pairs(BrokerGarbage.inventory) do
@@ -877,13 +896,13 @@ function BrokerGarbage:AutoSell()
 		end

 		if self == _G["BrokerGarbage_SellIcon"] then
-			BrokerGarbage:Debug("AutoSell on Sell Icon.")
-			if sellValue == 0 and BG_GlobalDB.reportNothingToSell then
+			BrokerGarbage:Debug("AutoSell on Sell Icon.", BrokerGarbage:FormatMoney(sellValue), BrokerGarbage:FormatMoney(BrokerGarbage.toSellValue))
+
+			if BrokerGarbage.toSellValue == 0 and BG_GlobalDB.reportNothingToSell then
 				BrokerGarbage:Print(BrokerGarbage.locale.reportNothingToSell)
-			elseif sellValue ~= 0 then
-				BrokerGarbage:Print(format(BrokerGarbage.locale.sell, BrokerGarbage:FormatMoney(sellValue)))
+			elseif BrokerGarbage.toSellValue ~= 0 and not BG_GlobalDB.autoSellToVendor then
+				BrokerGarbage:Print(format(BrokerGarbage.locale.sell, BrokerGarbage:FormatMoney(BrokerGarbage.toSellValue)))
 			end
-			_G["BrokerGarbage_SellIcon"]:Disable()
 			_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(true)
 		end
 	end
diff --git a/deDE.lua b/deDE.lua
index c78fa67..434163c 100644
--- a/deDE.lua
+++ b/deDE.lua
@@ -30,7 +30,7 @@ BrokerGarbage.locale = {
 	noItems = "Keine Items zum Löschen.",
 	increaseTreshold = "Erhöhe die Item Qualität",

-	autoSellTooltip = "Müll verkaufen",
+	autoSellTooltip = "Müll für %s verkaufen",
 	reportNothingToSell = "Nichts zu verkaufen!",

 	-- Statistics Frame
@@ -123,14 +123,14 @@ BrokerGarbage.locale = {

 		-- Exclude List
 	LOPExcludeHeader = "Ausschlussliste - Items hier werden nie verkauft/gelöscht.",
-	LOPExcludePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst",
+	LOPExcludePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst. Rechtsklick, um Kategorien hinzuzufügen!",
 	LOPExcludeMinusTT = "Wähle Items, die du entfernen willst. Dann klicke hier.",
 	LOPExcludePromoteTT = "Klicke um alle markierten Items in die globale Ausnahmeliste zu übernehmen.",
 	LOPExcludeEmptyTT = "Klicke, um die lokale Ausschlussliste völlig zu leeren.\n|cffff0000Achtung!",

 		-- Force Vendor Price List
 	LOPForceHeader = "Händlerpreis-Liste - Für diese Items wird nur der Händlerpreis betrachtet.",
-	LOPForcePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst",
+	LOPForcePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst. Rechtsklick, um Kategorien hinzuzufügen!",
 	LOPForceMinusTT = "Wähle Items, die du entfernen willst. Dann klicke hier.",
 	LOPForcePromoteTT = "Die Händlerpreis-Liste ist bereits global.",
 	LOPForceEmptyTT = "Klicke, um die Händlerliste völlig zu leeren.\n|cffff0000Achtung!",
@@ -141,14 +141,14 @@ BrokerGarbage.locale = {

 		-- Include List
 	LONIncludeHeader = "Einschlussliste - Items hier werden mit als erstes im Tooltip gezeigt.",
-	LONIncludePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst",
+	LONIncludePlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst. Rechtsklick, um Kategorien hinzuzufügen!",
 	LONIncludeMinusTT = "Wähle Items, die du entfernen willst. Dann klicke hier.",
 	LONIncludePromoteTT = "Klicke, um alle markierten Items in die globale Einschlussliste zu übernehmen.",
 	LONIncludeEmptyTT = "Klicke, um die lokale Einschlussliste völlig zu leeren.\n|cffff0000Achtung!",

 		-- Auto Sell List
 	LONAutoSellHeader = "Verkaufsliste - Items hier werden bei Händlern automatisch verkauft.",
-	LONAutoSellPlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst",
+	LONAutoSellPlusTT = "Items hinzufügen, indem du sie hierher ziehst/hier ablegst. Rechtsklick, um Kategorien hinzuzufügen!",
 	LONAutoSellMinusTT = "Wähle Items, die du entfernen willst. Dann klicke hier.",
 	LONAutoSellPromoteTT = "Klicke, um alle markierten Items in die globale Verkaufsliste zu übernehmen.",
 	LONAutoSellEmptyTT = "Klicke, um die lokale Verkaufsliste völlig zu leeren.\n|cffff0000Achtung!",
diff --git a/enUS.lua b/enUS.lua
index 3737884..8d91a02 100644
--- a/enUS.lua
+++ b/enUS.lua
@@ -30,7 +30,7 @@ BrokerGarbage.locale = {
 	noItems = "No items to delete.",
 	increaseTreshold = "Increase quality treshold",

-	autoSellTooltip = "Sell gray items",
+	autoSellTooltip = "Sell Items for %s",
 	reportNothingToSell = "Nothing to sell!",

 	-- Statistics Frame
@@ -123,14 +123,14 @@ BrokerGarbage.locale = {

 		-- Exclude List
 	LOPExcludeHeader = "Exclude List - these items will never be sold/deleted.",
-	LOPExcludePlusTT = "Add items to the Exclude List by dragging/placing them on me!",
+	LOPExcludePlusTT = "Add items to the Exclude List by dragging/placing them on me. Right click on me for categories!",
 	LOPExcludeMinusTT = "Select items you want to remove, then click here.",
 	LOPExcludePromoteTT = "Selected items will be written onto your global Exclude List, as seen by every character.",
 	LOPExcludeEmptyTT = "Click to fully empty your local Exclude List.\n|cffff0000Caution!",

 		-- Force Vendor Price List
 	LOPForceHeader = "Vendor Price List - These items will only have their vendor price considered.",
-	LOPForcePlusTT = "Add items to the Vendor Price List by dragging/placing them on me!",
+	LOPForcePlusTT = "Add items to the Exclude List by dragging/placing them on me. Right click on me for categories!",
 	LOPForceMinusTT = "Select items you want to remove, then click here.",
 	LOPForcePromoteTT = "The Vendor Price List is already global and effects every character.",
 	LOPForceEmptyTT = "Click to fully empty your Vendor Price List.\n|cffff0000Caution!",
@@ -140,15 +140,15 @@ BrokerGarbage.locale = {
 	LONSubTitle = "To add Items to lists, drag them over the corresponding '+' icon, to remove them select them and click the '-'.",

 		-- Include List
-	LONIncludeHeader = "Include List - these items will shown first in the tooltip.",
-	LONIncludePlusTT = "Add items to your Include List by dragging/placing them on me!",
+	LONIncludeHeader = "Include List - these items will be shown first in the tooltip.",
+	LONIncludePlusTT = "Add items to the Exclude List by dragging/placing them on me. Right click on me for categories!",
 	LONIncludeMinusTT = "Select items you want to remove, then click here.",
 	LONIncludePromoteTT = "Selected items will be written onto your global Include List, as seen by every character.",
 	LONIncludeEmptyTT = "Click to fully empty your local Include List.\n|cffff0000Caution!",

 		-- Auto Sell List
-	LONAutoSellHeader = "Sell List - These items will me automatically sold when at a vendor.",
-	LONAutoSellPlusTT = "Add items to your Sell List by dragging/placing them on me!",
+	LONAutoSellHeader = "Sell List - These items will be sold automatically when at a vendor.",
+	LONAutoSellPlusTT = "Add items to the Exclude List by dragging/placing them on me. Right click on me for categories!",
 	LONAutoSellMinusTT = "Select items you want to remove, then click here.",
 	LONAutoSellPromoteTT = "Selected items will be written onto your global Sell List, as seen by every character.",
 	LONAutoSellEmptyTT = "Click to fully empty your local Sell List.\n|cffff0000Caution!",
diff --git a/options.lua b/options.lua
index cc57cfc..42165cf 100644
--- a/options.lua
+++ b/options.lua
@@ -362,7 +362,7 @@ local function ShowOptions(frame)

 	local nothingtext = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.basicOptions, nil, BrokerGarbage.locale.showNothingToSellTitle, "TOPLEFT", autosellicon, "BOTTOMLEFT", 0, 0)
 	nothingtext.tiptext = BrokerGarbage.locale.showNothingToSellText
-	nothingtext:SetChecked(BG_GlobalDB.showAutoSellIcon)
+	nothingtext:SetChecked(BG_GlobalDB.reportNothingToSell)
 	local checksound = nothingtext:GetScript("OnClick")
 	nothingtext:SetScript("OnClick", function(nothingtext)
 		checksound(nothingtext)
@@ -962,6 +962,9 @@ local function ShowListOptions(frame)
 			BrokerGarbage:ListOptionsUpdate("autosell")
 			ClearCursor()
 		end
+
+		BrokerGarbage:ScanInventory()
+		MerchantFrame_UpdateRepairButtons()
 	end

 	if not _G["BrokerGarbagePTMenuFrame"] then
@@ -1147,6 +1150,7 @@ local function ShowListOptions(frame)
 		end

 		BrokerGarbage:ScanInventory()
+		MerchantFrame_UpdateRepairButtons()
 	end

 	emptyExcludeList:SetScript("OnClick", OnClick)
diff --git a/readme.txt b/readme.txt
index e12c3cc..36e8dfc 100644
--- a/readme.txt
+++ b/readme.txt
@@ -27,7 +27,7 @@ If you get past that point (and really, you should) it's about time to set up yo
 3. I got an error!!!11!1!
 -----------------
 Well, that's not good, but it's good ;) If you report an error I can have a look to fix it. Of course, there shouldn't be any errors in the first place but you know ... I'm only human, too.
-To report a bug just log on to WoWInterface.com or curse.com and leave me a message or a comment (the full links can be found at the top of this file) giving as much information as you can. On curse it even offers a bug tracker and I wouldn't mind you using it.
+To report a bug just log on to WoWInterface.com or curse.com and leave me a message or a comment (the full links can be found at the top of this file) giving as much information as you can. On curse it even offers a bug tracker and I wouldn't mind you using it. Some info you should always include:

 * When did it happen? (on login, on /reload, when selling, ...)
 * What happened? ("The tooltip went blank.", "The tooltip sticks to the cursor.", ...)
@@ -53,11 +53,11 @@ Grayed out items on there are items that are on your global list, active for all
 Items on this list will never have their auction value used. This is useful for food, drinks and other things people tend to put on the AH at unbelievable prices.

 * Include List
-Items on this list will be always be shown in the drop Tooltip, no matter what Quality Treshold you might have set. Caution!
+Items on this list will be always be shown in the drop Tooltip, no matter what Quality Treshold you might have set. If you have too many, you won't see any other items in the tooltip. Caution!
 Grayed out items on there are items that are on your global list, active for all characters. Colorful ones are just for your current character.

 * Auto-Sell List
-Items on this list will be sold whenever you talk to a vendor. Items of higher quality than your Quality Treshold WILL be sold.
+Items on this list will be sold whenever you talk to a vendor. Items of higher quality than your Quality Treshold WILL be sold, just keep that in mind.

 Each of these lists except the 'Force Vendor Price' list have a global (affects all your characters) and local (only affects the current character) component. You can broadcast items on your local lists as global by selecting them and then clicking on the promote icon next to the list.

@@ -67,11 +67,11 @@ Starting in version 3.3v11 you can add category strings to make your life easier
 Navigate your way through the menu and add any category you like simply by clicking on it.
 To remove a category simply do as you would with any other item on your list: Select it and then hit the corresponding 'minus' icon.

-Why these categories are only in English? There's a simple answer to that: Because I do not want to localize the complete LPT. Sorry for that, but it's kind of not my job to do that ;)
+Why these categories are only in English? There's a simple answer to that: Because that's what LPT does and I do not want to localize the complete LPT. Sorry for that, but it's kind of not my job to do that ;)

 7. How to adjust the LDB display text
 -----------------
-In 3.3v15 I added the possibility to adjust the LDB display text to your liking. To do so, simply type "/garbage format formatstring" where formatstring is your desired output format (withouth quotation marks). The LDB display format supports several parameters:
+In 3.3v15 I added the possibility to adjust the LDB display text to your liking. To do so, simply change the text on the Basic Options panel or type "/garbage format 'formatstring'" where formatstring is your desired output format (withouth quotation marks). The LDB display format supports several parameters:

 	%1$s		item link
 	%2$d		item count