Quantcast

things. re-inserted combat-checkbox, eliminated some variables

ckaotik [06-17-10 - 09:51]
things. re-inserted combat-checkbox, eliminated some variables
Filename
core.lua
helper.lua
diff --git a/core.lua b/core.lua
index bee64ad..3aead83 100644
--- a/core.lua
+++ b/core.lua
@@ -382,9 +382,10 @@ function BrokerGarbage:GetItemValue(item, count)
 	end

 	if BrokerGarbage:GetCached(itemID) then
-		return BrokerGarbage:GetCached(itemID).value * count
+		return BrokerGarbage:GetCached(itemID).value * (count or 1)
 	else
-		return nil
+		local value = BrokerGarbage:GetSingleItemValue(item)
+		return value and value * (count or 1) or nil
 	end
 end

diff --git a/helper.lua b/helper.lua
index 53b5f39..8dea1d1 100644
--- a/helper.lua
+++ b/helper.lua
@@ -413,6 +413,7 @@ function BrokerGarbage:UpdateCache(itemID)
 		return nil
 	end

+	local value, _ = BrokerGarbage:GetSingleItemValue(itemID)
 	-- check if item is excluded by itemID
 	if BG_GlobalDB.exclude[itemID] or BG_LocalDB.exclude[itemID] then
 		BrokerGarbage:Debug("Item "..itemID.." is excluded via its itemID.")
@@ -420,7 +421,7 @@ function BrokerGarbage:UpdateCache(itemID)
 	end

 	-- check if the item is classified by its itemID
-	if not class then
+	if not class or class ~= BrokerGarbage.EXCLUDE then
 		if BG_GlobalDB.include[itemID] or BG_LocalDB.include[itemID] then

 			if BG_LocalDB.include[itemID] and type(BG_LocalDB.include[itemID]) ~= "boolean" then
@@ -513,12 +514,12 @@ function BrokerGarbage:UpdateCache(itemID)
 		end
 	end

-	if not class then
-		value, class = BrokerGarbage:GetSingleItemValue(itemID)
-	end
 	if not value then
 		value = 0
 	end
+	if not class then
+		_, class = BrokerGarbage:GetSingleItemValue(itemID)
+	end

 	-- save to items cache
 	if not value or not class or not quality then