Ejemplo n.º 1
0
        // Function from file: server.dm
        public void update_logs(  )
        {
            int?         i = null;
            CommLogEntry L = null;


            if ((this.logs ?? 0) >= 400)
            {
                i = null;
                i = 1;

                while ((i ?? 0) <= (this.logs ?? 0))
                {
                    L = this.log_entries[i];

                    if (L.garbage_collector)
                    {
                        this.log_entries.Remove(L);
                        this.logs--;
                        break;
                    }
                    i++;
                }
            }
            return;
        }
Ejemplo n.º 2
0
        // Function from file: server.dm
        public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
        {
            CommLogEntry log        = null;
            string       identifier = null;
            int?         can_send   = null;


            if (Lang13.Bool(signal.data["message"]))
            {
                if (this.is_freq_listening(signal))
                {
                    if (this.traffic > 0)
                    {
                        this.totaltraffic += this.traffic;
                    }

                    if (Convert.ToInt32(signal.data["type"]) != 4)
                    {
                        this.update_logs();
                        log = new CommLogEntry();
                        log.parameters["mobtype"]  = signal.data["mobtype"];
                        log.parameters["job"]      = signal.data["job"];
                        log.parameters["key"]      = signal.data["key"];
                        log.parameters["message"]  = signal.data["message"];
                        log.parameters["name"]     = signal.data["name"];
                        log.parameters["realname"] = signal.data["realname"];
                        log.parameters["uspeech"]  = signal.data["languages"] & 1;

                        if (Convert.ToDouble(signal.data["compression"]) > 0)
                        {
                            log.parameters["message"]  = GlobalFuncs.Gibberish(signal.data["message"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["job"]      = GlobalFuncs.Gibberish(signal.data["job"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["name"]     = GlobalFuncs.Gibberish(signal.data["name"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["realname"] = GlobalFuncs.Gibberish(signal.data["realname"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.input_type             = "Corrupt File";
                        }
                        this.log_entries.Add(log);

                        if (!this.stored_names.Contains(signal.data["name"]))
                        {
                            this.stored_names.Add(signal.data["name"]);
                        }
                        this.logs++;
                        signal.data["server"] = this;
                        identifier            = String13.NumberToString(Rand13.Int(-1000, 1000) + Game13.time);
                        log.name = "data packet (" + Num13.Md5(identifier) + ")";
                    }
                    can_send = this.relay_information(signal, "/obj/machinery/telecomms/hub");

                    if (!Lang13.Bool(can_send))
                    {
                        this.relay_information(signal, "/obj/machinery/telecomms/broadcaster");
                    }
                }
            }
            return;
        }
Ejemplo n.º 3
0
        // Function from file: server.dm
        public void add_entry(dynamic content = null, dynamic input = null)
        {
            CommLogEntry log        = null;
            string       identifier = null;

            log                       = new CommLogEntry();
            identifier                = String13.NumberToString(Rand13.Int(-1000, 1000) + Game13.time);
            log.name                  = "" + input + " (" + Num13.Md5(identifier) + ")";
            log.input_type            = input;
            log.parameters["message"] = content;
            this.log_entries.Add(log);
            this.update_logs();
            return;
        }
Ejemplo n.º 4
0
        // Function from file: logbrowser.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string dat = null;
            Obj_Machinery_Telecomms T = null;
            int          i            = 0;
            CommLogEntry C            = null;
            string       race         = null;
            string       language     = null;
            dynamic      mobtype      = null;
            dynamic      humans       = null;
            dynamic      monkeys      = null;
            dynamic      silicons     = null;
            dynamic      slimes       = null;
            dynamic      animals      = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "<TITLE>Telecommunication Server Monitor</TITLE><center><b>Telecommunications Server Monitor</b></center>";

            switch ((bool)(this.screen))
            {
            case false:
                dat += "<br>" + this.temp + "<br>";
                dat += new Txt("<br>Current Network: <a href='?src=").Ref(this).str(";network=1'>").item(this.network).str("</a><br>").ToString();

                if (this.servers.len != 0)
                {
                    dat += "<br>Detected Telecommunication Servers:<ul>";

                    foreach (dynamic _a in Lang13.Enumerate(this.servers, typeof(Obj_Machinery_Telecomms)))
                    {
                        T = _a;

                        dat += new Txt("<li><a href='?src=").Ref(this).str(";viewserver=").item(T.id).str("'>").Ref(T).str(" ").item(T.name).str("</a> (").item(T.id).str(")</li>").ToString();
                    }
                    dat += "</ul>";
                    dat += new Txt("<br><a href='?src=").Ref(this).str(";operation=release'>[Flush Buffer]</a>").ToString();
                }
                else
                {
                    dat += new Txt("<br>No servers detected. Scan for servers: <a href='?src=").Ref(this).str(";operation=scan'>[Scan]</a>").ToString();
                }
                break;

            case true:
                dat += "<br>" + this.temp + "<br>";
                dat += new Txt("<center><a href='?src=").Ref(this).str(";operation=mainmenu'>[Main Menu]</a>     <a href='?src=").Ref(this).str(";operation=refresh'>[Refresh]</a></center>").ToString();
                dat += "<br>Current Network: " + this.network;
                dat += "<br>Selected Server: " + this.SelectedServer.id;

                if (Convert.ToDouble(((dynamic)this.SelectedServer).totaltraffic) >= 1024)
                {
                    dat += "<br>Total recorded traffic: " + Num13.Floor(Convert.ToDouble(((dynamic)this.SelectedServer).totaltraffic / 1024)) + " Terrabytes<br><br>";
                }
                else
                {
                    dat += "<br>Total recorded traffic: " + ((dynamic)this.SelectedServer).totaltraffic + " Gigabytes<br><br>";
                }
                dat += "Stored Logs: <ol>";
                i    = 0;

                foreach (dynamic _b in Lang13.Enumerate(((dynamic)this.SelectedServer).log_entries, typeof(CommLogEntry)))
                {
                    C = _b;

                    i++;

                    if (C.input_type == "Speech File")
                    {
                        dat     += new Txt("<li><font color = #008F00>").item(C.name).str("</font color>  <font color = #FF0000><a href='?src=").Ref(this).str(";delete=").item(i).str("'>[X]</a></font color><br>").ToString();
                        race     = null;
                        language = "Human";
                        mobtype  = C.parameters["mobtype"];
                        humans   = Lang13.GetTypes(typeof(Mob_Living_Carbon_Human), typeof(Mob_Living_Carbon_Brain));
                        monkeys  = Lang13.GetTypes(typeof(Mob_Living_Carbon_Monkey));
                        silicons = Lang13.GetTypes(typeof(Mob_Living_Silicon));
                        slimes   = Lang13.GetTypes(typeof(Mob_Living_SimpleAnimal_Slime));
                        animals  = Lang13.GetTypes(typeof(Mob_Living_SimpleAnimal));

                        if (Lang13.Bool(humans.Contains(mobtype)))
                        {
                            race     = "Humanoid";
                            language = race;
                        }
                        else if (Lang13.Bool(slimes.Contains(mobtype)))
                        {
                            race     = "Slime";
                            language = race;
                        }
                        else if (Lang13.Bool(monkeys.Contains(mobtype)))
                        {
                            race     = "Monkey";
                            language = race;
                        }
                        else if (Lang13.Bool(((dynamic)(Lang13.Bool(silicons) || C.parameters["job"] == "AI")).Contains(mobtype)))
                        {
                            race     = "Artificial Life";
                            language = "Humanoid";
                        }
                        else if (mobtype is Obj)
                        {
                            race     = "Machinery";
                            language = race;
                        }
                        else if (Lang13.Bool(animals.Contains(mobtype)))
                        {
                            race     = "Domestic Animal";
                            language = race;
                        }
                        else
                        {
                            race     = "<i>Unidentifiable</i>";
                            language = race;
                        }

                        if (language == "Humanoid" || this.universal_translate || Lang13.Bool(C.parameters["uspeech"]))
                        {
                            dat += "<u><font color = #18743E>Data type</font color></u>: " + C.input_type + "<br>";
                            dat += "<u><font color = #18743E>Source</font color></u>: " + C.parameters["name"] + " (Job: " + C.parameters["job"] + ")<br>";
                            dat += "<u><font color = #18743E>Class</font color></u>: " + race + "<br>";
                            dat += "<u><font color = #18743E>Contents</font color></u>: \"" + C.parameters["message"] + "\"<br>";
                        }
                        else
                        {
                            dat += "<u><font color = #18743E>Data type</font color></u>: Audio File<br>";
                            dat += "<u><font color = #18743E>Source</font color></u>: <i>Unidentifiable</i><br>";
                            dat += "<u><font color = #18743E>Class</font color></u>: " + race + "<br>";
                            dat += "<u><font color = #18743E>Contents</font color></u>: <i>Unintelligble</i><br>";
                        }
                        dat += "</li><br>";
                    }
                    else if (C.input_type == "Execution Error")
                    {
                        dat += new Txt("<li><font color = #990000>").item(C.name).str("</font color>  <font color = #FF0000><a href='?src=").Ref(this).str(";delete=").item(i).str("'>[X]</a></font color><br>").ToString();
                        dat += "<u><font color = #787700>Output</font color></u>: \"" + C.parameters["message"] + "\"<br>";
                        dat += "</li><br>";
                    }
                }
                dat += "</ol>";
                break;
            }
            Interface13.Browse(a, dat, "window=comm_monitor;size=575x400");
            GlobalFuncs.onclose(a, "server_control");
            this.temp = "";
            return(null);
        }