-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwwEnergy.lua
75 lines (59 loc) · 2.62 KB
/
wwEnergy.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
-------------------------------------------------------------------------------
-- TSU: UNIT_POWER_FREQUENT:player, UNIT_SPELL_HASTE:player
function(allstates, event, ...)
if event == "UNIT_POWER_FREQUENT" then
-- Don't update the state in response to 'UNIT_SPELL_HASTE' events.
local powerType = select(2, ...)
if powerType ~= "ENERGY" and powerType ~= nil then
return false
end
local maxPower = UnitPowerMax("player", Enum.PowerType.Energy)
-- Set the state for the energy bar.
local state = allstates[1]
if state == nil then
state = {
["show"] = true,
["progressType"] = "static"
}
allstates[1] = state
end
state.changed = true
state.total = maxPower
state.value = UnitPower("player", Enum.PowerType.Energy)
end
-- Still return 'true' for 'UNIT_SPELL_HASTE' events. This allows the
-- custom text code to run additional code to manipulate the regions in
-- response to these events.
return true
end
-------------------------------------------------------------------------------
-- custom text code
function()
local tickNum = 0
for _, subregion in ipairs(aura_env.region.subRegions) do
if subregion.type and subregion.type == "subtick" then
tickNum = tickNum + 1
if tickNum == 1 then
-- Treat this as the Fists of Fury energy limit. Note that the
-- energy gained during a Fists of Fury channel does not vary
-- with haste; more haste increases the energy regen rate, but
-- it also reduces the channel time of Fists of Fury by the
-- exact same multiplier. The energy gained does change,
-- however, based on whether the Ascension talent is selected,
-- which increases energy regeneration without modifying haste.
local hasAscension = select(
4,
GetTalentInfoByID(22098, GetActiveSpecGroup()))
subregion:SetTickPlacement(hasAscension and 44 or 40)
elseif tickNum == 2 then
-- Treat this as the GCD energy limit. Note that the majority
-- of windwalker rotational abilities incur a GCD of exactly
-- 1.0 second, regardless of haste.
local energyRegenRate = GetPowerRegen()
subregion:SetTickPlacement(energyRegenRate)
-- Break the loop.
break
end
end
end
end