-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHandsUpSpammer.cs
119 lines (93 loc) · 3.48 KB
/
HandsUpSpammer.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
using BrokeProtocol.Utility.Networking;
using BrokeProtocolClient.settings;
using BrokeProtocolClient.utils;
using ENet;
using System.Collections;
using UnityEngine;
using BrokeProtocol.Entities;
using BrokeProtocol.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace BrokeProtocolClient.modules.misc
{
class HandsUpSpammer : Module
{
ModeSetting mode = new ModeSetting("Mode", Mode.Target);
BooleanSetting allowPlayers = new BooleanSetting("Players", true);
BooleanSetting allowNpcs = new BooleanSetting("Npcs", false);
InputSetting targetInput = new InputSetting("Targets username/ID", 16, "");
NumberSetting delay = new NumberSetting("Delay (seconds)", 0, 10, 0.1, 0.1);
IEnumerator spammer;
public HandsUpSpammer() : base(Categories.Misc, "Hands up spammer", "Spams hands up interaction")
{
addSetting(mode);
addSetting(allowPlayers);
addSetting(allowNpcs);
addSetting(targetInput);
addSetting(delay);
}
public override void onActivate()
{
if (spammer != null) return;
spammer = SpammerThread();
getClient().StartCoroutine(spammer);
}
public override void onDeactivate()
{
if (spammer == null) return;
getClient().StopCoroutine(spammer);
spammer = null;
}
public override void onRender()
{
}
public override void onUpdate()
{
}
private IEnumerator SpammerThread()
{
while (true)
{
yield return new WaitForSeconds(delay.getValueFloat());
if (!getClient().ClManager.myPlayer) break;
if (mode.isMode((int)Mode.Target))
{
ShPlayer target;
if (!EntityCollections.TryGetPlayerByNameOrID(targetInput.getValue(), out target))
{
ConsoleBase.WriteLine($"{targetInput.getValue()} not found!");
break;
}
if (!allowPlayers.isEnabled() && target.isHuman) break;
if (!allowNpcs.isEnabled() && !target.isHuman) break;
HandsUp(target);
}
else if (mode.isMode((int)Mode.All))
{
List<ShPlayer> targets = new List<ShPlayer>();
if (allowPlayers.isEnabled()) targets.AddRange((EntityCollections.Humans as Collection<ShPlayer>).ToList());
if (allowNpcs.isEnabled()) targets.AddRange((EntityCollections.NPCs as Collection<ShPlayer>).ToList());
foreach (ShPlayer target in targets)
{
if (target == getClient().ClManager.myPlayer) continue;
HandsUp(target);
}
}
}
}
private void HandsUp(ShPlayer player)
{
getClient().ClManager.SendToServer((PacketFlags)1, SvPacket.EntityAction, new object[]
{
player.ID,
"HandsUp"
});
}
enum Mode
{
All,
Target
}
}
}