comparison ProspectMe.lua @ 21:dc011841fcb4

Added handling of remenant Gem Chips on load - this should clean up and consolidate any lingering chips from 1.7.0.2
author Geoff Brock <mischivin@gmail.com>
date Sun, 04 Sep 2016 21:53:29 -0400
parents 8e12723d408d
children c11461d5095c
comparison
equal deleted inserted replaced
20:4a10e5d1618c 21:dc011841fcb4
9 local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() 9 local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower()
10 local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() 10 local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower()
11 local containerID, containerLink = nil, nil 11 local containerID, containerLink = nil, nil
12 local getContents = false 12 local getContents = false
13 local bulkMultiplier = 1 --This will be used for mass prospecting/milling in Legion 13 local bulkMultiplier = 1 --This will be used for mass prospecting/milling in Legion
14
15 local function PM_Init()
16 if not PM_ResultsTable then
17 PM_ResultsTable = {}
18 PM_ItemTable = {}
19 end
20 PM_SessionTable = {}
21 end
22 14
23 local function CreateTableEntry(id) 15 local function CreateTableEntry(id)
24 local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(id) 16 local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(id)
25 PM_ItemTable[id] = {} 17 PM_ItemTable[id] = {}
26 PM_ItemTable[id].name = name 18 PM_ItemTable[id].name = name
35 PM_ItemTable[id].texture = texture 27 PM_ItemTable[id].texture = texture
36 PM_ItemTable[id].vendorPrice = vendorPrice 28 PM_ItemTable[id].vendorPrice = vendorPrice
37 PM_ItemTable[id].price = PM_GetItemValue(id) 29 PM_ItemTable[id].price = PM_GetItemValue(id)
38 end 30 end
39 31
32 function PM_GemCleanup()
33 local cleanupIDs = { "129099", "130200", "130201", "130202", "130203", "130204" }
34 if not PM_ItemTable["129100"] then
35 CreateTableEntry("129100")
36 end
37 for i, r in pairs(PM_ResultsTable) do
38 for k, v in pairs(cleanupIDs) do
39 if PM_ResultsTable[i][v] then
40 if not PM_ResultsTable[i]["129100"] then
41 PM_ResultsTable[i]["129100"] = 0
42 end
43 PM_ResultsTable[i]["129100"] = PM_ResultsTable[i]["129100"] + PM_ResultsTable[i][v]
44 PM_ResultsTable[i][v] = nil
45 end
46 end
47 end
48 for k, v in pairs(cleanupIDs) do
49 if PM_ItemTable[v] then
50 PM_ItemTable[v] = nil
51 end
52 end
53 end
54
55 local function PM_Init()
56 if not PM_ResultsTable then
57 PM_ResultsTable = {}
58 PM_ItemTable = {}
59 end
60 PM_SessionTable = {}
61 PM_GemCleanup() --Run cleanup on excess Gem Chips created in v1.7.0.2 and earlier
62 end
63
40 --debugging function to print the databases results 64 --debugging function to print the databases results
41 function PM_PrintResults() 65 function PM_PrintResults()
42 for container, k in pairs(PM_ResultsTable) do 66 for container, k in pairs(PM_ResultsTable) do
43 print(PM_ItemTable[container].link, PM_ResultsTable[container].timesProspected) 67 print(PM_ItemTable[container].link, PM_ResultsTable[container].timesProspected)
44 for i, num in pairs(k) do 68 for i, num in pairs(k) do