public void Activate(Mobile m) { CheckDoors(); DoorOne.Open = false; DoorTwo.Open = false; DoorOne.Locked = true; DoorTwo.Locked = true; Effects.PlaySound(DoorOne.Location, DoorOne.Map, 0x241); Effects.PlaySound(DoorTwo.Location, DoorTwo.Map, 0x241); if (Guardians == null) { Guardians = new List <DarkGuardian>(); } int count = 0; foreach (var mob in this.GetEnumeratedMobiles().Where(mob => mob is PlayerMobile || (mob is BaseCreature && ((BaseCreature)mob).GetMaster() != null && !mob.IsDeadBondedPet))) { if (mob.NetState != null) { mob.SendLocalizedMessage(1050000, "", 365); // The locks on the door click loudly and you begin to hear a faint hissing near the walls. } if (mob.Alive) { count++; } } count = Math.Max(1, count * 2); for (int i = 0; i < count; i++) { DarkGuardian guardian = new DarkGuardian(); int x = Utility.RandomMinMax(PentagramBounds.X, PentagramBounds.X + PentagramBounds.Width); int y = Utility.RandomMinMax(PentagramBounds.Y, PentagramBounds.Y + PentagramBounds.Height); int z = Map.Malas.GetAverageZ(x, y); guardian.MoveToWorld(new Point3D(x, y, z), Map.Malas); Guardians.Add(guardian); guardian.Combatant = m; } if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } m_Timer = new InternalTimer(this); m_Timer.Start(); }
public void ClearRoom() { IPooledEnumerable eable = Map.Malas.GetMobilesInBounds(Rect); ArrayList list = new ArrayList(); foreach (object obj in eable) { if (obj is Mobile) { Mobile mobile = obj as Mobile; if (mobile != null) { if (mobile.Player) { mobile.SendLocalizedMessage(1050055, null, 0x41); // You hear the doors unlocking and the hissing stops. } if (mobile is DarkGuardian) { list.Add(mobile); } } } } eable.Free(); for (int i = 0; i < list.Count; i++) { DarkGuardian guardian = list[i] as DarkGuardian; if (guardian != null) { guardian.Delete(); } } if (m_Door != null && m_Door.Link != null) { m_Door.Locked = false; m_Door.Link.Locked = false; } if (m_Timer != null) { m_Timer.Stop(); } InternalTimer timer = new InternalTimer(this); // at OSI we have some delay for looting corpses ;-) timer.Start(); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (m != null && m_Door != null && !m_Door.Locked && !m_Door.Open && m.Player && m.Alive && m_CanActive) { IPooledEnumerable eable = Map.Malas.GetMobilesInBounds(Rect); foreach (object obj in eable) { if (obj is Mobile) { Mobile mobile = obj as Mobile; if (mobile != null && !(mobile is DarkGuardian)) { if (mobile.Player) { mobile.SendLocalizedMessage(1050000, null, 0x41); // The locks on the door click loudly and you begin to hear a faint hissing near the walls. } for (int j = 0; j < 2; j++) { DarkGuardian guard = new DarkGuardian(); guard.Map = Map.Malas; guard.Location = new Point3D(365, 15, -1); } } } } eable.Free(); m_Door.Locked = true; m_Door.Link.Locked = true; if (m_Timer != null) { m_Timer.Stop(); } m_Timer = new PoisonTimer(this); m_Timer.Start(); m_CanActive = false; } }
public void Activate(Mobile m) { CheckDoors(); DoorOne.Open = false; DoorTwo.Open = false; DoorOne.Locked = true; DoorTwo.Locked = true; Effects.PlaySound(DoorOne.Location, DoorOne.Map, 0x241); Effects.PlaySound(DoorTwo.Location, DoorTwo.Map, 0x241); if (Guardians == null) { Guardians = new List <DarkGuardian>(); } int count = MobileCount() * 2; for (int i = 0; i < count; i++) { DarkGuardian guardian = new DarkGuardian(); int x = Utility.RandomMinMax(PentagramBounds.X, PentagramBounds.X + PentagramBounds.Width); int y = Utility.RandomMinMax(PentagramBounds.Y, PentagramBounds.Y + PentagramBounds.Height); int z = Map.Malas.GetAverageZ(x, y); guardian.MoveToWorld(new Point3D(x, y, z), Map.Malas); Guardians.Add(guardian); guardian.Combatant = m; } if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } m_Timer = new InternalTimer(this); m_Timer.Start(); }
public void SpawnGuardians(int amount) { for (int i = 0; i < amount; ++i) { DarkGuardian guardian = new DarkGuardian(); switch (Utility.Random(4)) { case 0: guardian.MoveToWorld(new Point3D(364, 15, -1), Map.Malas); break; case 1: guardian.MoveToWorld(new Point3D(366, 15, -1), Map.Malas); break; case 2: guardian.MoveToWorld(new Point3D(365, 14, -1), Map.Malas); break; case 3: guardian.MoveToWorld(new Point3D(365, 16, -1), Map.Malas); break; } m_Guardians.Add(guardian); } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (!Rect.Contains(m.Location) || m is BaseCreature) { return; } if (m != null && m_Door != null && !m_Door.Locked && !m_Door.Open && m_Door.Link != null && !m_Door.Link.Locked && !m_Door.Link.Open && m.IsPlayer && m.Alive && m_CanActive) { m_CanActive = false; //Carrabas: Moved this here so it will not execute the OnMovement more than once while executing the loops int guardianCount = 0; foreach (var mobile in Map.GetMobilesInBounds(Rect).ToArray()) { if (!(mobile is DarkGuardian)) { if (mobile.IsPlayer) { mobile.SendLocalizedMessage(1050000, null, 0x41); // The locks on the door click loudly and you begin to hear a faint hissing near the walls. } guardianCount += 2; } } if (guardianCount > 12) { guardianCount = 12; } for (int j = 0; j < guardianCount; j++) { DarkGuardian guard = new DarkGuardian(); guard.Map = Map.Malas; guard.Location = guard.Map.GetSpawnPosition(new Point3D(365, 15, -1), 8); } for (int i = 0; i < 5; i++) { int x = Utility.Random(Rect.X, Rect.Width); int y = Utility.Random(Rect.Y, Rect.Height); GuardianTreasureChest chest = new GuardianTreasureChest(0xE41); int itemID = Utility.RandomList(chest.ItemIDs); chest.ItemID = itemID; chest.MoveToWorld(new Point3D(x, y, -1), Map.Malas); } m_Door.Locked = true; m_Door.Link.Locked = true; if (m_Timer != null) { m_Timer.Stop(); } m_Timer = new PoisonTimer(this); m_Timer.Start(); } }