diff ProspectMe.lua @ 58:f9b6c0305908

Added an integrity check to incoming data to make sure the ItemID is a valid ore/herb Updated tooltips to allow hiding of the economics data (in addition to the existing toggles for granular results) Updated tooltips to give better hints when the player hasn't prospected/milled an item before
author Vynn <mischivin@gmail.com>
date Mon, 28 Nov 2016 12:09:11 -0500
parents b267cddd6496
children
line wrap: on
line diff
--- a/ProspectMe.lua	Sun Nov 20 23:15:57 2016 -0500
+++ b/ProspectMe.lua	Mon Nov 28 12:09:11 2016 -0500
@@ -55,6 +55,7 @@
 			PerSession = false,
 			ShowPercent = true,
 			ShowNumber = true,
+			ShowEconomics = true,
 		}
 	end
 	if not ProspectMe.Results then
@@ -124,27 +125,30 @@
 	Expects the Item ID and pairs of arguments in table with key being the result's ItemID and value being the quantity returned
 	]]
 	ProspectMe.AddEntry = function (ItemID, BatchSize, ResultsTable)
-		if not ProspectMe.Results[ItemID] then
-			ProspectMe.Results[ItemID] = { TimesProspected = 0 }
+		if ProspectMe.Tables.Ores[ItemID] or ProspectMe.Tables.Herbs[ItemID] then
+			if not ProspectMe.Results[ItemID] then
+				ProspectMe.Results[ItemID] = { TimesProspected = 0 }
+			end
+			if not ProspectMe.Session[ItemID] then
+				ProspectMe.Session[ItemID] = { TimesProspected = 0 }
+			end
+			for k, v in pairs(ResultsTable) do
+				if not ProspectMe.Results[ItemID][k] then
+					ProspectMe.Results[ItemID][k] = v
+				else
+					ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v
+				end
+				if not ProspectMe.Session[ItemID][k] then
+					ProspectMe.Session[ItemID][k] = v
+				else
+					ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v
+				end
+			end
+			ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize
+			ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize
+		else
+			print("Attempted to create invalid entry for ID: ", ItemID)
 		end
-		if not ProspectMe.Session[ItemID] then
-			ProspectMe.Session[ItemID] = { TimesProspected = 0 }
-		end
-		for k, v in pairs(ResultsTable) do
-			if not ProspectMe.Results[ItemID][k] then
-				ProspectMe.Results[ItemID][k] = v
-			else
-				ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v
-			end
-			if not ProspectMe.Session[ItemID][k] then
-				ProspectMe.Session[ItemID][k] = v
-			else
-				ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v
-			end
-		end
-		ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize
-		ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize
-		
 	end
 
 	--[[