comparison ProspectMe.lua @ 11:61b9ea84a44c

Added groundwork for Legion mass prospecting and milling.
author Geoff Brock <mischivin@gmail.com>
date Wed, 17 Aug 2016 13:41:17 -0400
parents 69b46322ff1b
children c5a66cdf45e2
comparison
equal deleted inserted replaced
10:7adac5b705e6 11:61b9ea84a44c
1 local PROSPECT_ID = 31252 1 local PROSPECT_ID = 31252
2 local MILLING_ID = 51005 2 local MILLING_ID = 51005
3 local MASS_PROSPECT_FELSLATE_ID = 225902
4 local MASS_PROSPECT_LEYSTONE_ID = 225902
5 local MASS_MILLING_YSERALLINE_ID = 210116
3 local PROSPECT = GetSpellInfo(PROSPECT_ID) 6 local PROSPECT = GetSpellInfo(PROSPECT_ID)
4 local MILLING = GetSpellInfo(MILLING_ID) 7 local MILLING = GetSpellInfo(MILLING_ID)
8 local MASS_PROSPECT_FELSLATE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID)
9 local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID)
10 local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID)
5 local containerID, containerLink = nil, nil 11 local containerID, containerLink = nil, nil
6 local getContents = false 12 local getContents = false
13 local bulkMultiplier = 1 --This will be used for mass prospecting/milling in Legion
7 14
8 local function PM_Init() 15 local function PM_Init()
9 if not PM_ResultsTable then 16 if not PM_ResultsTable then
10 PM_ResultsTable = {} 17 PM_ResultsTable = {}
11 PM_ItemTable = {} 18 PM_ItemTable = {}
70 else 77 else
71 PM_SessionTable[containerID][itemID] = quantity 78 PM_SessionTable[containerID][itemID] = quantity
72 end 79 end
73 end 80 end
74 81
75 PM_ResultsTable[containerID].timesProspected = PM_ResultsTable[containerID].timesProspected + 1 82 PM_ResultsTable[containerID].timesProspected = PM_ResultsTable[containerID].timesProspected + bulkMultiplier
76 PM_SessionTable[containerID].timesProspected = PM_SessionTable[containerID].timesProspected + 1 83 PM_SessionTable[containerID].timesProspected = PM_SessionTable[containerID].timesProspected + bulkMultiplier
77 end 84 end
78 85
79 local function EventHandler(self, event, ...) 86 local function EventHandler(self, event, ...)
80 if event == "VARIABLES_LOADED" then 87 if event == "VARIABLES_LOADED" then
81 PM_Init() 88 PM_Init()
130 end 137 end
131 end) 138 end)
132 139
133 hooksecurefunc("CastSpell", function(...) 140 hooksecurefunc("CastSpell", function(...)
134 local spellName = GetSpellInfo(...) 141 local spellName = GetSpellInfo(...)
135 if spellName:lower() == PROSPECT:lower() or spellName:lower() == MILLING:lower() then 142 if spellName:lower() == PROSPECT:lower() or spellName:lower() == MILLING:lower() or spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE :lower () then
136 getContents = true 143 getContents = true
144 if spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE :lower () then
145 bulkMultiplier = 4
146 else
147 bulkMultiplier = 1
148 end
137 end 149 end
138 end) 150 end)
139 151
140 hooksecurefunc("CastSpellByID", function(spellID) 152 hooksecurefunc("CastSpellByID", function(spellID)
141 if spellID == PROSPECT_ID or spellID == MILLING_ID then 153 if spellID == PROSPECT_ID or spellID == MILLING_ID or spellID == MASS_PROSPECT_FELSTATE_ID or spellID == MASS_PROSPECT_LEYSTONE_ID or spellID == MASS_MILLING_YSERALLINE_ID then
142 getContents = true 154 getContents = true
155 if spellID == MASS_PROSPECT_FELSTATE_ID or spellID == MASS_PROSPECT_LEYSTONE_ID or spellID == MASS_MILLING_YSERALLINE_ID then
156 bulkMultiplier = 4
157 else
158 bulkMultiplier = 1
159 end
143 end 160 end
144 end) 161 end)
145 162
146 hooksecurefunc("UseAction", function(actionID) 163 hooksecurefunc("UseAction", function(actionID)
147 local spellID = select(2, GetActionInfo(actionID)) 164 local spellID = select(2, GetActionInfo(actionID))
148 if spellID == PROSPECT_ID or spellID == MILLING_ID then 165 if spellID == PROSPECT_ID or spellID == MILLING_ID or spellID == MASS_PROSPECT_FELSTATE_ID or spellID == MASS_PROSPECT_LEYSTONE_ID or spellID == MASS_MILLING_YSERALLINE_ID then
149 getContents = true 166 getContents = true
167 if spellID == MASS_PROSPECT_FELSTATE_ID or spellID == MASS_PROSPECT_LEYSTONE_ID or spellID == MASS_MILLING_YSERALLINE_ID then
168 bulkMultiplier = 4
169 else
170 bulkMultiplier = 1
171 end
150 end 172 end
151 end) 173 end)
152 174
153 hooksecurefunc("CastSpellByName", function(spellName, onSelf) 175 hooksecurefunc("CastSpellByName", function(spellName, onSelf)
154 if spellName:lower() == PROSPECT:lower() or spellName:lower() == MILLING:lower() then 176 if spellName:lower() == PROSPECT:lower() or spellName:lower() == MILLING:lower() or spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE :lower () then
155 getContents = true 177 getContents = true
178 if spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE :lower () then
179 bulkMultiplier = 4
180 else
181 bulkMultiplier = 1
182 end
156 end 183 end
157 end) 184 end)