From 528c64b1d049e8453f52b67cdd11f8c288fe43fc Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Mon, 21 Apr 2014 05:01:32 +0000 Subject: [PATCH] Change OvaleSpellBook:IsUsableSpell() to allow checking unlearned spells. Not every spell that is cast is in the spellbook, e.g., spells due to procs. Also, fudge the output slightly by checking value of IsSpellOverlayed() in case the ID of the spell being checked has changed due to a proc. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1296 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleSpellBook.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OvaleSpellBook.lua b/OvaleSpellBook.lua index 0bd013a..78a2c42 100644 --- a/OvaleSpellBook.lua +++ b/OvaleSpellBook.lua @@ -1,7 +1,7 @@ --[[-------------------------------------------------------------------- Ovale Spell Priority Copyright (C) 2012 Sidoine - Copyright (C) 2012, 2013 Johnny C. Lam + Copyright (C) 2012, 2013, 2014 Johnny C. Lam This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License in the LICENSE @@ -33,6 +33,7 @@ local API_GetSpellLink = GetSpellLink local API_GetSpellTabInfo = GetSpellTabInfo local API_GetTalentInfo = GetTalentInfo local API_HasPetSpells = HasPetSpells +local API_IsSpellOverlayed = IsSpellOverlayed local API_IsUsableSpell = IsUsableSpell local BOOKTYPE_PET = BOOKTYPE_PET local BOOKTYPE_SPELL = BOOKTYPE_SPELL @@ -254,15 +255,14 @@ function OvaleSpellBook:IsKnownTalent(talentId) end -- Returns true if the given spell ID is usable. A spell is *not* usable if: --- The player hasn't learned the spell. -- The player lacks required mana or reagents. -- Reactive conditions haven't been met. +-- XXX Use IsSpellOverlayed() to catch instances where a spell becomes usable due +-- 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) - if name then - return API_IsUsableSpell(self:GetSpellName(spellId)) - end - return false + return API_IsUsableSpell(name) or API_IsSpellOverlayed(spellId) end -- Print out the list of active glyphs in alphabetical order. -- 1.7.9.5