Quantcast

* added (currently hidden) option to show which item was sold. Enable with /run BG_GlobalDB.showSellLog = true

ckaotik [12-19-10 - 10:18]
* added (currently hidden) option to show which item was sold. Enable with /run BG_GlobalDB.showSellLog = true
* added check for BoP items, as they can't be auctioned (no matter what your AH addon may say ;) )
* fixed bug when using "Minimum free slots" slider
* fixed error thrown when deleting (some more testing needed)
* maybe fixed "attempt to compare with nil value" error thrown when looting (some more testing needed)
Filename
Broker_Garbage-LootManager/core.lua
Broker_Garbage-LootManager/options.lua
Broker_Garbage/constants.lua
Broker_Garbage/core.lua
Broker_Garbage/locale/deDE.lua
Broker_Garbage/locale/enUS.lua
Broker_Garbage/util.lua
diff --git a/Broker_Garbage-LootManager/core.lua b/Broker_Garbage-LootManager/core.lua
index f17b24e..79f240c 100644
--- a/Broker_Garbage-LootManager/core.lua
+++ b/Broker_Garbage-LootManager/core.lua
@@ -331,9 +331,8 @@ function BGLM.SelectiveLooting(autoloot)	-- jwehgH"G$(&/&§$/!!" stupid . vs. :
 							BGLM:Debug("Item can be made to fit.", itemLink)
 							lootAction = "deletePartial"

-						elseif BGLM_LocalDB.autoDestroy and
-							(((alwaysLoot or prepareSkinning) and compareTo) or
-							(compareTo and value > compareTo.value)) then
+						elseif BGLM_LocalDB.autoDestroy and compareTo and compareTo.value and
+							(alwaysLoot or prepareSkinning or value > compareTo.value) then
 							-- delete only if it's worth more, if it's an item we really need or if we want to skin the mob
 							BGLM:Debug("Deleting item", compareTo.itemLink, "to make room for", itemLink)
 							lootAction = "delete"
diff --git a/Broker_Garbage-LootManager/options.lua b/Broker_Garbage-LootManager/options.lua
index 2609bee..a565539 100644
--- a/Broker_Garbage-LootManager/options.lua
+++ b/Broker_Garbage-LootManager/options.lua
@@ -252,7 +252,7 @@ local function Options_LootManager(pluginID)
 	minFreeSlots:SetScript("OnValueChanged", function(minFreeSlots)
 		BGLM_GlobalDB.tooFewSlots = minFreeSlots:GetValue()
 		minFreeSlotsText:SetText(BGLM.locale.LMFreeSlotsTitle .. ": " .. BGLM_GlobalDB.tooFewSlots)
-		BrokerGarbage:ScanInventory()
+		Broker_Garbage:ScanInventory()
 	end)
 	low:Hide(); high:Hide()

diff --git a/Broker_Garbage/constants.lua b/Broker_Garbage/constants.lua
index 614246a..155dcbb 100644
--- a/Broker_Garbage/constants.lua
+++ b/Broker_Garbage/constants.lua
@@ -15,6 +15,7 @@ BG.defaultGlobalSettings = {
 	autoRepairAtVendor = true,
 	sellNotWearable = false,
 	sellOldGear = false,			-- TODO: to be used with TopFit
+	showSellLog = false,

 	disableKey = "SHIFT",
 	autoSellIncludeItems = false,	-- toggle include list being sell list as well
diff --git a/Broker_Garbage/core.lua b/Broker_Garbage/core.lua
index 4c6642f..5599158 100644
--- a/Broker_Garbage/core.lua
+++ b/Broker_Garbage/core.lua
@@ -443,8 +443,8 @@ function BG:GetSingleItemValue(item)
        	return nil
 	end

-	-- ignore AH prices for gray items
-    if not itemQuality or itemQuality == 0 then
+	-- ignore AH prices for gray items and soulbound items
+    if not itemQuality or itemQuality == 0 or BG:IsItemSoulbound(itemLink) then
         return vendorPrice, vendorPrice and BG.VENDOR
     end

@@ -591,8 +591,11 @@ function BG:Delete(item, position)
     end

     -- security check
-    if not cursorType and GetContainerItemID(position[1] or item.bag, position[2] or item.slot) ~= itemID then
+    local bag = position[1] or item.bag
+    local slot = position[2] or item.slot
+    if not cursorType and (not (bag and slot) or GetContainerItemID(bag, slot) ~= itemID) then
         BG:Print("Error! Item to be deleted is not the expected item.")
+        BG:Debug("I got these parameters:", item, bag, slot)
         return
     end

@@ -601,16 +604,10 @@ function BG:Delete(item, position)
         ClearCursor()
     end

-    if not cursorType and (not position or type(position) ~= "table") then
-        BG:Print("Error! No position given to delete from.")
-        return
-
-    else
-        _, itemCount = GetContainerItemInfo(position[1], position[2])
-    end
+    _, itemCount = GetContainerItemInfo(bag, slot)

     -- actual deleting happening after this
-    securecall(PickupContainerItem, position[1], position[2])
+    securecall(PickupContainerItem, bag, slot)
     securecall(DeleteCursorItem)					-- comment this line to prevent item deletion

     local itemValue = (BG:GetCached(itemID).value or 0) * itemCount	-- if an item is unknown to the cache, statistics will not change
@@ -823,6 +820,9 @@ function BG:AutoSell()
                         BG:Debug("Selling", itemID)
                         ClearCursor()
                         UseContainerItem(container, slot)
+                        if BG_GlobalDB.showSellLog then
+                        	BG:Print(BG.locale.sellItem, itemLink, count, BG:FormatMoney(count * value))
+                        end

                         sellValue = sellValue + (count * value)
                         -- update statistics
diff --git a/Broker_Garbage/locale/deDE.lua b/Broker_Garbage/locale/deDE.lua
index 15c0066..e17cc2e 100644
--- a/Broker_Garbage/locale/deDE.lua
+++ b/Broker_Garbage/locale/deDE.lua
@@ -9,6 +9,7 @@ if GetLocale() == "deDE" then
 	BG.locale.addedTo_forceVendorPrice = "Für %s wird nun nur der Händlerpreis genutzt."

 	BG.locale.reportNothingToSell = "Nichts zu verkaufen!"
+	BG.locale.sellItem = "%1$sx%2$d für %3$s verkauft."
 	BG.locale.sell = "Müll verkauft für %s."
 	BG.locale.sellAndRepair = "Müll für %1$s verkauft, repariert für %2$s. Änderung: %3$s."
 	BG.locale.repair = "Repariert für %s."
diff --git a/Broker_Garbage/locale/enUS.lua b/Broker_Garbage/locale/enUS.lua
index dadef34..c32ef4f 100644
--- a/Broker_Garbage/locale/enUS.lua
+++ b/Broker_Garbage/locale/enUS.lua
@@ -9,6 +9,7 @@ BG.locale = {
 	addedTo_forceVendorPrice = "%s will only have its vendor price considered.",

 	reportNothingToSell = "Nothing to sell!",
+	sellItem = "Sold %1$sx%2$d for %3$s.",
 	sell = "Sold trash for %s.",
 	sellAndRepair = "Sold trash for %1$s, repaired for %2$s. Change: %3$s.",
 	repair = "Repaired for %s.",
diff --git a/Broker_Garbage/util.lua b/Broker_Garbage/util.lua
index 33e21ad..66388ee 100644
--- a/Broker_Garbage/util.lua
+++ b/Broker_Garbage/util.lua
@@ -424,8 +424,8 @@ function BG:UpdateCache(itemID)
 	end

 	-- save to items cache
-	if not class or not quality then
-		BG:Debug("Error! Caching item "..itemID.." failed!")
+	if not class or not quality or not value then
+		BG:Debug("Error! Caching item "..itemID.." failed!", class, quality, value)
 		return
 	end
 	if not BG.itemsCache[itemID] then