Mercurial > wow > prospect-me
comparison ProspectMe.lua @ 14:56a8d7064c9a
Optimized the handling of several functions to decrease footprint - condensed 32 function calls into 7. *cheers*
| author | Geoff Brock <mischivin@gmail.com> |
|---|---|
| date | Wed, 17 Aug 2016 14:09:16 -0400 |
| parents | c5a66cdf45e2 |
| children | 8e12723d408d |
comparison
equal
deleted
inserted
replaced
| 13:e6eec48ecf14 | 14:56a8d7064c9a |
|---|---|
| 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 | 3 local MASS_PROSPECT_FELSLATE_ID = 225902 |
| 4 local MASS_PROSPECT_LEYSTONE_ID = 225902 | 4 local MASS_PROSPECT_LEYSTONE_ID = 225902 |
| 5 local MASS_MILLING_YSERALLINE_ID = 210116 | 5 local MASS_MILLING_YSERALLINE_ID = 210116 |
| 6 local PROSPECT = GetSpellInfo(PROSPECT_ID) | 6 local PROSPECT = GetSpellInfo(PROSPECT_ID):lower() |
| 7 local MILLING = GetSpellInfo(MILLING_ID) | 7 local MILLING = GetSpellInfo(MILLING_ID):lower() |
| 8 local MASS_PROSPECT_FELSLATE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) | 8 local MASS_PROSPECT_FELSLATE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() |
| 9 local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) | 9 local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() |
| 10 local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) | 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 | 14 |
| 15 local function PM_Init() | 15 local function PM_Init() |
| 88 PM_Init() | 88 PM_Init() |
| 89 PM_UpdateValues() | 89 PM_UpdateValues() |
| 90 end | 90 end |
| 91 if event == "UNIT_SPELLCAST_INTERRUPTED" then | 91 if event == "UNIT_SPELLCAST_INTERRUPTED" then |
| 92 local unitID, spell, rank = ... | 92 local unitID, spell, rank = ... |
| 93 spell = spell:lower() | |
| 93 if unitID == "player" and (spell == PROSPECT or spell == MILLING or spell == MASS_PROSPECT_FELSLATE or spell == MASS_PROSPECT_LEYSTONE or spell == MASS_MILLING_YSERALLINE)then | 94 if unitID == "player" and (spell == PROSPECT or spell == MILLING or spell == MASS_PROSPECT_FELSLATE or spell == MASS_PROSPECT_LEYSTONE or spell == MASS_MILLING_YSERALLINE)then |
| 94 getContents = false | 95 getContents = false |
| 95 end | 96 end |
| 96 end | 97 end |
| 97 if event == "LOOT_OPENED" then | 98 if event == "LOOT_OPENED" then |
| 136 containerID = containerLink:match("Hitem:(%d+)") | 137 containerID = containerLink:match("Hitem:(%d+)") |
| 137 end | 138 end |
| 138 end) | 139 end) |
| 139 | 140 |
| 140 hooksecurefunc("CastSpell", function(...) | 141 hooksecurefunc("CastSpell", function(...) |
| 141 local spellName = GetSpellInfo(...) | 142 local spellName = GetSpellInfo(...):lower() |
| 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 | 143 if spellName == PROSPECT or spellName == MILLING or spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then |
| 143 getContents = true | 144 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 if spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then |
| 145 bulkMultiplier = 4 | 146 bulkMultiplier = 4 |
| 146 else | 147 else |
| 147 bulkMultiplier = 1 | 148 bulkMultiplier = 1 |
| 148 end | 149 end |
| 149 end | 150 end |
| 171 end | 172 end |
| 172 end | 173 end |
| 173 end) | 174 end) |
| 174 | 175 |
| 175 hooksecurefunc("CastSpellByName", function(spellName, onSelf) | 176 hooksecurefunc("CastSpellByName", function(spellName, onSelf) |
| 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 | 177 spellName = spellName:lower() |
| 178 if spellName == PROSPECT or spellName == MILLING or spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then | |
| 177 getContents = true | 179 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 | 180 if spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then |
| 179 bulkMultiplier = 4 | 181 bulkMultiplier = 4 |
| 180 else | 182 else |
| 181 bulkMultiplier = 1 | 183 bulkMultiplier = 1 |
| 182 end | 184 end |
| 183 end | 185 end |
