-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhdh_actions.lua
233 lines (186 loc) · 8.09 KB
/
hdh_actions.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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
aura_env.updateInterval = 0.03
aura_env.lastUpdate = GetTime()
aura_env.targetWipeInterval = 5
aura_env.danger_treshold = 55
aura_env.critical_treshold = 30
if aura_env.in_combat == nil then aura_env.in_combat = false end
aura_env.enabledToggle = "ALT-SHIFT-T"
aura_env.offCooldownsToggle = "ALT-SHIFT-R"
aura_env.defCooldownsToggle = "ALT-SHIFT-E"
WA_Redfellas_Rot_HDH_Enabled = WeakAurasSaved.displays[aura_env.id].hekiliEnabled == nil and true or WeakAurasSaved.displays[aura_env.id].hekiliEnabled
WA_Redfellas_Rot_HDH_Off_CDs = WeakAurasSaved.displays[aura_env.id].hekiliCooldownsOff == nil and false or WeakAurasSaved.displays[aura_env.id].hekiliCooldownsOff
WA_Redfellas_Rot_HDH_Def_CDs = WeakAurasSaved.displays[aura_env.id].hekiliCooldownsDef == nil and false or WeakAurasSaved.displays[aura_env.id].hekiliCooldownsDef
aura_env.bindsInitialized = false
aura_env.keyhandler = aura_env.keyhandler or CreateFrame("Button", aura_env.id.."_Keyhandler", UIParent)
aura_env.keyhandler.parent = aura_env
aura_env.keyhandler:RegisterForClicks("AnyDown")
aura_env.keyhandler:SetScript("OnClick", function (self, button, down)
if button == "defCooldowns" then
WA_Redfellas_Rot_HDH_Def_CDs = not WA_Redfellas_Rot_HDH_Def_CDs
print("|cFF00FFFFRedfella's Rotation Helper Defensive Cooldowns: " .. ( WA_Redfellas_Rot_HDH_Def_CDs and "|cFF00FF00ENABLED|r" or "|cFFFF0000DISABLED|r" ) )
elseif button == "Enabled" then
WA_Redfellas_Rot_HDH_Enabled = not WA_Redfellas_Rot_HDH_Enabled
print("|cFF00FFFFRedfella's Rotation Helper: " .. ( WA_Redfellas_Rot_HDH_Enabled and "|cFF00FF00ENABLED|r" or "|cFFFF0000DISABLED|r" ) )
elseif button == "offCooldowns" then
WA_Redfellas_Rot_HDH_Off_CDs = not WA_Redfellas_Rot_HDH_Off_CDs
print("|cFF00FFFFRedfella's Rotation Offensive Helper: " .. ( WA_Redfellas_Rot_HDH_Off_CDs and "|cFF00FF00ENABLED|r" or "|cFFFF0000DISABLED|r" ) )
end
WeakAurasSaved.displays[self.parent.id].hekiliEnabled = WA_Redfellas_Rot_HDH_Enabled
WeakAurasSaved.displays[self.parent.id].hekiliCooldownsOff = WA_Redfellas_Rot_HDH_Off_CDs
WeakAurasSaved.displays[self.parent.id].hekiliCooldownsDef = WA_Redfellas_Rot_HDH_Def_CDs
end)
function aura_env.setupBinds()
if InCombatLockdown() then return end
ClearOverrideBindings( aura_env.keyhandler )
SetOverrideBindingClick( aura_env.keyhandler, true, aura_env.enabledToggle, aura_env.id.."_Keyhandler", "Enabled" )
SetOverrideBindingClick( aura_env.keyhandler, true, aura_env.offCooldownsToggle, aura_env.id.."_Keyhandler", "offCooldowns" )
SetOverrideBindingClick( aura_env.keyhandler, true, aura_env.defCooldownsToggle, aura_env.id.."_Keyhandler", "defCooldowns" )
print("|cFF00FFFFRedfella's Rotation Helper|r: Keybinds are now active.")
print("Enable/Disable - |cFFFFD100" .. aura_env.enabledToggle .. "|r.")
print("Toggle Defensive Cooldowns - |cFFFFD100" .. aura_env.defCooldownsToggle .. "|r.")
print("Toggle Offensive Cooldowns - |cFFFFD100" .. aura_env.offCooldownsToggle .. "|r.")
print("You can *carefully* change these keybinds in the " .. aura_env.id .. " WeakAura on the Actions Tab, On Init, Expand Text Editor and see lines 11 to 13." )
aura_env.bindsInitialized = true
end
aura_env.setupBinds()
aura_env.showCooldownRing = true
aura_env.invertCooldownRing = false
aura_env.showRangeHighlight = true
aura_env.recommended = 208175
aura_env.timeToReady = 0
aura_env.timeOffset = 0
aura_env.targets = {}
aura_env.targetCount = 0
aura_env.talents = {
fel_mastery = { 1, 1, 1 },
chaos_cleave = { 1, 2, 1 },
blind_fury = { 1, 3, 1 },
prepared = { 2, 1, 1 },
demon_blades = { 2, 2, 1 },
demonic_appetite = { 2, 3, 1 },
felblade = { 3, 1, 1 },
todo = { 3, 2, 1 },
bloodlet = { 3, 3, 1 },
todo = { 4, 1, 1 },
todo = { 4, 2, 1 },
todo = { 4, 3, 1 },
todo = { 5, 1, 1 },
fel_eruption = { 5, 2, 1 },
todo = { 5, 3, 1 },
todo = {6, 1, 1 },
todo = { 6, 2, 1 },
todo = { 6, 3, 1 },
todo = { 7, 1, 1 },
todo = { 7, 2, 1 },
demonic = {7, 3, 1 }
}
aura_env.talented = {}
aura_env.abilities = {
demons_bite = 162243,
chaos_strike = 162794,
annihilation = 201427,
blade_dance = 188499,
death_sweep = 210152,
fury_of_the_illidari = 201467,
eye_beam = 198013,
throw_glaive = 185123,
fel_barrage = 211053,
fel_rush = 195072,
vengeful_retreat = 198793,
blur = 198589,
metamorphosis = 191427,
darkness = 196718
}
aura_env.chargedAbilities = {
fel_rush = 195072
}
aura_env.abilityNames = {}
for k,v in pairs( aura_env.abilities ) do
aura_env.abilityNames[ v ] = GetSpellInfo( v )
end
aura_env.cooldowns = {
metamorphosis = 191427,
darkness = 196718
}
aura_env.charges = {}
aura_env.chargeTime = {}
aura_env.chargesMax = {}
aura_env.buffs = {
metamorphosis = 162264,
fel_barrage = 222707,
momentum = 208628,
blur = 212800
}
aura_env.buffNames = {}
for k,v in pairs( aura_env.buffs ) do
aura_env.buffNames[ v ] = GetSpellInfo( v )
end
aura_env.buffRemains = {}
aura_env.debuffs = {
frailty = 224509
}
aura_env.debuffNames = {}
for k,v in pairs( aura_env.debuffs ) do
aura_env.debuffNames[ v ] = GetSpellInfo( v )
end
aura_env.debuffRemains = {}
function aura_env.rec( spell )
aura_env.recommended = aura_env.abilities[ spell ]
aura_env.timeToReady = aura_env.cooldowns[ spell ]
end
function aura_env.ready( spell )
local result = aura_env.cooldowns[ spell ] < aura_env.timeToReady
return result
end
function aura_env.soul_fragments()
local soul_fragments = GetSpellCount(228477) or 0
return soul_fragments
end
function aura_env.health_percentage()
return math.ceil( (UnitHealth("player") / UnitHealthMax("player") * 100) )
end
function aura_env.get_unit_aura_value(aura, valueType, unit, sourceUnit)
if not aura then return end valueType, unit = valueType or 'name', unit or 'player' if not UnitExists(unit) then return end local v, value = {}
local GetAuraValues = function(unit, aura, filter)
local v, filter = {}, filter or 'HELPFUL'
v.name, v.rank, v.icon, v.count, v.auraType, v.duration, v.expirationTime, v.unitCaster, v.isStealable, v.shouldConsolidate, v.spellId, v.canApplyAura, v.isBossDebuff, v.value1, v.value2, v.value3 = UnitAura(unit, aura, type(aura)=='number' and filter or nil, filter)
return v
end
local GetAuraValue = function(v, t, s) if v[t] then if s then if v.unitCaster and UnitExists(s) and v.unitCaster == s then return v[t] end else return v[t] end end end
local ScanAuras = function(aura, valueType, unit, sourceUnit)
local output = nil
if type(aura) == 'string' then
v = GetAuraValues(unit, aura)
output = GetAuraValue(v,valueType,sourceUnit)
if output then return output end
v = GetAuraValues(unit, aura, 'HARMFUL')
output = GetAuraValue(v,valueType,sourceUnit)
if output then return output end
elseif type(aura) == 'number' then
for i=1,40 do
v = GetAuraValues(unit, i)
output = GetAuraValue(v,valueType,sourceUnit)
if v.spellId and v.spellId == aura then if output then return output end end
v = GetAuraValues(unit, i, 'HARMFUL')
output = GetAuraValue(v,valueType,sourceUnit)
if v.spellId and v.spellId == aura then if output then return output end end
end
end
end
if type(aura) == 'table' then
local output = nil
for iAura,vAura in pairs(aura) do
output = ScanAuras(vAura, valueType, unit, sourceUnit)
if output then return output end
end
else
return ScanAuras(aura, valueType, unit, sourceUnit)
end
end
function aura_env.chargeCt( spell )
local rounded = tonumber( format( "%.1f", aura_env.timeOffset ) ) - 0.1
return min( aura_env.chargesMax[ spell ], aura_env.charges[ spell ] + rounded / aura_env.chargeTime[ spell ] )
end
function aura_env.cdLeft( spell )
return max( 0, aura_env.cooldowns[ spell ] - aura_env.timeOffset )
end