Skip to content

Commit c6c5db5

Browse files
committed
fix Range Check by using names again unless it's special
1 parent 87ba151 commit c6c5db5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ElvUI_Libraries/Core/LibRangeCheck-3.0/LibRangeCheck-3.0.lua

+6-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ local CheckInteractDistance = CheckInteractDistance
6767
local GetInventoryItemLink = GetInventoryItemLink
6868
local GetItemInfo = GetItemInfo
6969
local GetNumSpellTabs = GetNumSpellTabs
70-
local GetSpellBookItemInfo = GetSpellBookItemInfo
70+
local GetSpellBookItemName = GetSpellBookItemName
7171
local GetSpellInfo = GetSpellInfo
7272
local GetSpellTabInfo = GetSpellTabInfo
7373
local GetTime = GetTime
@@ -133,6 +133,7 @@ local InteractLists = {
133133
}
134134

135135
local MeleeRange = 2
136+
local MatchSpellByID = {} -- specific matching to avoid incorrect index
136137
local FriendSpells, HarmSpells, ResSpells, PetSpells = {}, {}, {}, {}
137138

138139
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
196197
end
197198

198199
if isEraSOD then
200+
MatchSpellByID[401417] = true
201+
199202
tinsert(FriendSpells.MAGE, 401417) -- Regeneration (40 yards)
200203
tinsert(FriendSpells.MAGE, 412510) -- Mass Regeneration (40 yards)
201204
end
@@ -653,15 +656,14 @@ local function getNumSpells()
653656
end
654657

655658
-- return the spellIndex of the given spell by scanning the spellbook
656-
local allowSpellType = { SPELL = true, FUTURESPELL = true }
657659
local function findSpellIdx(spellName, sid)
658660
if not spellName or spellName == "" then
659661
return nil
660662
end
661663

662664
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
665667
return i
666668
end
667669
end

0 commit comments

Comments
 (0)