-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathProgram.cs
344 lines (293 loc) · 12 KB
/
Program.cs
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
using System;
using System.Collections;
using System.Linq;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
using System.Drawing;
using Color = System.Drawing.Color;
using System.Collections.Generic;
using System.Threading;
namespace Ezreal___The_prodigal_explorer
{
class Program
{
private static Orbwalking.Orbwalker Orbwalker;
private static Spell Q;
private static Spell W;
private static Spell E;
private static Spell R;
private static SpellSlot FlashSlot = SpellSlot.Unknown;
public static float FlashRange = 450f;
public static Vector2 oWp;
public static Vector2 nWp;
private static Menu Config;
public static Obj_AI_Hero Player = ObjectManager.Player;
static void Main(string[] args)
{
CustomEvents.Game.OnGameLoad += Game_OnGameLoad;
}
static void Game_OnGameLoad(EventArgs args)
{
Notifications.AddNotification("Ezreal - The Prodigal Explorer by DanZ Loaded!", 1000);
FlashSlot = Player.GetSpellSlot("SummonerFlash");
Q = new Spell(SpellSlot.Q, 1200);
W = new Spell(SpellSlot.W, 1050);
E = new Spell(SpellSlot.E, 475);
R = new Spell(SpellSlot.R, 20000);
Q.SetSkillshot(0.25f, 60f, 2000f, true, SkillshotType.SkillshotLine);
W.SetSkillshot(0.25f, 80f, 1600f, false, SkillshotType.SkillshotLine);
Config = new Menu("Ezreal", "ezreal_menu", true);
var targetSelectorMenu = new Menu("Target Selector", "Target Selector");
TargetSelector.AddToMenu(targetSelectorMenu);
Config.AddSubMenu(targetSelectorMenu);
Config.AddSubMenu(new Menu("Orbwalking", "Orbwalking"));
Orbwalker = new Orbwalking.Orbwalker(Config.SubMenu("Orbwalking"));
Config.AddSubMenu(new Menu("Combo", "Combo"));
Config.SubMenu("Combo").AddItem(new MenuItem("UseQCombo", "Use Q")).SetValue(true);
Config.SubMenu("Combo").AddItem(new MenuItem("UseWCombo", "Use W")).SetValue(true);
Config.SubMenu("Combo").AddItem(new MenuItem("UseECombo", "Use E offensively")).SetValue(false);
Config.SubMenu("Combo").AddItem(new MenuItem("UseRCombo", "Use R if killable")).SetValue(true);
Config.AddSubMenu(new Menu("Harass", "Harass"));
Config.SubMenu("Harass").AddItem(new MenuItem("UseQHarass", "Use Q")).SetValue(true);
Config.SubMenu("Harass").AddItem(new MenuItem("UseWHarass", "Use W")).SetValue(true);
Config.AddSubMenu(new Menu("Ult", "Ult"));
Config.SubMenu("Ult").AddItem(new MenuItem("ForceRCast", "Force R")).SetValue(new KeyBind("G".ToCharArray()[0], KeyBindType.Press));
Config.AddSubMenu(new Menu("Farming", "Farming"));
Config.SubMenu("Farming").AddItem(new MenuItem("QLast", "Use Q to Last Hit")).SetValue(true);
Config.SubMenu("Farming").AddItem(new MenuItem("QClear", "Use Q to Clear Wave")).SetValue(true);
Config.SubMenu("Farming").AddItem(new MenuItem("QClearmana", "Min. Mana % to Q Clear")).SetValue(new Slider(30, 0, 100));
Config.SubMenu("Farming").AddItem(new MenuItem("QLastmana", "Min. Mana % to Q Last Hit")).SetValue(new Slider(50, 0, 100));
Config.AddSubMenu(new Menu("KS", "KS"));
Config.SubMenu("KS").AddItem(new MenuItem("UseQKS", "Use Q")).SetValue(true);
Config.SubMenu("KS").AddItem(new MenuItem("UseWKS", "Use W")).SetValue(true);
Config.SubMenu("KS").AddItem(new MenuItem("UseRKS", "Use R (NOT IMPLEMENTED!!)")).SetValue(true);
Config.SubMenu("KS").AddItem(new MenuItem("RKSRange", "R KS Range")).SetValue(new Slider(1000, 1000, 4000));
Config.AddSubMenu(new Menu("Drawings", "Drawings"));
Config.SubMenu("Drawings").AddItem(new MenuItem("drawEnable", "Enable Drawing")).SetValue(true);
Config.SubMenu("Drawings").AddItem(new MenuItem("drawpred", "Draw skillshot line prediction")).SetValue(true);
Config.SubMenu("Drawings").AddItem(new MenuItem("drawQ", "Draw Q")).SetValue(true);
Config.SubMenu("Drawings").AddItem(new MenuItem("drawW", "Draw W")).SetValue(true);
Config.SubMenu("Drawings").AddItem(new MenuItem("drawE", "Draw E")).SetValue(true);
Config.AddToMainMenu();
Game.OnUpdate += OnGameUpdate;
Drawing.OnDraw += OnDraw;
}
private static void OnDraw(EventArgs args)
{
var myPos = Drawing.WorldToScreen(Player.Position);
if (Config.Item("drawEnable").GetValue<bool>())
{
if (Config.Item("drawQ").GetValue<bool>())
{
Render.Circle.DrawCircle(ObjectManager.Player.Position, Q.Range, Color.Aqua, 1);
}
if (Config.Item("drawW").GetValue<bool>())
{
Render.Circle.DrawCircle(ObjectManager.Player.Position, W.Range, Color.Aqua, 1);
}
if (Config.Item("drawE").GetValue<bool>())
{
Render.Circle.DrawCircle(ObjectManager.Player.Position, E.Range, Color.Aqua, 1);
}
}
var enemy = TargetSelector.GetTarget(1500, TargetSelector.DamageType.Magical);
List<Vector2> waypoints = enemy.GetWaypoints();
for (int i = 0; i < waypoints.Count - 1; i++)
{
oWp = Drawing.WorldToScreen(waypoints[i].To3D());
nWp = Drawing.WorldToScreen(waypoints[i + 1].To3D());
if (!waypoints[i].IsOnScreen() && !waypoints[i + 1].IsOnScreen())
{
continue;
}
if (Config.Item("drawpred").GetValue<bool>())
{
Drawing.DrawLine(myPos.X - 15, myPos.Y - 15, nWp[0] - 15, nWp[1] - 15, 1, Color.Red);
Drawing.DrawLine(myPos.X + 15, myPos.Y + 15, nWp[0] + 15, nWp[1] + 15, 1, Color.Red);
}
}
}
private static void Combo()
{
var target = TargetSelector.GetTarget(1300, TargetSelector.DamageType.Magical);
if (Q.IsReady() && (Config.Item("UseQCombo").GetValue<bool>()))
{
Q.CastIfHitchanceEquals(target, HitChance.Dashing, true);
Q.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Qprediction = Q.GetPrediction(target);
if (Qprediction.Hitchance >= HitChance.High && Qprediction.CollisionObjects.Count(h => h.IsEnemy && !h.IsDead && h is Obj_AI_Minion) < 2)
{
Q.Cast(Qprediction.CastPosition);
}
if (W.IsReady() && (Config.Item("UseWCombo").GetValue<bool>()))
{
W.CastIfHitchanceEquals(target, HitChance.Dashing, true);
W.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Wprediction = W.GetPrediction(target);
if (Wprediction.Hitchance >= HitChance.High)
{
W.Cast(Wprediction.CastPosition);
}
}
}
if (E.IsReady() && (Config.Item("UseECombo").GetValue<bool>()))
{
E.Cast(Game.CursorPos.Extend(target.ServerPosition, E.Range));
}
if (R.IsReady() && (Config.Item("UseRCombo").GetValue<bool>()))
{
R.CastIfHitchanceEquals(target, HitChance.Dashing, true);
R.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Rprediction = R.GetPrediction(target);
if (Rprediction.Hitchance >= HitChance.High)
{
R.Cast(Rprediction.CastPosition);
}
}
}
private static void ForceR()
{
var target = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical);
R.CastIfHitchanceEquals(target, HitChance.Dashing, true);
R.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Rprediction = R.GetPrediction(target);
if (Rprediction.Hitchance >= HitChance.High)
{
R.Cast(Rprediction.CastPosition);
}
}
private static void Harass()
{
var target = TargetSelector.GetTarget(1300, TargetSelector.DamageType.Magical);
if (Q.IsReady() && (Config.Item("UseQHarass").GetValue<bool>()))
{
Q.CastIfHitchanceEquals(target, HitChance.Dashing, true);
Q.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Qprediction = Q.GetPrediction(target);
if (Qprediction.Hitchance >= HitChance.High && Qprediction.CollisionObjects.Count(h => h.IsEnemy && !h.IsDead && h is Obj_AI_Minion) < 2)
{
Q.Cast(Qprediction.CastPosition);
}
if (W.IsReady() && (Config.Item("UseWHarass").GetValue<bool>()))
{
W.CastIfHitchanceEquals(target, HitChance.Dashing, true);
W.CastIfHitchanceEquals(target, HitChance.Immobile, true);
var Wprediction = W.GetPrediction(target);
if (Wprediction.Hitchance >= HitChance.High)
{
W.Cast(Wprediction.CastPosition);
}
}
}
}
private static void LaneClear()
{
if (Player.Mana / Player.MaxMana * 100 >= Config.Item("QClearmana").GetValue<Slider>().Value)
{
var minions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
bool jungleMobs = minions.Any(x => x.Team == GameObjectTeam.Neutral);
if ((Config.Item("QClear").GetValue<bool>() || jungleMobs))
{
MinionManager.FarmLocation farmLocation = Q.GetLineFarmLocation(minions);
if (farmLocation.Position.IsValid())
if (farmLocation.MinionsHit >= 1 || jungleMobs)
Q.Cast(farmLocation.Position);
}
}
}
private static void LastHit()
{
if (Player.Mana / Player.MaxMana * 100 >= Config.Item("QLastmana").GetValue<Slider>().Value)
{
var minions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
bool jungleMobs = minions.Any(x => x.Team == GameObjectTeam.Neutral);
if ((Config.Item("QLast").GetValue<bool>() || jungleMobs))
{
foreach (var minion in MinionManager.GetMinions(Q.Range, MinionTypes.All, MinionTeam.Enemy).
Where(x => Q.GetDamage(x) >= x.Health))
{
if (Q.CanCast(minion))
Q.CastOnUnit(minion, true);
}
}
}
}
private static void QKS()
{
foreach (Obj_AI_Hero hero in ObjectManager.Get<Obj_AI_Hero>().Where(unit => unit.IsValidTarget(Q.Range)))
{
var target = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Magical);
if (target == null) return;
var predictionQ = Q.GetPrediction(target);
if (Q.IsReady())
{
if (target.Health < Q.GetDamage(target))
{
if (predictionQ.Hitchance >= HitChance.High && predictionQ.CollisionObjects.Count(h => h.IsEnemy && !h.IsDead && h is Obj_AI_Minion) < 1)
{
Q.Cast(predictionQ.CastPosition);
}
}
}
}
}
private static void WKS()
{
foreach (Obj_AI_Hero hero in ObjectManager.Get<Obj_AI_Hero>().Where(unit => unit.IsValidTarget(W.Range)))
{
var target = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Magical);
if (target == null) return;
var predictionW = W.GetPrediction(target);
if (Q.IsReady())
{
if (target.Health < Q.GetDamage(target))
{
if (predictionW.Hitchance >= HitChance.High)
{
Q.Cast(predictionW.CastPosition);
}
}
}
}
}
private static void RKS()
{
}
private static void OnGameUpdate(EventArgs args)
{
var target = TargetSelector.GetTarget(1300, TargetSelector.DamageType.Magical, true);
if (Config.Item("ForceRCast").GetValue<KeyBind>().Active)
{
ForceR();
}
if (Config.Item("UseQKS").GetValue<bool>())
{
QKS();
}
if (Config.Item("UseWKS").GetValue<bool>())
{
WKS();
}
if (Config.Item("UseRKS").GetValue<bool>())
{
RKS();
}
switch (Orbwalker.ActiveMode)
{
case Orbwalking.OrbwalkingMode.Combo:
Combo();
break;
case Orbwalking.OrbwalkingMode.Mixed:
Harass();
break;
case Orbwalking.OrbwalkingMode.LaneClear:
LaneClear();
break;
case Orbwalking.OrbwalkingMode.LastHit:
LastHit();
break;
}
}
}
}