コード例 #1
0
        public void OnConsoleCommand(ConsoleCommandEvent ev)
        {
            if (Cooldowns.CheckCooldown(Cooldowns.MtfCmdCool))
            {
                ev.Color         = "red";
                ev.ReturnMessage = $"You must wait {Cooldowns.MtfCmdCool} seconds to use abilities.";
                return;
            }

            if (ev.Player != hub)
            {
                return;
            }

            if (ev.Command.StartsWith("respawn"))
            {
                if (Cooldowns.CheckCooldown(Cooldowns.MtfRespawnTime))
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = $"You must wait {Cooldowns.MtfRespawnTime} seconds to respawn another wave.";
                    return;
                }

                GameCore.Console.singleton.TypeCommand("/SERVER_EVENT FORCE_MTF_RESPAWN");
                ev.Color         = "cyan";
                ev.ReturnMessage = "An MTF unit has been alerted to immediately come to your location.";
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoMTFRespawnCooldown()));
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoMtfCommandCooldown()));
            }
            else if (ev.Command.StartsWith("teslas"))
            {
                if (Cooldowns.CheckCooldown(Cooldowns.TeslasTime))
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = $"Tesla gates cannot be toggled for {Cooldowns.TeslasTime} seconds.";
                    return;
                }

                if (EventHandlers.TeslaDisabled)
                {
                    EventHandlers.TeslaDisabled = false;
                    Methods.DoAnnouncement("MtfUnit Commander has activated Facility automatic security systems");
                }
                else
                {
                    EventHandlers.TeslaDisabled = true;
                    Methods.DoAnnouncement("MtfUnit Commander has Deactivated Facility automatic security systems ");
                }
                ev.Color         = "cyan";
                ev.ReturnMessage = "Tesla gates have been successfully toggled.";
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoTeslaCooldown()));
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoMtfCommandCooldown()));
            }
            else if (ev.Command.StartsWith("icom"))
            {
                if (Cooldowns.CheckCooldown(Cooldowns.IcomTime))
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = $"You cannot use the intercom remotely for {Cooldowns.IcomTime} seconds.";
                    return;
                }
                if (ev.Player.IsIntercomMuted())
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = "Denied as you are currently intercom muted. Contact this server's staff if you believe this is in error.";
                    return;
                }
                GameCore.Console.singleton.TypeCommand("INTERCOM-TIMEOUT");
                ev.Color         = "cyan";
                ev.ReturnMessage = "You are now live on the intercom. Thirty seconds remaining.";
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoIComCooldown()));
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoMtfCommandCooldown()));
            }
            else if (ev.Command.StartsWith("scan"))
            {
                if (Cooldowns.CheckCooldown(Cooldowns.ScanTime))
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = $"You cannot scan the facility for {Cooldowns.ScanTime} seconds.";
                    return;
                }
                ev.Color         = "cyan";
                ev.ReturnMessage = "Commencing Scan.";
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Methods.DoScan("mtf")));
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoScanCooldown()));
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoMtfCommandCooldown()));
            }
            else if (ev.Command.StartsWith("lockdown"))
            {
                if (!EventHandlers.MTFLock)
                {
                    ev.Color         = "red";
                    ev.ReturnMessage = "You must wait until another round to access this command.";
                    return;
                }
                EventHandlers.Coroutines.Add(Timing.RunCoroutine(Methods.DoGateLock()));
                ev.Color              = "cyan";
                ev.ReturnMessage      = "Lockdown successful.";
                EventHandlers.MTFLock = false;
            }
            else if (ev.Command.StartsWith("help"))
            {
                ev.Color         = "white";
                ev.ReturnMessage =
                    "\n.help: Shows all commands and delays" +
                    "\n.teslas: Toggles the activation of teslas - Cooldown: 2 minutes" +
                    "\n.respawn: Forces a MTF respawn - Cooldown: 10 minutes" +
                    //"\n.icom: Allows you to speak on the intercom at will - Cooldown: 5 minutes" +
                    "\n.scan: Scans the facility for all alive people - Cooldown: 10 minutes" +
                    "\n.lockdown: Locks both Gate A and Gate B closed for one minute - Can be used once per round";
            }
            ;
        }
コード例 #2
0
        public void OnConsoleCommand(ConsoleCommandEvent ev)
        {
            try
            {
                if (Cooldowns.CheckCooldown(Cooldowns.ChaosCmdCool))
                {
                    ev.ReturnMessage = $"<color=red>You must wait {Cooldowns.ChaosCmdCool} seconds to use abilities.</color>";
                    return;
                }

                if (ev.Player != hub)
                {
                    return;
                }

                if (ev.Command.StartsWith("emp"))
                {
                    bool Does173Exist = new bool();
                    if (!EventHandlers.ChaosDevice)
                    {
                        ev.Color         = "red";
                        ev.ReturnMessage = "You must wait until another round to access this command.";
                        return;
                    }
                    foreach (ReferenceHub hub in Player.GetHubs())
                    {
                        if (hub.GetRole() == RoleType.Scp173)
                        {
                            Does173Exist = true;
                        }
                    }
                    if (Does173Exist)
                    {
                        ev.Color         = "red";
                        ev.ReturnMessage = "Blackout cancelled. Entity in the facility has been found to directly benefit from the darkness.";
                        Does173Exist     = false;
                        return;
                    }
                    ev.Color                  = "yellow";
                    ev.ReturnMessage          = "Facility blacked out for 60 seconds.";
                    EventHandlers.ChaosDevice = false;
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Methods.DoBlackout()));
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoChsCommandCooldown()));
                }
                else if (ev.Command.StartsWith("respawn"))
                {
                    if (Cooldowns.CheckCooldown(Cooldowns.ChaosRespawnTime))
                    {
                        ev.Color         = "red";
                        ev.ReturnMessage = $"You must wait {Cooldowns.ChaosRespawnTime} seconds to respawn another wave.";
                        return;
                    }
                    GameCore.Console.singleton.TypeCommand("/SERVER_EVENT FORCE_CI_RESPAWN");
                    ev.ReturnMessage = "<color=cyan>An Chaos unit has been alerted to immediately come to your location.</color>";
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoChaosRespawnCooldown()));
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoChsCommandCooldown()));
                }
                else if (ev.Command.StartsWith("hack"))
                {
                    if (Cooldowns.CheckCooldown(Cooldowns.HackTime))
                    {
                        ev.Color         = "red";
                        ev.ReturnMessage = $"You must wait {Cooldowns.HackTime} seconds to attempt another hack.";
                        return;
                    }

                    string Cmd      = string.Empty;
                    int    CoolTime = new int();

                    if (ev.Command.Contains("scan"))
                    {
                        Cmd      = "scan";
                        CoolTime = 600;
                    }
                    else if (ev.Command.Contains("teslas"))
                    {
                        Cmd      = "teslas";
                        CoolTime = 120;
                    }
                    else
                    {
                        ev.ReturnMessage = "You must specify a command to hack: .hack (scan/teslas)";
                        return;
                    }
                    ev.ReturnMessage = null;
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Methods.HackSequence(hub, Cmd)));
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoHackCooldown(CoolTime)));
                    EventHandlers.Coroutines.Add(Timing.RunCoroutine(Cooldowns.DoChsCommandCooldown()));
                }
                else if (ev.Command.StartsWith("help"))
                {
                    ev.Color         = "white";
                    ev.ReturnMessage =
                        "\n.help: Shows all commands and delays " +
                        "\n.emp: Blacksout the facility and disabled tesla gates, also lets anybody open any door - Can only be used once per round" +
                        "\n.respawn: Forces a Chaos respawn - Cooldown: 10 minutes" +
                        "\n.hack (scan/teslas): Attempts to mimick the NTF commanders ability's - Cooldowns: (scan 10 min/teslas 2 min)";
                }
            }
            catch (Exception e)
            {
                Log.Error($"BetterRespawns exception for ChaosCommander ConsoleCommand: {e}");
            }
        }