-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridStatusRange.lua
More file actions
97 lines (80 loc) · 2.51 KB
/
GridStatusRange.lua
File metadata and controls
97 lines (80 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
local L = AceLibrary("AceLocale-2.2"):new("Grid")
GridStatusRange = GridStatus:NewModule("GridStatusRange")
GridStatusRange.menuName = "Range"
--{{{ AceDB defaults
GridStatusRange.defaultDB = {
debug = false,
alert_range = {
text = "Range",
enable = true,
color = { r = 1, g = 0, b = 0, a = 1 },
priority = 99,
interval = 0.25,
},
}
--}}}
GridStatusRange.options = false
--{{{ additional options
local rangeOptions = {
["interval"] = {
type = "range",
name = "Range Check Interval",
desc = "Set the range check interval.",
max = 5,
min = 0.25,
step = 0.25,
get = function ()
return GridStatusRange.db.profile.alert_range.interval
end,
set = function (v)
GridStatusRange.db.profile.alert_range.interval = v
GridStatusRange:UpdateRangeFrequency()
end,
},
["range"] = false,
}
function GridStatusRange:OnInitialize()
self.super.OnInitialize(self)
end
function GridStatusRange:OnEnable()
self:RegisterStatus("alert_range", "Range alert", rangeOptions, true)
self:ScheduleRepeatingEvent("GridEnhancedRangeCheck", self.RangeCheck, GridStatusRange.db.profile.alert_range.interval, self)
end
function GridStatusRange:RangeCheck()
--local settings = self.db.profile.alert_range
--if not settings.enable then return end
local settings = self.db.profile.alert_range
if not settings.enable then return end
--local now = GetTime()
for frameName,frame in pairs(GridFrame.registeredFrames) do
if frame.unit then
if CheckInteractDistance(frame.unit, 4) then
self.core:SendStatusLost(frame.unitName, "alert_range")
--if frame.frame:GetAlpha() ~= 1 then
--frame.frame.BarBG:SetAlpha(1)
--frame.frame.Bar:SetAlpha(1)
-- frame.frame:SetAlpha(1)
--end
else
self.core:SendStatusGained(frame.unitName, "alert_range",
settings.priority,
nil,
settings.color,
settings.text,
nil,
nil,
nil)
--if frame.frame:GetAlpha() ~= settings.opacity then
--frame.frame.BarBG:SetAlpha(settings.opacity)
--frame.frame.Bar:SetAlpha(settings.opacity)
-- frame.frame:SetAlpha(settings.opacity)
--end
end
end
end
end
function GridStatusRange:UpdateRangeFrequency()
local settings = self.db.profile.alert_range
self:CancelScheduledEvent("GridEnhancedRangeCheck")
self:ScheduleRepeatingEvent("GridEnhancedRangeCheck", self.RangeCheck, settings.interval, self)
end