Ejemplo n.º 1
0
        // Function from file: seed_extractor.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            SeedPile N = null;
            Obj      T = null;
            Obj      O = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            href_list["li"]  = String13.ParseNumber(href_list["li"]);
            href_list["en"]  = String13.ParseNumber(href_list["en"]);
            href_list["ma"]  = String13.ParseNumber(href_list["ma"]);
            href_list["pr"]  = String13.ParseNumber(href_list["pr"]);
            href_list["yi"]  = String13.ParseNumber(href_list["yi"]);
            href_list["pot"] = String13.ParseNumber(href_list["pot"]);

            foreach (dynamic _a in Lang13.Enumerate(this.piles, typeof(SeedPile)))
            {
                N = _a;


                if (href_list["name"] == N.name && Lang13.Bool(href_list["li"]) == N.lifespan && Lang13.Bool(href_list["en"]) == N.endurance && Lang13.Bool(href_list["ma"]) == N.maturation && Lang13.Bool(href_list["pr"]) == N.production && Lang13.Bool(href_list["yi"]) == N.yield && Lang13.Bool(href_list["pot"]) == N.potency)
                {
                    if ((N.amount ?? 0) <= 0)
                    {
                        return(null);
                    }
                    N.amount = Num13.MaxInt((N.amount ?? 0) - 1, 0);

                    if ((N.amount ?? 0) <= 0)
                    {
                        this.piles.Remove(N);
                        GlobalFuncs.qdel(N);
                    }
                    break;
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(this.contents, typeof(Obj)))
            {
                T = _b;

                O = T;

                if (((dynamic)O).plantname == href_list["name"] && ((dynamic)O).lifespan == href_list["li"] && ((dynamic)O).endurance == href_list["en"] && ((dynamic)O).maturation == href_list["ma"] && ((dynamic)O).production == href_list["pr"] && ((dynamic)O).yield == href_list["yi"] && ((dynamic)O).potency == href_list["pot"])
                {
                    O.loc = this.loc;
                    break;
                }
            }
            this.updateUsrDialog();
            return(null);
        }
Ejemplo n.º 2
0
        // Function from file: seed_extractor.dm
        public bool add(dynamic O = null)
        {
            Ent_Static M = null;
            Ent_Static S = null;
            SeedPile   N = null;


            if (this.contents.len >= 999)
            {
                Task13.User.WriteMsg(new Txt("<span class='notice'>").The(this).item().str(" is full.</span>").ToString());
                return(false);
            }

            if (O.loc is Mob)
            {
                M = O.loc;

                if (!((Mob)M).unEquip(O))
                {
                    Task13.User.WriteMsg(new Txt("<span class='warning'>").the(O).item().str(" is stuck to your hand, you cannot put it in ").the(this).item().str("!</span>").ToString());
                    return(false);
                }
            }
            else if (O.loc is Obj_Item_Weapon_Storage)
            {
                S = O.loc;
                ((dynamic)S).remove_from_storage(O, this);
            }
            O.loc = this;

            foreach (dynamic _a in Lang13.Enumerate(this.piles, typeof(SeedPile)))
            {
                N = _a;


                if (O.plantname == N.name && Lang13.Bool(O.lifespan) == N.lifespan && Lang13.Bool(O.endurance) == N.endurance && Lang13.Bool(O.maturation) == N.maturation && Lang13.Bool(O.production) == N.production && Lang13.Bool(O.yield) == N.yield && Lang13.Bool(O.potency) == N.potency)
                {
                    N.amount++;
                    return(false);
                }
            }
            this.piles.Add(new SeedPile(O.plantname, O.lifespan, O.endurance, O.maturation, O.production, O.yield, O.potency));
            return(false);
        }
Ejemplo n.º 3
0
        // Function from file: seed_extractor.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            string   dat   = null;
            SeedPile O     = null;
            Browser  popup = null;


            if (this.stat != 0)
            {
                return(0);
            }
            dat = "<b>Stored seeds:</b><br>";

            if (this.contents.len == 0)
            {
                dat += "<font color='red'>No seeds</font>";
            }
            else
            {
                dat += "<table cellpadding='3' style='text-align:center;'><tr><td>Name</td><td>Lifespan</td><td>Endurance</td><td>Maturation</td><td>Production</td><td>Yield</td><td>Potency</td><td>Stock</td></tr>";

                foreach (dynamic _a in Lang13.Enumerate(this.piles, typeof(SeedPile)))
                {
                    O = _a;

                    dat += "<tr><td>" + O.name + "</td><td>" + O.lifespan + "</td><td>" + O.endurance + "</td><td>" + O.maturation + "</td>";
                    dat += "<td>" + O.production + "</td><td>" + O.yield + "</td><td>" + O.potency + "</td><td>";
                    dat += new Txt("<a href='byond://?src=").Ref(this).str(";name=").item(O.name).str(";li=").item(O.lifespan).str(";en=").item(O.endurance).str(";ma=").item(O.maturation).str(";pr=").item(O.production).str(";yi=").item(O.yield).str(";pot=").item(O.potency).str("'>Vend</a> (").item(O.amount).str(" left)</td></tr>").ToString();
                }
                dat += "</table>";
            }
            popup = new Browser(user, "seed_ext", this.name, 700, 400);
            popup.set_content(dat);
            popup.open();
            return(null);
        }