RangeCheck added ENEMY_SPOTTED

This commit is contained in:
Sumsebrum 2021-06-17 16:43:28 +02:00
parent 6f5cb0498b
commit 6c471a0fad
2 changed files with 11 additions and 2 deletions

View File

@ -333,6 +333,7 @@ function Gladdy:CreateButton(i)
for _, v in self:IterModules() do for _, v in self:IterModules() do
self:Call(v, "CreateFrame", "arena" .. i) self:Call(v, "CreateFrame", "arena" .. i)
end end
self:ResetButton("arena" .. i)
end end
function Gladdy:GetAnchor(unit, position) function Gladdy:GetAnchor(unit, position)

View File

@ -54,6 +54,7 @@ local RangeCheck = Gladdy:NewModule("Range Check", nil, {
function RangeCheck:Initialize() function RangeCheck:Initialize()
self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_STEALTH") self:RegisterMessage("ENEMY_STEALTH")
self:RegisterMessage("ENEMY_SPOTTED")
self.playerClass = select(2, UnitClass("player")) self.playerClass = select(2, UnitClass("player"))
end end
@ -73,6 +74,7 @@ function RangeCheck:Test(unit)
if not button then if not button then
return return
end end
self:ENEMY_SPOTTED(unit)
self.test = true self.test = true
button.lastState = 0 button.lastState = 0
if Gladdy.db.rangeCheckEnabled then if Gladdy.db.rangeCheckEnabled then
@ -182,16 +184,22 @@ function RangeCheck:ENEMY_STEALTH(unit, stealth)
end end
button.lastState = 0 button.lastState = 0
if stealth then if stealth then
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
button.classColors = { r = 0.66, g = 0.66, b = 0.66 } button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
else else
if button.class then if button.class then
button.healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
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 }
end end
end end
end end
function RangeCheck:ENEMY_SPOTTED(unit)
local button = Gladdy.buttons[unit]
if (not button) then
return
end
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
end
function RangeCheck.CheckRange(self) function RangeCheck.CheckRange(self)
local button = self.parent local button = self.parent