Skip to content

Commit 7f3cae1

Browse files
committed
Synapse 3
1 parent bfa0f42 commit 7f3cae1

31 files changed

+996
-880
lines changed

MoreTools/App.config

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?><configuration>
2+
<runtime>
3+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
4+
<dependentAssembly>
5+
<assemblyIdentity name="Microsoft.Extensions.Caching.Memory" publicKeyToken="adb9793829ddae60" culture="neutral" />
6+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
7+
</dependentAssembly>
8+
<dependentAssembly>
9+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
11+
</dependentAssembly>
12+
</assemblyBinding>
13+
</runtime>
14+
</configuration>

MoreTools/Commands/Ball.cs

+43-44
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
using Synapse.Command;
2-
using UnityEngine;
3-
using Synapse.Api;
1+
using Neuron.Core.Meta;
2+
using Neuron.Modules.Commands;
3+
using Neuron.Modules.Commands.Command;
4+
using Synapse3.SynapseModule.Command;
5+
using Synapse3.SynapseModule.Item;
46

5-
namespace MoreTools.Commands
7+
namespace MoreTools.Commands;
8+
9+
[Automatic]
10+
[SynapseRaCommand(
11+
CommandName = "Ball",
12+
Aliases = new string[]{ },
13+
Description = "Spawns SCP-018 at the Players location",
14+
Permission = "moretools.ball",
15+
Platforms = new[] { CommandPlatform.RemoteAdmin,CommandPlatform.ServerConsole },
16+
Parameters = new []{ "Players", "Amount" }
17+
)]
18+
public class Ball : PlayerCommand
619
{
7-
[CommandInformation(
8-
Name = "Ball",
9-
Aliases = new string[] { },
10-
Description = "Spawns grenades at the player location",
11-
Permission = "moretools.ball",
12-
Platforms = new Platform[] { Platform.RemoteAdmin, Platform.ServerConsole },
13-
Usage = "Ball players (optional amount)",
14-
Arguments = new[] { "Players", "(Amount)" }
15-
)]
16-
public class Ball : ISynapseCommand
20+
public override void Execute(SynapseContext context, ref CommandResult result)
1721
{
18-
public CommandResult Execute(CommandContext context)
22+
if (context.Arguments.Length < 1)
1923
{
20-
if (context.Arguments.Count < 1)
21-
return new CommandResult
22-
{
23-
Message = "Usage: ball players (optional amount)",
24-
State = CommandResultState.Error
25-
};
26-
27-
if (context.Arguments.Count < 2)
28-
context.Arguments = new System.ArraySegment<string>(new[] { context.Arguments.At(0), "1" });
24+
result.Response = "Usage: ball players (optional amount)";
25+
result.StatusCode = CommandStatusCode.Error;
26+
return;
27+
}
2928

30-
if (!Extensions.TryGetPlayers(context.Arguments.At(0), context.Player, out var players))
31-
return new CommandResult
32-
{
33-
Message = "No Player was found",
34-
State = CommandResultState.Error
35-
};
29+
if (context.Arguments.Length < 2)
30+
context.Arguments = new[] { context.Arguments[0], "1" };
3631

37-
if (!int.TryParse(context.Arguments.At(1), out var amount))
38-
return new CommandResult
39-
{
40-
Message = "Invalid Amount of SCP-018s",
41-
State = CommandResultState.Error
42-
};
32+
if (!PlayerService.TryGetPlayers(context.Arguments[0], out var players, context.Player))
33+
{
34+
result.Response = "No Player was found";
35+
result.StatusCode = CommandStatusCode.NotFound;
36+
return;
37+
}
4338

44-
foreach (var player in players)
45-
for (int i = 0; i < amount; i++)
46-
Map.Get.SpawnGrenade(player.Position, Vector3.zero, 3, Synapse.Api.Enum.GrenadeType.Scp018, context.Player);
39+
if (!int.TryParse(context.Arguments[1], out var amount))
40+
{
41+
result.Response = "Invalid Amount";
42+
return;
43+
}
4744

48-
return new CommandResult
45+
foreach (var player in players)
46+
for (int i = 0; i < amount; i++)
4947
{
50-
Message = "Scp018 is spawned",
51-
State = CommandResultState.Ok
52-
};
53-
}
48+
var item = new SynapseItem(ItemType.SCP018, player.Position);
49+
item.Throwable.Fuse(player);
50+
}
51+
52+
result.Response = "Scp018 was spawned";
5453
}
5554
}

MoreTools/Commands/Broadcast.cs

+39-35
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1-
using Synapse.Api;
2-
using Synapse.Command;
3-
using System.Linq;
1+
using System.Linq;
2+
using Neuron.Core.Meta;
3+
using Neuron.Modules.Commands;
4+
using Neuron.Modules.Commands.Command;
5+
using Synapse3.SynapseModule.Command;
6+
using Synapse3.SynapseModule.Map;
47

5-
namespace MoreTools.Commands
8+
namespace MoreTools.Commands;
9+
10+
[Automatic]
11+
[SynapseRaCommand(
12+
CommandName = "Broadcast",
13+
Aliases = new[] { "bc", "alert", "alertmono", "broadcastmono", "bcmono" },
14+
Description = "A Command to send a Broadcast to all Players",
15+
Permission = "moretools.bc",
16+
Platforms = new[] { CommandPlatform.RemoteAdmin, CommandPlatform.ServerConsole },
17+
Parameters = new[] { "Time", "Message" }
18+
)]
19+
public class Broadcast : SynapseCommand
620
{
7-
[CommandInformation(
8-
Name = "Broadcast",
9-
Aliases = new string[] { "bc","alert","alertmono","broadcastmono","bcmono" },
10-
Description = "A Command to send a Broadcast to all Players",
11-
Permission = "moretools.bc",
12-
Platforms = new Platform[] { Platform.RemoteAdmin, Platform.ServerConsole },
13-
Usage = "Bc time message",
14-
Arguments = new[] { "Time", "Message" }
15-
)]
16-
public class Broadcast : ISynapseCommand
21+
private readonly CassieService _cassie;
22+
23+
public Broadcast(CassieService cassie)
1724
{
18-
public CommandResult Execute(CommandContext context)
19-
{
20-
if (context.Arguments.Count < 2)
21-
return new CommandResult
22-
{
23-
Message = "Missing Parameter! Usage: bc time message",
24-
State = CommandResultState.Error
25-
};
25+
_cassie = cassie;
26+
}
2627

27-
if (!ushort.TryParse(context.Arguments.First(), out var time))
28-
return new CommandResult
29-
{
30-
Message = "Invalid parameter for time",
31-
State = CommandResultState.Error
32-
};
28+
public override void Execute(SynapseContext context, ref CommandResult result)
29+
{
30+
if (context.Arguments.Length < 2)
31+
{
32+
result.Response = "Missing Parameter! Usage: bc time message";
33+
result.StatusCode = CommandStatusCode.BadSyntax;
34+
return;
35+
}
3336

34-
var msg = string.Join(" ", context.Arguments.Segment(1));
35-
Map.Get.SendBroadcast(time, msg);
36-
return new CommandResult
37-
{
38-
Message = "Broadcast was send",
39-
State = CommandResultState.Ok
40-
};
37+
if (!ushort.TryParse(context.Arguments.First(), out var time))
38+
{
39+
result.Response = "Invalid parameter for time";
40+
result.StatusCode = CommandStatusCode.BadSyntax;
4141
}
42+
43+
var msg = string.Join(" ", context.Arguments.Segment(1));
44+
_cassie.Broadcast(time, msg);
45+
result.Response = "Broadcast was send";
4246
}
4347
}

MoreTools/Commands/Flash.cs

+44-45
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
using Synapse.Command;
2-
using UnityEngine;
3-
using Synapse.Api;
1+
using Neuron.Core.Meta;
2+
using Neuron.Modules.Commands;
3+
using Neuron.Modules.Commands.Command;
4+
using Synapse3.SynapseModule.Command;
5+
using Synapse3.SynapseModule.Item;
46

5-
namespace MoreTools.Commands
7+
namespace MoreTools.Commands;
8+
9+
[Automatic]
10+
[SynapseRaCommand(
11+
CommandName = "Flash",
12+
Aliases = new string[] { },
13+
Description = "Spawns Flash grenades at the Players location",
14+
Permission = "moretools.flash",
15+
Platforms = new[] { CommandPlatform.RemoteAdmin, CommandPlatform.ServerConsole },
16+
Parameters = new[] { "Players", "Amount" }
17+
)]
18+
public class Flash : PlayerCommand
619
{
7-
[CommandInformation(
8-
Name = "Flash",
9-
Aliases = new string[] { },
10-
Description = "Spawns flashes at the player location",
11-
Permission = "moretools.flash",
12-
Platforms = new Platform[] { Platform.RemoteAdmin, Platform.ServerConsole },
13-
Usage = "Flash players (optional amount)",
14-
Arguments = new[] { "Players", "(Amount)" }
15-
)]
16-
public class Flash : ISynapseCommand
20+
public override void Execute(SynapseContext context, ref CommandResult result)
1721
{
18-
public CommandResult Execute(CommandContext context)
22+
if (context.Arguments.Length < 1)
1923
{
20-
if (context.Arguments.Count < 1)
21-
return new CommandResult
22-
{
23-
Message = "Usage: flash players (optional amount)",
24-
State = CommandResultState.Error
25-
};
26-
27-
if (context.Arguments.Count < 2)
28-
context.Arguments = new System.ArraySegment<string>(new[] { context.Arguments.At(0), "1" });
24+
result.Response = "Usage: flash players (optional amount)";
25+
result.StatusCode = CommandStatusCode.Error;
26+
return;
27+
}
2928

30-
if (!Extensions.TryGetPlayers(context.Arguments.At(0), context.Player, out var players))
31-
return new CommandResult
32-
{
33-
Message = "No Player was found",
34-
State = CommandResultState.Error
35-
};
29+
if (context.Arguments.Length < 2)
30+
context.Arguments = new[] { context.Arguments[0], "1" };
3631

37-
if (!int.TryParse(context.Arguments.At(1), out var amount))
38-
return new CommandResult
39-
{
40-
Message = "Invalid Amount of flashes",
41-
State = CommandResultState.Error
42-
};
32+
if (!PlayerService.TryGetPlayers(context.Arguments[0], out var players, context.Player))
33+
{
34+
result.Response = "No Player was found";
35+
result.StatusCode = CommandStatusCode.NotFound;
36+
return;
37+
}
4338

44-
foreach (var player in players)
45-
for (int i = 0; i < amount; i++)
46-
Map.Get.SpawnGrenade(player.Position, Vector3.zero, 3, Synapse.Api.Enum.GrenadeType.Flashbang, context.Player);
39+
if (!int.TryParse(context.Arguments[1], out var amount))
40+
{
41+
result.Response = "Invalid Amount";
42+
return;
43+
}
4744

48-
return new CommandResult
45+
foreach (var player in players)
46+
for (int i = 0; i < amount; i++)
4947
{
50-
Message = "Flashes are spawned",
51-
State = CommandResultState.Ok
52-
};
53-
}
48+
var item = new SynapseItem(ItemType.GrenadeFlash, player.Position);
49+
item.Throwable.Fuse(player);
50+
}
51+
52+
result.Response = "Flash was spawned";
5453
}
55-
}
54+
}

MoreTools/Commands/Grenade.cs

+43-44
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
using Synapse.Command;
2-
using UnityEngine;
3-
using Synapse.Api;
1+
using Neuron.Core.Meta;
2+
using Neuron.Modules.Commands;
3+
using Neuron.Modules.Commands.Command;
4+
using Synapse3.SynapseModule.Command;
5+
using Synapse3.SynapseModule.Item;
46

5-
namespace MoreTools.Commands
7+
namespace MoreTools.Commands;
8+
9+
[Automatic]
10+
[SynapseRaCommand(
11+
CommandName = "Grenade",
12+
Aliases = new[] { "gn" },
13+
Description = "Spawns grenades at the player location",
14+
Permission = "moretools.grenade",
15+
Platforms = new[] { CommandPlatform.RemoteAdmin, CommandPlatform.ServerConsole },
16+
Parameters = new[] { "Players", "(Amount)" }
17+
)]
18+
public class Grenade : PlayerCommand
619
{
7-
[CommandInformation(
8-
Name = "Grenade",
9-
Aliases = new string[] { "gn" },
10-
Description = "Spawns grenades at the player location",
11-
Permission = "moretools.grenade",
12-
Platforms = new Platform[] { Platform.RemoteAdmin, Platform.ServerConsole },
13-
Usage = "Grenade players (optional amount)",
14-
Arguments = new[] { "Players", "(Amount)" }
15-
)]
16-
public class Grenade : ISynapseCommand
20+
public override void Execute(SynapseContext context, ref CommandResult result)
1721
{
18-
public CommandResult Execute(CommandContext context)
22+
if (context.Arguments.Length < 1)
1923
{
20-
if (context.Arguments.Count < 1)
21-
return new CommandResult
22-
{
23-
Message = "Usage: Grenade players (optional amount)",
24-
State = CommandResultState.Error
25-
};
26-
27-
if (context.Arguments.Count < 2)
28-
context.Arguments = new System.ArraySegment<string>(new[] { context.Arguments.At(0), "1" });
24+
result.Response = "Usage: grenade players (optional amount)";
25+
result.StatusCode = CommandStatusCode.Error;
26+
return;
27+
}
2928

30-
if (!Extensions.TryGetPlayers(context.Arguments.At(0), context.Player, out var players))
31-
return new CommandResult
32-
{
33-
Message = "No Player was found",
34-
State = CommandResultState.Error
35-
};
29+
if (context.Arguments.Length < 2)
30+
context.Arguments = new[] { context.Arguments[0], "1" };
3631

37-
if (!int.TryParse(context.Arguments.At(1), out var amount))
38-
return new CommandResult
39-
{
40-
Message = "Invalid Amount of grenades",
41-
State = CommandResultState.Error
42-
};
32+
if (!PlayerService.TryGetPlayers(context.Arguments[0], out var players, context.Player))
33+
{
34+
result.Response = "No Player was found";
35+
result.StatusCode = CommandStatusCode.NotFound;
36+
return;
37+
}
4338

44-
foreach (var player in players)
45-
for (int i = 0; i < amount; i++)
46-
Map.Get.SpawnGrenade(player.Position, Vector3.zero,3,Synapse.Api.Enum.GrenadeType.Grenade,context.Player);
39+
if (!int.TryParse(context.Arguments[1], out var amount))
40+
{
41+
result.Response = "Invalid Amount";
42+
return;
43+
}
4744

48-
return new CommandResult
45+
foreach (var player in players)
46+
for (int i = 0; i < amount; i++)
4947
{
50-
Message = "Grenades are spawned",
51-
State = CommandResultState.Ok
52-
};
53-
}
48+
var item = new SynapseItem(ItemType.GrenadeHE, player.Position);
49+
item.Throwable.Fuse(player);
50+
}
51+
52+
result.Response = "Grenade was spawned";
5453
}
5554
}

0 commit comments

Comments
 (0)