Skip to content

Commit 3a523ca

Browse files
committed
Fixing heal range check crash on reload (GH issue #351)
1 parent 7358397 commit 3a523ca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/StatusRange.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local GetSpellInfo = Grid2.API.GetSpellInfo
1515
local IsSpellInRange = Grid2.API.IsSpellInRange
1616

1717
-------------------------------------------------------------------------
18-
-- Check Range Spells Info
18+
-- Range check spells initialization
1919
-------------------------------------------------------------------------
2020
local spellHostile, spellFriendly = nil, nil
2121
do
@@ -82,6 +82,9 @@ local rezSpellID = ({DRUID=20484,PRIEST=2006,PALADIN=7328,SHAMAN=2008,MONK=11517
8282

8383
local rezSpell = rezSpellID and GetSpellInfo(rezSpellID)
8484

85+
-- These range functions can be called before Grid2:UpdatePlayerRangeSpells() is executed because SPELLS_CHANGED
86+
-- event is executed after PLAYER_ENTERING_WORLD, it should not be a problem because those functions are checking
87+
-- if spellFriendly/spellHostile are not nil before calling IsSpellInRange()
8588
local Ranges = {
8689
[99] = UnitIsVisible,
8790
[38] = function(unit)
@@ -100,8 +103,12 @@ local Ranges = {
100103
return true
101104
elseif UnitCanAttack('player', unit) then
102105
return spellHostile == nil or IsSpellInRange(spellHostile, unit) == 1
106+
elseif rezSpell and UnitIsDeadOrGhost(unit) then
107+
return IsSpellInRange(rezSpell, unit) == 1
108+
elseif spellFriendly then
109+
return IsSpellInRange(spellFriendly, unit) == 1
103110
else
104-
return IsSpellInRange(UnitIsDeadOrGhost(unit) and rezSpell or spellFriendly, unit) == 1
111+
return InCombatLockdown() or CheckInteractDistance(unit,4)
105112
end
106113
end,
107114
["spell"] = function(unit)

0 commit comments

Comments
 (0)