-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathKamikaze.cs
82 lines (66 loc) · 2.19 KB
/
Kamikaze.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
using BrokeProtocol.Collections;
using BrokeProtocol.Entities;
using BrokeProtocol.Utility;
using BrokeProtocol.Utility.Networking;
using BrokeProtocolClient.settings;
using ENet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrokeProtocolClient.modules.combat
{
class Kamikaze : Module
{
public ModeSetting mode = new ModeSetting("Mine type", Mode.Any);
public NumberSetting range = new NumberSetting("Range", 1, 16, 10, 0.5);
public Kamikaze() : base(Categories.Combat, "Kamikaze", "Drop mine to explode yourself")
{
addSetting(mode);
addSetting(range);
}
public override void onActivate()
{
}
public override void onDeactivate()
{
}
public override void onRender()
{
}
public override void onUpdate()
{
if (!getClient().ClManager.myPlayer) return;
foreach (ShEntity entity in EntityCollections.Entities)
{
if (getClient().ClManager.myPlayer.Distance(entity) > range.getValueFloat()) continue;
ShExplosion explosion = entity as ShExplosion;
if (!explosion) continue;
if (!explosion.armed) continue;
if (shouldPickup(entity)) pickup(entity.ID);
}
}
private bool shouldPickup(ShEntity entity)
{
if (mode.isMode((int)Mode.Any) && (entity is ShMineAT || entity is ShMineAP)) return true;
else if (mode.isMode((int)Mode.AT) && entity is ShMineAT) return true;
else if (mode.isMode((int)Mode.AP) && entity is ShMineAP) return true;
return false;
}
private void pickup(int id)
{
getClient().ClManager.SendToServer((ENet.PacketFlags)1, SvPacket.Collect, new object[]
{
id,
false
});
}
enum Mode
{
Any,
AT,
AP
}
}
}