diff --git a/Commands/EventCountdown.cs b/Commands/EventCountdown.cs new file mode 100644 index 0000000..10181fa --- /dev/null +++ b/Commands/EventCountdown.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommandSystem; +using Exiled.API.Features; + +namespace EventTools.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + class EventCountdown : ICommand + { + public string Command { get; } = "EventCountdown"; + + public string[] Aliases { get; } = { }; + + public string Description { get; } = "Sends a cassie countdown specified in the plugins config."; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + string cassieMessage = EventTools.Instance.Config.CassieMessage; + Cassie.Message(cassieMessage, false, false, true); + string cassieResponseMessage = EventTools.Instance.Config.CassieResponseMessage; + response = cassieResponseMessage; + return true; + } + } +} diff --git a/Commands/EventEnd.cs b/Commands/EventEnd.cs new file mode 100644 index 0000000..d896a43 --- /dev/null +++ b/Commands/EventEnd.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommandSystem; +using Exiled.API; +using Exiled.Events; +using Exiled.API.Features; +using Exiled.API.Enums; + +namespace EventTools.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + class EventEnd : ICommand + { + public string Command => "EventEnd"; + + public string[] Aliases { get; set; } = { "Eventfinish"}; + + public string Description => "Finishes the event with a bang!"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + foreach(Player player in Player.List) + { + player.Teleport(Door.Get(DoorType.PrisonDoor)); + } + Warhead.Detonate(); + string responseMessage = EventTools.Instance.Config.EventEndResponseMessage; + response = "Everyone is sad because the event is over (and also they exploded!)."; + return true; + } + } +} diff --git a/Commands/EventStart.cs b/Commands/EventStart.cs new file mode 100644 index 0000000..570064d --- /dev/null +++ b/Commands/EventStart.cs @@ -0,0 +1,67 @@ +using CommandSystem; +using System; +using RemoteAdmin; +using Exiled.API.Features.Items; +using Exiled.API.Features; +using Exiled.Permissions.Extensions; +using Mirror; +using Exiled.API.Enums; +using Exiled.API; + +namespace EventTools.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + class EventStart : ICommand + { + public string Command { get; } = "EventStart"; + + public string[] Aliases { get; } = { }; + + public string Description { get; } = "Starts the event with parameters specified in the plugins config."; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if(EventTools.Instance.Config.CleanupRagdolls == true) + { + foreach (Ragdoll doll in UnityEngine.Object.FindObjectsOfType()) + NetworkServer.Destroy(doll.gameObject); + } + if(EventTools.Instance.Config.CleanupItems == true) + { + foreach (Pickup item in Map.Pickups) + item.Destroy(); + } + if(EventTools.Instance.Config.RoundLock == true) + { + Round.IsLocked = true; + } + if(EventTools.Instance.Config.RespawnTickets == true) + { + Respawn.NtfTickets = 1; + Respawn.ChaosTickets = 1; + } + if(EventTools.Instance.Config.ForceClassEveryone == true) + { + foreach (Player player in Player.List) + { + player.SetRole(RoleType.ClassD); + } + } + if(EventTools.Instance.Config.FCToTutorial == true) + { + Player.Get(sender).SetRole(RoleType.Tutorial); + } + if (EventTools.Instance.Config.LockAllDoors == true) + { + Door.LockAll(9999, DoorLockType.AdminCommand); + } + if (EventTools.Instance.Config.EnableNoclip == true) + { + Player.Get(sender).NoClipEnabled = true; + } + string responseMessage = EventTools.Instance.Config.EventStartResponseMessage; + response = responseMessage; + return true; + } + } +} diff --git a/Commands/LockZone.cs b/Commands/LockZone.cs new file mode 100644 index 0000000..4e39bc6 --- /dev/null +++ b/Commands/LockZone.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Enums; + +namespace EventTools.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + class LockZone : ICommand + { + public string Command { get; set; } = "lockzone"; + + public string[] Aliases { get; set; } = { }; + + public string Description { get; set; } = "Locks all the doors in a specified zone"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (arguments.Count != 1) + { + response = "Usage: lockzone lcz/hcz/ez/surface/all."; + return false; + } + switch (arguments.At(0)) + { + case "lcz": + Door.LockAll(9999, ZoneType.LightContainment, DoorLockType.AdminCommand); + response = "Toggled door lock in LCZ."; + return true; + case "hcz": + Door.LockAll(9999, ZoneType.HeavyContainment, DoorLockType.AdminCommand); + response = "Toggled door lock in HCZ."; + return true; + case "ez": + Door.LockAll(9999, ZoneType.Entrance, DoorLockType.AdminCommand); + response = "Toggled door lock in HCZ."; + return true; + case "surface": + Door.LockAll(9999, ZoneType.Surface, DoorLockType.AdminCommand); + response = "Toggled door lock on the surface."; + return true; + case "all": + Door.LockAll(9999, DoorLockType.AdminCommand); + response = "Toggled door lock everywhere in the facility."; + return true; + default: + response = "Usage: lockzone lcz/hcz/ez/surface/all."; + return false; + } + } + } +} diff --git a/Config.cs b/Config.cs new file mode 100644 index 0000000..aa865af --- /dev/null +++ b/Config.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Interfaces; +using System.ComponentModel; + +namespace EventTools +{ + public sealed class Config : IConfig + { + [Description("Enables or disables the plugin.")] + public bool IsEnabled { get; set; } = true; + + [Description("The message sent when someone enables the RoundLock, can be colored ONLY using hex codes displayed in game client console under the 'colors' command.")] + public string RLEnabledMessage { get; set; } = "[EventTools] RoundLock has been enabled."; + + [Description("The message sent when someone disables the RoundLock, can be colored ONLY using hex codes displayed in game client console under the 'colors' command..")] + public string RLDisabledMessage { get; set; } = "[EventTools] RoundLock has been disabled."; + + [Description("Sets the response message sent in RemoteAdmin after executing the 'EventStart' command.")] + public string EventStartResponseMessage { get; set; } = "The event has been succesfully started."; + + [Description("Whether or not the EventStart command should cleanup ragdolls. Default: true")] + public bool CleanupRagdolls { get; set; } = true; + + [Description("Whether or not the EventStart command should cleanup items. Default: true")] + public bool CleanupItems { get; set; } = true; + + [Description("Whether or not the EventStart command should enable roundlock.")] + public bool RoundLock { get; set; } = true; + + [Description("Whether or not the EventStart command should set MTF and CI tickets to 1.")] + public bool RespawnTickets { get; set; } = true; + + [Description("The message sent using CASSIE with the EventCountdown command.")] + public string CassieMessage = "10 . 9 . 8 . 7 . 6 . 5 . 4 . 3 . 2 . 1 start"; + + [Description("Sets the response message given in RemoteAdmin after executing the 'EventCountdown' command.")] + public string CassieResponseMessage { get; set; } = "The countdown has begun."; + + [Description("Whether or not the person executing the command should be forceclassed to tutorial.")] + public bool FCToTutorial { get; set; } = true; + + [Description("Whether or not all doors in the facility should be locked. Currently will ONLY send a reminder in AC due to EXILED being broken doo doo.")] + public bool LockAllDoors { get; set; } = true; + + [Description("Whether or not the person sending the command should have their noclip enabled.")] + public bool EnableNoclip { get; set; } = true; + + [Description("Whether or not everyone except for the person executing the command should be forceclassed Class D.")] + public bool ForceClassEveryone { get; set; } = true; + + [Description("Sets the response message given in RemoteAdmin after executing the 'EventEnd' command.")] + public string EventEndResponseMessage { get; set; } = "Everyone is sad because the event is over (and also they exploded!)."; + } +} diff --git a/EventTools.cs b/EventTools.cs new file mode 100644 index 0000000..4a9556b --- /dev/null +++ b/EventTools.cs @@ -0,0 +1,80 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using System; +using System.Timers; + +namespace EventTools +{ + public class EventTools : Plugin + { + private static System.Timers.Timer aTimer; + + private static readonly Lazy LazyInstance = new Lazy(() => new EventTools()); + public static EventTools Instance => LazyInstance.Value; + + public override PluginPriority Priority { get; } = PluginPriority.Medium; + + + private EventTools() + { + + } + + public static int tester1 = 2; + public static int tester2 = 2; + public static void RoundLockAdminChat(Object sender, ElapsedEventArgs e) + { + if (Round.IsLocked == true) + { + string message = EventTools.Instance.Config.RLEnabledMessage; + tester1 = 1; + if (tester2 == 2) + { + tester2 = tester1; + Map.Broadcast(2, message, Broadcast.BroadcastFlags.AdminChat); + } + if (tester2 == tester1) + { + + } + else + { + Map.Broadcast(2, message, Broadcast.BroadcastFlags.AdminChat); + tester2 = tester1; + } + } + else + { + string message = EventTools.Instance.Config.RLDisabledMessage; + tester1 = 0; + if (tester2 == 2) + { + tester2 = tester1; + Map.Broadcast(2, message, Broadcast.BroadcastFlags.AdminChat); + } + if (tester2 == tester1) + { + + } + else + { + Map.Broadcast(2, message, Broadcast.BroadcastFlags.AdminChat); + tester2 = tester1; + } + } + } + + private static void SetTimer() + { + aTimer = new Timer(1000); + aTimer.Elapsed += RoundLockAdminChat; + aTimer.AutoReset = true; + aTimer.Enabled = true; + } + + public override void OnEnabled() + { + SetTimer(); + } + } +}