-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAlerts.lua
More file actions
206 lines (132 loc) · 5.95 KB
/
Alerts.lua
File metadata and controls
206 lines (132 loc) · 5.95 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
HTT_Alerts = {
StoneGarden = {
weaponOnFireActive = false,
lastUsedAt = {
[1] = 0, --whop
[2] = 0, --inflamableConcoction
[3] = 0, --weapon on fire
[4] = 0, --scalding stab
},
cooldown = {
[1] = 15,
[2] = 15,
[3] = 15,
[4] = 6,
},
text = {
[1] = "Fiery Weapon",
[2] = "Throw Fire",
[3] = "Heavy Attack",
[4] = "DoT Stab",
},
color = {
[1] = {0.2,0.6,0.4},
[2] = {0.9,0.9,0.1},
[3] = {62/255, 41/255,1},
[4] = {1,0,0},
},
icon = {
[1] = "esoui/art/icons/ability_rogue_034.dds",
[2] = "/esoui/art/icons/death_recap_fire_aoe2.dds",
[3] = "/esoui/art/icons/death_recap_melee_heavy.dds",
[4] = "/esoui/art/icons/death_recap_melee_heavy.dds",
}
}
}
function HTT_Alerts.StoneGarden.initializeEvents()
EVENT_MANAGER:RegisterForEvent("scaldingStab", EVENT_COMBAT_EVENT, function()
HTT_Alerts.StoneGarden.lastUsedAt[4] = GetGameTimeSeconds()
HTT_Alerts.StoneGarden.cooldown[4] = 6
end)
EVENT_MANAGER:AddFilterForEvent("scaldingStab", EVENT_COMBAT_EVENT, REGISTER_FILTER_ABILITY_ID,133440)
EVENT_MANAGER:RegisterForEvent("whop", EVENT_COMBAT_EVENT, function()
if HTT_Alerts.StoneGarden.lastUsedAt[3] + HTT_Alerts.StoneGarden.cooldown[3] <= GetGameTimeSeconds() then
HTT_Alerts.StoneGarden.lastUsedAt[3] = GetGameTimeSeconds()
end
end)
EVENT_MANAGER:AddFilterForEvent("whop", EVENT_COMBAT_EVENT, REGISTER_FILTER_ABILITY_ID,134308)
EVENT_MANAGER:RegisterForEvent("inflamableConcoction", EVENT_COMBAT_EVENT, function()
if HTT_Alerts.StoneGarden.lastUsedAt[2] + HTT_Alerts.StoneGarden.cooldown[2] <= GetGameTimeSeconds() then
HTT_Alerts.StoneGarden.lastUsedAt[2] = GetGameTimeSeconds()
end
end)
EVENT_MANAGER:AddFilterForEvent("inflamableConcoction", EVENT_COMBAT_EVENT, REGISTER_FILTER_ABILITY_ID,134460)
EVENT_MANAGER:RegisterForEvent("weaponOnFire", EVENT_EFFECT_CHANGED, function(_,_,_,_,_,check)
if check ~= 0 then
HTT_Alerts.StoneGarden.lastUsedAt[1] = GetGameTimeSeconds()
HTT_Alerts.StoneGarden.lastUsedAt[4] = GetGameTimeSeconds()
HTT_Alerts.StoneGarden.cooldown[4] = 3
HTT_Alerts.StoneGarden.cooldown[1] = 15
HTT_Alerts.StoneGarden.weaponOnFireActive = true
end
end)
EVENT_MANAGER:AddFilterForEvent("weaponOnFire", EVENT_EFFECT_CHANGED, REGISTER_FILTER_ABILITY_ID,133423)
EVENT_MANAGER:RegisterForEvent("weaponOnFireOver", EVENT_EFFECT_CHANGED, function(_,_,_,_,_,check)
if check == 0 then
HTT_Alerts.StoneGarden.lastUsedAt[1] = GetGameTimeSeconds()
HTT_Alerts.StoneGarden.cooldown[1] = 10
HTT_Alerts.StoneGarden.weaponOnFireActive = false
end
end)
EVENT_MANAGER:AddFilterForEvent("weaponOnFireOver", EVENT_EFFECT_CHANGED, REGISTER_FILTER_ABILITY_ID,133423)
end
function HTT_Alerts.UpdateDuration()
local AlertBackground = HTTAlert:GetNamedChild("AlertsBackground")
local countMembers = 0
------------------ Cooldowns --------------------------------
if HTT_variables.scene~=SCENE_HIDDEN then
HTTAlert:SetHidden(false)
for n=1, 4 do
local effectIsOn = false
remainingTime = HTT_Alerts.StoneGarden.lastUsedAt[n] + HTT_Alerts.StoneGarden.cooldown[n] - GetGameTimeSeconds()
local textInBar = HTTAlert:GetNamedChild("AlertsTextInBar"..n)
local durationTimer = HTTAlert:GetNamedChild("AlertsDurationTimer"..n)
local durationBar = HTTAlert:GetNamedChild("AlertsDurationBar"..n)
local icon = HTTAlert:GetNamedChild("AlertsIcon"..n)
durationTimer:SetHidden(false)
durationBar:SetHidden(false)
icon:SetHidden(false)
textInBar:SetHidden(false)
countMembers = countMembers+1
durationBar:ClearAnchors()
durationBar:SetAnchor(TOPLEFT, AlertBackground, TOPLEFT, 24, (countMembers*22))
durationTimer:ClearAnchors()
durationTimer:SetAnchor(TOPLEFT, AlertBackground, TOPLEFT, 5, (22*countMembers))
textInBar:ClearAnchors()
textInBar:SetAnchor(TOPLEFT, AlertBackground, TOPLEFT, 30, (22*countMembers)+1)
icon:ClearAnchors()
icon:SetAnchor(TOPLEFT, AlertBackground, TOPLEFT, 5, (22*countMembers))
if remainingTime > 0 then
durationTimer:SetText((math.floor(remainingTime*10)/10).."s")
else
durationTimer:SetText("0.0s")
end
durationBar:SetColor(HTT_Alerts.StoneGarden.color[n][1],HTT_Alerts.StoneGarden.color[n][2],HTT_Alerts.StoneGarden.color[n][3])
if remainingTime > 0 then
durationBar:SetDimensions(math.floor(HTTsavedVars[HTT_variables.currentlySelectedProfile].width * ( 1 - 0.2))*(remainingTime/HTT_Alerts.StoneGarden.cooldown[n]),HTTsavedVars[HTT_variables.currentlySelectedProfile].height/2)
durationBar:SetTextureCoords(0,remainingTime/HTT_Alerts.StoneGarden.cooldown[n],0,1)
else
durationBar:SetDimensions(math.floor(HTTsavedVars[HTT_variables.currentlySelectedProfile].width * ( 1 - 0.2)),HTTsavedVars[HTT_variables.currentlySelectedProfile].height/2)
end
icon:SetTexture(HTT_Alerts.StoneGarden.icon[n])
if n==4 and not HTT_Alerts.StoneGarden.weaponOnFireActive then
durationBar:SetColor(0.9,0.1,0.9)
textInBar:SetText(HTT_Alerts.StoneGarden.text[n].." impossible")
elseif remainingTime <= 0 then
textInBar:SetText(HTT_Alerts.StoneGarden.text[n].." ready")
durationBar:SetTextureCoords(0,1,0,1)
durationBar:SetColor(50,50,51,0.5)
durationBar:SetDimensions(math.floor(HTTsavedVars[HTT_variables.currentlySelectedProfile].width * ( 1 - 0.2)),HTTsavedVars[HTT_variables.currentlySelectedProfile].height/2)
elseif n==1 and HTT_Alerts.StoneGarden.weaponOnFireActive then
durationBar:SetColor(1, 80/255, 5/255)
textInBar:SetText(HTT_Alerts.StoneGarden.text[n].." active")
else
textInBar:SetText(HTT_Alerts.StoneGarden.text[n].." on cooldown")
end
end
AlertBackground:SetDimensions(210, 22*countMembers+26)
else
HTTAlert:SetHidden(true)
end
------------------ Cooldowns --------------------------------
end