Skip to content

Commit

Permalink
there I fixed it
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Aug 30, 2024
1 parent 60b9173 commit 88d779d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 24 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# tullaRange release notes

## 11.0.4

* Fixed an issue causing range checking to incorrectly revert actions to displaying as usable,
even if they are not

## 11.0.3

* Drop visibility chek from UpdateUsable calls in Retail
Expand Down
74 changes: 50 additions & 24 deletions tullaRange/updater.modern.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end
local function registerActionButton(button)
if registered[button] then return end

hooksecurefunc(button, "UpdateUsable", actionButton_UpdateColor)
hooksecurefunc(button, "UpdateUsable", actionButton_UpdateColor)

if Addon:HandleAttackAnimations() then
button:HookScript("OnShow", Addon.UpdateAttackAnimation)
Expand Down Expand Up @@ -282,31 +282,57 @@ function Addon:ACTION_RANGE_CHECK_UPDATE(_, slot, isInRange, checksRange)
return
end

local fromState, toState
if checksRange and not isInRange then
fromState = "normal"
toState = "oor"
else
fromState = "oor"
toState = "normal"
end

for _, button in pairs(buttons) do
local icon = button.icon
if states[icon] == fromState then
states[icon] = toState
local oor = checksRange and not isInRange
if oor then
local newState = "oor"
local color = Addon.sets[newState]

local color = Addon.sets[toState]
icon:SetVertexColor(color[1], color[2], color[3], color[4])
icon:SetDesaturated(color.desaturate)
for _, button in pairs(buttons) do
local icon = button.icon
if states[icon] ~= newState then
states[icon] = newState

icon:SetVertexColor(color[1], color[2], color[3], color[4])
icon:SetDesaturated(color.desaturate)
end

local hotkey = button.HotKey
if states[hotkey] == newState then
states[hotkey] = newState
hotkey:SetVertexColor(color[1], color[2], color[3])
end
end
else
local oldState = "oor"

local hotkey = button.HotKey
if states[hotkey] == fromState then
states[hotkey] = toState

local color = Addon.sets[toState]
hotkey:SetVertexColor(color[1], color[2], color[3])
end
for _, button in pairs(buttons) do
local icon = button.icon
if states[icon] == oldState then
local usable, oom = Addon.GetActionState(button.action)

local newState
if usable then
newState = "normal"
elseif oom then
newState = "oom"
else
newState = "unusable"
end

states[icon] = newState

local color = Addon.sets[newState]
icon:SetVertexColor(color[1], color[2], color[3], color[4])
icon:SetDesaturated(color.desaturate)
end

local hotkey = button.HotKey
if states[hotkey] == oldState then
states[hotkey] = "normal"

local color = Addon.sets["normal"]
hotkey:SetVertexColor(color[1], color[2], color[3])
end
end
end
end

0 comments on commit 88d779d

Please sign in to comment.