Beispiel #1
0
        // Function from file: server.dm
        public override void initialize(  )
        {
            ByTable no_id_servers       = null;
            ByTable server_ids          = null;
            Obj_Machinery_RND_Server S  = null;
            Obj_Machinery_RND_Server S2 = null;
            int num = 0;

            base.initialize();
            no_id_servers = new ByTable();
            server_ids    = new ByTable();

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


                switch ((int?)(S.server_id))
                {
                case -1:
                    continue;
                    break;

                case 0:
                    no_id_servers.Add(S);
                    break;

                default:
                    server_ids.Add(S.server_id);
                    break;
                }
            }

            foreach (dynamic _c in Lang13.Enumerate(no_id_servers, typeof(Obj_Machinery_RND_Server)))
            {
                S2 = _c;

                num = 1;

                while (!Lang13.Bool(S2.server_id))
                {
                    if (server_ids.Contains(num))
                    {
                        num++;
                    }
                    else
                    {
                        S2.server_id = num;
                        server_ids.Add(num);
                    }
                }
                no_id_servers.Remove(S2);
            }
            return;
        }
Beispiel #2
0
        // Function from file: server.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string dat = null;
            Obj_Machinery_RND_Server         S = null;
            Obj_Machinery_Computer_Rdconsole C = null;
            dynamic console_turf = null;
            Obj_Machinery_Computer_Rdconsole C2 = null;
            dynamic console_turf2       = null;
            dynamic v                   = null;
            dynamic T                   = null;
            dynamic v2                  = null;
            dynamic D                   = null;
            Obj_Machinery_RND_Server S2 = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "";

            switch ((int)(this.screen))
            {
            case 0:
                dat += "Connected Servers:<BR><BR>";

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server)))
                {
                    S = _a;


                    if (S is Obj_Machinery_RND_Server_Centcom && !this.badmin)
                    {
                        continue;
                    }
                    dat += "" + S.name + " || ";
                    dat += new Txt("<A href='?src=").Ref(this).str(";access=").item(S.server_id).str("'>Access Rights</A> | ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";data=").item(S.server_id).str("'>Data Management</A>").ToString();

                    if (this.badmin)
                    {
                        dat += new Txt(" | <A href='?src=").Ref(this).str(";transfer=").item(S.server_id).str("'>Server-to-Server Transfer</A>").ToString();
                    }
                    dat += "<BR>";
                }
                break;

            case 1:
                dat += "" + this.temp_server.name + " Access Rights<BR><BR>";
                dat += "Consoles with Upload Access<BR>";

                foreach (dynamic _b in Lang13.Enumerate(this.consoles, typeof(Obj_Machinery_Computer_Rdconsole)))
                {
                    C = _b;

                    console_turf = GlobalFuncs.get_turf(C);
                    dat         += new Txt("* <A href='?src=").Ref(this).str(";upload_toggle=").item(C.id).str("'>").item(console_turf.loc).ToString();

                    if (this.temp_server.id_with_upload.Contains(C.id))
                    {
                        dat += " (Remove)</A><BR>";
                    }
                    else
                    {
                        dat += " (Add)</A><BR>";
                    }
                }
                dat += "Consoles with Download Access<BR>";

                foreach (dynamic _c in Lang13.Enumerate(this.consoles, typeof(Obj_Machinery_Computer_Rdconsole)))
                {
                    C2 = _c;

                    console_turf2 = GlobalFuncs.get_turf(C2);
                    dat          += new Txt("* <A href='?src=").Ref(this).str(";download_toggle=").item(C2.id).str("'>").item(console_turf2.loc).ToString();

                    if (this.temp_server.id_with_download.Contains(C2.id))
                    {
                        dat += " (Remove)</A><BR>";
                    }
                    else
                    {
                        dat += " (Add)</A><BR>";
                    }
                }
                dat += new Txt("<HR><A href='?src=").Ref(this).str(";main=1'>Main Menu</A>").ToString();
                break;

            case 2:
                dat += "" + this.temp_server.name + " Data ManagementP<BR><BR>";
                dat += "Known Technologies<BR>";

                foreach (dynamic _d in Lang13.Enumerate(this.temp_server.files.known_tech))
                {
                    v = _d;

                    T    = this.temp_server.files.known_tech[v];
                    dat += "* " + T.name + " ";
                    dat += new Txt("<A href='?src=").Ref(this).str(";reset_tech=").item(T.id).str("'>(Reset)</A><BR>").ToString();
                }
                dat += "Known Designs<BR>";

                foreach (dynamic _e in Lang13.Enumerate(this.temp_server.files.known_designs))
                {
                    v2 = _e;

                    D    = this.temp_server.files.known_designs[v2];
                    dat += "* " + D.name + " ";
                    dat += new Txt("<A href='?src=").Ref(this).str(";reset_design=").item(D.id).str("'>(Delete)</A><BR>").ToString();
                }
                dat += new Txt("<HR><A href='?src=").Ref(this).str(";main=1'>Main Menu</A>").ToString();
                break;

            case 3:
                dat += "" + this.temp_server.name + " Server to Server Transfer<BR><BR>";
                dat += "Send Data to what server?<BR>";

                foreach (dynamic _f in Lang13.Enumerate(this.servers, typeof(Obj_Machinery_RND_Server)))
                {
                    S2 = _f;

                    dat += new Txt().item(S2.name).str(" <A href='?src=").Ref(this).str(";send_to=").item(S2.server_id).str("'>(Transfer)</A><BR>").ToString();
                }
                dat += new Txt("<HR><A href='?src=").Ref(this).str(";main=1'>Main Menu</A>").ToString();
                break;
            }
            Interface13.Browse(a, "<TITLE>R&D Server Control</TITLE><HR>" + dat, "window=server_control;size=575x400");
            GlobalFuncs.onclose(a, "server_control");
            return(null);
        }
Beispiel #3
0
        // Function from file: server.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Obj_Machinery_RND_Server         S = null;
            Obj_Machinery_Computer_Rdconsole C = null;
            Obj_Machinery S2      = null;
            double?       num     = null;
            double?       num2    = null;
            string        choice  = null;
            dynamic       T       = null;
            string        choice2 = null;
            dynamic       D       = null;


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

            if (!this.allowed(Task13.User) && !Lang13.Bool(this.emagged))
            {
                Task13.User.WriteMsg("<span class='danger'>You do not have the required access level.</span>");
                return(null);
            }

            if (Lang13.Bool(href_list["main"]))
            {
                this.screen = 0;
            }
            else if (Lang13.Bool(href_list["access"]) || Lang13.Bool(href_list["data"]) || Lang13.Bool(href_list["transfer"]))
            {
                this.temp_server = null;
                this.consoles    = new ByTable();
                this.servers     = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server)))
                {
                    S = _a;


                    if (S.server_id == String13.ParseNumber(href_list["access"]) || S.server_id == String13.ParseNumber(href_list["data"]) || S.server_id == String13.ParseNumber(href_list["transfer"]))
                    {
                        this.temp_server = S;
                        break;
                    }
                }

                if (Lang13.Bool(href_list["access"]))
                {
                    this.screen = 1;

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


                        if (C.sync)
                        {
                            this.consoles.Add(C);
                        }
                    }
                }
                else if (Lang13.Bool(href_list["data"]))
                {
                    this.screen = 2;
                }
                else if (Lang13.Bool(href_list["transfer"]))
                {
                    this.screen = 3;

                    foreach (dynamic _c in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server)))
                    {
                        S2 = _c;


                        if (S2 == this)
                        {
                            continue;
                        }
                        this.servers.Add(S2);
                    }
                }
            }
            else if (Lang13.Bool(href_list["upload_toggle"]))
            {
                num = String13.ParseNumber(href_list["upload_toggle"]);

                if (this.temp_server.id_with_upload.Contains(num))
                {
                    this.temp_server.id_with_upload.Remove(num);
                }
                else
                {
                    this.temp_server.id_with_upload.Add(num);
                }
            }
            else if (Lang13.Bool(href_list["download_toggle"]))
            {
                num2 = String13.ParseNumber(href_list["download_toggle"]);

                if (this.temp_server.id_with_download.Contains(num2))
                {
                    this.temp_server.id_with_download.Remove(num2);
                }
                else
                {
                    this.temp_server.id_with_download.Add(num2);
                }
            }
            else if (Lang13.Bool(href_list["reset_tech"]))
            {
                choice = Interface13.Alert("Technology Data Reset", "Are you sure you want to reset this technology to its default data? Data lost cannot be recovered.", "Continue", "Cancel");

                if (choice == "Continue")
                {
                    T = this.temp_server.files.known_tech[href_list["reset_tech"]];

                    if (Lang13.Bool(T))
                    {
                        T.level = 1;
                    }
                }
                this.temp_server.files.RefreshResearch();
            }
            else if (Lang13.Bool(href_list["reset_design"]))
            {
                choice2 = Interface13.Alert("Design Data Deletion", "Are you sure you want to delete this design? If you still have the prerequisites for the design, it'll reset to its base reliability. Data lost cannot be recovered.", "Continue", "Cancel");

                if (choice2 == "Continue")
                {
                    D = this.temp_server.files.known_designs[href_list["reset_design"]];

                    if (Lang13.Bool(D))
                    {
                        this.temp_server.files.known_designs.Remove(D.id);
                    }
                }
                this.temp_server.files.RefreshResearch();
            }
            this.updateUsrDialog();
            return(null);
        }