From 6c471a0fad6be38e63fec63796d5220bed8d7666 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Thu, 17 Jun 2021 16:43:28 +0200 Subject: [PATCH] RangeCheck added ENEMY_SPOTTED --- Frame.lua | 1 + Modules/RangeCheck.lua | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Frame.lua b/Frame.lua index cd854eb..018171e 100644 --- a/Frame.lua +++ b/Frame.lua @@ -333,6 +333,7 @@ function Gladdy:CreateButton(i) for _, v in self:IterModules() do self:Call(v, "CreateFrame", "arena" .. i) end + self:ResetButton("arena" .. i) end function Gladdy:GetAnchor(unit, position) diff --git a/Modules/RangeCheck.lua b/Modules/RangeCheck.lua index e1f6f9e..8a0b26b 100644 --- a/Modules/RangeCheck.lua +++ b/Modules/RangeCheck.lua @@ -54,6 +54,7 @@ local RangeCheck = Gladdy:NewModule("Range Check", nil, { function RangeCheck:Initialize() self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("ENEMY_STEALTH") + self:RegisterMessage("ENEMY_SPOTTED") self.playerClass = select(2, UnitClass("player")) end @@ -73,6 +74,7 @@ function RangeCheck:Test(unit) if not button then return end + self:ENEMY_SPOTTED(unit) self.test = true button.lastState = 0 if Gladdy.db.rangeCheckEnabled then @@ -182,16 +184,22 @@ function RangeCheck:ENEMY_STEALTH(unit, stealth) end button.lastState = 0 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 } else 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 } 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) local button = self.parent