Quantcast

Return proper IsUsableSpell() value if the name differs from GetSpellInfo.

Johnny C. Lam [04-21-14 - 05:01]
Return proper IsUsableSpell() value if the name differs from GetSpellInfo.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1297 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleSpellBook.lua
diff --git a/OvaleSpellBook.lua b/OvaleSpellBook.lua
index 78a2c42..dbf890a 100644
--- a/OvaleSpellBook.lua
+++ b/OvaleSpellBook.lua
@@ -261,8 +261,17 @@ end
 -- XXX to a proc but the proc replaces the spell in the spellbook, e.g.,
 -- XXX "Aimed Shot" --> "Aimed Shot!".
 function OvaleSpellBook:IsUsableSpell(spellId)
-	local name = self:GetSpellName(spellId)
-	return API_IsUsableSpell(name) or API_IsSpellOverlayed(spellId)
+	local spellName = self:GetSpellName(spellId)
+	local result = API_IsUsableSpell(spellName) or API_IsSpellOverlayed(spellId)
+	if not result then
+		-- Catch case where the name in the spellbook does not match the GetSpellInfo() name,
+		-- e.g., druid's Incarnation.
+		local name = API_GetSpellInfo(spellId)
+		if name ~= spellName then
+			result = API_IsUsableSpell(name)
+		end
+	end
+	return result
 end

 -- Print out the list of active glyphs in alphabetical order.