Exemple #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);
        }
Exemple #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);
        }
        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));
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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;
        }
Exemple #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;
            }
        }
Exemple #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");
        }
Exemple #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);
        }
Exemple #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;
            }
        }