Quantcast

Use OvaleData:GetSpellName() for efficiency.

Johnny C. Lam [03-29-13 - 01:57]
Use OvaleData:GetSpellName() for efficiency.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@853 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleData.lua
OvaleFuture.lua
OvaleIcone.lua
diff --git a/OvaleData.lua b/OvaleData.lua
index c9790e4..c34fd97 100644
--- a/OvaleData.lua
+++ b/OvaleData.lua
@@ -486,7 +486,7 @@ end
 function OvaleData:DebugGlyphs()
 	local array = {}
 	for glyphId in pairs(self.glyphs) do
-		tinsert(array, API_GetSpellInfo(glyphId) .. ": " .. glyphId)
+		tinsert(array, self:GetSpellName(glyphId) .. ": " .. glyphId)
 	end
 	tsort(array)
 	for _, v in ipairs(array) do
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index a037a8c..9021ae3 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -27,7 +27,6 @@ local select = select
 local strfind = string.find
 local tinsert = table.insert
 local tremove = table.remove
-local API_GetSpellInfo = GetSpellInfo
 local API_UnitCastingInfo = UnitCastingInfo
 local API_UnitChannelInfo = UnitChannelInfo
 local API_UnitGUID = UnitGUID
@@ -92,8 +91,7 @@ local function AddSpellToQueue(spellId, lineId, startTime, endTime, channeled, a
 		spellcast.target = API_UnitGUID("target")
 	end
 	if self.traceSpellId and self.traceSpellId == spellId then
-		local spellName = OvaleData.spellList[spellId] or API_GetSpellInfo(spellId)
-		Ovale:Printf("    AddSpellToQueue: %f %s (%d), lineId = %d", Ovale.now, spellName, spellId, lineId)
+		Ovale:Printf("    AddSpellToQueue: %f %s (%d), lineId = %d", Ovale.now, OvaleData:GetSpellName(spellId), spellId, lineId)
 		Ovale:Printf("        startTime = %f, endTime = %f, target = %s", startTime, endTime, spellcast.target)
 	end

@@ -157,8 +155,7 @@ local function RemoveSpellFromQueue(spellId, lineId)
 	for index, spellcast in ipairs(self_activeSpellcast) do
 		if spellcast.lineId == lineId then
 			if self.traceSpellId and self.traceSpellId == spellId then
-				local spellName = OvaleData.spellList[spellId] or API_GetSpellInfo(spellId)
-				Ovale:Printf("    RemoveSpellFromQueue: %f %s (%d)", Ovale.now, spellName, spellId)
+				Ovale:Printf("    RemoveSpellFromQueue: %f %s (%d)", Ovale.now, OvaleData:GetSpellName(spellId), spellId)
 			end
 			tremove(self_activeSpellcast, index)
 			self_pool:Release(spellcast)
@@ -343,8 +340,7 @@ function OvaleFuture:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 				if spellcast.allowRemove and (spellcast.spellId == spellId or spellcast.auraSpellId == spellId) then
 					if not spellcast.channeled and (spellcast.removeOnSuccess or strfind(event, "SPELL_CAST_SUCCESS") ~= 1) then
 						if self.traceSpellId and self.traceSpellId == spellId then
-							local spellName = OvaleData.spellList[spellId] or API_GetSpellInfo(spellId)
-							Ovale:Printf("    Spell finished: %f %s (%d)", Ovale.now, spellName, spellId)
+							Ovale:Printf("    Spell finished: %f %s (%d)", Ovale.now, OvaleData:GetSpellName(spellId), spellId)
 						end
 						tremove(self_activeSpellcast, index)
 						self_pool:Release(spellcast)
@@ -432,8 +428,7 @@ function OvaleFuture:Debug()
 		Ovale:Print("No spells in flight!")
 	end
 	for spellId, lineId in self:InFlightSpells(Ovale.now) do
-		local spellName = OvaleData.spellList[spellId] or API_GetSpellInfo(spellId)
-		Ovale:Printf("    %s (%d), lineId = %s", spellName, spellId, lineId)
+		Ovale:Printf("    %s (%d), lineId = %s", OvaleData:GetSpellName(spellId), spellId, lineId)
 	end
 end
 --</public-static-methods>
diff --git a/OvaleIcone.lua b/OvaleIcone.lua
index 94ac94e..a990b52 100644
--- a/OvaleIcone.lua
+++ b/OvaleIcone.lua
@@ -237,7 +237,7 @@ function OvaleIcone_OnEnter(self)
 			GameTooltip:SetText(L[self.help])
 		end
 		if self.spellId then
-			GameTooltip:AddLine(GetSpellInfo(self.spellId),0.5,1,0.75)
+			GameTooltip:AddLine(OvaleData:GetSpellName(self.spellId), 0.5, 1, 0.75)
 		end
 		if next(Ovale.casesACocher) or next(Ovale.listes) then
 			GameTooltip:AddLine(L["Cliquer pour afficher/cacher les options"],1,1,1)