From e2dd37d4202431689ab75fb6169c011c314447ae Mon Sep 17 00:00:00 2001 From: ckaotik Date: Sun, 24 Oct 2010 12:06:53 +0200 Subject: [PATCH] 4.0 v3 release --- helper.lua | 4 ++-- locale/deDE.lua | 2 ++ locale/enUS.lua | 2 ++ options.lua | 28 ++++++++++++++++++++++------ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/helper.lua b/helper.lua index f83eb8d..bdf275c 100644 --- a/helper.lua +++ b/helper.lua @@ -294,7 +294,7 @@ function BrokerGarbage:LPTDropDown(self, level, functionHandler) if UIDROPDOWNMENU_MENU_VALUE and string.find(UIDROPDOWNMENU_MENU_VALUE, ".") then local parts = { strsplit(".", UIDROPDOWNMENU_MENU_VALUE) } or {} for k = 1, #parts do - dataTable = dataTable[ parts[k] ] + dataTable = dataTable[ parts[k] ] or {} end elseif UIDROPDOWNMENU_MENU_VALUE then dataTable = dataTable[ UIDROPDOWNMENU_MENU_VALUE ] or {} @@ -318,7 +318,7 @@ function BrokerGarbage:LPTDropDown(self, level, functionHandler) end end - for key, value in pairs(dataTable) do + for key, value in pairs(dataTable or {}) do local info = UIDropDownMenu_CreateInfo() local prefix = "" if UIDROPDOWNMENU_MENU_VALUE then diff --git a/locale/deDE.lua b/locale/deDE.lua index 79b7d18..54600b5 100644 --- a/locale/deDE.lua +++ b/locale/deDE.lua @@ -26,6 +26,8 @@ if GetLocale() == "deDE" then /garbage |cffc0c0c0globallimit |cffc0c0ffitemLink/ID Anzahl|r setzt ein Limit für alle Charaktere. /garbage |cffc0c0c0value |cffc0c0ffWertInKupfer|r setzt den Itemwert, ab dem Items gelootet werden (benötigt den Loot Manager).]] BrokerGarbage.locale.minValueSet = "Mindestwert für items wurde auf %s gesetzt." + BrokerGarbage.locale.minSlotsSet = "Der Loot Manager wird versuchen, mindestens %s Inventarplätze frei halten." + BrokerGarbage.locale.invalidArgument = "Ungültiges Argument. Bitte überprüfe deine Eingabe!" BrokerGarbage.locale.GlobalSetting = "\n|cffffff9aDiese Einstellung ist global." diff --git a/locale/enUS.lua b/locale/enUS.lua index a09e1e7..698c74c 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -26,6 +26,8 @@ BrokerGarbage.locale = { /garbage |cffc0c0c0globallimit |cffc0c0ffitemLink/ID count|r sets a limit for all characters. /garbage |cffc0c0c0value |cffc0c0ffvalueInCopper|r sets the minimum value for items to be looted (Loot Manager needed).]], minValueSet = "Items with a value less than %s will not be looted anymore.", + minSlotsSet = "The Loot Manager will try to keep at least %s slots free.", + invalidArgument = "You supplied an invalid argument. Please check your input and try again.", GlobalSetting = "\n|cffffff9aThis setting is global.", diff --git a/options.lua b/options.lua index 9cdf7b6..59ea79e 100644 --- a/options.lua +++ b/options.lua @@ -1269,9 +1269,12 @@ function SlashCmdList.BROKERGARBAGE(msg, editbox) elseif command == "limit" or command == "glimit" or command == "globallimit" then local itemID, count = rest:match("^[^0-9]-([0-9]+).-([0-9]+)$") - itemID = tonumber(itemID) - count = tonumber(count) + itemID = tonumber(itemID) or -1 + count = tonumber(count) or -1 + if itemID < 1 or count < 0 then + BrokerGarbage:Print(BrokerGarbage.locale.invalidArgument) + end BrokerGarbage.itemsCache[itemID] = nil if string.find(command, "g") then @@ -1283,12 +1286,25 @@ function SlashCmdList.BROKERGARBAGE(msg, editbox) BrokerGarbage:Print(format(BrokerGarbage.locale.limitSet, itemLink, count)) BrokerGarbage:ListOptionsUpdate("include") - elseif command == "value" or command == "minvalue" and LootManager then - rest = tonumber(rest) - if not rest then return end + elseif LootManager and (command == "value" or command == "minvalue") then + rest = tonumber(rest) or -1 + if rest < 0 then + BrokerGarbage:Print(BrokerGarbage.locale.invalidArgument) + return + end BrokerGarbage_LootManager:SetMinValue(rest) - BrokerGarbage:Print(format(BrokerGarbage.locale.minValueSet, BrokerGarbage:FormatMoney(BG_LocalDB.itemMinValue))) + BrokerGarbage:Print(format(BrokerGarbage.locale.minValueSet, BrokerGarbage:FormatMoney(BGLM_LocalDB.itemMinValue))) + + elseif LootManager and (command == "freeslots" or command == "slots" or command == "free" or command == "minfree") then + rest = tonumber(rest) + if not rest then + BrokerGarbage:Print(BrokerGarbage.locale.invalidArgument) + return + end + + BrokerGarbage_LootManager:SetMinSlots(rest) + BrokerGarbage:Print(format(BrokerGarbage.locale.minSlotsSet, BGLM_GlobalDB.tooFewSlots)) else BrokerGarbage:Print(BrokerGarbage.locale.slashCommandHelp) -- 1.7.9.5