changeset 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 e6eec48ecf14
children b2bf629434c9
files ProspectMe.lua
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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