Skip to content

Commit

Permalink
ShowAllSpellRanks causing range to be invalid when toggled. (#15)
Browse files Browse the repository at this point in the history
The library internally in the spell checkers, e.g. checkers_Spell uses the "spell index". The spell index is actually the index into the player's spell book, not the spell id.

Toggling the "Show all ranks" toggle does change these indexes, since multiple ranks are shown, thus the checkers need to reinitialized.
  • Loading branch information
kodewdle authored Feb 18, 2024
1 parent 6222731 commit 491840e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion LibRangeCheck-3.0/LibRangeCheck-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ License: MIT
-- @class file
-- @name LibRangeCheck-3.0
local MAJOR_VERSION = "LibRangeCheck-3.0"
local MINOR_VERSION = 12
local MINOR_VERSION = 13

---@class lib
local lib, oldminor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
Expand Down Expand Up @@ -1224,6 +1224,12 @@ function lib:SPELLS_CHANGED()
self:scheduleInit()
end

function lib:CVAR_UPDATE(_, cvar)
if cvar == "ShowAllSpellRanks" then
self:scheduleInit()
end
end

function lib:UNIT_INVENTORY_CHANGED(event, unit)
if self.initialized and unit == "player" and self.handSlotItem ~= GetInventoryItemLink("player", HandSlotId) then
self:scheduleInit()
Expand Down Expand Up @@ -1670,6 +1676,10 @@ function lib:activate()
frame:RegisterEvent("CHARACTER_POINTS_CHANGED")
frame:RegisterEvent("SPELLS_CHANGED")

if isEra or isWrath then
frame:RegisterEvent("CVAR_UPDATE")
end

if isRetail or isWrath then
frame:RegisterEvent("PLAYER_TALENT_UPDATE")
end
Expand Down

0 comments on commit 491840e

Please sign in to comment.