forked from tdymel/RogueRota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRogueRota.lua
173 lines (167 loc) · 4.43 KB
/
RogueRota.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
-- Global Variables
RogueRota = {}
RogueRota.TickTime = 2
RogueRota.Global = 1
RogueRota.FirstTick = 0
RogueRota.Energy = 100
RogueRota.f = CreateFrame("Frame", "Energy", UIParent)
RogueRota.f:RegisterEvent("UNIT_ENERGY")
RogueRota.f:SetScript("OnEvent", function(self, event)
if (UnitMana("player") == (RogueRota.Energy+20)) then
RogueRota.FirstTick = GetTime()
end
RogueRota.Energy = UnitMana("player")
end)
if GetLocale() == "deDE" then
RogueRota.name = {
[1] = "Zerhäckseln",
[2] = "Erdschlag",
[3] = "Heilige Stärke",
[4] = "Adrenalinrausch",
[5] = "Finsterer Stoß",
[6] = "Ausweiden"
}
else
RogueRota.name = {
[1] = "Slice and Dice",
[2] = "Earthstrike",
[3] = "Holy Strength",
[4] = "Adrenaline Rush",
[5] = "Sinister Strike",
[6] = "Eviscerate"
}
end
-- Local Variables
local f = CreateFrame("GameTooltip", "f", UIParent, "GameTooltipTemplate")
-- Begin Functions
function RogueRota:GetNextTick()
local i, now = RogueRota.FirstTick, GetTime()
while true do
if (i>now) then
return (i-now)
end
i = i + RogueRota.TickTime
end
end
function RogueRota:IsActive(name)
for i=0, 31 do
f:SetOwner(UIParent, "ANCHOR_NONE")
f:ClearLines()
f:SetPlayerBuff(GetPlayerBuff(i, "HELPFUL"))
local buff = fTextLeft1:GetText()
if (not buff) then break end
if (buff == name) then
return true, GetPlayerBuffTimeLeft(GetPlayerBuff(i, "HELPFUL"))
end
f:Hide()
end
return false, 0
end
function RogueRota:Rota()
local active, timeLeft = RogueRota:IsActive(RogueRota.name[1])
local Eactive, EtimeLeft = RogueRota:IsActive(RogueRota.name[2])
local Cactive, CtimeLeft = RogueRota:IsActive(RogueRota.name[3])
local Aactive, AtimeLeft = RogueRota:IsActive(RogueRota.name[4])
local cP = GetComboPoints("player")
local health = UnitHealth("target")
local healthMax = UnitHealthMax("target")
local healthPercent = 100*(health/healthMax)
local energy = UnitMana("player")
if (not UnitIsPlayer("target")) then
if (cP<5) then
if ((cP==1 or cP==3) and (not active or timeLeft < 2)) then
if (healthPercent<10 or (health<5000 and healthPercent<50)) then
if (energy<=40 and RogueRota:GetNextTick() > 1) then
return
else
if (cP==3) then
CastSpellByName(RogueRota.name[6])
else
CastSpellByName(RogueRota.name[5])
end
end
else
if (cP>1 and Eactive) then
CastSpellByName(RogueRota.name[5])
else
if (Active and AtimeLeft>RogueRota:GetNextTick()) then
if (timeLeft>1 and energy<=30 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[1])
end
else
if (timeLeft>1 and energy<=65 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[1])
end
end
end
end
else
if ((healthPercent<10 or (health<5000 and healthPercent<50)) and cP>2) then
if (energy>=60) then
if (health<2500 and healthPercent<25) then
CastSpellByName(RogueRota.name[6])
else
CastSpellByName(RogueRota.name[5])
end
else
CastSpellByName(RogueRota.name[6])
end
else
if (healthPercent<5 or (health<2500 and healthPercent<25)) and (energy<40) then
CastSpellByName(RogueRota.name[6])
else
CastSpellByName(RogueRota.name[5])
end
end
end
else
if (not active or timeLeft < 2) and (healthPercent>40 or (health>5000 and healthPercent>50)) then
if (Eactive) then
if (energy<=45 and not Cactive and not Active) then
return
else
CastSpellByName(RogueRota.name[6])
end
else
if (Active and AtimeLeft>RogueRota:GetNextTick()) then
if (timeLeft>1 and energy<=30 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[1])
end
else
if (timeLeft>1 and energy<=65 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[1])
end
end
end
else
if (Cactive) then
CastSpellByName(RogueRota.name[6])
else
if (Active and AtimeLeft>RogueRota:GetNextTick()) then
if (energy<=45 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[6])
end
else
if (energy<=65 and RogueRota:GetNextTick() > 1) then
return
else
CastSpellByName(RogueRota.name[6])
end
end
end
end
end
else
CastSpellByName(RogueRota.name[5])
end
end