Exemplo n.º 1
0
        // Function from file: message.dm
        public Obj_Item_Weapon_Paper_Monitorkey(dynamic loc = null) : base((object)(loc))
        {
            Obj_Machinery_MessageServer server = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            Task13.Schedule(10, (Task13.Closure)(() => {
                if (GlobalVars.message_servers != null)
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.message_servers, typeof(Obj_Machinery_MessageServer)))
                    {
                        server = _a;


                        if (!(server == null))
                        {
                            if (!(server.decryptkey == null))
                            {
                                this.info       = "<center><h2>Daily Key Reset</h2></center><br>The new message monitor key is '" + server.decryptkey + "'.<br>Please keep this a secret and away from the clown.<br>If necessary, change the password to a more secure one.";
                                this.info_links = this.info;
                                this.overlays.Add("paper_words");
                                break;
                            }
                        }
                    }
                }
                return;
            }));
            return;
        }
        // Function from file: message_server.dm
        public void round_end_data_gathering(  )
        {
            int pda_msg_amt = 0;
            int rc_msg_amt  = 0;
            Obj_Machinery_MessageServer MS = null;

            pda_msg_amt = 0;
            rc_msg_amt  = 0;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.message_servers, typeof(Obj_Machinery_MessageServer)))
            {
                MS = _a;


                if (MS.pda_msgs.len > pda_msg_amt)
                {
                    pda_msg_amt = MS.pda_msgs.len;
                }

                if (MS.rc_msgs.len > rc_msg_amt)
                {
                    rc_msg_amt = MS.rc_msgs.len;
                }
            }
            GlobalFuncs.feedback_set_details("radio_usage", "");
            GlobalFuncs.feedback_add_details("radio_usage", "COM-" + this.msg_common.len);
            GlobalFuncs.feedback_add_details("radio_usage", "SCI-" + this.msg_science.len);
            GlobalFuncs.feedback_add_details("radio_usage", "HEA-" + this.msg_command.len);
            GlobalFuncs.feedback_add_details("radio_usage", "MED-" + this.msg_medical.len);
            GlobalFuncs.feedback_add_details("radio_usage", "ENG-" + this.msg_engineering.len);
            GlobalFuncs.feedback_add_details("radio_usage", "SEC-" + this.msg_security.len);
            GlobalFuncs.feedback_add_details("radio_usage", "DTH-" + this.msg_deathsquad.len);
            GlobalFuncs.feedback_add_details("radio_usage", "SYN-" + this.msg_syndicate.len);
            GlobalFuncs.feedback_add_details("radio_usage", "SRV-" + this.msg_service.len);
            GlobalFuncs.feedback_add_details("radio_usage", "CAR-" + this.msg_cargo.len);
            GlobalFuncs.feedback_add_details("radio_usage", "OTH-" + this.messages.len);
            GlobalFuncs.feedback_add_details("radio_usage", "PDA-" + pda_msg_amt);
            GlobalFuncs.feedback_add_details("radio_usage", "RC-" + rc_msg_amt);
            GlobalFuncs.feedback_set_details("round_end", "" + String13.FormatTime(Game13.realtime, null));
            return;
        }
Exemplo n.º 3
0
        // Function from file: requests_console.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string new_message                    = null;
            string new_message2                   = null;
            double?radio_freq                     = null;
            string log_msg                        = null;
            string sending                        = null;
            bool   pass                           = false;
            Obj_Machinery_MessageServer MS        = null;
            double?radio_freq2                    = null;
            string authentic                      = null;
            string alert                          = null;
            Obj_Machinery_RequestsConsole Console = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(GlobalFuncs.reject_bad_text(href_list["write"])))
            {
                this.dpt    = String13.CKey(href_list["write"]);
                new_message = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024);

                if (Lang13.Bool(new_message))
                {
                    this.message = new_message;
                    this.screen  = 9;

                    if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2)
                    {
                        this.priority = -1;
                    }
                    else
                    {
                        this.priority = String13.ParseNumber(href_list["priority"]);
                    }
                }
                else
                {
                    this.dpt         = "";
                    this.msgVerified = "";
                    this.msgStamped  = "";
                    this.screen      = 0;
                    this.priority    = -1;
                }
            }

            if (Lang13.Bool(href_list["writeAnnouncement"]))
            {
                new_message2 = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024);

                if (Lang13.Bool(new_message2))
                {
                    this.message = new_message2;

                    if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2)
                    {
                        this.priority = -1;
                    }
                    else
                    {
                        this.priority = String13.ParseNumber(href_list["priority"]);
                    }
                }
                else
                {
                    this.message      = "";
                    this.announceAuth = false;
                    this.screen       = 0;
                }
            }

            if (Lang13.Bool(href_list["sendAnnouncement"]))
            {
                if (!this.announcementConsole)
                {
                    return(null);
                }
                GlobalFuncs.minor_announce(this.message, "" + this.department + " Announcement:");
                GlobalVars.news_network.SubmitArticle(this.message, this.department, "Station Announcements", null);
                GlobalFuncs.log_say("" + GlobalFuncs.key_name(Task13.User) + " has made a station announcement: " + this.message);
                GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(Task13.User) + " has made a station announcement.");
                this.announceAuth = false;
                this.message      = "";
                this.screen       = 0;
            }

            if (Lang13.Bool(href_list["emergency"]))
            {
                if (!Lang13.Bool(this.emergency))
                {
                    switch ((int?)(String13.ParseNumber(href_list["emergency"])))
                    {
                    case 1:
                        radio_freq     = GlobalVars.SEC_FREQ;
                        this.emergency = "Security";
                        break;

                    case 2:
                        radio_freq     = GlobalVars.ENG_FREQ;
                        this.emergency = "Engineering";
                        break;

                    case 3:
                        radio_freq     = GlobalVars.MED_FREQ;
                        this.emergency = "Medical";
                        break;
                    }

                    if (Lang13.Bool(radio_freq))
                    {
                        this.Radio.set_frequency(radio_freq);
                        this.Radio.talk_into(this, "" + this.emergency + " emergency in " + this.department + "!!", radio_freq);
                        this.update_icon();
                        Task13.Schedule(3000, (Task13.Closure)(() => {
                            this.emergency = null;
                            this.update_icon();
                            return;
                        }));
                    }
                }
            }

            if (Lang13.Bool(href_list["department"]) && Lang13.Bool(this.message))
            {
                log_msg  = this.message;
                sending  = this.message;
                sending += "<br>";

                if (Lang13.Bool(this.msgVerified))
                {
                    sending += this.msgVerified;
                    sending += "<br>";
                }

                if (Lang13.Bool(this.msgStamped))
                {
                    sending += this.msgStamped;
                    sending += "<br>";
                }
                this.screen = 7;

                if (Lang13.Bool(sending))
                {
                    pass = false;

                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_MessageServer)))
                    {
                        MS = _b;


                        if (!MS.active)
                        {
                            continue;
                        }
                        MS.send_rc_message(href_list["department"], this.department, log_msg, this.msgStamped, this.msgVerified, this.priority);
                        pass = true;
                    }

                    if (pass)
                    {
                        radio_freq2 = 0;

                        dynamic _c = href_list["department"];                         // Was a switch-case, sorry for the mess.
                        if (_c == "bridge")
                        {
                            radio_freq2 = GlobalVars.COMM_FREQ;
                        }
                        else if (_c == "medbay")
                        {
                            radio_freq2 = GlobalVars.MED_FREQ;
                        }
                        else if (_c == "science")
                        {
                            radio_freq2 = GlobalVars.SCI_FREQ;
                        }
                        else if (_c == "engineering")
                        {
                            radio_freq2 = GlobalVars.ENG_FREQ;
                        }
                        else if (_c == "security")
                        {
                            radio_freq2 = GlobalVars.SEC_FREQ;
                        }
                        else if (_c == "cargobay")
                        {
                            radio_freq2 = GlobalVars.SUPP_FREQ;
                        }
                        this.Radio.set_frequency(radio_freq2);
                        authentic = null;

                        if (Lang13.Bool(this.msgVerified) || Lang13.Bool(this.msgStamped))
                        {
                            authentic = " (Authenticated)";
                        }
                        alert = "";

                        foreach (dynamic _e in Lang13.Enumerate(GlobalVars.allConsoles, typeof(Obj_Machinery_RequestsConsole)))
                        {
                            Console = _e;


                            if (String13.CKey(Console.department) == String13.CKey(href_list["department"]))
                            {
                                switch ((int?)(this.priority))
                                {
                                case 2:
                                    alert = "PRIORITY Alert in " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 2);
                                    break;

                                case 3:
                                    alert = "EXTREME PRIORITY Alert from " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 3);
                                    break;

                                default:
                                    alert = "Message from " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 1);
                                    break;
                                }
                                this.screen = 6;
                                Console.SetLuminosity(2);
                            }
                        }

                        if (Lang13.Bool(radio_freq2))
                        {
                            this.Radio.talk_into(this, "" + alert + ": <i>" + this.message + "</i>", radio_freq2);
                        }

                        switch ((int?)(this.priority))
                        {
                        case 2:
                            this.messages.Add("<span class='bad'>High Priority</span><BR><b>To:</b> " + this.dpt + "<BR>" + sending);
                            break;

                        default:
                            this.messages.Add("<b>To: " + this.dpt + "</b><BR>" + sending);
                            break;
                        }
                    }
                    else
                    {
                        this.say("NOTICE: No server detected!");
                    }
                }
            }

            switch ((int?)(String13.ParseNumber(href_list["setScreen"])))
            {
            case null:

                break;

            case 1:
                this.screen = 1;
                break;

            case 2:
                this.screen = 2;
                break;

            case 3:
                this.screen = 3;
                break;

            case 5:
                this.screen = 5;
                break;

            case 6:
                this.screen = 6;
                break;

            case 7:
                this.screen = 7;
                break;

            case 8:
                this.screen = 8;
                break;

            case 9:
                this.screen = 9;
                break;

            case 10:

                if (!this.announcementConsole)
                {
                    return(null);
                }
                this.screen = 10;
                break;

            default:
                this.dpt         = "";
                this.msgVerified = "";
                this.msgStamped  = "";
                this.message     = "";
                this.priority    = -1;
                this.screen      = 0;
                break;
            }

            dynamic _h = href_list["setSilent"];             // Was a switch-case, sorry for the mess.

            if (_h == null)
            {
            }
            else if (_h == "1")
            {
                this.silent = true;
            }
            else
            {
                this.silent = false;
            }
            this.updateUsrDialog();
            return(null);
        }