示例#1
0
        // Function from file: chem_master.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string name = null;
            Obj_Item_Weapon_ReagentContainers P = null;
            dynamic R         = null;
            string  dat       = null;
            dynamic T         = null;
            Browser popup     = null;
            string  id        = null;
            double? amount    = null;
            dynamic id2       = null;
            dynamic amt_temp  = null;
            string  id3       = null;
            double? amount2   = null;
            dynamic id4       = null;
            dynamic amt_temp2 = null;
            int?    amount3   = null;
            int     vol_each  = 0;
            string  name2     = null;
            Obj_Item_Weapon_ReagentContainers_Pill P2 = null;
            int?   i     = null;
            string name3 = null;
            Obj_Item_Weapon_ReagentContainers_Food_Condiment_Pack P3 = null;
            int?   amount4   = null;
            int    vol_each2 = 0;
            string name4     = null;
            Obj_Item_Weapon_ReagentContainers_Pill_Patch P4 = null;
            int?i2 = null;


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

            if (Lang13.Bool(href_list["ejectp"]))
            {
                if (Lang13.Bool(this.bottle))
                {
                    this.bottle.loc = this.loc;
                    this.bottle     = null;
                }
            }
            else if (Lang13.Bool(href_list["close"]))
            {
                Interface13.Browse(Task13.User, null, "window=chem_master");
                Task13.User.unset_machine();
                return(null);
            }
            else if (Lang13.Bool(href_list["toggle"]))
            {
                this.mode = !this.mode;
            }
            else if (Lang13.Bool(href_list["createbottle"]))
            {
                name = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your bottle!", (Lang13.Bool(this.reagents.total_volume) ? this.reagents.get_master_reagent_name() : " "), 26);

                if (!Lang13.Bool(name))
                {
                    return(null);
                }

                if (this.condi)
                {
                    P = new Obj_Item_Weapon_ReagentContainers_Food_Condiment(this.loc);
                }
                else
                {
                    P         = new Obj_Item_Weapon_ReagentContainers_Glass_Bottle(this.loc);
                    P.pixel_x = Rand13.Int(-7, 7);
                    P.pixel_y = Rand13.Int(-7, 7);
                }
                P.name = GlobalFuncs.trim("" + name + " bottle");
                this.reagents.trans_to(P, P.volume);
            }

            if (Lang13.Bool(this.beaker))
            {
                if (Lang13.Bool(href_list["analyze"]))
                {
                    if (Lang13.Bool(Lang13.FindObj(href_list["reagent"])))
                    {
                        R = Lang13.FindObj(href_list["reagent"]);

                        if (Lang13.Bool(R))
                        {
                            dat  = "";
                            dat += "<H1>" + (this.condi ? "Condiment" : "Chemical") + " information:</H1>";
                            dat += "<B>Name:</B> " + Lang13.Initial(R, "name") + "<BR><BR>";
                            dat += "<B>State:</B> ";

                            if (Lang13.Initial(R, "reagent_state") == 1)
                            {
                                dat += "Solid";
                            }
                            else if (Lang13.Initial(R, "reagent_state") == 2)
                            {
                                dat += "Liquid";
                            }
                            else if (Lang13.Initial(R, "reagent_state") == 3)
                            {
                                dat += "Gas";
                            }
                            else
                            {
                                dat += "Unknown";
                            }
                            dat  += "<BR>";
                            dat  += "<B>Color:</B> <span style='color:" + Lang13.Initial(R, "color") + ";background-color:" + Lang13.Initial(R, "color") + ";font:Lucida Console'>" + Lang13.Initial(R, "color") + "</span><BR><BR>";
                            dat  += "<B>Description:</B> " + Lang13.Initial(R, "description") + "<BR><BR>";
                            T     = Lang13.Initial(R, "metabolization_rate") * 20;
                            dat  += "<B>Metabolization Rate:</B> " + T + "u/minute<BR>";
                            dat  += "<B>Overdose Threshold:</B> " + (Lang13.Bool(Lang13.Initial(R, "overdose_threshold")) ? "" + Lang13.Initial(R, "overdose_threshold") + "u" : "none") + "<BR>";
                            dat  += "<B>Addiction Threshold:</B> " + (Lang13.Bool(Lang13.Initial(R, "addiction_threshold")) ? "" + Lang13.Initial(R, "addiction_threshold") + "u" : "none") + "<BR><BR>";
                            dat  += new Txt("<BR><A href='?src=").Ref(this).str(";main=1'>Back</A>").ToString();
                            popup = new Browser(Task13.User, "chem_master", this.name);
                            popup.set_content(dat);
                            popup.set_title_image(Task13.User.browse_rsc_icon(this.icon, this.icon_state));
                            popup.open(true);
                            return(null);
                        }
                    }
                }
                else if (Lang13.Bool(href_list["main"]))
                {
                    this.attack_hand(Task13.User);
                    return(null);
                }
                else if (Lang13.Bool(href_list["add"]))
                {
                    if (Lang13.Bool(href_list["amount"]))
                    {
                        id     = href_list["add"];
                        amount = String13.ParseNumber(href_list["amount"]);

                        if ((amount ?? 0) > 0)
                        {
                            ((Reagents)this.beaker.reagents).trans_id_to(this, id, amount);
                        }
                    }
                }
                else if (Lang13.Bool(href_list["addcustom"]))
                {
                    id2      = href_list["addcustom"];
                    amt_temp = this.isgoodnumber(Interface13.Input(Task13.User, "Select the amount to transfer.", "Transfer how much?", this.useramount, null, InputType.Num | InputType.Null));

                    if (!Lang13.Bool(amt_temp))
                    {
                        return(null);
                    }
                    this.useramount = amt_temp;
                    this.Topic(null, new ByTable().Set("amount", "" + this.useramount).Set("add", "" + id2));
                }
                else if (Lang13.Bool(href_list["remove"]))
                {
                    if (Lang13.Bool(href_list["amount"]))
                    {
                        id3     = href_list["remove"];
                        amount2 = String13.ParseNumber(href_list["amount"]);

                        if ((amount2 ?? 0) > 0)
                        {
                            if (this.mode)
                            {
                                this.reagents.trans_id_to(this.beaker, id3, amount2);
                            }
                            else
                            {
                                this.reagents.remove_reagent(id3, amount2);
                            }
                        }
                    }
                }
                else if (Lang13.Bool(href_list["removecustom"]))
                {
                    id4       = href_list["removecustom"];
                    amt_temp2 = this.isgoodnumber(Interface13.Input(Task13.User, "Select the amount to transfer.", "Transfer how much?", this.useramount, null, InputType.Num | InputType.Null));

                    if (!Lang13.Bool(amt_temp2))
                    {
                        return(null);
                    }
                    this.useramount = amt_temp2;
                    this.Topic(null, new ByTable().Set("amount", "" + this.useramount).Set("remove", "" + id4));
                }
                else if (Lang13.Bool(href_list["eject"]))
                {
                    if (Lang13.Bool(this.beaker))
                    {
                        this.beaker.loc = this.loc;
                        this.beaker     = null;
                        this.reagents.clear_reagents();
                        this.icon_state = "mixer0";
                    }
                }
                else if (Lang13.Bool(href_list["createpill"]))
                {
                    if (this.reagents.total_volume == 0)
                    {
                        return(null);
                    }

                    if (!this.condi)
                    {
                        amount3  = 1;
                        vol_each = Num13.MinInt(((int)(this.reagents.total_volume ?? 0)), 50);

                        if (Lang13.Bool(String13.ParseNumber(href_list["many"])))
                        {
                            amount3 = Num13.MinInt(Num13.MaxInt(Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Max 10. Buffer content will be split evenly.", "How many pills?", amount3, null, InputType.Num | InputType.Null))), 0), 10);

                            if (!Lang13.Bool(amount3))
                            {
                                return(null);
                            }
                            vol_each = Num13.MinInt(((int)((this.reagents.total_volume ?? 0) / (amount3 ?? 0))), 50);
                        }
                        name2 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your pill!", "" + this.reagents.get_master_reagent_name() + " (" + vol_each + "u)", 26);

                        if (!Lang13.Bool(name2) || !Lang13.Bool(this.reagents.total_volume))
                        {
                            return(null);
                        }
                        i = null;
                        i = 0;

                        while ((i ?? 0) < (amount3 ?? 0))
                        {
                            if (Lang13.Bool(this.bottle) && this.bottle.contents.len < (this.bottle.storage_slots ?? 0))
                            {
                                P2 = new Obj_Item_Weapon_ReagentContainers_Pill(this.bottle);
                            }
                            else
                            {
                                P2 = new Obj_Item_Weapon_ReagentContainers_Pill(this.loc);
                            }
                            P2.name    = GlobalFuncs.trim("" + name2 + " pill");
                            P2.pixel_x = Rand13.Int(-7, 7);
                            P2.pixel_y = Rand13.Int(-7, 7);
                            this.reagents.trans_to(P2, vol_each);
                            i++;
                        }
                    }
                    else
                    {
                        name3 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your pack!", this.reagents.get_master_reagent_name(), 26);

                        if (!Lang13.Bool(name3) || !Lang13.Bool(this.reagents.total_volume))
                        {
                            return(null);
                        }
                        P3 = new Obj_Item_Weapon_ReagentContainers_Food_Condiment_Pack(this.loc);
                        P3.originalname = name3;
                        P3.name         = GlobalFuncs.trim("" + name3 + " pack");
                        P3.desc         = "A small condiment pack. The label says it contains " + name3 + ".";
                        this.reagents.trans_to(P3, 10);
                    }
                }
                else if (Lang13.Bool(href_list["createpatch"]))
                {
                    if (this.reagents.total_volume == 0)
                    {
                        return(null);
                    }
                    amount4   = 1;
                    vol_each2 = Num13.MinInt(((int)(this.reagents.total_volume ?? 0)), 50);

                    if (Lang13.Bool(String13.ParseNumber(href_list["many"])))
                    {
                        amount4 = Num13.MinInt(Num13.MaxInt(Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Max 10. Buffer content will be split evenly.", "How many patches?", amount4, null, InputType.Num | InputType.Null))), 0), 10);

                        if (!Lang13.Bool(amount4))
                        {
                            return(null);
                        }
                        vol_each2 = Num13.MinInt(((int)((this.reagents.total_volume ?? 0) / (amount4 ?? 0))), 50);
                    }
                    name4 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your patch!", "" + this.reagents.get_master_reagent_name() + " (" + vol_each2 + "u)", 26);

                    if (!Lang13.Bool(name4) || !Lang13.Bool(this.reagents.total_volume))
                    {
                        return(null);
                    }
                    P4 = null;
                    i2 = null;
                    i2 = 0;

                    while ((i2 ?? 0) < (amount4 ?? 0))
                    {
                        P4         = new Obj_Item_Weapon_ReagentContainers_Pill_Patch(this.loc);
                        P4.name    = GlobalFuncs.trim("" + name4 + " patch");
                        P4.pixel_x = Rand13.Int(-7, 7);
                        P4.pixel_y = Rand13.Int(-7, 7);
                        this.reagents.trans_to(P4, vol_each2);
                        i2++;
                    }
                }
            }
            this.updateUsrDialog();
            return(null);
        }
        // Function from file: pandemic.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Obj_Item_Weapon_ReagentContainers_Glass_Bottle B = null;
            dynamic   path         = null;
            dynamic   vaccine_type = null;
            string    vaccine_name = null;
            dynamic   D            = null;
            dynamic   D2           = null;
            dynamic   type         = null;
            dynamic   D3           = null;
            Base_Data A            = null;
            string    name         = null;
            Obj_Item_Weapon_ReagentContainers_Glass_Bottle B2 = null;
            ByTable         data     = null;
            string          new_name = null;
            dynamic         id       = null;
            Disease_Advance A2       = null;
            Disease_Advance AD       = null;


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

            if (!Lang13.Bool(this.beaker))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["create_vaccine"]))
            {
                if (!(this.wait == true))
                {
                    B = new Obj_Item_Weapon_ReagentContainers_Glass_Bottle(this.loc);

                    if (B != null)
                    {
                        B.pixel_x    = Rand13.Int(-3, 3);
                        B.pixel_y    = Rand13.Int(-3, 3);
                        path         = this.GetResistancesByIndex(String13.ParseNumber(href_list["create_vaccine"]));
                        vaccine_type = path;
                        vaccine_name = "Unknown";

                        if (!(vaccine_type is Type))
                        {
                            if (Lang13.Bool(GlobalVars.archive_diseases[path]))
                            {
                                D = GlobalVars.archive_diseases[path];

                                if (Lang13.Bool(D))
                                {
                                    vaccine_name = D.name;
                                    vaccine_type = path;
                                }
                            }
                        }
                        else if (Lang13.Bool(vaccine_type))
                        {
                            D2 = Lang13.Call(vaccine_type, 0, null);

                            if (Lang13.Bool(D2))
                            {
                                vaccine_name = D2.name;
                            }
                        }

                        if (Lang13.Bool(vaccine_type))
                        {
                            B.name = "" + vaccine_name + " vaccine bottle";
                            B.reagents.add_reagent("vaccine", 15, new ByTable(new object [] { vaccine_type }));
                            this.replicator_cooldown(200);
                        }
                    }
                }
                else
                {
                    this.temp_html = "The replicator is not ready yet.";
                }
                this.updateUsrDialog();
                return(null);
            }
            else if (Lang13.Bool(href_list["create_virus_culture"]))
            {
                if (!(this.wait == true))
                {
                    type = this.GetVirusTypeByIndex(String13.ParseNumber(href_list["create_virus_culture"]));
                    D3   = null;

                    if (!(type is Type))
                    {
                        D3 = this.GetVirusByIndex(String13.ParseNumber(href_list["create_virus_culture"]));
                        A  = GlobalVars.archive_diseases[((Disease)D3).GetDiseaseID()];

                        if (A != null)
                        {
                            D3 = Lang13.Call(A.type, 0, A);
                        }
                    }
                    else if (Lang13.Bool(type))
                    {
                        if (Lang13.Bool(GlobalVars.diseases.Contains(type)))
                        {
                            D3 = Lang13.Call(type, 0, null);
                        }
                    }

                    if (!Lang13.Bool(D3))
                    {
                        return(null);
                    }
                    name = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name the culture", D3.name, 26);

                    if (name == null || this.wait == true)
                    {
                        return(null);
                    }
                    B2            = new Obj_Item_Weapon_ReagentContainers_Glass_Bottle(this.loc);
                    B2.icon_state = "bottle3";
                    B2.pixel_x    = Rand13.Int(-3, 3);
                    B2.pixel_y    = Rand13.Int(-3, 3);
                    this.replicator_cooldown(50);
                    data    = new ByTable().Set("viruses", new ByTable(new object [] { D3 }));
                    B2.name = "" + name + " culture bottle";
                    B2.desc = "A small bottle. Contains " + D3.agent + " culture in synthblood medium.";
                    B2.reagents.add_reagent("blood", 20, data);
                    this.updateUsrDialog();
                }
                else
                {
                    this.temp_html = "The replicator is not ready yet.";
                }
                this.updateUsrDialog();
                return(null);
            }
            else if (Lang13.Bool(href_list["empty_beaker"]))
            {
                ((Reagents)this.beaker.reagents).clear_reagents();
                this.updateUsrDialog();
                return(null);
            }
            else if (Lang13.Bool(href_list["eject"]))
            {
                this.beaker.loc = this.loc;
                this.beaker     = null;
                this.icon_state = "mixer0";
                this.updateUsrDialog();
                return(null);
            }
            else if (Lang13.Bool(href_list["clear"]))
            {
                this.temp_html = "";
                this.updateUsrDialog();
                return(null);
            }
            else if (Lang13.Bool(href_list["name_disease"]))
            {
                new_name = GlobalFuncs.stripped_input(Task13.User, "Name the Disease", "New Name", "", 26);

                if (!Lang13.Bool(new_name))
                {
                    return(null);
                }

                if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
                {
                    return(null);
                }
                id = this.GetVirusTypeByIndex(String13.ParseNumber(href_list["name_disease"]));

                if (Lang13.Bool(GlobalVars.archive_diseases[id]))
                {
                    A2 = GlobalVars.archive_diseases[id];
                    A2.AssignName(new_name);

                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSdisease.processing, typeof(Disease_Advance)))
                    {
                        AD = _a;

                        AD.Refresh();
                    }
                }
                this.updateUsrDialog();
            }
            else
            {
                Interface13.Browse(Task13.User, null, "window=pandemic");
                this.updateUsrDialog();
                return(null);
            }
            this.add_fingerprint(Task13.User);
            return(null);
        }