Esempio n. 1
0
        // Function from file: dna.dm
        public string generate_struc_enzymes(  )
        {
            ByTable        sorting = null;
            string         result  = null;
            Mutation_Human A       = null;
            dynamic        B       = null;

            sorting = new ByTable(19);
            result  = "";

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.good_mutations + GlobalVars.bad_mutations + GlobalVars.not_good_mutations, typeof(Mutation_Human)))
            {
                A = _a;


                if (A.name == "Monkified" && this.holder is Mob_Living_Carbon_Monkey)
                {
                    sorting[A.dna_block] = GlobalFuncs.num2hex(A.lowest_value + Rand13.Int(0, 1536), 3);
                    this.mutations.Or(A);
                }
                else
                {
                    sorting[A.dna_block] = GlobalFuncs.random_string(3, new ByTable(new object [] { "0", "1", "2", "3", "4", "5", "6" }));
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(sorting))
            {
                B = _b;

                result += B;
            }
            return(result);
        }
Esempio n. 2
0
        // Function from file: dna.dm
        public void add_mutation(dynamic mutation_name = null)
        {
            Mutation_Human HM = null;

            HM = GlobalVars.mutations_list[mutation_name];
            HM.on_acquiring(this.holder);
            return;
        }
Esempio n. 3
0
        // Function from file: dna.dm
        public void remove_mutation(dynamic mutation_name = null)
        {
            Mutation_Human HM = null;

            HM = GlobalVars.mutations_list[mutation_name];
            HM.on_losing(this.holder);
            return;
        }
        // Function from file: dna_injector.dm
        public virtual void inject(dynamic M = null, dynamic user = null)
        {
            string         log_msg = null;
            Mutation_Human HM      = null;
            Mutation_Human HM2     = null;

            this.prepare();

            if (Lang13.Bool(M.has_dna()) && !Lang13.Bool(M.disabilities & 128))
            {
                M.radiation += Rand13.Int(((int)(20 / Math.Pow(this.damage_coeff, 2))), ((int)(50 / Math.Pow(this.damage_coeff, 2))));
                log_msg      = "" + GlobalFuncs.key_name(user) + " injected " + GlobalFuncs.key_name(M) + " with the " + this.name;

                foreach (dynamic _a in Lang13.Enumerate(this.remove_mutations, typeof(Mutation_Human)))
                {
                    HM = _a;

                    HM.force_lose(M);
                }

                foreach (dynamic _b in Lang13.Enumerate(this.add_mutations, typeof(Mutation_Human)))
                {
                    HM2 = _b;


                    if (HM2.name == "Monkified")
                    {
                        GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(user) + " injected " + GlobalFuncs.key_name_admin(M) + " with the " + this.name + " <span class='danger'>(MONKEY)</span>");
                        log_msg += " (MONKEY)";
                    }
                    HM2.force_give(M);
                }

                if (this.fields != null)
                {
                    if (Lang13.Bool(this.fields["name"]) && Lang13.Bool(this.fields["UE"]) && Lang13.Bool(this.fields["blood_type"]))
                    {
                        M.real_name          = this.fields["name"];
                        M.dna.unique_enzymes = this.fields["UE"];
                        M.name           = M.real_name;
                        M.dna.blood_type = this.fields["blood_type"];
                    }

                    if (Lang13.Bool(this.fields["UI"]))
                    {
                        M.dna.uni_identity = GlobalFuncs.merge_text(M.dna.uni_identity, this.fields["UI"]);
                        ((Mob_Living_Carbon)M).updateappearance(null, null, true);
                    }
                }
                GlobalFuncs.log_attack(log_msg);
            }
            else
            {
                user.WriteMsg("<span class='notice'>It appears that " + M + " does not have compatible DNA.</span>");
                return;
            }
            return;
        }
Esempio n. 5
0
        // Function from file: dna.dm
        public ByTable mutations_get_spans(  )
        {
            ByTable        spans = null;
            Mutation_Human M     = null;

            spans = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(this.mutations, typeof(Mutation_Human)))
            {
                M = _a;

                spans.Or(M.get_spans());
            }
            return(spans);
        }
Esempio n. 6
0
        // Function from file: dna.dm
        public dynamic mutations_say_mods(dynamic message = null)
        {
            Mutation_Human M = null;


            if (Lang13.Bool(message))
            {
                foreach (dynamic _a in Lang13.Enumerate(this.mutations, typeof(Mutation_Human)))
                {
                    M = _a;

                    message = M.say_mod(message);
                }
                return(message);
            }
            return(null);
        }
Esempio n. 7
0
        // Function from file: dna.dm
        public void remove_mutation_group(ByTable group = null)
        {
            Mutation_Human HM = null;


            if (!(group != null))
            {
                return;
            }

            foreach (dynamic _a in Lang13.Enumerate(group, typeof(Mutation_Human)))
            {
                HM = _a;

                HM.force_lose(this.holder);
            }
            return;
        }
        // Function from file: chameleon_skin.dm
        public override void on_refund(Mob user = null)
        {
            Mob            C  = null;
            Mutation_Human HM = null;


            if (user.has_dna() != null)
            {
                C  = user;
                HM = GlobalVars.mutations_list["Chameleon"];

                if (Lang13.Bool(((dynamic)C).dna.mutations.Contains(HM)))
                {
                    HM.force_lose(C);
                }
            }
            return;
        }
        // Function from file: chameleon_skin.dm
        public override dynamic sting_action(Mob user = null, Ent_Static target = null)
        {
            Mob            H  = null;
            Mutation_Human HM = null;

            H = user;

            if (!(H is Mob_Living_Carbon_Human))
            {
                return(null);
            }
            HM = GlobalVars.mutations_list["Chameleon"];

            if (Lang13.Bool(((dynamic)H).dna.mutations.Contains(HM)))
            {
                HM.force_lose(H);
            }
            else
            {
                HM.force_give(H);
            }
            GlobalFuncs.feedback_add_details("changeling_powers", "CS");
            return(1);
        }
        // Function from file: dna_console.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Mob     viable_occupant             = null;
            double? num                         = null;
            string  last_change                 = null;
            bool    epinephrine_amount          = false;
            int     can_add                     = 0;
            string  text                        = null;
            dynamic buffer_slot                 = null;
            ByTable buffer_slot2                = null;
            dynamic buffer_slot3                = null;
            Obj_Item_Weapon_Dnainjector_Timed I = null;
            Mutation_Human HM                   = null;
            int?           time_coeff           = null;
            Mutation_Human HM2                  = null;
            dynamic        buffer_slot4         = null;
            dynamic        locked_state         = null;
            int            len                  = 0;
            int            block                = 0;
            double         subblock             = 0;
            string         hex                  = null;
            int            len2                 = 0;
            int            block2               = 0;
            double         subblock2            = 0;
            string         hex2                 = null;


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

            if (!(Task13.User.loc is Tile))
            {
                return(null);
            }

            if (!(this.loc is Tile && Map13.GetDistance(this, Task13.User) <= 1 || Task13.User is Mob_Living_Silicon))
            {
                return(null);
            }

            if (this.current_screen == "working")
            {
                return(null);
            }
            this.add_fingerprint(Task13.User);
            Task13.User.set_machine(this);
            viable_occupant = this.get_viable_occupant();
            num             = Num13.Floor(String13.ParseNumber(href_list["num"]) ?? 0);

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

            if (_f == "togglelock")
            {
                if (Lang13.Bool(this.connected))
                {
                    this.connected.locked = !Lang13.Bool(this.connected.locked);
                }
            }
            else if (_f == "toggleopen")
            {
                if (Lang13.Bool(this.connected))
                {
                    ((Obj_Machinery_DnaScannernew)this.connected).toggle_open(Task13.User);
                }
            }
            else if (_f == "setduration")
            {
                if (!Lang13.Bool(num))
                {
                    num = Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Choose pulse duration:", "Input an Integer", null, null, InputType.Num | InputType.Null)));
                }

                if (Lang13.Bool(num))
                {
                    this.radduration = GlobalFuncs.Wrap(num, true, 31);
                }
            }
            else if (_f == "setstrength")
            {
                if (!Lang13.Bool(num))
                {
                    num = Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Choose pulse strength:", "Input an Integer", null, null, InputType.Num | InputType.Null)));
                }

                if (Lang13.Bool(num))
                {
                    this.radstrength = GlobalFuncs.Wrap(num, true, 16);
                }
            }
            else if (_f == "screen")
            {
                this.current_screen = href_list["text"];
            }
            else if (_f == "rejuv")
            {
                if (viable_occupant != null && viable_occupant.reagents != null)
                {
                    epinephrine_amount = viable_occupant.reagents.get_reagent_amount("epinephrine");
                    can_add            = Num13.MaxInt(Num13.MinInt(90 - (epinephrine_amount ?1:0), 15), 0);
                    viable_occupant.reagents.add_reagent("epinephrine", can_add);
                }
            }
            else if (_f == "setbufferlabel")
            {
                text = GlobalFuncs.sanitize(Interface13.Input(Task13.User, "Input a new label:", "Input an Text", null, null, InputType.Str | InputType.Null));

                if (Lang13.Bool(num) && Lang13.Bool(text))
                {
                    num         = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot = this.buffer[num];

                    if (buffer_slot is ByTable)
                    {
                        buffer_slot["label"] = text;
                    }
                }
            }
            else if (_f == "setbuffer")
            {
                if (Lang13.Bool(num) && viable_occupant != null)
                {
                    num = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    this.buffer[num] = new ByTable()
                                       .Set("label", "Buffer" + num + ":" + viable_occupant.real_name)
                                       .Set("UI", ((dynamic)viable_occupant).dna.uni_identity)
                                       .Set("SE", ((dynamic)viable_occupant).dna.struc_enzymes)
                                       .Set("UE", ((dynamic)viable_occupant).dna.unique_enzymes)
                                       .Set("name", viable_occupant.real_name)
                                       .Set("blood_type", ((dynamic)viable_occupant).dna.blood_type)
                    ;
                }
            }
            else if (_f == "clearbuffer")
            {
                if (Lang13.Bool(num))
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot2 = this.buffer[num];

                    if (buffer_slot2 is ByTable)
                    {
                        buffer_slot2.Cut();
                    }
                }
            }
            else if (_f == "transferbuffer")
            {
                if (Lang13.Bool(num) && viable_occupant != null)
                {
                    dynamic _a = href_list["text"];                     // Was a switch-case, sorry for the mess.
                    if (_a == "se")
                    {
                        this.apply_buffer(1, num);
                    }
                    else if (_a == "ui")
                    {
                        this.apply_buffer(2, num);
                    }
                    else if (_a == "ue")
                    {
                        this.apply_buffer(3, num);
                    }
                    else if (_a == "mixed")
                    {
                        this.apply_buffer(4, num);
                    }
                }
            }
            else if (_f == "injector")
            {
                if (Lang13.Bool(num) && this.injectorready)
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot3 = this.buffer[num];

                    if (buffer_slot3 is ByTable)
                    {
                        I = null;

                        dynamic _d = href_list["text"];                         // Was a switch-case, sorry for the mess.
                        if (_d == "se")
                        {
                            if (Lang13.Bool(buffer_slot3["SE"]))
                            {
                                I = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);

                                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.good_mutations + GlobalVars.bad_mutations + GlobalVars.not_good_mutations, typeof(Mutation_Human)))
                                {
                                    HM = _b;


                                    if (HM.check_block_string(buffer_slot3["SE"]))
                                    {
                                        I.add_mutations.Add(HM);
                                    }
                                    else
                                    {
                                        I.remove_mutations.Add(HM);
                                    }
                                }
                                time_coeff = null;

                                foreach (dynamic _c in Lang13.Enumerate(I.add_mutations, typeof(Mutation_Human)))
                                {
                                    HM2 = _c;


                                    if (!Lang13.Bool(time_coeff))
                                    {
                                        time_coeff = HM2.time_coeff;
                                        continue;
                                    }
                                    time_coeff = Num13.MinInt(time_coeff ?? 0, HM2.time_coeff);
                                }

                                if (Lang13.Bool(this.connected))
                                {
                                    I.duration     = I.duration * (time_coeff ?? 0) * Convert.ToDouble(this.connected.damage_coeff);
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "ui")
                        {
                            if (Lang13.Bool(buffer_slot3["UI"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("UI", buffer_slot3["UI"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "ue")
                        {
                            if (Lang13.Bool(buffer_slot3["name"]) && Lang13.Bool(buffer_slot3["UE"]) && Lang13.Bool(buffer_slot3["blood_type"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("name", buffer_slot3["name"]).Set("UE", buffer_slot3["UE"]).Set("blood_type", buffer_slot3["blood_type"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "mixed")
                        {
                            if (Lang13.Bool(buffer_slot3["UI"]) && Lang13.Bool(buffer_slot3["name"]) && Lang13.Bool(buffer_slot3["UE"]) && Lang13.Bool(buffer_slot3["blood_type"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("UI", buffer_slot3["UI"]).Set("name", buffer_slot3["name"]).Set("UE", buffer_slot3["UE"]).Set("blood_type", buffer_slot3["blood_type"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }

                        if (I != null)
                        {
                            this.injectorready = false;
                            Task13.Schedule(100, (Task13.Closure)(() => {
                                this.injectorready = true;
                                return;
                            }));
                        }
                    }
                }
            }
            else if (_f == "loaddisk")
            {
                if (Lang13.Bool(num) && Lang13.Bool(this.diskette) && Lang13.Bool(this.diskette.fields))
                {
                    num = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    this.buffer[num] = this.diskette.fields.Copy();
                }
            }
            else if (_f == "savedisk")
            {
                if (Lang13.Bool(num) && Lang13.Bool(this.diskette) && !this.diskette.read_only)
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot4 = this.buffer[num];

                    if (buffer_slot4 is ByTable)
                    {
                        this.diskette.name   = "data disk [" + buffer_slot4["label"] + "]";
                        this.diskette.fields = buffer_slot4.Copy();
                    }
                }
            }
            else if (_f == "ejectdisk")
            {
                if (Lang13.Bool(this.diskette))
                {
                    this.diskette.loc = GlobalFuncs.get_turf(this);
                    this.diskette     = null;
                }
            }
            else if (_f == "setdelayed")
            {
                if (Lang13.Bool(num))
                {
                    this.delayed_action = new ByTable().Set("action", String13.ParseNumber(href_list["delayaction"])).Set("buffer", num);
                }
            }
            else if (_f == "pulseui" || _f == "pulsese")
            {
                if (Lang13.Bool(num) && viable_occupant != null && Lang13.Bool(this.connected))
                {
                    this.radduration      = GlobalFuncs.Wrap(this.radduration, true, 31);
                    this.radstrength      = GlobalFuncs.Wrap(this.radstrength, true, 16);
                    locked_state          = this.connected.locked;
                    this.connected.locked = 1;
                    this.current_screen   = "working";
                    this.ShowInterface(Task13.User);
                    Task13.Sleep(((int)((this.radduration ?? 0) * 10)));
                    this.current_screen = "mainmenu";

                    if (viable_occupant != null && Lang13.Bool(this.connected) && this.connected.occupant == viable_occupant)
                    {
                        viable_occupant.radiation += (this.radduration ?? 0) * (this.radstrength ?? 0) * 0.2 / Math.Pow(Convert.ToDouble(this.connected.damage_coeff), 2);

                        dynamic _e = href_list["task"];                         // Was a switch-case, sorry for the mess.
                        if (_e == "pulseui")
                        {
                            len          = Lang13.Length(((dynamic)viable_occupant).dna.uni_identity);
                            num          = GlobalFuncs.Wrap(num, true, len + 1);
                            num          = this.randomize_radiation_accuracy(num, (this.radduration ?? 0) + Math.Pow(Convert.ToDouble(this.connected.precision_coeff), 2), len);
                            block        = Num13.Floor(((num ?? 0) - 1) / 3) + 1;
                            subblock     = (num ?? 0) - block * 3;
                            last_change  = "UI #" + block + "-" + subblock + "; ";
                            hex          = String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, ((int)(num ?? 0)), ((int)((num ?? 0) + 1)));
                            last_change += "" + hex;
                            hex          = this.scramble(hex, this.radstrength, this.radduration);
                            last_change += "->" + hex;
                            ((dynamic)viable_occupant).dna.uni_identity = String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, 1, ((int)(num ?? 0))) + hex + String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, ((int)((num ?? 0) + 1)), 0);
                            new ByTable().Set("mutations_overlay_update", 1).Apply(Lang13.BindFunc(viable_occupant, "updateappearance"));
                        }
                        else if (_e == "pulsese")
                        {
                            len2         = Lang13.Length(((dynamic)viable_occupant).dna.struc_enzymes);
                            num          = GlobalFuncs.Wrap(num, true, len2 + 1);
                            num          = this.randomize_radiation_accuracy(num, (this.radduration ?? 0) + Math.Pow(Convert.ToDouble(this.connected.precision_coeff), 2), len2);
                            block2       = Num13.Floor(((num ?? 0) - 1) / 3) + 1;
                            subblock2    = (num ?? 0) - block2 * 3;
                            last_change  = "SE #" + block2 + "-" + subblock2 + "; ";
                            hex2         = String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, ((int)(num ?? 0)), ((int)((num ?? 0) + 1)));
                            last_change += "" + hex2;
                            hex2         = this.scramble(hex2, this.radstrength, this.radduration);
                            last_change += "->" + hex2;
                            ((dynamic)viable_occupant).dna.struc_enzymes = String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, 1, ((int)(num ?? 0))) + hex2 + String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, ((int)((num ?? 0) + 1)), 0);
                            viable_occupant.domutcheck();
                        }
                    }
                    else
                    {
                        this.current_screen = "mainmenu";
                    }

                    if (Lang13.Bool(this.connected))
                    {
                        this.connected.locked = locked_state;
                    }
                }
            }
            this.ShowInterface(Task13.User, last_change);
            return(null);
        }
        // Function from file: dna_injector.dm
        public override void inject(dynamic M = null, dynamic user = null)
        {
            string         log_msg = null;
            double         endtime = 0;
            Mutation_Human HM      = null;
            Mutation_Human HM2     = null;

            this.prepare();

            if (Lang13.Bool(M.has_dna()) && !Lang13.Bool(M.disabilities & 128))
            {
                if (Convert.ToInt32(M.stat) == 2)
                {
                    user.WriteMsg(new Txt("<span class='notice'>You can't modify ").item(M).str("'s DNA while ").he_she_it_they().str("'s dead.</span>").ToString());
                    return;
                }
                M.radiation += Rand13.Int(((int)(20 / Math.Pow(this.damage_coeff, 2))), ((int)(50 / Math.Pow(this.damage_coeff, 2))));
                log_msg      = "" + GlobalFuncs.key_name(user) + " injected " + GlobalFuncs.key_name(M) + " with the " + this.name;
                endtime      = Game13.time + this.duration;

                foreach (dynamic _a in Lang13.Enumerate(this.remove_mutations, typeof(Mutation_Human)))
                {
                    HM = _a;


                    if (HM.name == "Monkified")
                    {
                        if (M is Mob_Living_Carbon_Human)
                        {
                            continue;
                        }
                        M = HM.force_lose(M);
                    }
                    else
                    {
                        HM.force_lose(M);
                    }
                }

                foreach (dynamic _b in Lang13.Enumerate(this.add_mutations, typeof(Mutation_Human)))
                {
                    HM2 = _b;


                    if (Lang13.Bool(M.dna.mutations.Contains(HM2)) && !Lang13.Bool(M.dna.temporary_mutations[HM2.name]))
                    {
                        continue;
                    }

                    if (HM2.name == "Monkified" && M is Mob_Living_Carbon_Human)
                    {
                        GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(user) + " injected " + GlobalFuncs.key_name_admin(M) + " with the " + this.name + " <span class='danger'>(MONKEY)</span>");
                        log_msg += " (MONKEY)";
                        M        = HM2.force_give(M);
                    }
                    else
                    {
                        HM2.force_give(M);
                    }
                    M.dna.temporary_mutations[HM2.name] = endtime;
                }

                if (this.fields != null)
                {
                    if (Lang13.Bool(this.fields["name"]) && Lang13.Bool(this.fields["UE"]) && Lang13.Bool(this.fields["blood_type"]))
                    {
                        if (!Lang13.Bool(M.dna.previous["name"]))
                        {
                            M.dna.previous["name"] = M.real_name;
                        }

                        if (!Lang13.Bool(M.dna.previous["UE"]))
                        {
                            M.dna.previous["UE"] = M.dna.unique_enzymes;
                        }

                        if (!Lang13.Bool(M.dna.previous["blood_type"]))
                        {
                            M.dna.previous["blood_type"] = M.dna.blood_type;
                        }
                        M.real_name          = this.fields["name"];
                        M.dna.unique_enzymes = this.fields["UE"];
                        M.name           = M.real_name;
                        M.dna.blood_type = this.fields["blood_type"];
                        M.dna.temporary_mutations["ue changed"] = endtime;
                    }

                    if (Lang13.Bool(this.fields["UI"]))
                    {
                        if (!Lang13.Bool(M.dna.previous["UI"]))
                        {
                            M.dna.previous["UI"] = M.dna.uni_identity;
                        }
                        M.dna.uni_identity = GlobalFuncs.merge_text(M.dna.uni_identity, this.fields["UI"]);
                        ((Mob_Living_Carbon)M).updateappearance(null, null, true);
                        M.dna.temporary_mutations["ui changed"] = endtime;
                    }
                }
                GlobalFuncs.log_attack(log_msg);
            }
            else
            {
                user.WriteMsg("<span class='notice'>It appears that " + M + " does not have compatible DNA.</span>");
                return;
            }
            return;
        }