예제 #1
0
 // Function from file: gateway.dm
 public override void initialize(  )
 {
     this.update_icon();
     this.wait     = Game13.time + (GlobalVars.config.gateway_delay ?? 0);
     this.awaygate = Lang13.FindObj(typeof(Obj_Machinery_Gateway_Centeraway));
     return;
 }
예제 #2
0
        // Function from file: spellbook.dm
        public int Refund(Mob user = null, Obj_Item_Weapon_Spellbook book = null)
        {
            dynamic A            = null;
            int     spell_levels = 0;
            Obj_Effect_ProcHolder_Spell aspell = null;

            A = Lang13.FindObj(typeof(Zone_WizardStation));

            if (!A.contents.Contains(user))
            {
                user.WriteMsg("<span clas=='warning'>You can only refund spells at the wizard lair</span>");
                return(-1);
            }

            if (!Lang13.Bool(this.S))
            {
                this.S = Lang13.Call(this.spell_type);
            }
            spell_levels = 0;

            foreach (dynamic _a in Lang13.Enumerate(user.mind.spell_list, typeof(Obj_Effect_ProcHolder_Spell)))
            {
                aspell = _a;


                if (Lang13.Initial(this.S, "name") == Lang13.Initial(aspell, "name"))
                {
                    spell_levels = aspell.spell_level;
                    user.mind.spell_list.Remove(aspell);
                    GlobalFuncs.qdel(this.S);
                    return(this.cost * (spell_levels + 1));
                }
            }
            return(-1);
        }
예제 #3
0
		// Function from file: pinpointer.dm
		public void scandisk(  ) {
			
			if ( !Lang13.Bool( this.the_disk ) ) {
				this.the_disk = Lang13.FindObj( typeof(Obj_Item_Weapon_Disk_Nuclear) );
			}
			return;
		}
        // Function from file: book.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            double? iconi     = null;
            dynamic biblename = null;
            dynamic B         = null;


            if (Lang13.Bool(href_list["seticon"]) && GlobalVars.ticker != null && !Lang13.Bool(GlobalVars.ticker.Bible_icon_state))
            {
                iconi        = String13.ParseNumber(href_list["seticon"]);
                biblename    = GlobalVars.biblenames[iconi];
                B            = Lang13.FindObj(href_list["src"]);
                B.icon_state = GlobalVars.biblestates[iconi];
                B.item_state = GlobalVars.bibleitemstates[iconi];
                this.setupbiblespecifics(B, Task13.User);

                if (GlobalVars.ticker != null)
                {
                    GlobalVars.ticker.Bible_icon_state = B.icon_state;
                    GlobalVars.ticker.Bible_item_state = B.item_state;
                }
                GlobalFuncs.feedback_set_details("religion_book", "" + biblename);
                Interface13.Browse(Task13.User, null, "window=editicon");
            }
            return(null);
        }
예제 #5
0
        // Function from file: guncase.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic O = null;


            if (Lang13.Bool(href_list["retrieve"]))
            {
                O = Lang13.FindObj(href_list["retrieve"]);

                if (!Task13.User.canUseTopic(this))
                {
                    return(null);
                }

                if (Task13.User is Mob_Living_Carbon_Human)
                {
                    if (!Lang13.Bool(Task13.User.get_active_hand()))
                    {
                        Task13.User.put_in_hands(O);
                    }
                    else
                    {
                        O.loc = GlobalFuncs.get_turf(this);
                    }
                    this.update_icon();
                }
            }
            return(null);
        }
예제 #6
0
        // Function from file: observer.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic target = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Task13.User == this)
            {
                if (Lang13.Bool(href_list["follow"]))
                {
                    target = Lang13.FindObj(href_list["follow"]);

                    if (target is Ent_Dynamic && target != this)
                    {
                        this.ManualFollow(target);
                    }
                }

                if (Lang13.Bool(href_list["reenter"]))
                {
                    this.__CallVerb("Re-enter Corpse");
                }
            }
            return(null);
        }
예제 #7
0
        // Function from file: computer.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Type    areapath = null;
            dynamic area     = null;
            double? safe     = null;


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

            if (!this.Adjacent(Task13.User) && !(Task13.User is Mob_Living_Silicon))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(href_list["loadarea"]))
            {
                areapath = Lang13.FindClass(href_list["loadarea"]);

                if (!Lang13.Bool(((dynamic)areapath).IsSubclassOf(typeof(Zone_Holodeck))))
                {
                    return(null);
                }
                area = Lang13.FindObj(areapath);

                if (!(area is Zone_Holodeck))
                {
                    return(null);
                }

                if (area == this.offline_program || this.program_cache.Contains(area) || Lang13.Bool(this.emagged) && this.emag_programs.Contains(area))
                {
                    this.load_program(area);
                }
            }
            else if (href_list.Contains("safety"))
            {
                safe         = String13.ParseNumber(href_list["safety"]);
                this.emagged = !Lang13.Bool(safe) ?1:0;

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

                if (Lang13.Bool(safe) && this.emag_programs.Contains(this.program))
                {
                    this.emergency_shutdown();
                }
                this.nerf(safe);
            }
            this.updateUsrDialog();
            return(null);
        }
예제 #8
0
        // Function from file: events.dm
        public dynamic findEventArea(  )
        {
            ByTable safe_areas   = null;
            ByTable danger_areas = null;

            safe_areas   = new ByTable(new object [] { typeof(Zone_TurretProtected_Ai), typeof(Zone_TurretProtected_AiUpload), typeof(Zone_Engine), typeof(Zone_Solar), typeof(Zone_Holodeck), typeof(Zone_Shuttle) });
            danger_areas = new ByTable(new object [] { typeof(Zone_Engine_BreakRoom), typeof(Zone_Engine_ChiefsOffice) });
            return(Lang13.FindObj(Rand13.PickFromTable(GlobalVars.the_station_areas - safe_areas + danger_areas)));
        }
예제 #9
0
        // Function from file: garbage.dm
        public void HandleQueue(int time_to_stop = 0)
        {
            int?    time_to_kill = null;
            dynamic refID        = null;
            int?    GCd_at_time  = null;
            dynamic A            = null;

            this.delslasttick = 0;
            this.gcedlasttick = 0;
            time_to_kill      = Game13.time - this.collection_timeout;

            while (this.queue.len != 0 && Game13.timeofday < time_to_stop)
            {
                refID = this.queue[1];

                if (!Lang13.Bool(refID))
                {
                    this.queue.Cut(1, 2);
                    continue;
                }
                GCd_at_time = Lang13.IntNullable(this.queue[refID]);

                if ((GCd_at_time ?? 0) > (time_to_kill ?? 0))
                {
                    break;
                }
                A = null;

                if (!(refID is string))
                {
                    Lang13.Delete(A);
                    A = null;
                }
                else
                {
                    A = Lang13.FindObj(refID);

                    if (Lang13.Bool(A) && A.gc_destroyed == GCd_at_time)
                    {
                        GlobalFuncs.testing(new Txt("GC: -- ").Ref(A).str(" | ").item(A.type).str(" was unable to be GC'd and was deleted --").ToString());
                        this.didntgc["" + A.type]++;
                        Lang13.Delete(A);
                        A = null;
                        this.delslasttick++;
                        this.totaldels++;
                    }
                    else
                    {
                        this.gcedlasttick++;
                        this.totalgcs++;
                    }
                }
                this.queue.Cut(1, 2);
            }
            return;
        }
예제 #10
0
        // Function from file: computer.dm
        public override void initialize(  )
        {
            dynamic typekey = null;
            dynamic A       = null;

            this.program_cache = new ByTable();
            this.emag_programs = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Lang13.GetTypes(this.program_type) - this.program_type))
            {
                typekey = _a;

                A = Lang13.FindObj(typekey);

                if (!Lang13.Bool(A) || A.Equals(this.offline_program))
                {
                    continue;
                }

                if (A.contents.len == 0)
                {
                    continue;
                }

                if (A.restricted)
                {
                    this.emag_programs.Add(A);
                }
                else
                {
                    this.program_cache.Add(A);
                }

                if (typekey == this.init_program)
                {
                    this.load_program(A, true);
                }
            }

            if (this.random_program && this.program_cache.len != 0 && this.init_program == null)
            {
                this.load_program(Rand13.PickFromTable(this.program_cache), true);
            }
            else if (!Lang13.Bool(this.program))
            {
                this.load_program(this.offline_program);
            }
            return;
        }
        // Function from file: telecrystalconsoles.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic A      = null;
            dynamic A2     = null;
            int     sanity = 0;
            Obj_Machinery_Computer_Telecrystals_Uplinker A3 = null;


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

            if (Lang13.Bool(href_list["scan"]))
            {
                this.scanUplinkers();
            }

            if (Lang13.Bool(href_list["give1"]))
            {
                A = Lang13.FindObj(href_list["give1"]);
                ((Obj_Machinery_Computer_Telecrystals_Uplinker)A).giveTC(1);
            }

            if (Lang13.Bool(href_list["give5"]))
            {
                A2 = Lang13.FindObj(href_list["give5"]);
                ((Obj_Machinery_Computer_Telecrystals_Uplinker)A2).giveTC(5);
            }

            if (Lang13.Bool(href_list["distrib"]))
            {
                sanity = 0;

                while (this.storedcrystals != 0 && sanity < 100)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.TCstations, typeof(Obj_Machinery_Computer_Telecrystals_Uplinker)))
                    {
                        A3 = _a;

                        A3.giveTC(1, false);
                    }
                    sanity++;
                }
                this.logTransfer("" + this + " evenly distributed telecrystals.");
            }
            this.updateUsrDialog();
            return(null);
        }
예제 #12
0
        // Function from file: nuclearbomb.dm
        public Obj_Machinery_Nuclearbomb_Syndicate(dynamic loc = null) : base((object)(loc))
        {
            dynamic existing = null;

            existing = Lang13.FindObj("syndienuke");

            if (Lang13.Bool(existing))
            {
                GlobalFuncs.qdel(this);
                throw new Exception("Attempted to spawn a syndicate nuke while one already exists at " + existing.loc.x + "," + existing.loc.y + "," + existing.loc.z);
                return;                 // Warning! Attempt to return some other value!
            }
            this.tag = "syndienuke";
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            return;
        }
예제 #13
0
        // Function from file: topic_input.dm
        public bool getAndLocate(string i = null)
        {
            dynamic t = null;

            t = this.get(i);

            if (Lang13.Bool(t))
            {
                t = Lang13.FindObj(t);
            }

            if (t is string)
            {
                t = null;
            }
            return(Lang13.Bool(t) || false);
        }
예제 #14
0
        // Function from file: table.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic TR       = null;
            dynamic fail_msg = null;


            if (Task13.User.stat != 0 || !this.Adjacent(Task13.User) || Lang13.Bool(Task13.User.lying))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["make"]))
            {
                TR        = Lang13.FindObj(href_list["make"]);
                this.busy = true;
                this.interact(Task13.User);
                fail_msg = this.construct_item(Task13.User, TR);

                if (!Lang13.Bool(fail_msg))
                {
                    Task13.User.WriteMsg("<span class='notice'>" + TR.name + " constructed.</span>");
                }
                else
                {
                    Task13.User.WriteMsg("<span class ='warning'>Construction failed" + fail_msg + "</span>");
                }
                this.busy = false;
                this.interact(Task13.User);
            }

            if (Lang13.Bool(href_list["forwardCat"]))
            {
                this.viewing_category = this.next_cat();
                Task13.User.WriteMsg("<span class='notice'>Category is now " + this.categories[this.viewing_category] + ".</span>");
                this.interact(Task13.User);
            }

            if (Lang13.Bool(href_list["backwardCat"]))
            {
                this.viewing_category = this.prev_cat();
                Task13.User.WriteMsg("<span class='notice'>Category is now " + this.categories[this.viewing_category] + ".</span>");
                this.interact(Task13.User);
            }
            return(null);
        }
예제 #15
0
        // Function from file: ripley.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic O = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Lang13.Bool(href_list["drop_from_cargo"]))
            {
                O = Lang13.FindObj(href_list["drop_from_cargo"]);

                if (this.cargo.Contains(Lang13.Bool(O) && Lang13.Bool(O)))
                {
                    this.occupant_message("<span class='notice'>You unload " + O + ".</span>");
                    O.loc = this.loc;
                    this.cargo.Remove(O);
                    this.log_message("Unloaded " + O + ". Cargo compartment capacity: " + (this.cargo_capacity - this.cargo.len));
                }
            }
            return(null);
        }
예제 #16
0
        // Function from file: lightswitch.dm
        public Obj_Machinery_LightSwitch(dynamic loc = null) : base((object)(loc))
        {
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            Task13.Schedule(5, (Task13.Closure)(() => {
                this.area = this.loc.loc;

                if (Lang13.Bool(this.otherarea))
                {
                    this.area = Lang13.FindObj(Lang13.FindClass("/area/" + this.otherarea));
                }

                if (!Lang13.Bool(this.name))
                {
                    this.name = "light switch (" + this.area.name + ")";
                }
                this.on = this.area.lightswitch;
                this.updateicon();
                return;
            }));
            return;
        }
예제 #17
0
        // Function from file: filingcabinet.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic P = null;


            if (Lang13.Bool(href_list["retrieve"]))
            {
                Interface13.Browse(Task13.User, "", "window=filingcabinet");
                P = Lang13.FindObj(href_list["retrieve"]);

                if (P is Obj_Item && P.loc == this && Map13.GetDistance(this, Task13.User) <= 1)
                {
                    Task13.User.put_in_hands(P);
                    this.updateUsrDialog();
                    this.icon_state = "" + Lang13.Initial(this, "icon_state") + "-open";
                    Task13.Sleep(5);
                    this.icon_state = Lang13.Initial(this, "icon_state");
                }
            }
            return(null);
        }
예제 #18
0
        // Function from file: folders.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic I  = null;
            dynamic I2 = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Task13.User.stat != 0 || Task13.User.restrained())
            {
                return(null);
            }

            if (Task13.User.contents.Find(this) != 0)
            {
                if (Lang13.Bool(href_list["remove"]))
                {
                    I = Lang13.FindObj(href_list["remove"]);

                    if (I is Obj_Item && I.loc == this)
                    {
                        I.loc = Task13.User.loc;
                        Task13.User.put_in_hands(I);
                    }
                }

                if (Lang13.Bool(href_list["read"]))
                {
                    I2 = Lang13.FindObj(href_list["read"]);

                    if (I2 is Obj_Item && I2.loc == this)
                    {
                        Task13.User.__CallVerb("Examine", I2);
                    }
                }
                this.attack_self(Task13.User);
                this.update_icon();
            }
            return(null);
        }
예제 #19
0
        // Function from file: computer.dm
        public Obj_Machinery_Computer_Holodeck(dynamic location = null, dynamic C = null) : base((object)(location), (object)(C))
        {
            dynamic AS = null;


            if (Lang13.Bool(((dynamic)this.holodeck_type).IsSubclassOf(typeof(Zone))))
            {
                this.linked = Lang13.FindObj(this.holodeck_type);
            }

            if (Lang13.Bool(this.offline_program.IsSubclassOf(typeof(Zone))))
            {
                this.offline_program = Lang13.FindObj(this.offline_program);
            }
            AS = GlobalFuncs.get_area(this);

            if (AS is Zone_Holodeck)
            {
                Game13.log.WriteMsg("### MAPPING ERROR");
                Game13.log.WriteMsg("Holodeck computer cannot be in a holodeck.");
                Game13.log.WriteMsg("This would cause circular power dependency.");
                GlobalFuncs.qdel(this);
                return;
            }
            else
            {
                this.linked.linked = this;
            }

            if (GlobalVars.ticker != null && GlobalVars.ticker.current_state >= 3)
            {
                this.initialize();
            }
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            return;
        }
예제 #20
0
        // Function from file: cards.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic card = null;


            if (hsrc is HtmlInterfaceClient)
            {
                dynamic _a = href_list["action"];                 // Was a switch-case, sorry for the mess.
                if (_a == "play_card")
                {
                    card = Lang13.FindObj(href_list["card"]);

                    if (this.cards.Contains(card))
                    {
                        this.__CallVerb("Discard", card);
                    }
                }
                else if (_a == "toggle_conceal")
                {
                    this.__CallVerb("Toggle conceal");
                }
            }
            return(null);
        }
예제 #21
0
파일: Swapmap.cs 프로젝트: Somnium13/SS13
        // Function from file: swapmaps.dm
        public override void Write(SaveFile F = null)
        {
            double  x       = 0;
            double  y       = 0;
            double  z       = 0;
            dynamic n       = null;
            ByTable areas   = null;
            dynamic defarea = null;
            dynamic T       = null;
            string  oldcd   = null;
            Tile    T2      = null;

            defarea = Lang13.FindObj(Game13.default_zone);

            if (!Lang13.Bool(defarea))
            {
                defarea = Lang13.Call(Game13.default_zone);
            }
            areas = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(this.x1, this.y1, this.z1 ?? 0), Map13.GetTile(this.x2, this.y2, this.z2 ?? 0))))
            {
                T = _a;

                areas[T.loc] = null;
            }

            foreach (dynamic _b in Lang13.Enumerate(areas))
            {
                n = _b;

                areas.Remove(n);
                areas.Add(n);
            }
            areas.Remove(defarea);
            GlobalFuncs.InitializeSwapMaps();
            this.locked = true;
            F["id"]     = this.id;
            F["z"]      = (this.z2 ?? 0) - (this.z1 ?? 0) + 1;
            F["y"]      = this.y2 - this.y1 + 1;
            F["x"]      = this.x2 - this.x1 + 1;
            F["areas"]  = areas;

            foreach (dynamic _c in Lang13.IterateRange(1, areas.len))
            {
                n = _c;

                areas[areas[n]] = n;
            }
            oldcd = F.cd;

            foreach (dynamic _f in Lang13.IterateRange(this.z1, this.z2))
            {
                z = _f;

                F.cd = "" + (z - (this.z1 ?? 0) + 1);

                foreach (dynamic _e in Lang13.IterateRange(this.y1, this.y2))
                {
                    y = _e;

                    F.cd = "" + (y - this.y1 + 1);

                    foreach (dynamic _d in Lang13.IterateRange(this.x1, this.x2))
                    {
                        x = _d;

                        F.cd      = "" + (x - this.x1 + 1);
                        T2        = Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z)));
                        F["type"] = T2.type;

                        if (T2.loc != defarea)
                        {
                            F["AREA"] = areas[T2.loc];
                        }
                        T2.Write(F);
                        F.cd = "..";
                    }
                    F.cd = "..";
                }
                Task13.Sleep(0);
                F.cd = oldcd;
            }
            this.locked = false;
            GlobalFuncs.qdel(areas);
            return;
        }
예제 #22
0
        // Function from file: cart.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Ent_Static pda = null;
            Obj_Item_Radio_Integrated_Signal S  = null;
            Obj_Item_Radio_Integrated_Signal S2 = null;
            double new_frequency = 0;
            Obj_Item_Radio_Integrated_Signal S3 = null;
            double?pnum                    = null;
            string pda_owner_name          = null;
            string message                 = null;
            Newscaster_FeedChannel current = null;
            Newscaster_FeedChannel chan    = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (!Task13.User.canmove || Task13.User.stat != 0 || Task13.User.restrained() || !(Map13.GetDistance(this.loc, Task13.User) <= 1))
            {
                Task13.User.unset_machine();
                Interface13.Browse(Task13.User, null, "window=pda");
                return(null);
            }
            pda = this.loc;

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

            if (_c == "Medical Records")
            {
                this.active1 = GlobalFuncs.find_record("id", href_list["target"], GlobalVars.data_core.general);

                if (this.active1 != null)
                {
                    this.active2 = GlobalFuncs.find_record("id", href_list["target"], GlobalVars.data_core.medical);
                }
                ((dynamic)pda).mode = 441;
                this.mode           = 441;

                if (!(this.active2 != null))
                {
                    this.active1 = null;
                }
            }
            else if (_c == "Security Records")
            {
                this.active1 = GlobalFuncs.find_record("id", href_list["target"], GlobalVars.data_core.general);

                if (this.active1 != null)
                {
                    this.active3 = GlobalFuncs.find_record("id", href_list["target"], GlobalVars.data_core.security);
                }
                ((dynamic)pda).mode = 451;
                this.mode           = 451;

                if (!(this.active3 != null))
                {
                    this.active1 = null;
                }
            }
            else if (_c == "Send Signal")
            {
                Task13.Schedule(0, (Task13.Closure)(() => {
                    S = this.radio;
                    S.send_signal("ACTIVATE");
                    return;

                    return;
                }));
            }
            else if (_c == "Signal Frequency")
            {
                S2            = this.radio;
                new_frequency = GlobalFuncs.sanitize_frequency(S2.frequency + (String13.ParseNumber(href_list["sfreq"]) ?? 0));
                S2.set_frequency(new_frequency);
            }
            else if (_c == "Signal Code")
            {
                S3       = this.radio;
                S3.code += String13.ParseNumber(href_list["scode"]) ?? 0;
                S3.code  = Num13.Floor(S3.code);
                S3.code  = Num13.MinInt(100, ((int)(S3.code)));
                S3.code  = Num13.MaxInt(1, ((int)(S3.code)));
            }
            else if (_c == "Status")
            {
                dynamic _a = href_list["statdisp"];                 // Was a switch-case, sorry for the mess.
                if (_a == "message")
                {
                    this.post_status("message", this.message1, this.message2);
                }
                else if (_a == "alert")
                {
                    this.post_status("alert", href_list["alert"]);
                }
                else if (_a == "setmsg1")
                {
                    this.message1 = GlobalFuncs.reject_bad_text(Interface13.Input("Line 1", "Enter Message Text", this.message1, null, null, InputType.Str | InputType.Null), 40);
                    this.updateSelfDialog();
                }
                else if (_a == "setmsg2")
                {
                    this.message2 = GlobalFuncs.reject_bad_text(Interface13.Input("Line 2", "Enter Message Text", this.message2, null, null, InputType.Str | InputType.Null), 40);
                    this.updateSelfDialog();
                }
                else
                {
                    this.post_status(href_list["statdisp"]);
                }
            }
            else if (_c == "Power Select")
            {
                pnum                = String13.ParseNumber(href_list["target"]);
                this.powmonitor     = this.powermonitors[pnum];
                ((dynamic)pda).mode = 433;
                this.mode           = 433;
            }
            else if (_c == "Supply Orders")
            {
                ((dynamic)pda).mode = 47;
                this.mode           = 47;
            }
            else if (_c == "Newscaster Access")
            {
                this.mode = 53;
            }
            else if (_c == "Newscaster Message")
            {
                pda_owner_name = (Lang13.Bool(((dynamic)pda).id) ? "" + ((dynamic)pda).id.registered_name + " (" + ((dynamic)pda).id.assignment + ")" : "Unknown");
                message        = ((Obj_Item_Device_Pda)pda).msg_input();
                current        = null;

                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.news_network.network_channels, typeof(Newscaster_FeedChannel)))
                {
                    chan = _b;


                    if (chan.channel_name == this.current_channel)
                    {
                        current = chan;
                    }
                }

                if (current.locked && current.author != pda_owner_name)
                {
                    ((dynamic)pda).cart += "<h5> ERROR : NOT AUTHORIZED " + (Lang13.Bool(((dynamic)pda).id) ? "" : "- ID SLOT EMPTY") + " </h5>";
                    pda.Topic(null, new ByTable().Set("choice", "Refresh"));
                    return(null);
                }
                GlobalVars.news_network.SubmitArticle(message, ((dynamic)pda).owner, this.current_channel);
                pda.Topic(null, new ByTable().Set("choice", String13.NumberToString(this.mode)));
                return(null);
            }
            else if (_c == "Newscaster Switch Channel")
            {
                this.current_channel = ((Obj_Item_Device_Pda)pda).msg_input();
                pda.Topic(null, new ByTable().Set("choice", String13.NumberToString(this.mode)));
                return(null);
            }

            if (Lang13.Bool(href_list["op"]))
            {
                dynamic _d = href_list["op"];                 // Was a switch-case, sorry for the mess.
                if (_d == "control")
                {
                    this.active_bot = Lang13.FindObj(href_list["bot"]);
                }
                else if (_d == "botlist")
                {
                    this.active_bot = null;
                }
                else if (_d == "summon")
                {
                    ((Mob_Living_SimpleAnimal_Bot)this.active_bot).bot_control("summon", null, GlobalFuncs.get_turf(Task13.User), ((dynamic)pda).GetAccess());
                }
                else
                {
                    ((Mob_Living_SimpleAnimal_Bot)this.active_bot).bot_control(href_list["op"], Task13.User);
                }
            }

            if (Lang13.Bool(href_list["mule"]))
            {
                ((Mob_Living_SimpleAnimal_Bot)this.active_bot).bot_control(href_list["mule"], Task13.User);
            }
            this.generate_menu(Task13.User);
            this.print_to_host(this.menu);
            return(null);
        }
예제 #23
0
        // Function from file: prisoner.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic I       = null;
            int     num     = 0;
            dynamic I2      = null;
            dynamic I3      = null;
            dynamic I4      = null;
            string  warning = null;
            dynamic I5      = null;
            dynamic R       = null;


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

            if (Task13.User.contents.Find(this) != 0 || Map13.GetDistance(this, Task13.User) <= 1 && this.loc is Tile || Task13.User is Mob_Living_Silicon)
            {
                Task13.User.set_machine(this);

                if (Lang13.Bool(href_list["id"]))
                {
                    if (href_list["id"] == "insert" && !(this.inserted_id is Obj_Item_Weapon_Card_Id_Prisoner))
                    {
                        I = Task13.User.get_active_hand();

                        if (I is Obj_Item_Weapon_Card_Id_Prisoner)
                        {
                            if (!Task13.User.drop_item())
                            {
                                return(null);
                            }
                            I.loc            = this;
                            this.inserted_id = I;
                        }
                        else
                        {
                            Task13.User.WriteMsg("<span class='danger'>No valid ID.</span>");
                        }
                    }
                    else if (this.inserted_id is Obj_Item_Weapon_Card_Id_Prisoner)
                    {
                        dynamic _a = href_list["id"];                         // Was a switch-case, sorry for the mess.
                        if (_a == "eject")
                        {
                            this.inserted_id.loc = GlobalFuncs.get_turf(this);
                            this.inserted_id.__CallVerb("Pick up");
                            this.inserted_id = null;
                        }
                        else if (_a == "reset")
                        {
                            this.inserted_id.points = 0;
                        }
                        else if (_a == "setgoal")
                        {
                            num = Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Choose prisoner's goal:", "Input an Integer", null, null, InputType.Num | InputType.Null)));

                            if (num >= 0)
                            {
                                num = Num13.MinInt(num, 1000);
                                this.inserted_id.goal = num;
                            }
                        }
                    }
                }
                else if (Lang13.Bool(href_list["inject1"]))
                {
                    I2 = Lang13.FindObj(href_list["inject1"]);

                    if (Lang13.Bool(I2))
                    {
                        I2.activate(1);
                    }
                }
                else if (Lang13.Bool(href_list["inject5"]))
                {
                    I3 = Lang13.FindObj(href_list["inject5"]);

                    if (Lang13.Bool(I3))
                    {
                        I3.activate(5);
                    }
                }
                else if (Lang13.Bool(href_list["inject10"]))
                {
                    I4 = Lang13.FindObj(href_list["inject10"]);

                    if (Lang13.Bool(I4))
                    {
                        I4.activate(10);
                    }
                }
                else if (Lang13.Bool(href_list["lock"]))
                {
                    if (this.allowed(Task13.User))
                    {
                        this.screen = !this.screen;
                    }
                    else
                    {
                        Task13.User.WriteMsg("Unauthorized Access.");
                    }
                }
                else if (Lang13.Bool(href_list["warn"]))
                {
                    warning = String13.SubStr(GlobalFuncs.sanitize(Interface13.Input(Task13.User, "Message:", "Enter your message here!", "", null, InputType.Any)), 1, 1024);

                    if (!Lang13.Bool(warning))
                    {
                        return(null);
                    }
                    I5 = Lang13.FindObj(href_list["warn"]);

                    if (Lang13.Bool(I5) && Lang13.Bool(I5.imp_in))
                    {
                        R = I5.imp_in;
                        R.WriteMsg("<span class='italics'>You hear a voice in your head saying: '" + warning + "'</span>");
                        GlobalFuncs.log_say("" + Task13.User + "/" + Task13.User.ckey + " sent an implant message to " + R + "/" + R.ckey + ": '" + warning + "'");
                    }
                }
                this.add_fingerprint(Task13.User);
            }
            this.updateUsrDialog();
            return(null);
        }
예제 #24
0
        // Function from file: noticeboard.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic P  = null;
            dynamic P2 = null;
            dynamic P3 = null;

            base.Topic(href, href_list, (object)(hsrc));
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["remove"]))
            {
                if (Task13.User.stat != 0 || Task13.User.restrained())
                {
                    return(null);
                }
                P = Lang13.FindObj(href_list["remove"]);

                if (Lang13.Bool(P) && P.loc == this)
                {
                    P.loc = GlobalFuncs.get_turf(this);
                    ((Ent_Static)P).add_fingerprint(Task13.User);
                    this.add_fingerprint(Task13.User);
                    this.notices--;
                    this.icon_state = "nboard0" + this.notices;
                }
            }

            if (Lang13.Bool(href_list["write"]))
            {
                if (Task13.User.stat != 0 || Task13.User.restrained())
                {
                    return(null);
                }
                P2 = Lang13.FindObj(href_list["write"]);

                if (Lang13.Bool(P2) && P2.loc == this)
                {
                    if (Task13.User.r_hand is Obj_Item_Weapon_Pen)
                    {
                        this.add_fingerprint(Task13.User);
                        ((Ent_Static)P2).attackby(Task13.User.r_hand, Task13.User);
                    }
                    else if (Task13.User.l_hand is Obj_Item_Weapon_Pen)
                    {
                        this.add_fingerprint(Task13.User);
                        ((Ent_Static)P2).attackby(Task13.User.l_hand, Task13.User);
                    }
                    else
                    {
                        Task13.User.WriteMsg("<span class='notice'>You'll need something to write with!</span>");
                    }
                }
            }

            if (Lang13.Bool(href_list["read"]))
            {
                P3 = Lang13.FindObj(href_list["read"]);

                if (Lang13.Bool(P3) && P3.loc == this)
                {
                    if (!(Task13.User is Mob_Living_Carbon_Human))
                    {
                        Interface13.Browse(Task13.User, "<HTML><HEAD><TITLE>" + P3.name + "</TITLE></HEAD><BODY><TT>" + GlobalFuncs.stars(P3.info) + "</TT></BODY></HTML>", "window=" + P3.name);
                        GlobalFuncs.onclose(Task13.User, "" + P3.name);
                    }
                    else
                    {
                        Interface13.Browse(Task13.User, "<HTML><HEAD><TITLE>" + P3.name + "</TITLE></HEAD><BODY><TT>" + P3.info + "</TT></BODY></HTML>", "window=" + P3.name);
                        GlobalFuncs.onclose(Task13.User, "" + P3.name);
                    }
                }
            }
            return(null);
        }
 // Function from file: gateway.dm
 public override void initialize(  )
 {
     this.update_icon();
     this.stationgate = Lang13.FindObj(typeof(Obj_Machinery_Gateway_Centerstation));
     return;
 }
예제 #26
0
        // Function from file: cloning.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            string      dat   = null;
            Data_Record R     = null;
            dynamic     H     = null;
            ByTable     L     = null;
            Browser     popup = null;

            ((Mob)user).set_machine(this);
            this.add_fingerprint(user);

            if (Lang13.Bool(base.interact((object)(user), flag1)))
            {
                return(null);
            }
            this.updatemodules();
            dat  = "";
            dat += new Txt("<a href='byond://?src=").Ref(this).str(";refresh=1'>Refresh</a>").ToString();

            if (Lang13.Bool(this.scanner) && Lang13.Bool(this.pod1) && (this.scanner.scan_level > 2 || Convert.ToDouble(this.pod1.efficiency) > 5))
            {
                if (!this.autoprocess)
                {
                    dat += new Txt("<a href='byond://?src=").Ref(this).str(";task=autoprocess'>Autoprocess</a>").ToString();
                }
                else
                {
                    dat += new Txt("<a href='byond://?src=").Ref(this).str(";task=stopautoprocess'>Stop autoprocess</a>").ToString();
                }
            }
            else
            {
                dat += "<span class='linkOff'>Autoprocess</span>";
            }
            dat += "<h3>Cloning Pod Status</h3>";
            dat += "<div class='statusDisplay'>" + this.temp + "&nbsp;</div>";

            switch ((int?)(this.menu))
            {
            case 1:

                if (this.scanner == null || this.pod1 == null)
                {
                    dat += "<h3>Modules</h3>";

                    if (this.scanner == null)
                    {
                        dat += "<font class='bad'>ERROR: No Scanner detected!</font><br>";
                    }

                    if (this.pod1 == null)
                    {
                        dat += "<font class='bad'>ERROR: No Pod detected</font><br>";
                    }
                }

                if (!(this.scanner == null))
                {
                    dat += "<h3>Scanner Functions</h3>";
                    dat += "<div class='statusDisplay'>";

                    if (!Lang13.Bool(this.scanner.occupant))
                    {
                        dat += "Scanner Unoccupied";
                    }
                    else if (this.loading)
                    {
                        dat += "" + this.scanner.occupant + " => Scanning...";
                    }
                    else
                    {
                        if (this.scanner.occupant.ckey != this.scantemp_ckey)
                        {
                            this.scantemp      = "Ready to Scan";
                            this.scantemp_ckey = this.scanner.occupant.ckey;
                        }
                        dat += "" + this.scanner.occupant + " => " + this.scantemp;
                    }
                    dat += "</div>";

                    if (Lang13.Bool(this.scanner.occupant))
                    {
                        dat += new Txt("<a href='byond://?src=").Ref(this).str(";scan=1'>Start Scan</a>").ToString();
                        dat += new Txt("<br><a href='byond://?src=").Ref(this).str(";lock=1'>").item((Lang13.Bool(this.scanner.locked) ? "Unlock Scanner" : "Lock Scanner")).str("</a>").ToString();
                    }
                    else
                    {
                        dat += "<span class='linkOff'>Start Scan</span>";
                    }
                }
                dat += "<h3>Database Functions</h3>";

                if (this.records.len != 0 && this.records.len > 0)
                {
                    dat += new Txt("<a href='byond://?src=").Ref(this).str(";menu=2'>View Records (").item(this.records.len).str(")</a><br>").ToString();
                }
                else
                {
                    dat += "<span class='linkOff'>View Records (0)</span><br>";
                }

                if (Lang13.Bool(this.diskette))
                {
                    dat += new Txt("<a href='byond://?src=").Ref(this).str(";disk=eject'>Eject Disk</a><br>").ToString();
                }
                break;

            case 2:
                dat += "<h3>Current records</h3>";
                dat += new Txt("<a href='byond://?src=").Ref(this).str(";menu=1'><< Back</a><br><br>").ToString();

                foreach (dynamic _a in Lang13.Enumerate(this.records, typeof(Data_Record)))
                {
                    R = _a;

                    dat += new Txt("<h4>").item(R.fields["name"]).str("</h4>Scan ID ").item(R.fields["id"]).str(" <a href='byond://?src=").Ref(this).str(";view_rec=").item(R.fields["id"]).str("'>View Record</a>").ToString();
                }
                break;

            case 3:
                dat += "<h3>Selected Record</h3>";
                dat += new Txt("<a href='byond://?src=").Ref(this).str(";menu=2'><< Back</a><br>").ToString();

                if (!(this.active_record != null))
                {
                    dat += "<font class='bad'>Record not found.</font>";
                }
                else
                {
                    dat += "<h4>" + this.active_record.fields["name"] + "</h4>";
                    dat += new Txt("Scan ID ").item(this.active_record.fields["id"]).str(" <a href='byond://?src=").Ref(this).str(";clone=").item(this.active_record.fields["id"]).str("'>Clone</a><br>").ToString();
                    H    = Lang13.FindObj(this.active_record.fields["imp"]);

                    if (Lang13.Bool(H) && H is Obj_Item_Weapon_Implant_Health)
                    {
                        dat += "<b>Health Implant Data:</b><br />" + ((Obj_Item_Weapon_Implant_Health)H).sensehealth() + "<br><br />";
                    }
                    else
                    {
                        dat += "<font class='bad'>Unable to locate Health Implant.</font><br /><br />";
                    }
                    dat += "<b>Unique Identifier:</b><br /><span class='highlight'>" + this.active_record.fields["UI"] + "</span><br>";
                    dat += "<b>Structural Enzymes:</b><br /><span class='highlight'>" + this.active_record.fields["SE"] + "</span><br>";

                    if (Lang13.Bool(this.diskette) && Lang13.Bool(this.diskette.fields))
                    {
                        dat += "<div class='block'>";
                        dat += "<h4>Inserted Disk</h4>";
                        dat += "<b>Contents:</b> ";
                        L    = new ByTable();

                        if (Lang13.Bool(this.diskette.fields["UI"]))
                        {
                            L.Add("Unique Identifier");
                        }

                        if (Lang13.Bool(this.diskette.fields["UE"]) && Lang13.Bool(this.diskette.fields["name"]) && Lang13.Bool(this.diskette.fields["blood_type"]))
                        {
                            L.Add("Unique Enzymes");
                        }

                        if (Lang13.Bool(this.diskette.fields["SE"]))
                        {
                            L.Add("Structural Enzymes");
                        }
                        dat += GlobalFuncs.english_list(L, "Empty", " + ", " + ");
                        dat += new Txt("<br /><a href='byond://?src=").Ref(this).str(";disk=load'>Load from Disk</a>").ToString();
                        dat += new Txt("<br /><a href='byond://?src=").Ref(this).str(";disk=save'>Save to Disk</a>").ToString();
                        dat += "</div>";
                    }
                    dat += new Txt("<font size=1><a href='byond://?src=").Ref(this).str(";del_rec=1'>Delete Record</a></font>").ToString();
                }
                break;

            case 4:

                if (!(this.active_record != null))
                {
                    this.menu = 2;
                }
                dat  = "" + this.temp + "<br>";
                dat += "<h3>Confirm Record Deletion</h3>";
                dat += new Txt("<b><a href='byond://?src=").Ref(this).str(";del_rec=1'>Scan card to confirm.</a></b><br>").ToString();
                dat += new Txt("<b><a href='byond://?src=").Ref(this).str(";menu=3'>Cancel</a></b>").ToString();
                break;
            }
            popup = new Browser(user, "cloning", "Cloning System Control");
            popup.set_content(dat);
            popup.set_title_image(((Mob)user).browse_rsc_icon(this.icon, this.icon_state));
            popup.open();
            return(null);
        }
예제 #27
0
        // Function from file: message.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string              dkey     = null;
            string              dkey2    = null;
            string              newkey   = null;
            ByTable             sendPDAs = null;
            Obj_Item_Device_Pda PDARec   = null;
            Obj_Item_Device_Pda P        = null;
            Ent_Static          H        = null;
            Ent_Static          H2       = null;


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

            if (Task13.User.contents.Find(this) != 0 || Map13.GetDistance(this, Task13.User) <= 1 && this.loc is Tile || Task13.User is Mob_Living_Silicon)
            {
                if (Lang13.Bool(href_list["auth"]))
                {
                    if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.auth   = false;
                        this.screen = 0;
                    }
                    else
                    {
                        dkey = GlobalFuncs.trim(Interface13.Input(Task13.User, "Please enter the decryption key.", null, null, null, InputType.Str | InputType.Null));

                        if (Lang13.Bool(dkey) && dkey != "")
                        {
                            if (this.linkedServer.decryptkey == dkey)
                            {
                                this.auth = true;
                            }
                            else
                            {
                                this.message = this.incorrectkey;
                            }
                        }
                    }
                }

                if (Lang13.Bool(href_list["active"]))
                {
                    if (this.auth)
                    {
                        this.linkedServer.active = !Lang13.Bool(this.linkedServer.active);
                    }
                }

                if (Lang13.Bool(href_list["find"]))
                {
                    if (GlobalVars.message_servers != null && GlobalVars.message_servers.len > 1)
                    {
                        this.linkedServer = Interface13.Input(Task13.User, "Please select a server.", "Select a server.", null, GlobalVars.message_servers, InputType.Null | InputType.Any);
                        this.message      = "<span class='alert'>NOTICE: Server selected.</span>";
                    }
                    else if (GlobalVars.message_servers != null && GlobalVars.message_servers.len > 0)
                    {
                        this.linkedServer = GlobalVars.message_servers[1];
                        this.message      = "<span class='notice'>NOTICE: Only Single Server Detected - Server selected.</span>";
                    }
                    else
                    {
                        this.message = this.noserver;
                    }
                }

                if (Lang13.Bool(href_list["view"]))
                {
                    if (this.linkedServer == null || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.screen = 1;
                    }
                }

                if (Lang13.Bool(href_list["clear"]))
                {
                    if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.linkedServer.pda_msgs = new ByTable();
                        this.message = "<span class='notice'>NOTICE: Logs cleared.</span>";
                    }
                }

                if (Lang13.Bool(href_list["clearr"]))
                {
                    if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.linkedServer.rc_msgs = new ByTable();
                        this.message = "<span class='notice'>NOTICE: Logs cleared.</span>";
                    }
                }

                if (Lang13.Bool(href_list["pass"]))
                {
                    if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        dkey2 = GlobalFuncs.trim(Interface13.Input(Task13.User, "Please enter the decryption key.", null, null, null, InputType.Str | InputType.Null));

                        if (Lang13.Bool(dkey2) && dkey2 != "")
                        {
                            if (this.linkedServer.decryptkey == dkey2)
                            {
                                newkey = GlobalFuncs.trim(Interface13.Input(Task13.User, "Please enter the new key (3 - 16 characters max):", null, null, null, InputType.Any));

                                if (Lang13.Length(newkey) <= 3)
                                {
                                    this.message = "<span class='notice'>NOTICE: Decryption key too short!</span>";
                                }
                                else if (Lang13.Length(newkey) > 16)
                                {
                                    this.message = "<span class='notice'>NOTICE: Decryption key too long!</span>";
                                }
                                else if (Lang13.Bool(newkey) && newkey != "")
                                {
                                    this.linkedServer.decryptkey = newkey;
                                }
                                this.message = "<span class='notice'>NOTICE: Decryption key set.</span>";
                            }
                            else
                            {
                                this.message = this.incorrectkey;
                            }
                        }
                    }
                }

                if (Lang13.Bool(href_list["hack"]))
                {
                    if (Task13.User is Mob_Living_Silicon && GlobalFuncs.is_special_character(Task13.User) != 0)
                    {
                        this.hacking = true;
                        this.screen  = 2;
                        Task13.Schedule(Lang13.Length(this.linkedServer.decryptkey) * 100, (Task13.Closure)(() => {
                            if (this != null && Lang13.Bool(this.linkedServer) && Task13.User != null)
                            {
                                this.BruteForce(Task13.User);
                            }
                            return;
                        }));
                    }
                }

                if (Lang13.Bool(href_list["delete"]))
                {
                    if (this.screen == 1)
                    {
                        if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                        {
                            this.message = this.noserver;
                        }
                        else
                        {
                            this.linkedServer.pda_msgs.Remove(Lang13.FindObj(href_list["delete"]));
                            this.message = "<span class='notice'>NOTICE: Log Deleted!</span>";
                        }
                    }
                }

                if (Lang13.Bool(href_list["deleter"]))
                {
                    if (this.screen == 4)
                    {
                        if (!Lang13.Bool(this.linkedServer) || Lang13.Bool(this.linkedServer.stat & 3))
                        {
                            this.message = this.noserver;
                        }
                        else
                        {
                            this.linkedServer.rc_msgs.Remove(Lang13.FindObj(href_list["deleter"]));
                            this.message = "<span class='notice'>NOTICE: Log Deleted!</span>";
                        }
                    }
                }

                if (Lang13.Bool(href_list["msg"]))
                {
                    if (this.linkedServer == null || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.screen = 3;
                    }
                }

                if (Lang13.Bool(href_list["select"]))
                {
                    if (this.linkedServer == null || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                        this.screen  = 0;
                    }
                    else
                    {
                        dynamic _b = href_list["select"];                         // Was a switch-case, sorry for the mess.
                        if (_b == "Reset")
                        {
                            this.ResetMessage();
                        }
                        else if (_b == "Sender")
                        {
                            this.customsender = GlobalFuncs.stripped_input(Task13.User, "Please enter the sender's name.");
                        }
                        else if (_b == "Recepient")
                        {
                            sendPDAs = GlobalFuncs.get_viewable_pdas();

                            if (GlobalVars.PDAs != null && GlobalVars.PDAs.len > 0)
                            {
                                this.customrecepient = Interface13.Input(Task13.User, "Select a PDA from the list.", null, null, GlobalFuncs.sortNames(sendPDAs), InputType.Null | InputType.Any);
                            }
                            else
                            {
                                this.customrecepient = null;
                            }
                        }
                        else if (_b == "RecJob")
                        {
                            this.customjob = GlobalFuncs.stripped_input(Task13.User, "Please enter the sender's job.");
                        }
                        else if (_b == "Message")
                        {
                            this.custommessage = GlobalFuncs.stripped_input(Task13.User, "Please enter your message.");
                        }
                        else if (_b == "Send")
                        {
                            if (this.customsender == null || this.customsender == "")
                            {
                                this.customsender = "UNKNOWN";
                            }

                            if (this.customrecepient == null)
                            {
                                this.message = "<span class='notice'>NOTICE: No recepient selected!</span>";
                                return(this.attack_hand(Task13.User));
                            }

                            if (this.custommessage == null || this.custommessage == "")
                            {
                                this.message = "<span class='notice'>NOTICE: No message entered!</span>";
                                return(this.attack_hand(Task13.User));
                            }
                            PDARec = null;

                            foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.get_viewable_pdas(), typeof(Obj_Item_Device_Pda)))
                            {
                                P = _a;


                                if (P.owner == this.customsender)
                                {
                                    PDARec = P;
                                }
                            }

                            if (PDARec == null)
                            {
                                ((Obj_Machinery_MessageServer)this.linkedServer).send_pda_message("" + this.customrecepient.owner, "" + this.customsender, "" + this.custommessage);
                                this.customrecepient.tnote += new Txt("<i><b>&larr; From <a href='byond://?src=").Ref(this.customrecepient).str(";choice=Message;target=").Ref(this).str("'>").item(this.customsender).str("</a> (").item(this.customjob).str("):</b></i><br>").item(this.custommessage).str("<br>").ToString();

                                if (!Lang13.Bool(this.customrecepient.silent))
                                {
                                    GlobalFuncs.playsound(this.customrecepient.loc, "sound/machines/twobeep.ogg", 50, 1);
                                    ((Ent_Static)this.customrecepient).audible_message(new Txt().icon(this.customrecepient).str(" *").item(this.customrecepient.ttone).str("*").ToString(), null, 3);

                                    if (this.customrecepient.loc != null && this.customrecepient.loc is Mob_Living_Carbon_Human)
                                    {
                                        H = this.customrecepient.loc;
                                        ((dynamic)H).WriteMsg(new Txt().icon(this.customrecepient).str(" <b>Message from ").item(this.customsender).str(" (").item(this.customjob).str("), </b>\"").item(this.custommessage).str("\" (<a href='byond://?src=").Ref(this).str(";choice=Message;skiprefresh=1;target=").Ref(this).str("'>Reply</a>)").ToString());
                                    }
                                    GlobalFuncs.log_pda("" + Task13.User + "/(" + Task13.User.ckey + ") (PDA: " + this.customsender + ") sent \"" + this.custommessage + "\" to " + this.customrecepient.owner);
                                    this.customrecepient.overlays.Cut();
                                    this.customrecepient.overlays += new Image("icons/obj/pda.dmi", "pda-r");
                                }
                            }
                            else
                            {
                                ((Obj_Machinery_MessageServer)this.linkedServer).send_pda_message("" + this.customrecepient.owner, "" + PDARec.owner, "" + this.custommessage);
                                this.customrecepient.tnote += new Txt("<i><b>&larr; From <a href='byond://?src=").Ref(this.customrecepient).str(";choice=Message;target=").Ref(PDARec).str("'>").item(PDARec.owner).str("</a> (").item(this.customjob).str("):</b></i><br>").item(this.custommessage).str("<br>").ToString();

                                if (!Lang13.Bool(this.customrecepient.silent))
                                {
                                    GlobalFuncs.playsound(this.customrecepient.loc, "sound/machines/twobeep.ogg", 50, 1);
                                    ((Ent_Static)this.customrecepient).audible_message(new Txt().icon(this.customrecepient).str(" *").item(this.customrecepient.ttone).str("*").ToString(), null, 3);

                                    if (this.customrecepient.loc != null && this.customrecepient.loc is Mob_Living_Carbon_Human)
                                    {
                                        H2 = this.customrecepient.loc;
                                        ((dynamic)H2).WriteMsg(new Txt().icon(this.customrecepient).str(" <b>Message from ").item(PDARec.owner).str(" (").item(this.customjob).str("), </b>\"").item(this.custommessage).str("\" (<a href='byond://?src=").Ref(this.customrecepient).str(";choice=Message;skiprefresh=1;target=").Ref(PDARec).str("'>Reply</a>)").ToString());
                                    }
                                    GlobalFuncs.log_pda("" + Task13.User + "/(" + Task13.User.ckey + ") (PDA: " + PDARec.owner + ") sent \"" + this.custommessage + "\" to " + this.customrecepient.owner);
                                    this.customrecepient.overlays.Cut();
                                    this.customrecepient.overlays += new Image("icons/obj/pda.dmi", "pda-r");
                                }
                            }
                            this.ResetMessage();
                        }
                    }
                }

                if (Lang13.Bool(href_list["viewr"]))
                {
                    if (this.linkedServer == null || Lang13.Bool(this.linkedServer.stat & 3))
                    {
                        this.message = this.noserver;
                    }
                    else if (this.auth)
                    {
                        this.screen = 4;
                    }
                }

                if (Lang13.Bool(href_list["back"]))
                {
                    this.screen = 0;
                }
            }
            return(this.attack_hand(Task13.User));
        }
예제 #28
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);
        }
예제 #29
0
파일: DmmSuite.cs 프로젝트: Somnium13/SS13
        // Function from file: reader.dm
        public void parse_grid(string model = null, int xcrd = 0, double ycrd = 0, int zcrd = 0)
        {
            ByTable members            = null;
            ByTable members_attributes = null;
            double  index            = 0;
            int     old_position     = 0;
            int     dpos             = 0;
            string  full_def         = null;
            Type    atom_def         = null;
            ByTable fields           = null;
            int     variables_start  = 0;
            ByTable turfs_underlays  = null;
            dynamic instance         = null;
            Tile    crds             = null;
            int     first_turf_index = 0;
            dynamic T  = null;
            dynamic UT = null;

            members            = new ByTable();
            members_attributes = new ByTable();
            index        = 1;
            old_position = 1;

            do
            {
                dpos     = this.find_next_delimiter_position(model, old_position, ",", "{", "}");
                full_def = String13.SubStr(model, old_position, dpos);
                atom_def = Lang13.FindClass(String13.SubStr(full_def, 1, String13.FindIgnoreCase(full_def, "{", 1, 0)));
                members.Add(atom_def);
                old_position    = dpos + 1;
                fields          = new ByTable();
                variables_start = String13.FindIgnoreCase(full_def, "{", 1, 0);

                if (variables_start != 0)
                {
                    full_def = String13.SubStr(full_def, variables_start + 1, Lang13.Length(full_def));
                    fields   = this.readlist(full_def, ";");
                }
                members_attributes.len++;
                members_attributes[index++] = fields;
                Task13.Sleep(-1);
            } while (dpos != 0);
            turfs_underlays = new ByTable();
            index           = members.len;
            GlobalVars._preloader.setup(members_attributes[index]);
            instance = Lang13.FindObj(members[index]);
            crds     = Map13.GetTile(xcrd, ((int)(ycrd)), zcrd);

            if (crds != null)
            {
                instance.contents.Add(crds);
            }

            if (Lang13.Bool(GlobalVars.use_preloader) && Lang13.Bool(instance))
            {
                GlobalVars._preloader.load(instance);
            }
            members.Remove(members[index]);
            first_turf_index = 1;

            while (!Lang13.Bool(members[first_turf_index].IsSubclassOf(typeof(Tile))))
            {
                first_turf_index++;
            }
            T = this.instance_atom(members[first_turf_index], members_attributes[first_turf_index], xcrd, ycrd, zcrd);

            if (Lang13.Bool(T))
            {
                index = first_turf_index + 1;

                while (index <= members.len)
                {
                    turfs_underlays.Insert(1, new Image(T.icon, null, T.icon_state, T.layer, T.dir));
                    UT = this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
                    this.add_underlying_turf(UT, T, turfs_underlays);
                    T = UT;
                    index++;
                }
            }

            foreach (dynamic _a in Lang13.IterateRange(1, first_turf_index - 1))
            {
                index = _a;

                this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
            }
            return;
        }
예제 #30
0
파일: Swapmap.cs 프로젝트: Somnium13/SS13
        // Function from file: swapmaps.dm
        public override void Read(SaveFile F = null, dynamic __id = null, dynamic locorner = null)
        {
            double     x       = 0;
            double     y       = 0;
            double     z       = 0;
            dynamic    n       = null;
            dynamic    areas   = null;
            dynamic    defarea = null;
            dynamic    dummy   = null;
            string     oldcd   = null;
            dynamic    tp      = null;
            dynamic    T       = null;
            Ent_Static A       = null;
            Obj        O       = null;
            dynamic    M       = null;

            defarea = Lang13.FindObj(Game13.default_zone);
            this.id = __id;

            if (Lang13.Bool(locorner))
            {
                this.ischunk = true;
                this.x1      = Convert.ToInt32(locorner.x);
                this.y1      = Convert.ToInt32(locorner.y);
                this.z1      = Lang13.IntNullable(locorner.z);
            }

            if (!Lang13.Bool(defarea))
            {
                defarea = Lang13.Call(Game13.default_zone);
            }

            if (!Lang13.Bool(__id))
            {
                this.id = F.ReadItem("id", this.id);
            }
            else
            {
                dummy = F.ReadItem("id", dummy);
            }
            this.z2     = F.ReadItem("z", this.z2);
            this.y2     = F.ReadItem("y", this.y2);
            this.x2     = F.ReadItem("x", this.x2);
            areas       = F.ReadItem("areas", areas);
            this.locked = true;
            this.AllocateSwapMap();
            oldcd = F.cd;

            foreach (dynamic _e in Lang13.IterateRange(this.z1, this.z2))
            {
                z = _e;

                F.cd = "" + (z - (this.z1 ?? 0) + 1);

                foreach (dynamic _d in Lang13.IterateRange(this.y1, this.y2))
                {
                    y = _d;

                    F.cd = "" + (y - this.y1 + 1);

                    foreach (dynamic _c in Lang13.IterateRange(this.x1, this.x2))
                    {
                        x = _c;

                        F.cd = "" + (x - this.x1 + 1);
                        tp   = null;
                        tp   = F.ReadItem("type", tp);
                        T    = Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z)));
                        T.loc.contents.Remove(T);
                        T = Lang13.Call(tp, Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z))));

                        if (F.dir.Contains("AREA"))
                        {
                            n = F.ReadItem("AREA", n);
                            A = areas[n];
                            A.contents.Add(T);
                        }
                        else
                        {
                            defarea.contents.Add(T);
                        }

                        foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj)))
                        {
                            O = _a;

                            GlobalFuncs.qdel(O);
                        }

                        foreach (dynamic _b in Lang13.Enumerate(T))
                        {
                            M = _b;


                            if (!Lang13.Bool(M.key))
                            {
                                GlobalFuncs.qdel(M);
                            }
                            else
                            {
                                M.loc = null;
                            }
                        }
                        ((Base_Data)T).Read(F);
                        F.cd = "..";
                    }
                    F.cd = "..";
                }
                Task13.Sleep(0);
                F.cd = oldcd;
            }
            this.locked = false;
            GlobalFuncs.qdel(areas);
            return;
        }