-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlust-offset.lua
96 lines (75 loc) · 2.58 KB
/
lust-offset.lua
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
-------------------------------------------------------------------------------
-- TSU: TRIGGER:1, TRIGGER:2
function(allstates, event, triggerNum, triggerStates)
if event ~= 'TRIGGER' then
return false
end
local state = allstates['']
local triggerState = triggerStates['']
if triggerNum == 1 and triggerState == nil then
-- The Sated debuff has expired. Hide this state.
if state == nil then
return false
end
state['show'] = false
state['changed'] = true
return true
end
-- We need to populate data into 'state'.
if state == nil then
state = {
['show'] = true,
['progressType'] = 'timed',
['autoHide'] = false,
}
allstates[''] = state
end
if triggerNum == 1 then
state['satedExpiration'] = triggerState['expirationTime']
state['satedDuration'] = triggerState['duration']
else
if triggerState == nil then
state['spellCdExpiration'] = nil
state['spellCdDuration'] = nil
else
state['spellCdExpiration'] = triggerState['expirationTime']
state['spellCdDuration'] = triggerState['duration']
end
end
if state['satedExpiration'] == nil then
-- Wait for this trigger to come in.
return false
end
if state['spellCdExpiration'] ~= nil then
-- The spell is on CD. Show the difference.
local difference = state['satedExpiration'] - state['spellCdExpiration']
local absDifference = math.abs(difference)
state['sign'] = difference < 0 and '-' or '+'
state['difference'] = difference
state['absDifference'] = absDifference
state['paused'] = true
state['expirationTime'] = state['spellCdExpiration']
state['duration'] = absDifference
state['remaining'] = absDifference
else
-- The spell is not on CD. Show the remaining duration on Sated.
state['sign'] = '+'
state['difference'] = state['satedDuration']
state['absDifference'] = state['satedDuration']
state['paused'] = false
state['expirationTime'] = state['satedExpiration']
state['duration'] = state['satedDuration']
end
state['changed'] = true
return true
end
-------------------------------------------------------------------------------
-- Custom Variables
{
['expirationTime'] = true,
['duration'] = true,
['paused'] = 'bool',
['sign'] = 'string',
['difference'] = 'number',
['absDifference'] = 'number',
}