Skip to content

Commit c9a85c3

Browse files
authored
Add files via upload
1 parent c825b47 commit c9a85c3

File tree

14 files changed

+762
-0
lines changed

14 files changed

+762
-0
lines changed

API/Features.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Exiled.API.Features;
2+
using Exiled.CustomRoles.API.Features;
3+
using SCP_600V.Extensions;
4+
using SCP_600V.Roles;
5+
using System;
6+
using System.Linq;
7+
8+
namespace SCP_600V.API
9+
{
10+
public class Features
11+
{
12+
/// <summary>
13+
/// allows you to give the Scp600 role to a player without any special implementation into the project and searching for a registered role by its ID, etc.
14+
/// </summary>
15+
/// <param name="ply">Player who getted role</param>
16+
public static void SpawnPlayer(Player ply)
17+
{
18+
CustomRole.Get(typeof(Scp600)).AddRole(ply);
19+
}
20+
/// <summary>
21+
/// Lets you get <see cref="Array"/> containing players playing for Scp600
22+
/// </summary>
23+
/// <returns>An array with players or null if there is no one</returns>
24+
public static Player[] GetAffected()
25+
{
26+
Player[] a = Player.List.Where(x => x != null & x.IsScp600()).ToArray();
27+
if (a.Length == 0) return null;
28+
else
29+
{
30+
return a;
31+
}
32+
}
33+
/// <summary>
34+
/// Is the player Scp600
35+
/// </summary>
36+
/// <param name="ply"></param>
37+
/// <returns>true if scp600</returns>
38+
[Obsolete("there is a method in Extensions which is also called", false)]
39+
public static bool IsScp600(Player ply) => ply.IsScp600();
40+
}
41+
}

Commands/ImetateKill.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using CommandSystem;
2+
using Exiled.API.Features;
3+
using Exiled.Permissions.Extensions;
4+
using System;
5+
6+
namespace SCP_600V.Commands
7+
{
8+
[CommandHandler(typeof(RemoteAdminCommandHandler))]
9+
public class ImetateKill : ICommand
10+
{
11+
public string Command { get; } = "fakekill";
12+
13+
public string[] Aliases { get; } = { "fkl" };
14+
15+
public string Description { get; } = "Created for test, you can do not use it";
16+
17+
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
18+
{
19+
if (!sender.CheckPermission("s6.debug") | arguments.Count > 2)
20+
{
21+
response = "do not have permissions or arguments lower 2";
22+
return false;
23+
}
24+
else
25+
{
26+
Player a = Player.Get(arguments.At(0)); // attacker
27+
Player b = Player.Get(arguments.At(1)); // target
28+
b.Hurt(a, b.Health+1, Exiled.API.Enums.DamageType.Custom, null); // for kill target
29+
response = "done";
30+
return true;
31+
}
32+
}
33+
}
34+
}

Commands/Lists.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using CommandSystem;
2+
using Exiled.API.Features;
3+
using Exiled.Permissions.Extensions;
4+
using SCP_600V.Extensions;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace SCP_600V.Commands
12+
{
13+
[CommandHandler(typeof(RemoteAdminCommandHandler))]
14+
public class Lists : ICommand
15+
{
16+
public string Command { get; set; } = "slist";
17+
18+
public string[] Aliases { get; set; } = Array.Empty<string>();
19+
20+
public string Description { get; set; } = "get all player played now as scp600";
21+
22+
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
23+
{
24+
if (!sender.CheckPermission("s6.list")) { response = "do not have permissions"; return false; }
25+
else
26+
{
27+
try
28+
{
29+
StringBuilder sb = new StringBuilder();
30+
foreach (Player ply in Player.List.Where(x => x.IsAlive & x.IsScp600()).ToList())
31+
{
32+
sb.AppendLine($"{ply.Nickname}: {(int)ply.Health} Hp | {(int)ply.ArtificialHealth} Ahp");
33+
}
34+
response = sb.ToString();
35+
return true;
36+
}
37+
catch
38+
{
39+
Log.Debug("slist unkown error");
40+
response = "command not complete detected error try again later";
41+
return false;
42+
}
43+
}
44+
}
45+
}
46+
}

Commands/Parent.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using CommandSystem;
2+
using Exiled.API.Features;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace SCP_600V.Commands
10+
{
11+
[CommandHandler(typeof(RemoteAdminCommandHandler))]
12+
public class Parent : ParentCommand
13+
{
14+
public Parent() => LoadGeneratedCommands();
15+
16+
public override string Command { get; } = "scp600";
17+
18+
public override string[] Aliases { get; } = { "sp6" };
19+
20+
public override string Description { get; } = "Handle behaviour of a plugin scp600v";
21+
22+
public override void LoadGeneratedCommands()
23+
{
24+
Log.Debug("Registering other commands");
25+
RegisterCommand(new Lists());
26+
RegisterCommand(new Spawn());
27+
RegisterCommand(new ImetateKill());
28+
29+
}
30+
31+
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response)
32+
{
33+
response = "sp6 slist | spawn";
34+
return true;
35+
}
36+
}
37+
}

Commands/Spawn.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using CommandSystem;
2+
using Exiled.API.Features;
3+
using Exiled.CustomRoles.API.Features;
4+
using Exiled.Permissions.Extensions;
5+
using SCP_600V.Roles;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
12+
namespace SCP_600V.Commands
13+
{
14+
[CommandHandler(typeof(RemoteAdminCommandHandler))]
15+
public class Spawn : ICommand
16+
{
17+
public string Command { get; set; } = "spawn";
18+
19+
public string[] Aliases { get; set; } = { "s6cr" };
20+
21+
public string Description { get; set; } = "allow spaawn your or other player as scp600";
22+
23+
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
24+
{
25+
if (!sender.CheckPermission("s6.spawn"))
26+
{
27+
response = "do not have permissions";
28+
return false;
29+
}
30+
else
31+
{
32+
Player ply = null;
33+
if (arguments.Count > 0)
34+
{
35+
ply = Player.Get(arguments.At(0));
36+
}
37+
if (arguments.Count == 0)
38+
{
39+
ply = Player.Get(sender);
40+
}
41+
CustomRole.Get(typeof(Scp600)).AddRole(ply);
42+
response = $"succes added for {ply.Nickname}";
43+
return true;
44+
}
45+
}
46+
}
47+
}

Config.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.ComponentModel;
2+
using Exiled.API.Interfaces;
3+
using SCP_600V.Roles;
4+
5+
namespace SCP_600V
6+
{
7+
internal class Config : IConfig
8+
{
9+
[Description("Enable or disable plugin")]
10+
public bool IsEnabled { get; set; } = true;
11+
12+
[Description("Can the player see the debug message in the server console")]
13+
public bool Debug { get; set; } = false;
14+
15+
[Description("Configuration for the Scp600 role")]
16+
public Scp600 ScpConfig { get; set; } = new Scp600();
17+
}
18+
}

Events/Delegaters.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using SCP_600V.Events.EventArgs;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace SCP_600V.Events
9+
{
10+
public delegate void Spawning(SpawningEventArg e);
11+
12+
public delegate void Died(DiedEventArg e);
13+
}

Events/EventArgs/DiedEventArg.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Exiled.API.Features;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace SCP_600V.Events.EventArgs
9+
{
10+
public class DiedEventArg
11+
{
12+
public Player Player { get; set; }
13+
14+
public Player Killer { get; set; }
15+
16+
public DiedEventArg(Player player, Player killer)
17+
{
18+
Player = player;
19+
Killer = killer;
20+
}
21+
}
22+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Exiled.API.Features;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Security.Policy;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace SCP_600V.Events.EventArgs
10+
{
11+
public class SpawningEventArg: System.EventArgs
12+
{
13+
public Player Player { get; set; }
14+
15+
public float MaxHealt { get; }
16+
17+
public bool IsAllow { get; set; }
18+
19+
public SpawningEventArg(Player player, float maxHealt, bool isAllow)
20+
{
21+
Player = player;
22+
MaxHealt = maxHealt;
23+
IsAllow = isAllow;
24+
}
25+
}
26+
}

Events/Handlers/Scp600Handler.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using SCP_600V.Events.EventArgs;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace SCP_600V.Events.Handlers
9+
{
10+
public class Scp600Handler
11+
{
12+
/// <summary>
13+
/// called before spawn scp600
14+
/// </summary>
15+
public static event Spawning OnSpawning;
16+
/// <summary>
17+
/// called after death scp600
18+
/// </summary>
19+
public static event Died OnDied;
20+
21+
internal void CallSpawning(SpawningEventArg e)
22+
{
23+
OnSpawning?.Invoke(e);
24+
}
25+
26+
internal void CallDied(DiedEventArg e)
27+
{
28+
OnDied?.Invoke(e);
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)