public override void ResolveTrap(Mobile from) { PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText); int creatures = (int)(Math.Ceiling((double)TrapDifficulty / 50)); for (int a = 0; a < creatures; a++) { Point3D spawnLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Z); SpellHelper.AdjustField(ref spawnLocation, Map, 12, false); int threatLevel = UOACZPersistance.m_ThreatLevel - 30; UOACZBaseUndead bc_Creature = (UOACZBaseUndead)Activator.CreateInstance(UOACZBaseUndead.GetRandomUndeadType(0, threatLevel)); if (bc_Creature != null) { if (Map.CanSpawnMobile(spawnLocation)) { bc_Creature.MoveToWorld(spawnLocation, Map); } else { if (UOACZSystem.IsUOACZValidMobile(from)) { spawnLocation = new Point3D(from.Location.X + Utility.RandomList(-1, 1), from.Location.Y + Utility.RandomList(-1, 1), from.Location.Z); SpellHelper.AdjustField(ref spawnLocation, Map, 12, false); if (Map.CanSpawnMobile(spawnLocation)) { bc_Creature.MoveToWorld(spawnLocation, Map); } else { bc_Creature.MoveToWorld(from.Location, Map); } } } } } TrapType = ScavengeTrapType.None; }
public override void Spawn(Point3D point, Map map) { if (!UOACZPersistance.Active) { return; } int creatureThreatLevel = UOACZPersistance.m_ThreatLevel; if (!m_Wilderness) { creatureThreatLevel -= 30; } int minThreatLevel = 0; int maxThreatLevel = creatureThreatLevel; if (m_MinThreatLevel > -1) { minThreatLevel = m_MinThreatLevel; } if (m_MaxThreatLevel > -1) { maxThreatLevel = m_MaxThreatLevel; } Type creatureType = UOACZBaseUndead.GetRandomUndeadType(minThreatLevel, maxThreatLevel); if (creatureType != null) { UOACZBaseUndead creature = (UOACZBaseUndead)Activator.CreateInstance(creatureType); if (creature != null) { creature.RangeHome = HomeRange; creature.Home = point; creature.m_Spawner = this; creature.InWilderness = m_Wilderness; creature.CanTeleportToBaseNode = m_AllowTeleportToBaseNode; creature.MoveToWorld(point, map); m_Mobiles.Add(creature); if (m_AllowTeleportToBaseNode) { if (m_GotoSplitGroup == -1) { creature.m_NeedWaypoint = true; } else { UOACZWayPoint closestWaypoint = null; int closestWaypointDistance = 100000; foreach (UOACZWayPoint waypoint in UOACZWayPoint.m_UOACZWaypoints) { if (waypoint == null) { continue; } if (waypoint.Deleted) { continue; } if (waypoint.m_GotoSplitGroup == -1) { continue; } if (!UOACZRegion.ContainsItem(waypoint)) { continue; } if (waypoint.WaypointType == UOACZWayPoint.UOACZWaypointType.UndeadTown && m_Wilderness) { continue; } if (waypoint.WaypointType == UOACZWayPoint.UOACZWaypointType.UndeadWilderness && !m_Wilderness) { continue; } if (waypoint.SplitGroup == m_GotoSplitGroup) { int distanceToWaypoint = Utility.GetDistance(creature.Location, waypoint.Location); if (distanceToWaypoint <= closestWaypointDistance) { closestWaypoint = waypoint; closestWaypointDistance = distanceToWaypoint; } } } if (closestWaypoint != null) { creature.CurrentWaypoint = closestWaypoint; } } } } } }