Exemplo n.º 1
0
        private static BaseRegion GetCommandData(CommandEventArgs args)
        {
            Mobile from = args.Mobile;

            Region reg;

            if (args.Length == 0)
            {
                reg = from.Region;
            }
            else
            {
                string name = args.GetString(0);
                //reg = (Region) from.Map.Regions[name];

                if (!from.Map.Regions.TryGetValue(name, out reg))
                {
                    from.SendMessage("Could not find region '{0}'.", name);
                    return(null);
                }
            }

            BaseRegion br = reg as BaseRegion;

            if (br == null || br.Spawns == null)
            {
                from.SendMessage("There are no spawners in region '{0}'.", reg);
                return(null);
            }

            return(br);
        }
Exemplo n.º 2
0
        public static string GetRuneNameFor(Region region)
        {
            while (region != null)
            {
                BaseRegion br = region as BaseRegion;

                if (br != null && br.m_RuneName != null)
                {
                    return(br.m_RuneName);
                }

                if (br == null)
                {
                    return("an unknown location");
                }

                if (region.Parent != null)
                {
                    return(region.Parent.ToString());
                }
                else
                {
                    return(region.ToString());
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        public override ISpawnable Spawn(SpawnEntry entry)
        {
            BaseRegion region = entry.Region;
            Map        map    = region.Map;

            Point3D loc = entry.RandomSpawnLocation(Height, Land, Water);

            if (loc == Point3D.Zero)
            {
                return(null);
            }

            return(Construct(entry, loc, map));
        }
Exemplo n.º 4
0
        public static string GetRuneNameFor(Region region)
        {
            while (region != null)
            {
                BaseRegion br = region as BaseRegion;

                if (br != null && br.m_RuneName != null)
                {
                    return(br.m_RuneName);
                }

                region = region.Parent;
            }

            return(null);
        }
Exemplo n.º 5
0
        private static void StopRegionSpawns_OnCommand(CommandEventArgs args)
        {
            BaseRegion region = GetCommandData(args);

            if (region == null)
            {
                return;
            }

            for (int i = 0; i < region.Spawns.Length; i++)
            {
                region.Spawns[i].Stop();
            }

            args.Mobile.SendMessage("Spawners of region '{0}' have stopped.", region);
        }
Exemplo n.º 6
0
        private static void DelRegionSpawns_OnCommand(CommandEventArgs args)
        {
            BaseRegion region = GetCommandData(args);

            if (region == null)
            {
                return;
            }

            for (int i = 0; i < region.Spawns.Length; i++)
            {
                region.Spawns[i].DeleteSpawnedObjects();
            }

            args.Mobile.SendMessage("Spawned objects of region '{0}' have been deleted.", region);
        }
Exemplo n.º 7
0
        private static void RespawnRegion_OnCommand(CommandEventArgs args)
        {
            BaseRegion region = GetCommandData(args);

            if (region == null)
            {
                return;
            }

            for (int i = 0; i < region.Spawns.Length; i++)
            {
                region.Spawns[i].Respawn();
            }

            args.Mobile.SendMessage("Region '{0}' has respawned.", region);
        }
Exemplo n.º 8
0
        public SpawnEntry(int id, BaseRegion region, Point3D home, int range, Direction direction, SpawnDefinition definition, int max, TimeSpan minSpawnTime, TimeSpan maxSpawnTime)
        {
            this.m_ID = id;
            this.m_Region = region;
            this.m_Home = home;
            this.m_Range = range;
            this.m_Direction = direction;
            this.m_Definition = definition;
            this.m_SpawnedObjects = new List<ISpawnable>();
            this.m_Max = max;
            this.m_MinSpawnTime = minSpawnTime;
            this.m_MaxSpawnTime = maxSpawnTime;
            this.m_Running = false;

            if (m_Table.Contains(id))
                Console.WriteLine("Warning: double SpawnEntry ID '{0}'", id);
            else
                m_Table[id] = this;
        }
Exemplo n.º 9
0
        public SpawnEntry(int id, BaseRegion region, Point3D home, int range, Direction direction, SpawnDefinition definition, int max, TimeSpan minSpawnTime, TimeSpan maxSpawnTime)
        {
            this.m_ID             = id;
            this.m_Region         = region;
            this.m_Home           = home;
            this.m_Range          = range;
            this.m_Direction      = direction;
            this.m_Definition     = definition;
            this.m_SpawnedObjects = new List <ISpawnable>();
            this.m_Max            = max;
            this.m_MinSpawnTime   = minSpawnTime;
            this.m_MaxSpawnTime   = maxSpawnTime;
            this.m_Running        = false;

            if (m_Table.Contains(id))
            {
                Console.WriteLine("Warning: double SpawnEntry ID '{0}'", id);
            }
            else
            {
                m_Table[id] = this;
            }
        }
Exemplo n.º 10
0
        public static string GetRuneNameFor(Region region)
        {
            while (region != null)
            {
                BaseRegion br = region as BaseRegion;

                if (br != null && br.RuneName != null)
                {
                    return(br.RuneName);
                }
                if (region.Parent == null)
                {
                    if (br.Name != null)
                    {
                        return(br.Name);
                    }
                    return("Felucca");
                }

                region = region.Parent;
            }
            return("Felucca");
        }
Exemplo n.º 11
0
        public static bool CanSpawn(Region region, params Type[] types)
        {
            while (region != null)
            {
                if (!region.AllowSpawn())
                {
                    return(false);
                }

                BaseRegion br = region as BaseRegion;

                if (br != null)
                {
                    if (br.Spawns != null)
                    {
                        for (int i = 0; i < br.Spawns.Length; i++)
                        {
                            SpawnEntry entry = br.Spawns[i];

                            if (entry.Definition.CanSpawn(types))
                            {
                                return(true);
                            }
                        }
                    }

                    if (br.ExcludeFromParentSpawns)
                    {
                        return(false);
                    }
                }

                region = region.Parent;
            }

            return(false);
        }
Exemplo n.º 12
0
        public SpawnEntry(int id, BaseRegion region, Point3D home, int range, Direction direction,
                          SpawnDefinition definition, int max, TimeSpan minSpawnTime, TimeSpan maxSpawnTime)
        {
            ID             = id;
            Region         = region;
            HomeLocation   = home;
            HomeRange      = range;
            Direction      = direction;
            Definition     = definition;
            SpawnedObjects = new List <ISpawnable>();
            Max            = max;
            MinSpawnTime   = minSpawnTime;
            MaxSpawnTime   = maxSpawnTime;
            Running        = false;

            if (Table.ContainsKey(id))
            {
                Console.WriteLine("Warning: double SpawnEntry ID '{0}'", id);
            }
            else
            {
                Table[id] = this;
            }
        }