diff --git a/core.lua b/core.lua
index 8bf92b5..ba559e6 100644
--- a/core.lua
+++ b/core.lua
@@ -46,6 +46,7 @@ BrokerGarbage.defaultGlobalSettings = {
reportNothingToSell = true,
showLost = true,
showEarned = true,
+ LDBformat = "%1$sx%2$d (%3$s)",
-- showWarnings = true, -- TODO options
showSource = false,
}
@@ -502,8 +503,8 @@ function BrokerGarbage:OnClick(itemTable, button)
-- delete item
BrokerGarbage:Debug("SHIFT-Click!")
BrokerGarbage:Delete(select(2,GetItemInfo(itemTable.itemID)), itemTable.bag, itemTable.slot)
- BG_GlobalDB.moneyLostByDeleting = BG_GlobalDB.moneyLostByDeleting + itemTable.value
- BG_LocalDB.moneyLostByDeleting = BG_GlobalDB.moneyLostByDeleting + itemTable.value
+ BG_GlobalDB.moneyLostByDeleting = BG_GlobalDB.moneyLostByDeleting + itemTable.value
+ BG_LocalDB.moneyLostByDeleting = BG_LocalDB.moneyLostByDeleting + itemTable.value
elseif itemTable and IsControlKeyDown() then
-- add to exclude list
@@ -647,86 +648,98 @@ end
-- scans your inventory for possible junk items and updates LDB display
function BrokerGarbage:ScanInventory()
BrokerGarbage.inventory = {}
- local cheapestItem
+ local cheapestItem, freeSlots
local warnings = {}
+ local maxSpace = 0 -- will contain total number of inventory space
+ local freeSpace = 0 -- will contain total number of free bag space
+
for container = 0,4 do
- for slot = 1, GetContainerNumSlots(container) do
- local itemID = GetContainerItemID(container,slot)
- if itemID then
- -- GetContainerItemInfo sucks big time ... just don't use it for quality IDs!!!!!!!
- local _,count,locked,_,_,canOpen,itemLink = GetContainerItemInfo(container, slot)
- local quality = select(3,GetItemInfo(itemID))
-
- if canOpen and showWarnings then
- tinsert(warnings, format(BrokerGarbage.locale.openPlease,
- select(2,GetItemInfo(itemID))))
- end
-
- -- check if this item belongs to an excluded category
- local inCategory, skip
- for setName,_ in pairs(BrokerGarbage:JoinTables(BG_GlobalDB.exclude, BG_LocalDB.exclude)) do
- if type(setName) == "string" then
- _, inCategory = BrokerGarbage.PT:ItemInSet(itemID, setName)
- end
- -- item is on save list, skip
- if inCategory then
- skip = true
- break
+ local numSlots = GetContainerNumSlots(container)
+ if numSlots then
+ freeSlots = GetContainerFreeSlots(container)
+ freeSpace = freeSpace + (freeSlots and #freeSlots or 0)
+ maxSpace = maxSpace + GetContainerNumSlots(container)
+
+ for slot = 1, GetContainerNumSlots(container) do
+ local itemID = GetContainerItemID(container,slot)
+ if itemID then
+ -- GetContainerItemInfo sucks big time ... just don't use it for quality IDs!!!!!!!
+ local _,count,locked,_,_,canOpen,itemLink = GetContainerItemInfo(container, slot)
+ local quality = select(3,GetItemInfo(itemID))
+
+ if canOpen and showWarnings then
+ tinsert(warnings, format(BrokerGarbage.locale.openPlease,
+ select(2,GetItemInfo(itemID))))
end
- end
- inCategory = nil
- if not skip then
- for setName,_ in pairs(BrokerGarbage:JoinTables(BG_GlobalDB.autoSellList, BG_LocalDB.autoSellList, BG_LocalDB.include, BG_GlobalDB.include)) do
+
+ -- check if this item belongs to an excluded category
+ local inCategory, skip
+ for setName,_ in pairs(BrokerGarbage:JoinTables(BG_GlobalDB.exclude, BG_LocalDB.exclude)) do
if type(setName) == "string" then
_, inCategory = BrokerGarbage.PT:ItemInSet(itemID, setName)
end
- if inCategory then inCategory = setName; break end
+ -- item is on save list, skip
+ if inCategory then
+ skip = true
+ break
+ end
end
- end
-
- if quality and
- (quality <= BG_GlobalDB.dropQuality or inCategory
- or BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID]
- or BG_GlobalDB.autoSellList[itemID] or BG_LocalDB.autoSellList[itemID])
- and not BG_GlobalDB.exclude[itemID] and not BG_LocalDB.exclude[itemID] and not skip then -- save excluded items!!!
-
- local force = false
- local value, source = BrokerGarbage:GetItemValue(itemLink,count)
- -- make included items appear in tooltip list as "forced"
- if BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID]
- or BG_GlobalDB.include[inCategory] or BG_LocalDB.include[inCategory] then
- if not value then value = 0 end
- force = true
- source = "|cFF8C1717I" -- overwrites former value, I as in "include"
+ inCategory = nil
+ if not skip then
+ for setName,_ in pairs(BrokerGarbage:JoinTables(BG_GlobalDB.autoSellList, BG_LocalDB.autoSellList, BG_LocalDB.include, BG_GlobalDB.include)) do
+ if type(setName) == "string" then
+ _, inCategory = BrokerGarbage.PT:ItemInSet(itemID, setName)
+ end
+ if inCategory then inCategory = setName; break end
+ end
end
- if value then
- local currentItem = {
- bag = container,
- slot = slot,
- itemID = itemID,
- quality = quality,
- count = count,
- value = value,
- source = source,
- force = force,
- }
+
+ if quality and
+ (quality <= BG_GlobalDB.dropQuality or inCategory
+ or BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID]
+ or BG_GlobalDB.autoSellList[itemID] or BG_LocalDB.autoSellList[itemID])
+ and not BG_GlobalDB.exclude[itemID] and not BG_LocalDB.exclude[itemID] and not skip then -- save excluded items!!!
- if not cheapestItem or cheapestItem.value >= value then
- cheapestItem = currentItem
+ local force = false
+ local value, source = BrokerGarbage:GetItemValue(itemLink,count)
+ -- make included items appear in tooltip list as "forced"
+ if BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID]
+ or BG_GlobalDB.include[inCategory] or BG_LocalDB.include[inCategory] then
+ if not value then value = 0 end
+ force = true
+ source = "|cFF8C1717I" -- overwrites former value, I as in "include"
+ end
+ if value then
+ local currentItem = {
+ bag = container,
+ slot = slot,
+ itemID = itemID,
+ quality = quality,
+ count = count,
+ value = value,
+ source = source,
+ force = force,
+ }
+
+ if not cheapestItem or cheapestItem.value >= value then
+ cheapestItem = currentItem
+ end
+ tinsert(BrokerGarbage.inventory, currentItem)
end
- tinsert(BrokerGarbage.inventory, currentItem)
end
end
end
end
end
-
+
if cheapestItem then
- LDB.text = format("%sx%d (%s)",
+ LDB.text = format(BG_GlobalDB.LDBformat,
select(2,GetItemInfo(cheapestItem.itemID)),
cheapestItem.count,
- BrokerGarbage:FormatMoney(cheapestItem.value))
+ BrokerGarbage:FormatMoney(cheapestItem.value),
+ freeSpace,
+ maxSpace)
BrokerGarbage.cheapestItem = cheapestItem
else
LDB.text = BrokerGarbage.locale.label
diff --git a/deDE.lua b/deDE.lua
index 5a3e041..c7ef110 100644
--- a/deDE.lua
+++ b/deDE.lua
@@ -4,7 +4,7 @@ _, BrokerGarbage = ...
if GetLocale() == "deDE" then
BrokerGarbage.locale = {
- label = "Kein Junk",
+ label = "Kein Müll",
-- Chat Messages
sellAndRepair = "Müll für %1$s verkauft, repariert für %2$s. Änderung: %3$s.",
@@ -18,6 +18,8 @@ BrokerGarbage.locale = {
itemDeleted = "%s wurde gelöscht.",
openPlease = "Bitte öffne %s - es nimmt unnötig Platz weg.",
+ slashCommandHelp = "Nutze |cffc0c0c0/garbage config|r um die Einstellungen zu öffnen oder |cffc0c0c0/garbage format |cffc0c0ffformatstring|r um das Format der LDB Anzeige anzupassen. |cffc0c0c0/garbage format reset|r setzt das LDB Format zurück. Für Statistiken, gib |cffc0c0c0/garbage stats|r ein.",
+ statistics = "Statistik:\nGesamtverdienst (alle Charaktere): %1$s\nGesamtverlust (alle Charaktere): %2$s",
-- Tooltip
headerRightClick = "Rechts-Klick: Optionen",
diff --git a/enUS.lua b/enUS.lua
index a03063c..523691f 100644
--- a/enUS.lua
+++ b/enUS.lua
@@ -18,6 +18,8 @@ BrokerGarbage.locale = {
itemDeleted = "%s has been deleted.",
openPlease = "Please open your %s. It's in your bags, stealing your space!",
+ slashCommandHelp = "Use |cffc0c0c0/garbage config|r to open the config menu or |cffc0c0c0/garbage format |cc0c0c0ffformatstring|r to change the LDB display style or |cffc0c0c0/garbage format reset|r to reset it. For statistics type |cffc0c0c0/garbage stats|r.",
+ statistics = "Statistics:\nTotal earnings (all characters): %1$s\nTotal losses (all characters): %2$s",
-- Tooltip
headerRightClick = "Right-Click for options",
diff --git a/options.lua b/options.lua
index 298a276..44bd79b 100644
--- a/options.lua
+++ b/options.lua
@@ -894,7 +894,6 @@ local function ShowOptions(frame)
plus4:SetScript("OnReceiveDrag", ItemDrop)
plus4:SetScript("OnMouseDown", ItemDrop)
- -- buttons = {}
BrokerGarbage:ListOptionsUpdate()
BrokerGarbage.options:SetScript("OnShow", nil)
BrokerGarbage.listOptionsPositive:SetScript("OnShow", BrokerGarbage.ListOptionsUpdate)
@@ -915,6 +914,26 @@ LibStub("tekKonfig-AboutPanel").new("Broker_Garbage", "Broker_Garbage")
-- register slash commands
SLASH_BROKERGARBAGE1 = "/garbage"
SLASH_BROKERGARBAGE2 = "/garb"
-function SlashCmdList.BROKERGARBAGE()
- InterfaceOptionsFrame_OpenToCategory(BrokerGarbage.options)
+function SlashCmdList.BROKERGARBAGE(msg, editbox)
+ local command, rest = msg:match("^(%S*)%s*(.-)$")
+ local command = strlower(command)
+
+ if command == "format" then
+ if strlower(rest) ~= "reset" then
+ BG_GlobalDB.LDBformat = rest
+ else
+ BG_GlobalDB.LDBformat = "%1$sx%2$d (%3$s)"
+ end
+ BrokerGarbage:ScanInventory()
+ elseif command == "trash" or command == "stats" or command == "total" then
+ BrokerGarbage:Print(format(BrokerGarbage.locale.statistics,
+ BrokerGarbage:FormatMoney(BG_GlobalDB.moneyEarned),
+ BrokerGarbage:FormatMoney(BG_GlobalDB.moneyLostByDeleting)))
+
+ elseif command == "options" or command == "config" or command == "option" or command == "menu" then
+ InterfaceOptionsFrame_OpenToCategory(BrokerGarbage.options)
+
+ else
+ BrokerGarbage:Print(BrokerGarbage.locale.slashCommandHelp)
+ end
end
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 13cc66d..72dbd2c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -69,7 +69,25 @@ To remove a category simply do as you would with any other item on your list: Se
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 ;)
-7. How you can help
+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:
+
+ %1$s item link
+ %2$d item count
+ %3$s item value
+
+ %4$d number of free slots
+ %5$d number of maximum bag capacity
+
+Some examples:
+
+"%1$s - (%4$d/%5$d) - %3$s" -> [Hearthstone] - (18/48) - 0c
+"%1$sx%2$d (%3$s)" (default) -> [Hearthstone]x1 (0c)
+"%1$sx%2$d" -> [Hearthstone]x1
+"%4$d/%5$d - %1$s" -> 18/48 - [Hearthstone]
+
+8. How you can help
-----------------
I still need a few translations to get done. If you would like to help me with that, please do so on http://wow.curseforge.com/addons/broker_garbage/localization/ .
Likewise, I need people to test the addon with different auction addons. If you have one that isn't yet supported, make a Feature Suggestion (see 4.).