Skip to content

Commit

Permalink
LRC slot item check incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Nov 17, 2024
1 parent 274ee6c commit ada3fac
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions ElvUI_Libraries/Core/LibRangeCheck-3.0/LibRangeCheck-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ local setmetatable = setmetatable
local IsSpellKnownOrOverridesKnown = IsSpellKnownOrOverridesKnown
local CheckInteractDistance = CheckInteractDistance
local GetInventoryItemLink = GetInventoryItemLink
local GetTime = GetTime
local GetInventorySlotInfo = GetInventorySlotInfo
local InCombatLockdown = InCombatLockdown
local UnitCanAssist = UnitCanAssist
local UnitCanAttack = UnitCanAttack
Expand All @@ -77,6 +77,7 @@ local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local UnitIsUnit = UnitIsUnit
local UnitIsVisible = UnitIsVisible
local UnitRace = UnitRace
local GetTime = GetTime

local GetItemInfo = C_Item.GetItemInfo
local IsItemInRange = C_Item.IsItemInRange
Expand Down Expand Up @@ -141,8 +142,6 @@ end or _G.GetSpellTabInfo
local C_Timer = C_Timer
local Item = Item

local HandSlotId = GetInventorySlotInfo("HANDSSLOT")

local isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local isWrath = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC
local isEra = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
Expand Down Expand Up @@ -1062,7 +1061,6 @@ function lib:init(forced)
local _, playerRace = UnitRace("player")

local interactList = InteractLists[playerRace] or DefaultInteractList
self.handSlotItem = GetInventoryItemLink("player", HandSlotId)

local changed = false
if updateCheckers(self.friendRC, self.friendRCInCombat, createCheckerList(FriendSpells[playerClass], FriendItems, interactList)) then
Expand Down Expand Up @@ -1299,9 +1297,21 @@ function lib:CVAR_UPDATE(_, cvar)
end
end

function lib:UNIT_INVENTORY_CHANGED(event, unit)
if self.initialized and unit == "player" and self.handSlotItem ~= GetInventoryItemLink("player", HandSlotId) then
self:scheduleInit()
do
local chestSlotItem, legSlotItem
local ChestSlotID = GetInventorySlotInfo("CHESTSLOT")
local LegSlotID = GetInventorySlotInfo("LEGSSLOT")

function lib:UNIT_INVENTORY_CHANGED(event, unit) -- limited to Mages only currently
self.chestSlotItem = GetInventoryItemLink("player", ChestSlotID) -- Mage: Regeneration
self.legSlotItem = GetInventoryItemLink("player", LegSlotID) -- Mage: Mass Regeneration

if self.initialized and unit == "player" and (chestSlotItem ~= self.chestSlotItem or legSlotItem ~= self.legSlotItem) then
chestSlotItem = self.chestSlotID
legSlotItem = self.legSlotID

self:scheduleInit()
end
end
end

Expand Down Expand Up @@ -1432,8 +1442,7 @@ function lib:activate()
end

local _, playerClass = UnitClass("player")
if playerClass == "MAGE" or playerClass == "SHAMAN" then
-- Mage and Shaman gladiator gloves modify spell ranges
if playerClass == "MAGE" then
frame:RegisterUnitEvent("UNIT_INVENTORY_CHANGED", "player")
end
end
Expand Down

0 comments on commit ada3fac

Please sign in to comment.