@@ -67,7 +67,7 @@ local CheckInteractDistance = CheckInteractDistance
67
67
local GetInventoryItemLink = GetInventoryItemLink
68
68
local GetItemInfo = GetItemInfo
69
69
local GetNumSpellTabs = GetNumSpellTabs
70
- local GetSpellBookItemInfo = GetSpellBookItemInfo
70
+ local GetSpellBookItemName = GetSpellBookItemName
71
71
local GetSpellInfo = GetSpellInfo
72
72
local GetSpellTabInfo = GetSpellTabInfo
73
73
local GetTime = GetTime
@@ -133,6 +133,7 @@ local InteractLists = {
133
133
}
134
134
135
135
local MeleeRange = 2
136
+ local MatchSpellByID = {} -- specific matching to avoid incorrect index
136
137
local FriendSpells , HarmSpells , ResSpells , PetSpells = {}, {}, {}, {}
137
138
138
139
for _ , n in ipairs ({ " EVOKER" , " DEATHKNIGHT" , " DEMONHUNTER" , " DRUID" , " HUNTER" , " SHAMAN" , " MAGE" , " PALADIN" , " PRIEST" , " WARLOCK" , " WARRIOR" , " MONK" , " ROGUE" }) do
@@ -196,6 +197,8 @@ if not isRetail then
196
197
end
197
198
198
199
if isEraSOD then
200
+ MatchSpellByID [401417 ] = true
201
+
199
202
tinsert (FriendSpells .MAGE , 401417 ) -- Regeneration (40 yards)
200
203
tinsert (FriendSpells .MAGE , 412510 ) -- Mass Regeneration (40 yards)
201
204
end
@@ -653,15 +656,14 @@ local function getNumSpells()
653
656
end
654
657
655
658
-- return the spellIndex of the given spell by scanning the spellbook
656
- local allowSpellType = { SPELL = true , FUTURESPELL = true }
657
659
local function findSpellIdx (spellName , sid )
658
660
if not spellName or spellName == " " then
659
661
return nil
660
662
end
661
663
662
664
for i = 1 , getNumSpells () do
663
- local spellType , id = GetSpellBookItemInfo (i , BOOKTYPE_SPELL )
664
- if sid == id and allowSpellType [ spellType ] then
665
+ local name , _ , id = GetSpellBookItemName (i , BOOKTYPE_SPELL )
666
+ if sid == id or ( spellName == name and not MatchSpellByID [ id ]) then
665
667
return i
666
668
end
667
669
end
0 commit comments