Quantcast

Stuff...

ckaotik [02-21-10 - 20:17]
Stuff...
Filename
Broker_Garbage.toc
core.lua
deDE.lua
enUS.lua
options.lua
readme.txt
diff --git a/Broker_Garbage.toc b/Broker_Garbage.toc
index 8e528e0..63f3d8f 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.3v14
+## Version: 3.3v15
 ## X-Embeds: LibPeriodicTable-3.1
 ## X-Category: Inventory
 ## X-Credits: GarbageFu, Tekkub
diff --git a/core.lua b/core.lua
index dc3bba6..8bf92b5 100644
--- a/core.lua
+++ b/core.lua
@@ -8,7 +8,7 @@ _, BrokerGarbage = ...
 local LibQTip = LibStub("LibQTip-1.0")
 BrokerGarbage.PT = LibStub("LibPeriodicTable-3.1")

--- notation mix-up for B2FB to work
+-- notation mix-up for Broker2FuBar to work
 local LDB = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Garbage", {
 	type	= "data source",
 	icon	= "Interface\\Icons\\achievement_bg_returnxflags_def_wsg",
@@ -22,8 +22,7 @@ LDB.OnMouseWheel = function(...) BrokerGarbage:OnScroll(...) end

 -- default saved variables
 BrokerGarbage.defaultGlobalSettings = {
-	-- lists
-	-- key is either the itemID -or- the PeriodicTable category string
+	-- lists :: key is either the itemID -or- the PeriodicTable category string
 	exclude = {},
 	include = {},
 	autoSellList = {},
@@ -44,6 +43,7 @@ BrokerGarbage.defaultGlobalSettings = {

 	-- display options
 	showAutoSellIcon = true,
+	reportNothingToSell = true,
 	showLost = true,
 	showEarned = true,
 	-- showWarnings = true,		-- TODO options
@@ -76,7 +76,7 @@ BrokerGarbage.tt = nil

 -- event handler
 local function eventHandler(self, event, ...)
-	if event == "MERCHANT_SHOW" then
+	if event == "MERCHANT_SHOW" then
 		if not IsShiftKeyDown() then
 			BrokerGarbage:AutoRepair()
 			BrokerGarbage:AutoSell()
@@ -86,7 +86,6 @@ local function eventHandler(self, event, ...)
 		-- regular unlock

 		-- 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.")
 			return
@@ -107,6 +106,7 @@ local function eventHandler(self, event, ...)
 		elseif sellValue ~= 0 and BG_GlobalDB.autoSellToVendor then
 			-- autosell only
 			BrokerGarbage:Print(format(BrokerGarbage.locale.sell, BrokerGarbage:FormatMoney(sellValue)))
+
 		end

 		sellValue = 0
@@ -171,7 +171,7 @@ function MerchantFrame_UpdateRepairButtons(...)
 	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")	-- INV_Crate_05
+		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)
@@ -201,6 +201,9 @@ function MerchantFrame_UpdateRepairButtons(...)
 		iconbutton:Show()
 	end
 	MerchantRepairText:Hide()
+
+	iconbutton:Enable()
+	_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(false)
 end

 loaded = true
@@ -827,6 +830,17 @@ function BrokerGarbage:AutoSell()
 				i = i+1
 			end
 		end
+
+		if self == _G["BrokerGarbage_SellIcon"] then
+			BrokerGarbage:Debug("AutoSell on Sell Icon.")
+			if sellValue == 0 and BG_GlobalDB.reportNothingToSell then
+				BrokerGarbage:Print(BrokerGarbage.locale.reportNothingToSell)
+			elseif sellValue ~= 0 then
+				BrokerGarbage:Print(format(BrokerGarbage.locale.sell, BrokerGarbage:FormatMoney(sellValue)))
+			end
+			_G["BrokerGarbage_SellIcon"]:Disable()
+			_G["BrokerGarbage_SellIcon"]:GetNormalTexture():SetDesaturated(true)
+		end
 	end
 end

@@ -834,7 +848,7 @@ end
 function BrokerGarbage:AutoRepair()
 	if BG_GlobalDB.autoRepairAtVendor and CanMerchantRepair() then
 		cost = GetRepairAllCost()
-
+
 		if cost > 0 and GetGuildBankWithdrawMoney() >= cost and not BG_GlobalDB.neverRepairGuildBank then
 			RepairAllItems(CanGuildBankRepair())
 		elseif cost > 0 then
diff --git a/deDE.lua b/deDE.lua
index 4082ef8..5a3e041 100644
--- a/deDE.lua
+++ b/deDE.lua
@@ -28,7 +28,8 @@ BrokerGarbage.locale = {
 	noItems = "Keine Items zum Löschen.",
 	increaseTreshold = "Erhöhe die Item Qualität",

-	autoSellTooltip = "Graue Items verkaufen.",
+	autoSellTooltip = "Müll verkaufen",
+	reportNothingToSell = "Nichts zu verkaufen!",

 	-- Options Frame
 	subTitle = "Möchtest du einmal nicht automatisch verkaufen / reparieren? \nHalte SHIFT gedrückt, wenn du den Händler ansprichst!",
@@ -38,6 +39,9 @@ BrokerGarbage.locale = {
 	showAutoSellIconTitle = "Icon anzeigen",
 	showAutoSellIconText = "Wenn ausgewählt, wird bei Händlern ein Icon zum automatischen Verkaufen angezeigt.",

+	showNothingToSellTitle = "'Nichts zu verkaufen'",
+	showNothingToSellText = "Wenn ausgewählt, wird bei Besuch eines Händlers eine Nachricht ausgegeben, falls es nichts zu verkaufen gibt.",
+
 	autoRepairTitle = "Automatisch Reparieren",
 	autoRepairText = "Wenn ausgewählt, wird deine Ausrüstung automatisch repariert wenn möglich.",

diff --git a/enUS.lua b/enUS.lua
index d0035e7..a03063c 100644
--- a/enUS.lua
+++ b/enUS.lua
@@ -28,7 +28,8 @@ BrokerGarbage.locale = {
 	noItems = "No items to delete.",
 	increaseTreshold = "Increase quality treshold",

-	autoSellTooltip = "Sell gray items.",
+	autoSellTooltip = "Sell gray items",
+	reportNothingToSell = "Nothing to sell!",

 	-- Options Frame
 	subTitle = "Don't want to auto-sell/repair? \nHold Shift when adressing the merchant!",
@@ -38,6 +39,9 @@ BrokerGarbage.locale = {
 	showAutoSellIconTitle = "Show Icon",
 	showAutoSellIconText = "Toggles whether to show an icon to manually auto-sell when at a vendor.",

+	showNothingToSellTitle = "'Nothing to sell'",
+	showNothingToSellText = "Toggles whether to show a notice when at a vendor and there is nothing to sell.",
+
 	autoRepairTitle = "Auto Repair",
 	autoRepairText = "Toggles whether to automatically repair your gear when at a vendor.",

diff --git a/options.lua b/options.lua
index 9369fd1..298a276 100644
--- a/options.lua
+++ b/options.lua
@@ -38,7 +38,7 @@ for set, _ in pairs(BrokerGarbage.PT.sets) do
 				pre[ partials[i] ] = set
 			else
 				-- all parts before that
-				if not pre[ partials[i] ] then
+				if not pre[ partials[i] ] or type(pre[ partials[i] ]) == "string" then
 					pre[ partials[i] ] = {}
 				end
 				pre = pre[ partials[i] ]
@@ -53,18 +53,18 @@ BrokerGarbage.options.name = "Broker_Garbage"
 BrokerGarbage.options:Hide()

 -- list options: positive panel
-BrokerGarbage.listOptionsPositive = CreateFrame("Frame", "BrokerGarbageOptionsFrame", InterfaceOptionsFramePanelContainer)
+BrokerGarbage.listOptionsPositive = CreateFrame("Frame", "BrokerGarbageOptionsPositiveFrame", InterfaceOptionsFramePanelContainer)
 BrokerGarbage.listOptionsPositive.name = BrokerGarbage.locale.LOPTitle
 BrokerGarbage.listOptionsPositive.parent = "Broker_Garbage"
 BrokerGarbage.listOptionsPositive:Hide()

 -- list options: negative panel
-BrokerGarbage.listOptionsNegative = CreateFrame("Frame", "BrokerGarbageOptionsFrame", InterfaceOptionsFramePanelContainer)
+BrokerGarbage.listOptionsNegative = CreateFrame("Frame", "BrokerGarbageOptionsNegativeFrame", InterfaceOptionsFramePanelContainer)
 BrokerGarbage.listOptionsNegative.name = BrokerGarbage.locale.LONTitle
 BrokerGarbage.listOptionsNegative.parent = "Broker_Garbage"
 BrokerGarbage.listOptionsNegative:Hide()

--- list options
+-- lists that hold our iconbuttons
 BrokerGarbage.listButtons = {
 	-- positive
 	exclude = {},
@@ -98,6 +98,15 @@ local function ShowOptions(frame)
 		checksound(autosellicon)
 		BG_GlobalDB.showAutoSellIcon = not BG_GlobalDB.showAutoSellIcon
 	end)
+
+	local nothingtext = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showNothingToSellTitle, "TOPLEFT", autosellicon, "BOTTOMLEFT", 0, 0)
+	nothingtext.tiptext = BrokerGarbage.locale.showNothingToSellText
+	nothingtext:SetChecked(BG_GlobalDB.showAutoSellIcon)
+	local checksound = nothingtext:GetScript("OnClick")
+	nothingtext:SetScript("OnClick", function(nothingtext)
+		checksound(nothingtext)
+		BG_GlobalDB.reportNothingToSell = not BG_GlobalDB.reportNothingToSell
+	end)

 	local autorepair = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.autoRepairTitle, "LEFT", autosell, "LEFT", 200, 0)
 	autorepair.tiptext = BrokerGarbage.locale.autoRepairText
@@ -117,7 +126,7 @@ local function ShowOptions(frame)
 		BG_LocalDB.neverRepairGuildBank = not BG_LocalDB.neverRepairGuildBank
 	end)

-	local showlost = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showLostTitle, "TOPLEFT", autosellicon, "BOTTOMLEFT", -14, -10)
+	local showlost = LibStub("tekKonfig-Checkbox").new(BrokerGarbage.options, nil, BrokerGarbage.locale.showLostTitle, "TOPLEFT", nothingtext, "BOTTOMLEFT", -14, -10)
 	showlost.tiptext = BrokerGarbage.locale.showLostText
 	showlost:SetChecked(BG_GlobalDB.showLost)
 	local checksound = showlost:GetScript("OnClick")
@@ -135,7 +144,7 @@ local function ShowOptions(frame)
 		BG_GlobalDB.showEarned = not BG_GlobalDB.showEarned
 	end)

-	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.options, BrokerGarbage.locale.dropQualityTitle, 0, 6, "TOPLEFT", showlost, "BOTTOMLEFT", 5, -40)
+	local quality = LibStub("tekKonfig-Slider").new(BrokerGarbage.options, BrokerGarbage.locale.dropQualityTitle, 0, 6, "TOPLEFT", showlost, "BOTTOMLEFT", 5, -30)
 	quality.tiptext = BrokerGarbage.locale.dropQualityText
 	quality:SetWidth(200)
 	quality:SetValueStep(1)
@@ -191,7 +200,7 @@ local function ShowOptions(frame)
 		ttMaxHeight.text:SetText(ttMaxHeight:GetValue())
 	end)

-	local resetexclude = LibStub("tekKonfig-Button").new_small(BrokerGarbage.options, "TOPLEFT", ttMaxItems, "BOTTOMLEFT", 0, -50)
+	local resetexclude = LibStub("tekKonfig-Button").new_small(BrokerGarbage.options, "TOPLEFT", ttMaxItems, "BOTTOMLEFT", 0, -30)
 	resetexclude:SetText(BrokerGarbage.locale.emptyExcludeList)
 	resetexclude.tiptext = BrokerGarbage.locale.emptyExcludeListText
 	resetexclude:SetWidth(150) resetexclude:SetHeight(18)
@@ -885,7 +894,7 @@ local function ShowOptions(frame)
 	plus4:SetScript("OnReceiveDrag", ItemDrop)
 	plus4:SetScript("OnMouseDown", ItemDrop)

-	buttons = {}
+	-- buttons = {}
 	BrokerGarbage:ListOptionsUpdate()
 	BrokerGarbage.options:SetScript("OnShow", nil)
 	BrokerGarbage.listOptionsPositive:SetScript("OnShow", BrokerGarbage.ListOptionsUpdate)
@@ -901,4 +910,11 @@ BrokerGarbage.listOptionsNegative:SetScript("OnShow", ShowOptions)
 InterfaceOptions_AddCategory(BrokerGarbage.options)
 InterfaceOptions_AddCategory(BrokerGarbage.listOptionsPositive)
 InterfaceOptions_AddCategory(BrokerGarbage.listOptionsNegative)
-LibStub("tekKonfig-AboutPanel").new("Broker_Garbage", "Broker_Garbage")
\ No newline at end of file
+LibStub("tekKonfig-AboutPanel").new("Broker_Garbage", "Broker_Garbage")
+
+-- register slash commands
+SLASH_BROKERGARBAGE1 = "/garbage"
+SLASH_BROKERGARBAGE2 = "/garb"
+function SlashCmdList.BROKERGARBAGE()
+	InterfaceOptionsFrame_OpenToCategory(BrokerGarbage.options)
+end
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 659ecc6..13cc66d 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,7 +1,7 @@
 Broker_Garbage
 ==============
 Author: ckaotik
-Version: 3.3v14
+Version: 3.3v15
 WoW Version: 3.3.2 (TOC 30300)

 WoWInterface: http://www.wowinterface.com/downloads/info15531-Broker_Garbage.html