# HG changeset patch # User Geoff Brock # Date 1473040409 14400 # Node ID dc011841fcb49fd4508cea3bbe569134d02cbe6d # Parent 4a10e5d1618c6f4071120000d3515a3fc12c42e7 Added handling of remenant Gem Chips on load - this should clean up and consolidate any lingering chips from 1.7.0.2 diff -r 4a10e5d1618c -r dc011841fcb4 ProspectMe.lua --- a/ProspectMe.lua Sun Sep 04 21:51:07 2016 -0400 +++ b/ProspectMe.lua Sun Sep 04 21:53:29 2016 -0400 @@ -12,14 +12,6 @@ local getContents = false local bulkMultiplier = 1 --This will be used for mass prospecting/milling in Legion -local function PM_Init() - if not PM_ResultsTable then - PM_ResultsTable = {} - PM_ItemTable = {} - end - PM_SessionTable = {} -end - local function CreateTableEntry(id) local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(id) PM_ItemTable[id] = {} @@ -37,6 +29,38 @@ PM_ItemTable[id].price = PM_GetItemValue(id) end +function PM_GemCleanup() + local cleanupIDs = { "129099", "130200", "130201", "130202", "130203", "130204" } + if not PM_ItemTable["129100"] then + CreateTableEntry("129100") + end + for i, r in pairs(PM_ResultsTable) do + for k, v in pairs(cleanupIDs) do + if PM_ResultsTable[i][v] then + if not PM_ResultsTable[i]["129100"] then + PM_ResultsTable[i]["129100"] = 0 + end + PM_ResultsTable[i]["129100"] = PM_ResultsTable[i]["129100"] + PM_ResultsTable[i][v] + PM_ResultsTable[i][v] = nil + end + end + end + for k, v in pairs(cleanupIDs) do + if PM_ItemTable[v] then + PM_ItemTable[v] = nil + end + end +end + +local function PM_Init() + if not PM_ResultsTable then + PM_ResultsTable = {} + PM_ItemTable = {} + end + PM_SessionTable = {} + PM_GemCleanup() --Run cleanup on excess Gem Chips created in v1.7.0.2 and earlier +end + --debugging function to print the databases results function PM_PrintResults() for container, k in pairs(PM_ResultsTable) do