// Function from file: processor.dm
        public override void process_food(Ent_Static loc = null, dynamic what = null, Obj_Machinery_Processor processor = null)
        {
            dynamic O = null;
            Obj_Item_Weapon_ReagentContainers_Glass_Bucket bucket_of_blood = null;
            Reagent_Blood B = null;
            Disease       D = null;

            O = what;

            if (Lang13.Bool(O.client))
            {
                O.loc = loc;
                ((Ent_Static)O).visible_message("<span class='notice'>Suddenly " + O + " jumps out from the processor!</span>", "<span class='notice'>You jump out from the processor!</span>", "<span class='italics'>You hear chimpering.</span>");
                return;
            }
            bucket_of_blood = new Obj_Item_Weapon_ReagentContainers_Glass_Bucket(loc);
            B               = new Reagent_Blood();
            B.holder        = bucket_of_blood;
            B.volume        = 70;
            B.data["donor"] = O;

            foreach (dynamic _a in Lang13.Enumerate(O.viruses, typeof(Disease)))
            {
                D = _a;


                if (!((D.spread_flags & 1) != 0))
                {
                    B.data["viruses"] += D.Copy();
                }
            }

            if (Lang13.Bool(O.has_dna()))
            {
                B.data["blood_DNA"] = O.dna.unique_enzymes;
            }

            if (O.resistances != null && O.resistances.len != 0)
            {
                B.data["resistances"] = O.resistances.Copy();
            }
            bucket_of_blood.reagents.reagent_list.Add(B);
            bucket_of_blood.reagents.update_total();
            bucket_of_blood.on_reagent_change();
            base.process_food(loc, (object)(what), processor);
            return;
        }
        // Function from file: seeds.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Reagent_Blood bloodSample = null;


            if (A is Obj_Item_Weapon_ReagentContainers_Syringe)
            {
                if (!this.contains_sample)
                {
                    foreach (dynamic _a in Lang13.Enumerate(A.reagents.reagent_list, typeof(Reagent_Blood)))
                    {
                        bloodSample = _a;


                        if (Lang13.Bool(bloodSample.data["mind"]) && Lang13.Bool(bloodSample.data["cloneable"]) == true)
                        {
                            this.mind         = bloodSample.data["mind"];
                            this.ckey         = bloodSample.data["ckey"];
                            this.realName     = bloodSample.data["real_name"];
                            this.blood_gender = bloodSample.data["gender"];
                            this.blood_type   = bloodSample.data["blood_type"];
                            this.features     = bloodSample.data["features"];
                            this.factions     = bloodSample.data["factions"];
                            ((Reagents)A.reagents).clear_reagents();
                            user.WriteMsg("<span class='notice'>You inject the contents of the syringe into the seeds.</span>");
                            this.contains_sample = true;
                        }
                        else
                        {
                            user.WriteMsg("<span class='warning'>The seeds reject the sample!</span>");
                        }
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>The seeds already contain a genetic sample!</span>");
                }
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
示例#3
0
        // Function from file: syringes.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic       M          = null;
            dynamic       H          = null;
            dynamic       amount     = null;
            dynamic       T          = null;
            dynamic       B          = null;
            dynamic       H2         = null;
            dynamic       trans      = null;
            ByTable       rinject    = null;
            Reagent       R          = null;
            string        contained  = null;
            dynamic       M2         = null;
            double?       fraction   = null;
            ByTable       rinject2   = null;
            Reagent       R2         = null;
            string        contained2 = null;
            dynamic       M3         = null;
            double?       fraction2  = null;
            Reagent_Blood B2         = null;
            Reagent_Blood d          = null;
            dynamic       C          = null;


            if (this.busy)
            {
                return(false);
            }

            if (!(proximity_flag == true))
            {
                return(false);
            }

            if (!Lang13.Bool(target.reagents))
            {
                return(false);
            }

            if (target is Mob_Living)
            {
                M = target;

                if (!((Mob_Living)M).can_inject(user, true))
                {
                    return(false);
                }
            }

            switch ((bool)(this.mode))
            {
            case false:

                if ((this.reagents.total_volume ?? 0) >= Convert.ToDouble(this.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>The syringe is full.</span>");
                    return(false);
                }

                if (target is Mob)
                {
                    if (target is Mob_Living_Carbon_Human)
                    {
                        H = target;

                        if (Lang13.Bool(((dynamic)(H.dna.species.specflags != null && !(H.dna.species.exotic_blood != null))).Contains(1024)))
                        {
                            user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                            return(false);
                        }
                    }

                    if (Lang13.Bool(this.reagents.has_reagent("blood")))
                    {
                        user.WriteMsg("<span class='warning'>There is already a blood sample in this syringe!</span>");
                        return(false);
                    }

                    if (target is Mob_Living_Carbon)
                    {
                        amount = this.reagents.maximum_volume - this.reagents.total_volume;
                        T      = target;

                        if (!Lang13.Bool(T.has_dna()) || Lang13.Bool(T.disabilities & 128))
                        {
                            user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                            return(false);
                        }

                        if (target != user)
                        {
                            ((Ent_Static)target).visible_message("<span class='danger'>" + user + " is trying to take a blood sample from " + target + "!</span>", "<span class='userdanger'>" + user + " is trying to take a blood sample from " + target + "!</span>");
                            this.busy = true;

                            if (!GlobalFuncs.do_mob(user, target))
                            {
                                this.busy = false;
                                return(false);
                            }
                        }
                        this.busy = false;
                        B         = null;
                        B         = ((Mob_Living_Carbon)T).take_blood(this, amount);

                        if (!Lang13.Bool(B) && target is Mob_Living_Carbon_Human)
                        {
                            H2 = target;

                            if (H2.dna.species.exotic_blood != null && Lang13.Bool(H2.reagents.total_volume))
                            {
                                ((Reagents)target.reagents).trans_to(this, amount);
                            }
                            else
                            {
                                user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                                return(false);
                            }
                        }

                        if (Lang13.Bool(B))
                        {
                            this.reagents.reagent_list.Add(B);
                            this.reagents.update_total();
                            this.on_reagent_change();
                            this.reagents.handle_reactions();
                        }
                        ((Ent_Static)user).visible_message("" + user + " takes a blood sample from " + target + ".");
                    }
                }
                else
                {
                    if (!Lang13.Bool(target.reagents.total_volume))
                    {
                        user.WriteMsg("<span class='warning'>" + target + " is empty!</span>");
                        return(false);
                    }

                    if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Obj_Structure_ReagentDispensers) && !(target is Obj_Item_SlimeExtract))
                    {
                        user.WriteMsg("<span class='warning'>You cannot directly remove reagents from " + target + "!</span>");
                        return(false);
                    }
                    trans = ((Reagents)target.reagents).trans_to(this, this.amount_per_transfer_from_this);
                    user.WriteMsg("<span class='notice'>You fill " + this + " with " + trans + " units of the solution.</span>");
                }

                if ((this.reagents.total_volume ?? 0) >= Convert.ToDouble(this.reagents.maximum_volume))
                {
                    this.mode = !this.mode;
                    this.update_icon();
                }
                break;

            case true:

                if (!Lang13.Bool(this.reagents.total_volume))
                {
                    user.WriteMsg("<span class='notice'>" + this + " is empty.</span>");
                    return(false);
                }

                if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Mob) && !(target is Obj_Item_Weapon_ReagentContainers_Food) && !(target is Obj_Item_SlimeExtract) && !(target is Obj_Item_Clothing_Mask_Cigarette) && !(target is Obj_Item_Weapon_Storage_Fancy_Cigarettes))
                {
                    user.WriteMsg("<span class='warning'>You cannot directly fill " + target + "!</span>");
                    return(false);
                }

                if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>" + target + " is full.</span>");
                    return(false);
                }

                if (target is Mob && target != user)
                {
                    ((Ent_Static)target).visible_message("<span class='danger'>" + user + " is trying to inject " + target + "!</span>", "<span class='userdanger'>" + user + " is trying to inject " + target + "!</span>");

                    if (!GlobalFuncs.do_mob(user, target))
                    {
                        return(false);
                    }

                    if (!Lang13.Bool(this.reagents.total_volume))
                    {
                        return(false);
                    }

                    if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                    {
                        return(false);
                    }
                    ((Ent_Static)target).visible_message("<span class='danger'>" + user + " injects " + target + " with the syringe!", "<span class='userdanger'>" + user + " injects " + target + " with the syringe!");
                    rinject = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                    {
                        R = _a;

                        rinject.Add(R.name);
                    }
                    contained = GlobalFuncs.english_list(rinject);
                    M2        = target;
                    GlobalFuncs.add_logs(user, M2, "injected", this, "which had " + contained);
                    fraction = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);
                    this.reagents.reaction(target, GlobalVars.INJECT, fraction);
                }

                if (target is Mob && target == user)
                {
                    rinject2 = new ByTable();

                    foreach (dynamic _b in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                    {
                        R2 = _b;

                        rinject2.Add(R2.name);
                    }
                    contained2 = GlobalFuncs.english_list(rinject2);
                    M3         = target;
                    GlobalFuncs.log_attack("<font color='red'>" + user.name + " (" + user.ckey + ") injected " + M3.name + " (" + M3.ckey + ") with " + this.name + ", which had " + contained2 + " (INTENT: " + String13.ToUpper(user.a_intent) + ")</font>");
                    M3.attack_log += "[" + GlobalFuncs.time_stamp() + "] <font color='orange'>Injected themselves (" + contained2 + ") with " + this.name + ".</font>";
                    fraction2      = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);
                    this.reagents.reaction(target, GlobalVars.INJECT, fraction2);
                }
                Task13.Schedule(5, (Task13.Closure)(() => {
                    B2 = null;

                    foreach (dynamic _c in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent_Blood)))
                    {
                        d = _c;

                        B2 = d;
                        break;
                    }

                    if (B2 != null && target is Mob_Living_Carbon)
                    {
                        C = target;
                        ((Mob_Living_Carbon)C).inject_blood(this, 5);
                    }
                    else
                    {
                        this.reagents.trans_to(target, this.amount_per_transfer_from_this);
                    }
                    user.WriteMsg("<span class='notice'>You inject " + this.amount_per_transfer_from_this + " units of the solution. The syringe now contains " + this.reagents.total_volume + " units.</span>");

                    if ((this.reagents.total_volume ?? 0) <= 0 && this.mode)
                    {
                        this.mode = false;
                        this.update_icon();
                    }
                    return;
                }));
                break;
            }
            return(false);
        }
        // Function from file: pandemic.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string        dat              = null;
            Reagents      R                = null;
            Reagent_Blood Blood            = null;
            Reagent_Blood B                = null;
            ByTable       vir              = null;
            int           i                = 0;
            Disease       D                = null;
            Disease       A                = null;
            Disease       A2               = null;
            ByTable       english_symptoms = null;
            Symptom       S                = null;
            ByTable       res              = null;
            int           i2               = 0;
            dynamic       type             = null;
            string        disease_name     = null;
            dynamic       A3               = null;
            dynamic       D2               = null;


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

            if (Lang13.Bool(this.temp_html))
            {
                dat = new Txt().item(this.temp_html).str("<BR><BR><A href='?src=").Ref(this).str(";clear=1'>Main Menu</A>").ToString();
            }
            else if (!Lang13.Bool(this.beaker))
            {
                dat += "Please insert beaker.<BR>";
                dat += new Txt("<A href='?src=").Ref(a).str(";mach_close=pandemic'>Close</A>").ToString();
            }
            else
            {
                R     = this.beaker.reagents;
                Blood = null;

                foreach (dynamic _a in Lang13.Enumerate(R.reagent_list, typeof(Reagent_Blood)))
                {
                    B = _a;


                    if (B != null)
                    {
                        Blood = B;
                        break;
                    }
                }

                if (!Lang13.Bool(R.total_volume) || !(R.reagent_list.len != 0))
                {
                    dat += "The beaker is empty<BR>";
                }
                else if (!(Blood != null))
                {
                    dat += "No blood sample found in beaker.";
                }
                else if (!Lang13.Bool(Blood.data))
                {
                    dat += "No blood data found in beaker.";
                }
                else
                {
                    dat += "<h3>Blood sample data:</h3>";
                    dat += "<b>Blood DNA:</b> " + (Lang13.Bool(Blood.data["blood_DNA"]) || Lang13.Bool("none")) + "<BR>";
                    dat += "<b>Blood Type:</b> " + (Lang13.Bool(Blood.data["blood_type"]) || Lang13.Bool("none")) + "<BR>";

                    if (Lang13.Bool(Blood.data["viruses"]))
                    {
                        vir = Blood.data["viruses"];

                        if (vir.len != 0)
                        {
                            i = 0;

                            foreach (dynamic _c in Lang13.Enumerate(Blood.data["viruses"], typeof(Disease)))
                            {
                                D = _c;

                                i++;

                                if (!((D.visibility_flags & 2) != 0))
                                {
                                    if (D is Disease_Advance)
                                    {
                                        A = D;
                                        D = GlobalVars.archive_diseases[A.GetDiseaseID()];

                                        if (D != null && D.name == "Unknown")
                                        {
                                            dat += new Txt("<b><a href='?src=").Ref(this).str(";name_disease=").item(i).str("'>Name Disease</a></b><BR>").ToString();
                                        }
                                    }

                                    if (!(D != null))
                                    {
                                        Task13.Crash("We weren't able to get the advance disease from the archive.");
                                    }
                                    dat += "<b>Disease Agent:</b> " + (D != null ? new Txt().item(D.agent).str(" - <A href='?src=").Ref(this).str(";create_virus_culture=").item(i).str("'>Create virus culture bottle</A>").ToString() : "none") + "<BR>";
                                    dat += "<b>Common name:</b> " + (Lang13.Bool(D.name) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Description: </b> " + (Lang13.Bool(D.desc) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Spread:</b> " + (Lang13.Bool(D.spread_text) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Possible cure:</b> " + (Lang13.Bool(D.cure_text) || Lang13.Bool("none")) + "<BR><BR>";

                                    if (D is Disease_Advance)
                                    {
                                        A2   = D;
                                        dat += "<b>Symptoms:</b> ";
                                        english_symptoms = new ByTable();

                                        foreach (dynamic _b in Lang13.Enumerate(((dynamic)A2).symptoms, typeof(Symptom)))
                                        {
                                            S = _b;

                                            english_symptoms.Add(S.name);
                                        }
                                        dat += GlobalFuncs.english_list(english_symptoms);
                                    }
                                }
                                else
                                {
                                    dat += "No detectable virus in the sample.";
                                }
                            }
                        }
                    }
                    else
                    {
                        dat += "No detectable virus in the sample.";
                    }
                    dat += "<BR><b>Contains antibodies to:</b> ";

                    if (Lang13.Bool(Blood.data["resistances"]))
                    {
                        res = Blood.data["resistances"];

                        if (res.len != 0)
                        {
                            dat += "<ul>";
                            i2   = 0;

                            foreach (dynamic _d in Lang13.Enumerate(Blood.data["resistances"]))
                            {
                                type = _d;

                                i2++;
                                disease_name = "Unknown";

                                if (!(type is Type))
                                {
                                    A3 = GlobalVars.archive_diseases[type];

                                    if (Lang13.Bool(A3))
                                    {
                                        disease_name = A3.name;
                                    }
                                }
                                else
                                {
                                    D2           = Lang13.Call(type, 0, null);
                                    disease_name = D2.name;
                                }
                                dat += new Txt("<li>").item(disease_name).str(" - <A href='?src=").Ref(this).str(";create_vaccine=").item(i2).str("'>Create vaccine bottle</A></li>").ToString();
                            }
                            dat += "</ul><BR>";
                        }
                        else
                        {
                            dat += "nothing<BR>";
                        }
                    }
                    else
                    {
                        dat += "nothing<BR>";
                    }
                }
                dat += new Txt("<BR><A href='?src=").Ref(this).str(";eject=1'>Eject beaker</A>").item((Lang13.Bool(R.total_volume) && R.reagent_list.len != 0 ? new Txt("-- <A href='?src=").Ref(this).str(";empty_beaker=1'>Empty beaker</A>").ToString() : "")).str("<BR>").ToString();
                dat += new Txt("<A href='?src=").Ref(a).str(";mach_close=pandemic'>Close</A>").ToString();
            }
            Interface13.Browse(a, "<TITLE>" + this.name + "</TITLE><BR>" + dat, "window=pandemic;size=575x400");
            GlobalFuncs.onclose(a, "pandemic");
            return(null);
        }