Quantcast

itemLink ~= itemID

ckaotik [01-24-10 - 21:29]
itemLink ~= itemID
Filename
Broker_Garbage.toc
core.lua
options.lua
diff --git a/Broker_Garbage.toc b/Broker_Garbage.toc
index 58d716a..7807096 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.3v9
+## Version: 3.3v10
 ## X-Category: Inventory
 ## X-Credits: GarbageFu, Tekkub

diff --git a/core.lua b/core.lua
index 72874f6..fae046f 100644
--- a/core.lua
+++ b/core.lua
@@ -310,9 +310,9 @@ end

 function BrokerGarbage:ResetMoney(which)
 	if which == 0 then
-		BG_GlobalDB.moneyLostByDeleting = 0
+		BG_LocalDB.moneyLostByDeleting = 0
 	elseif which == 1 then
-		BG_GlobalDB.moneyEarned = 0
+		BG_LocalDB.moneyEarned = 0
 	end
 end

@@ -324,6 +324,11 @@ function BrokerGarbage:ResetList(which)
 	end
 end

+function BrokerGarbage:GetItemID(itemLink)
+	local itemID = string.gsub(itemLink, ".*|Hitem:([0-9]*):.*", "%1")
+	return tonumber(itemID)
+end
+
 function BrokerGarbage:CanDisenchant(itemLink)
 	if (itemLink) then
 		local _, _, quality, level, _, _, _, count, slot = GetItemInfo(itemLink)
@@ -494,6 +499,7 @@ function BrokerGarbage:OnClick(itemTable, button)
 		BrokerGarbage:Print(format(BrokerGarbage.locale.addedToPriceList, select(2,GetItemInfo(itemTable.itemID))))

 		BrokerGarbage:ListOptionsUpdate("forceprice")
+		BrokerGarbage:ScanInventory()

 	else
 		-- do nothing
@@ -505,6 +511,7 @@ end
 -- calculates the value of a stack/partial stack of an item
 function BrokerGarbage:GetItemValue(itemLink, count)
 	local vendorPrice = select(11,GetItemInfo(itemLink))
+	local itemID = BrokerGarbage:GetItemID(itemLink)
 	local auctionPrice, disenchantPrice, temp, source
 	local DE = false

@@ -516,6 +523,8 @@ function BrokerGarbage:GetItemValue(itemLink, count)
 		or BG_GlobalDB.autoSellList[itemID] or BG_LocalDB.autoSellList[itemID]
 		or BG_GlobalDB.forceVendorPrice[itemID] then

+		BrokerGarbage:Debug("Using Vendorprice", itemLink)
+
 		return vendorPrice and vendorPrice*count or nil, "|cFFF5DEB3V" -- orange
 	end

diff --git a/options.lua b/options.lua
index 48b7ff0..cab93f6 100644
--- a/options.lua
+++ b/options.lua
@@ -453,7 +453,6 @@ local function ShowOptions(frame)
 	local numCols = 8
 	function BrokerGarbage:ListOptionsUpdate(listName)
 		local globalList, localList, dataList, box, parent, buttonList
-		BrokerGarbage:Debug("List Name:", listName)
 		if listName == "include" then
 			globalList = BG_GlobalDB.include
 			localList = BG_LocalDB.include
@@ -555,7 +554,7 @@ local function ShowOptions(frame)
 			BrokerGarbage:ListOptionsUpdate("exclude")
 			ClearCursor()
 		elseif self == group_forceprice or self == forcepriceBox or self == plus2 then
-			BG_LocalDB.exclude[itemID] = true
+			BG_GlobalDB.forceVendorPrice[itemID] = true
 			BrokerGarbage:Print(format(BrokerGarbage.locale.addedToPriceList, link))
 			BrokerGarbage:ListOptionsUpdate("forceprice")
 			ClearCursor()
@@ -565,7 +564,7 @@ local function ShowOptions(frame)
 			BrokerGarbage:ListOptionsUpdate("include")
 			ClearCursor()
 		elseif self == group_autosell or self == autosellBox or self == plus4 then
-			BG_LocalDB.exclude[itemID] = true
+			BG_LocalDB.autoSellList[itemID] = true
 			BrokerGarbage:Print(format(BrokerGarbage.locale.addedToSellList, link))
 			BrokerGarbage:ListOptionsUpdate("autosell")
 			ClearCursor()