public static void OnLoad() { if (SpawnerCache.Spawners.Count == 0) { Console.Write("Loading spawner cache..."); int count = SpawnerCache.LoadSpawnerCache(); Console.WriteLine("done ({0} spawners loaded.)", count.ToString()); } Console.Write("Loading treasure map locations..."); int lcount = LoadLocations(); Console.WriteLine("done ({0} locations loaded.)", lcount.ToString()); }
public Mobile OverlandSpawnerSpawn(Mobile mob) { try { Spawner spawner = SpawnerCache.GetRandomSpawner(SpawnerCache.SpawnerType.Overland); if (spawner == null) { return(null); } Mobile m = SpawnAt(spawner, mob); return(m); } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Server.Engines.OverlandSpawner : Exception {0}", e); } return(null); }
/// <summary> /// Gets the city spawners. /// </summary> /// <param name="city">The city.</param> /// <returns></returns> private static List <Spawner> GetCitySpawners(KinFactionCities city) { return(SpawnerCache.GetSpawnersByRegion(city.ToString())); }
private static int LoadLocations() { string filePath = Path.Combine(Core.BaseDirectory, "Data/treasure.cfg"); ArrayList list = new ArrayList(); // first load up the standard OSI locations (we will still randomize around this point) if (File.Exists(filePath)) { using (StreamReader ip = new StreamReader(filePath)) { string line; while ((line = ip.ReadLine()) != null) { try { string[] split = line.Split(' '); int x = Convert.ToInt32(split[0]), y = Convert.ToInt32(split[1]); list.Add(new Point2D(x, y)); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } } // now load up the spawner locations if (Core.UOAI) { foreach (Spawner sx in SpawnerCache.Spawners) { Spawner random = sx; Region region = Server.Region.Find(random.Location, Map.Felucca); // Must be running if (!random.Running) { continue; } if (region != null) { // No Towns if (SpawnerCache.IsTown(region.Name)) { continue; } // no green acres, inside houses, etc.. if (SpawnerCache.IsValidRegion(random.Location, region) == false) { continue; } } list.Add(new Point2D(random.X, random.Y)); } } m_Locations = (Point2D[])list.ToArray(typeof(Point2D)); return(list.Count); }