comparison 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
comparison
equal deleted inserted replaced
57:8d7cc246ec11 58:f9b6c0305908
53 Epic = true, 53 Epic = true,
54 }, 54 },
55 PerSession = false, 55 PerSession = false,
56 ShowPercent = true, 56 ShowPercent = true,
57 ShowNumber = true, 57 ShowNumber = true,
58 ShowEconomics = true,
58 } 59 }
59 end 60 end
60 if not ProspectMe.Results then 61 if not ProspectMe.Results then
61 ProspectMe.Results = {} 62 ProspectMe.Results = {}
62 end 63 end
122 --[[ 123 --[[
123 Creates an table entry, if it does not exist, and adds results to the entry. 124 Creates an table entry, if it does not exist, and adds results to the entry.
124 Expects the Item ID and pairs of arguments in table with key being the result's ItemID and value being the quantity returned 125 Expects the Item ID and pairs of arguments in table with key being the result's ItemID and value being the quantity returned
125 ]] 126 ]]
126 ProspectMe.AddEntry = function (ItemID, BatchSize, ResultsTable) 127 ProspectMe.AddEntry = function (ItemID, BatchSize, ResultsTable)
127 if not ProspectMe.Results[ItemID] then 128 if ProspectMe.Tables.Ores[ItemID] or ProspectMe.Tables.Herbs[ItemID] then
128 ProspectMe.Results[ItemID] = { TimesProspected = 0 } 129 if not ProspectMe.Results[ItemID] then
129 end 130 ProspectMe.Results[ItemID] = { TimesProspected = 0 }
130 if not ProspectMe.Session[ItemID] then 131 end
131 ProspectMe.Session[ItemID] = { TimesProspected = 0 } 132 if not ProspectMe.Session[ItemID] then
132 end 133 ProspectMe.Session[ItemID] = { TimesProspected = 0 }
133 for k, v in pairs(ResultsTable) do 134 end
134 if not ProspectMe.Results[ItemID][k] then 135 for k, v in pairs(ResultsTable) do
135 ProspectMe.Results[ItemID][k] = v 136 if not ProspectMe.Results[ItemID][k] then
136 else 137 ProspectMe.Results[ItemID][k] = v
137 ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v 138 else
138 end 139 ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v
139 if not ProspectMe.Session[ItemID][k] then 140 end
140 ProspectMe.Session[ItemID][k] = v 141 if not ProspectMe.Session[ItemID][k] then
141 else 142 ProspectMe.Session[ItemID][k] = v
142 ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v 143 else
143 end 144 ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v
144 end 145 end
145 ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize 146 end
146 ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize 147 ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize
147 148 ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize
149 else
150 print("Attempted to create invalid entry for ID: ", ItemID)
151 end
148 end 152 end
149 153
150 --[[ 154 --[[
151 Parses the results of the spellcast or loot containerand returns a table of those results in key/value pairs of item/quantity. 155 Parses the results of the spellcast or loot containerand returns a table of those results in key/value pairs of item/quantity.
152 Expects an event and a set of arguments if the event has them. 156 Expects an event and a set of arguments if the event has them.