# HG changeset patch # User Geoff Brock # Date 1471457356 14400 # Node ID 56a8d7064c9ad8a60e492111eb599609db7c1ee2 # Parent e6eec48ecf14f9991c9403e626224782d7dd5406 Optimized the handling of several functions to decrease footprint - condensed 32 function calls into 7. *cheers* diff -r e6eec48ecf14 -r 56a8d7064c9a ProspectMe.lua --- a/ProspectMe.lua Wed Aug 17 13:58:48 2016 -0400 +++ b/ProspectMe.lua Wed Aug 17 14:09:16 2016 -0400 @@ -3,11 +3,11 @@ local MASS_PROSPECT_FELSLATE_ID = 225902 local MASS_PROSPECT_LEYSTONE_ID = 225902 local MASS_MILLING_YSERALLINE_ID = 210116 -local PROSPECT = GetSpellInfo(PROSPECT_ID) -local MILLING = GetSpellInfo(MILLING_ID) -local MASS_PROSPECT_FELSLATE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) -local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) -local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID) +local PROSPECT = GetSpellInfo(PROSPECT_ID):lower() +local MILLING = GetSpellInfo(MILLING_ID):lower() +local MASS_PROSPECT_FELSLATE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() +local MASS_PROSPECT_LEYSTONE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() +local MASS_MILLING_YSERALLINE = GetSpellInfo(MASS_PROSPECT_FELSLATE_ID):lower() local containerID, containerLink = nil, nil local getContents = false local bulkMultiplier = 1 --This will be used for mass prospecting/milling in Legion @@ -90,6 +90,7 @@ end if event == "UNIT_SPELLCAST_INTERRUPTED" then local unitID, spell, rank = ... + spell = spell:lower() 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 getContents = false end @@ -138,10 +139,10 @@ end) hooksecurefunc("CastSpell", function(...) - local spellName = GetSpellInfo(...) - 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 + local spellName = GetSpellInfo(...):lower() + if spellName == PROSPECT or spellName == MILLING or spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then getContents = true - if spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE:lower () then + if spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then bulkMultiplier = 4 else bulkMultiplier = 1 @@ -173,9 +174,10 @@ end) hooksecurefunc("CastSpellByName", function(spellName, onSelf) - 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 + spellName = spellName:lower() + if spellName == PROSPECT or spellName == MILLING or spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then getContents = true - if spellName:lower() == MASS_PROSPECT_FELSLATE:lower() or spellName:lower() == MASS_PROSPECT_LEYSTONE:lower() or spellName:lower() == MASS_MILLING_YSERALLINE:lower () then + if spellName == MASS_PROSPECT_FELSLATE or spellName == MASS_PROSPECT_LEYSTONE or spellName == MASS_MILLING_YSERALLINE then bulkMultiplier = 4 else bulkMultiplier = 1