forked from Screeder/SAwareness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoSmite.cs
107 lines (99 loc) · 3.82 KB
/
AutoSmite.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
namespace SAwareness
{
class AutoSmite
{
String[] monsters = { "GreatWraith", "Wraith", "AncientGolem", "GiantWolf", "LizardElder", "Golem", "Worm", "Dragon", "Wight" };
public AutoSmite()
{
Game.OnGameUpdate += Game_OnGameUpdate;
Drawing.OnDraw += Drawing_OnDraw;
}
~AutoSmite()
{
Game.OnGameUpdate -= Game_OnGameUpdate;
Drawing.OnDraw -= Drawing_OnDraw;
}
void Drawing_OnDraw(EventArgs args)
{
foreach (var minion in ObjectManager.Get<Obj_AI_Minion>())
{
int smiteDamage = GetSmiteDamage();
if (Vector3.Distance(ObjectManager.Player.ServerPosition, minion.ServerPosition) < 1500)
{
foreach (var monster in monsters)
{
if (minion.SkinName == monster && minion.IsVisible)
{
Vector2 pos = Drawing.WorldToScreen(minion.ServerPosition);
Drawing.DrawText(pos[0], pos[1], System.Drawing.Color.SkyBlue, minion.Health != 0 ? (((int)minion.Health - smiteDamage)).ToString() : "");
}
}
}
}
}
public bool IsActive()
{
return Menu.AutoSmite.GetActive();
}
void Game_OnGameUpdate(EventArgs args)
{
if (!IsActive())
return;
foreach (var minion in ObjectManager.Get<Obj_AI_Minion>())
{
List<Obj_AI_Minion> min = ObjectManager.Get<Obj_AI_Minion>().ToList();
if (Vector3.Distance(ObjectManager.Player.ServerPosition, minion.ServerPosition) < 750)
{
int smiteDamage = GetSmiteDamage();
if (minion.Health <= smiteDamage && minion.Health > 0)
{
foreach (var monster in monsters)
{
if (minion.SkinName == monster && minion.IsVisible)
{
SpellSlot spellSlot = GetSmiteSlot();
int slot = -1;
if (spellSlot == SpellSlot.Q)
slot = 64;
else if (spellSlot == SpellSlot.W)
slot = 65;
if (slot != -1)
{
GamePacket gPacketT = Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, (SpellSlot)slot));
gPacketT.Send();
}
}
}
}
}
}
}
private int GetSmiteDamage()
{
int level = ObjectManager.Player.Level;
int smiteDamage = 390 +
(level < 5 ? 20 * (level - 1) :
(level < 10 ? 60 + 30 * (level - 4) :
(level < 15 ? 210 + 40 * (level - 9) :
410 + 50 * (level - 14))));
return smiteDamage;
}
private SpellSlot GetSmiteSlot()
{
foreach (var spell in ObjectManager.Player.SummonerSpellbook.Spells)
{
if (spell.Name.Contains("Smite") && spell.State == SpellState.Ready)
return spell.Slot;
}
return SpellSlot.Unknown;
}
}
}