public Mobile SpawnGeneral(BarrierCrystal crystal) { try { Mobile m = Activator.CreateInstance(m_SpawnList.GetRandomGeneral()) as Mobile; m.OnBeforeSpawn(crystal.Location, crystal.Map); m.MoveToWorld(crystal.Location, crystal.Map); m.OnAfterSpawn(); return m; } catch { } return null; }
public ArrayList SpawnMinions(int amount, BarrierCrystal crystal) { ArrayList list = new ArrayList(); for (int i = 0; i < amount; i++) { try { Mobile m = Activator.CreateInstance(m_SpawnList.GetRandomMinion()) as Mobile; m.OnBeforeSpawn(crystal.Location, crystal.Map); m.MoveToWorld(crystal.Location, crystal.Map); m.OnAfterSpawn(); list.Add(m); } catch { } } return list; }
public CitySpawner(BarrierCrystal crystal) { m_Crystal = crystal; GetSpawnList(); }
public static CitySpawnList GetRandomSpawnList(BarrierCrystal.Difficulty difficulty ) { switch (difficulty) { case BarrierCrystal.Difficulty.Novice: { if (m_Novice != null) { List<CitySpawnList> lists = new List<CitySpawnList>(); foreach (string list in m_Novice.Keys) { CitySpawnList n; m_Novice.TryGetValue(list, out n); lists.Add(n); } if (lists.Count > 0) return lists[Utility.Random(lists.Count)]; } break; } case BarrierCrystal.Difficulty.Expert: { if (m_Expert != null) { List<CitySpawnList> lists = new List<CitySpawnList>(); foreach (string list in m_Expert.Keys) { CitySpawnList n; m_Expert.TryGetValue(list, out n); lists.Add(n); } if (lists.Count > 0) return lists[Utility.Random(lists.Count)]; } break; } case BarrierCrystal.Difficulty.Master: { if (m_Master != null) { List<CitySpawnList> lists = new List<CitySpawnList>(); foreach (string list in m_Master.Keys) { CitySpawnList n; m_Master.TryGetValue(list, out n); lists.Add(n); } if (lists.Count > 0) return lists[Utility.Random(lists.Count)]; } break; } } if (m_Notset != null) { List<CitySpawnList> lists = new List<CitySpawnList>(); foreach (string list in m_Notset.Keys) { CitySpawnList n; m_Notset.TryGetValue(list, out n); lists.Add(n); } if (lists.Count > 0) return lists[Utility.Random(lists.Count)]; } return null; }
public LeaderDeathTimer(BarrierCrystal crystal) : base(TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(0.1)) { m_Crystal = crystal; Priority = TimerPriority.TenMS; }
public DischargeTimer(BarrierCrystal crystal) : base(TimeSpan.FromSeconds(10.0), TimeSpan.FromSeconds(10.0)) { m_Crystal = crystal; Priority = TimerPriority.FiveSeconds; }
/// <summary> /// Initalizes the Guarded Region and determines the Major Crystal associated with it. /// </summary> public override void OnMapChange() { base.OnMapChange(); GuardedRegion GRegion = (GuardedRegion)Region.Find(this.Location, this.Map).GetRegion(typeof(GuardedRegion)); if (GRegion != null) { foreach (Rectangle3D r in GRegion.Area) { Rectangle2D rect = new Rectangle2D(r.Start, r.End); foreach (Item item in Map.GetItemsInBounds(rect)) { if (item is BarrierCrystal) { BarrierCrystal cryst = item as BarrierCrystal; m_MajorCrystal = cryst; if (!cryst.MinorCrystals.Contains(this)) cryst.MinorCrystals.Add(this); } } } } }
/// <summary> /// Loads the settings of the specific instances of this item /// </summary> /// <param name="reader"></param> public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); DischargeRate = reader.ReadEncodedInt(); m_MajorCrystal = reader.ReadItem<BarrierCrystal>(); m_Charges = reader.ReadEncodedInt(); m_Locked = reader.ReadBool(); m_DischargeTimer = new DischargeTimer(this); m_RelockTimer = new RelockTimer(this); this.CheckTimers(); }