Esempio n. 1
0
        // Range: -1 Access: 0 Flags: ( 0, 4, 255 )
        public static dynamic Reboot(dynamic reason = null, string feedback_c = null, string feedback_r = null, int?time = null)
        {
            double? delay = null;
            dynamic C     = null;

            if (reason == 1)
            {
                if (Task13.user != null)
                {
                    GlobalFuncs.log_admin("" + GlobalFuncs.key_name(Task13.user) + " Has requested an immediate world restart via client side debugging tools");
                    GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(Task13.user) + " Has requested an immediate world restart via client side debugging tools");
                }
                Game13.write("<span class='boldannounce'>Rebooting World immediately due to host request</span>");
                return(Game13._internal_Reboot(1, feedback_c, feedback_r, time));
            }
            if (Lang13.Bool(time))
            {
                delay = time;
            }
            else
            {
                delay = GlobalVars.config.round_end_countdown * 10;
            }
            if (GlobalVars.ticker.delay_end)
            {
                Game13.write("<span class='boldannounce'>An admin has delayed the round end.</span>");
                return(null);
            }
            Game13.write("<span class='boldannounce'>Rebooting World in " + (delay ?? 0) / 10 + " " + ((delay ?? 0) > 10 ? "seconds" : "second") + ". " + reason + "</span>");
            Task13.sleep(((int)(delay)));
            if (GlobalVars.blackbox != null)
            {
                GlobalVars.blackbox.save_all_data_to_sql();
            }
            if (GlobalVars.ticker.delay_end)
            {
                Game13.write("<span class='boldannounce'>Reboot was cancelled by an admin.</span>");
                return(null);
            }
            GlobalFuncs.feedback_set_details("" + feedback_c, "" + feedback_r);
            GlobalFuncs.log_game("<span class='boldannounce'>Rebooting World. " + reason + "</span>");
            GlobalFuncs.kick_clients_in_lobby("<span class='boldannounce'>The round came to an end with you in the lobby.</span>", 1);
            Task13.schedule(0, (Task13.Closure)(() => {
                if (GlobalVars.ticker != null && Lang13.Bool(GlobalVars.ticker.round_end_sound))
                {
                    Game13.write(new Sound(GlobalVars.ticker.round_end_sound));
                }
                else
                {
                    Game13.write(new Sound(Rand13.pick(new object [] { "sound/AI/newroundsexy.ogg", "sound/misc/apcdestroyed.ogg", "sound/misc/bangindonk.ogg", "sound/misc/leavingtg.ogg" })));
                }
                return;
            }));
            C = null;
            foreach (dynamic _a in GlobalVars.clients)
            {
                C = _a;
                if (!Lang13.Bool(((dynamic)typeof(Client)).IsInstanceOfType(C)))
                {
                    continue;
                }
                if (Lang13.Bool(GlobalVars.config.server))
                {
                    Interface13.link(C, "byond://" + GlobalVars.config.server);
                }
            }
            ;
            Game13._internal_Reboot(0, feedback_c, feedback_r, time);
            return(null);
        }