-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstacksAsProgress.lua
77 lines (60 loc) · 1.83 KB
/
stacksAsProgress.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
-------------------------------------------------------------------------------
-- TSU: TRIGGER:1, TRIGGER:3
function(allstates, event, triggerNum, updatedTriggerStates)
if event == 'OPTIONS' then
return false
end
local state = allstates['']
if state == nil then
state = {
['show'] = true,
['changed'] = true,
['progressType'] = 'static',
['stacks'] = 0,
['value'] = 0,
['total'] = aura_env.config.maxStacks
}
allstates[''] = state
end
if event == 'STATUS' then
return true
end
local triggerState = updatedTriggerStates['']
if triggerNum == 3 then
if triggerState == nil then
-- The max-stack buff just dropped, so We're at 0 stacks.
state['stacks'] = 0
state['atMaxStacks'] = false
else
-- We just gained the max-stack buff.
state['stacks'] = state['total']
state['atMaxStacks'] = true
end
state['value'] = state['stacks']
state['changed'] = true
return true
else
if triggerState == nil then
-- The stacking buff just dropped. Check if we're at max stacks.
if state['atMaxStacks'] then
return false
end
state['stacks'] = 0
state['atMaxStacks'] = false
else
state['stacks'] = triggerState['stacks']
state['atMaxStacks'] = state['stacks'] == state['total']
end
state['value'] = state['stacks']
state['changed'] = true
return true
end
end
-------------------------------------------------------------------------------
-- Custom Variables
{
['value'] = true,
['total'] = true,
['stacks'] = true,
['atMaxStacks'] = 'bool'
}