range check fix class colors

This commit is contained in:
Sumsebrum 2021-06-16 14:10:49 +02:00
parent f0c0286708
commit 993de572cd
3 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,8 @@ Gladdy.BUTTON_DEFAULTS = {
damaged = 0, damaged = 0,
click = false, click = false,
stealthed = false, stealthed = false,
classColors = {},
lastState = 0,
} }
function Gladdy:CreateFrame() function Gladdy:CreateFrame()
@ -272,7 +274,6 @@ end
function Gladdy:ToggleFrame(i) function Gladdy:ToggleFrame(i)
self:Reset() self:Reset()
if (self.frame and self.frame:IsShown() and i == self.curBracket) then if (self.frame and self.frame:IsShown() and i == self.curBracket) then
self:HideFrame() self:HideFrame()
else else
@ -288,6 +289,8 @@ function Gladdy:ToggleFrame(i)
self:CreateButton(o) self:CreateButton(o)
end end
end end
self:Reset()
self.curBracket = i
self:UpdateFrame() self:UpdateFrame()
self:Test() self:Test()
self.frame:Show() self.frame:Show()

View File

@ -289,7 +289,7 @@ end
--------------------------- ---------------------------
function Gladdy:Test() function Gladdy:Test()
Gladdy.frame.testing = true self.frame.testing = true
for i = 1, self.curBracket do for i = 1, self.curBracket do
local unit = "arena" .. i local unit = "arena" .. i
if (not self.buttons[unit]) then if (not self.buttons[unit]) then
@ -388,7 +388,7 @@ function Gladdy:ResetButton(unit)
button[k1] = nil button[k1] = nil
elseif (type(v1) == "number") then elseif (type(v1) == "number") then
button[k1] = 0 button[k1] = 0
elseif (type(v1) == "array") then elseif (type(v1) == "table") then
button[k1] = {} button[k1] = {}
elseif (type(v1) == "boolean") then elseif (type(v1) == "boolean") then
button[k1] = false button[k1] = false

View File

@ -64,8 +64,8 @@ end
function RangeCheck:ResetUnit(unit) function RangeCheck:ResetUnit(unit)
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
self:CancelTimer(button) self:CancelTimer(button)
button.lastState = 0
self:SetColor(button, 1) self:SetColor(button, 1)
button.classColors = {}
end end
function RangeCheck:Test(unit) function RangeCheck:Test(unit)
@ -99,7 +99,7 @@ function RangeCheck:SetColor(button, oorFac)
return return
end end
if not button.classColors then if not button.classColors.r then
if button.class then if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b } button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
else else