Exemple #1
0
        // Function from file: events.dm
        public void fireEvent(params object[] _)
        {
            ByTable _args = new ByTable(new object[] {  }).Extend(_);

            dynamic _event = null;
            Event   E      = null;

            _event = GlobalFuncs.listgetindex(this.events, _args[1]);

            if (_event is ByTable)
            {
                Task13.Schedule(0, (Task13.Closure)(() => {
                    foreach (dynamic _a in Lang13.Enumerate(_event, typeof(Event)))
                    {
                        E = _a;


                        if (!Lang13.Bool(_args.Copy(2).Apply(Lang13.BindFunc(E, "Fire"))))
                        {
                            this.clearEvent(_args[1], E);
                        }
                    }
                    return;
                }));
            }
            return;
        }
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic list2stickyban( ByTable ban = null ) {
			dynamic _default = null;
			if ( !( ban != null ) || !( ban is ByTable ) ) {
				return null;
			}
			_default = ban.Copy();
			if ( Lang13.Bool( _default["keys"] ) ) {
				_default["keys"] = GlobalFuncs.list2text( _default["keys"], "," );
			}
			if ( Lang13.Bool( _default["type"] ) ) {
				_default["type"] = GlobalFuncs.list2text( _default["type"], "," );
			}
			if ( Lang13.Bool( _default["IP"] ) ) {
				_default["IP"] = GlobalFuncs.list2text( _default["IP"], "," );
			}
			if ( Lang13.Bool( _default["computer_id"] ) ) {
				_default["computer_id"] = GlobalFuncs.list2text( _default["computer_id"], "," );
			}
			_default = String13.conv_list2urlParams( _default );
			return _default;
		}
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable shuffle( ByTable L = null ) {
			int? i = null;
			if ( !( L != null ) ) {
				return null;
			}
			L = L.Copy();
			i = null;
			i = 1;
			while (( i ??0) < L.len) {
				L.Swap( i ??0, Rand13.Int( i ??0, L.len ) );
				i++;
			}
			return L;
		}
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void SetViruses( Reagent_Blood R = null, ByTable data = null ) {
			ByTable preserve = null;
			Disease A = null;
			if ( data != null ) {
				preserve = new ByTable();
				if ( data is ByTable && Lang13.Bool( data["viruses"] ) ) {
					A = null;
					foreach (dynamic _a in data["viruses"] ) {
						if ( !( _a is Disease ) ) {
							continue;
						}
						A = _a;
						preserve += A.Copy();
					};
					R.data = data.Copy();
				}
				if ( preserve.len != 0 ) {
					R.data["viruses"] = preserve;
				}
			}
			return;
		}
Exemple #5
0
 // Function from file: topic_input.dm
 public TopicInput(string thref = null, ByTable thref_list = null)
 {
     this.href      = thref;
     this.href_list = thref_list.Copy();
     return;
 }
Exemple #6
0
        // Function from file: scrolls.dm
        public void teleportscroll(Mob user = null)
        {
            dynamic   A       = null;
            Base_Data thearea = null;
            EffectSystem_SmokeSpread smoke = null;
            ByTable L       = null;
            dynamic T       = null;
            bool    clear   = false;
            Obj     O       = null;
            ByTable tempL   = null;
            dynamic attempt = null;
            bool    success = false;

            A       = Interface13.Input(user, "Area to jump to", "BOOYEA", A, GlobalVars.teleportlocs, InputType.Any);
            thearea = GlobalVars.teleportlocs[A];

            if (!(user != null) || user.stat != 0 || user.restrained() || this.uses <= 0)
            {
                return;
            }

            if (!(user == this.loc || Map13.GetDistance(this, user) <= 1 && this.loc is Tile))
            {
                return;
            }
            smoke = new EffectSystem_SmokeSpread();
            smoke.set_up(2, user.loc);
            smoke.attach(user);
            smoke.start();
            L = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_area_turfs(thearea.type)))
            {
                T = _b;


                if (!T.density)
                {
                    clear = true;

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


                        if (O.density)
                        {
                            clear = false;
                            break;
                        }
                    }

                    if (clear)
                    {
                        L.Add(T);
                    }
                }
            }

            if (!(L.len != 0))
            {
                user.WriteMsg("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.");
                return;
            }

            if (user != null && user.buckled != null)
            {
                user.buckled.unbuckle_mob();
            }
            tempL   = L.Copy();
            attempt = null;
            success = false;

            while (tempL.len != 0)
            {
                attempt = Rand13.PickFromTable(tempL);
                user.Move(attempt);

                if (GlobalFuncs.get_turf(user) == attempt)
                {
                    success = true;
                    break;
                }
                else
                {
                    tempL.Remove(attempt);
                }
            }

            if (!success)
            {
                user.loc = Rand13.PickFromTable(L);
            }
            smoke.start();
            this.uses -= 1;
            return;
        }
        // Function from file: autolathe.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Ent_Static     T               = null;
            double?        multiplier      = null;
            int            max_multiplier  = 0;
            dynamic        is_stack        = null;
            double         coeff           = 0;
            dynamic        metal_cost      = null;
            dynamic        glass_cost      = null;
            double         power           = 0;
            ByTable        materials_used  = null;
            dynamic        N               = null;
            Obj_Item_Stack S               = null;
            ByTable        materials_used2 = null;
            dynamic        new_item        = null;
            dynamic        v               = null;
            dynamic        D               = null;


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

            if (!this.busy)
            {
                if (Lang13.Bool(href_list["menu"]))
                {
                    this.screen = String13.ParseNumber(href_list["menu"]);
                }

                if (Lang13.Bool(href_list["category"]))
                {
                    this.selected_category = href_list["category"];
                }

                if (Lang13.Bool(href_list["make"]))
                {
                    T = this.loc;
                    this.being_built = this.files.FindDesignByID(href_list["make"]);

                    if (!(this.being_built != null))
                    {
                        return(null);
                    }
                    multiplier     = String13.ParseNumber(href_list["multiplier"]);
                    max_multiplier = Num13.MinInt(this.being_built.maxstack, ((int)((Lang13.Bool(this.being_built.materials["$metal"]) ? Num13.Floor((this.materials.amount("$metal") ?1:0) / Convert.ToDouble(this.being_built.materials["$metal"])) : Double.PositiveInfinity))), ((int)((Lang13.Bool(this.being_built.materials["$glass"]) ? Num13.Floor((this.materials.amount("$glass") ?1:0) / Convert.ToDouble(this.being_built.materials["$glass"])) : Double.PositiveInfinity))));
                    is_stack       = this.being_built.build_path.IsSubclassOf(typeof(Obj_Item_Stack));

                    if (!Lang13.Bool(is_stack) && (multiplier ?? 0) > 1)
                    {
                        return(null);
                    }

                    if (!new ByTable(new object [] { 1, 10, 25, max_multiplier }).Contains(multiplier))
                    {
                        return(null);
                    }
                    coeff      = (Lang13.Bool(is_stack) ? 1 : Math.Pow(2, this.prod_coeff));
                    metal_cost = this.being_built.materials["$metal"];
                    glass_cost = this.being_built.materials["$glass"];
                    power      = Num13.MaxInt(2000, Convert.ToInt32((metal_cost + glass_cost) * multiplier / 5));

                    if ((this.materials.amount("$metal") ?1:0) >= Convert.ToDouble(metal_cost * multiplier / coeff) && (this.materials.amount("$glass") ?1:0) >= Convert.ToDouble(glass_cost * multiplier / coeff))
                    {
                        this.busy = true;
                        this.f_use_power(power);
                        this.icon_state = "autolathe";
                        Icon13.Flick("autolathe_n", this);
                        Task13.Schedule(((int)(32 / coeff)), (Task13.Closure)(() => {
                            this.f_use_power(power);

                            if (Lang13.Bool(is_stack))
                            {
                                materials_used = new ByTable().Set("$metal", metal_cost * multiplier).Set("$glass", glass_cost * multiplier);
                                this.materials.use_amount(materials_used);
                                N = Lang13.Call(this.being_built.build_path, T, multiplier);
                                N.update_icon();
                                ((Obj_Item)N).autolathe_crafted(this);

                                foreach (dynamic _a in Lang13.Enumerate(T.contents - N, typeof(Obj_Item_Stack)))
                                {
                                    S = _a;


                                    if (Lang13.Bool(((dynamic)N.merge_type).IsInstanceOfType(S)))
                                    {
                                        N.merge(S);
                                    }
                                }
                            }
                            else
                            {
                                materials_used2 = new ByTable().Set("$metal", metal_cost / coeff).Set("$glass", glass_cost / coeff);
                                this.materials.use_amount(materials_used2);
                                new_item           = Lang13.Call(this.being_built.build_path, T);
                                new_item.materials = materials_used2.Copy();
                                ((Obj_Item)new_item).autolathe_crafted(this);
                            }
                            this.busy = false;
                            this.updateUsrDialog();
                            return;
                        }));
                    }
                }

                if (Lang13.Bool(href_list["search"]))
                {
                    this.matching_designs.Cut();

                    foreach (dynamic _b in Lang13.Enumerate(this.files.known_designs))
                    {
                        v = _b;

                        D = this.files.known_designs[v];

                        if (String13.FindIgnoreCase(D.name, href_list["to_search"], 1, 0) != 0)
                        {
                            this.matching_designs.Add(D);
                        }
                    }
                }
            }
            else
            {
                Task13.User.WriteMsg("<span class=\"alert\">The autolathe is busy. Please wait for completion of previous operation.</span>");
            }
            this.updateUsrDialog();
            return(null);
        }