Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikihero authored May 5, 2022
1 parent 2b86bcb commit 22f0475
Show file tree
Hide file tree
Showing 6 changed files with 325 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Commands/EventCountdown.cs
Original file line number Diff line number Diff line change
@@ -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<string> 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;
}
}
}
35 changes: 35 additions & 0 deletions Commands/EventEnd.cs
Original file line number Diff line number Diff line change
@@ -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<string> 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;
}
}
}
67 changes: 67 additions & 0 deletions Commands/EventStart.cs
Original file line number Diff line number Diff line change
@@ -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<string> arguments, ICommandSender sender, out string response)
{
if(EventTools.Instance.Config.CleanupRagdolls == true)
{
foreach (Ragdoll doll in UnityEngine.Object.FindObjectsOfType<Ragdoll>())
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;
}
}
}
56 changes: 56 additions & 0 deletions Commands/LockZone.cs
Original file line number Diff line number Diff line change
@@ -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<string> 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;
}
}
}
}
58 changes: 58 additions & 0 deletions Config.cs
Original file line number Diff line number Diff line change
@@ -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; } = "[<color=#002db3>Event</color><color=#98fb98>Tools</color>] <color=#50c878>RoundLock</color><color=#ffffff> has been </color><color=#00ffff>enabled.</color>";

[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; } = "[<color=#002db3>Event</color><color=#98fb98>Tools</color>] <color=#50c878>RoundLock</color><color=#ffffff> has been </color><color=#c50000>disabled.</color>";

[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!).";
}
}
80 changes: 80 additions & 0 deletions EventTools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Exiled.API.Enums;
using Exiled.API.Features;
using System;
using System.Timers;

namespace EventTools
{
public class EventTools : Plugin<Config>
{
private static System.Timers.Timer aTimer;

private static readonly Lazy<EventTools> LazyInstance = new Lazy<EventTools>(() => 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();
}
}
}

0 comments on commit 22f0475

Please sign in to comment.