public void CreateMonster(int[] spawnPointIds, bool arg2, int arg3) { foreach (int spawnPointId in spawnPointIds) { MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnPointId); if (spawnPoint == null) { continue; } for (int i = 0; i < spawnPoint.Count; i++) { foreach (string npcId in spawnPoint.NpcIds) { if (int.TryParse(npcId, out int id)) { Mob mob = new Mob(id); if (mob.Friendly != 2) { IFieldObject <Mob> fieldMob = Field.RequestFieldObject(mob); fieldMob.Coord = spawnPoint.Position; fieldMob.Rotation = spawnPoint.Rotation; Field.AddMob(fieldMob); continue; } IFieldObject <Npc> fieldNpc = Field.RequestFieldObject(new Npc(mob.Id)); fieldNpc.Coord = spawnPoint.Position; fieldNpc.Rotation = spawnPoint.Rotation; Field.AddNpc(fieldNpc); } } } } }
public void DestroyMonster(int[] rangeId, bool arg2) { foreach (int spawnPointId in rangeId) { MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnPointId); if (spawnPoint is null) { continue; } foreach (string npcId in spawnPoint.NpcIds) { if (!int.TryParse(npcId, out int id)) { continue; } IFieldActor <NpcMetadata> fieldNpc = Field.State.Npcs.Values.FirstOrDefault(x => x.Value.Id == id); if (fieldNpc is null) { continue; } Field.RemoveNpc(fieldNpc); } } }
public void MoveNpc(int spawnTriggerId, string patrolDataName) { (PatrolData, List <WayPoint>)patrolData = MapEntityStorage.GetPatrolData(Field.MapId, patrolDataName); MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnTriggerId); if (spawnPoint is null) { return; } foreach (string npcId in spawnPoint.NpcIds) { if (!int.TryParse(npcId, out int id)) { continue; } IFieldActor <NpcMetadata> fieldNpc = Field.State.Npcs.Values.FirstOrDefault(x => x.Value.Id == id); if (fieldNpc is null) { continue; } // Just setting the coord as the last waypoint for now, replace with moveTo later // fieldNpc.MoveTo(patrolData.Item2.Last().Position); fieldNpc.Coord = patrolData.Item2.Last().Position.ToFloat(); } }
public bool MonsterDead(int[] spawnPointIds, bool arg2) { // TODO: Needs a better check for multiple mob spawns foreach (int spawnPointId in spawnPointIds) { MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnPointId); if (spawnPoint == null) { continue; } foreach (string npcId in spawnPoint.NpcIds) { if (int.TryParse(npcId, out int id)) { if (Field.State.Mobs.Values.Where(x => x.Value.Id == id).Any()) { return false; } } } } return true; }
public void SpawnNpcRange(int[] rangeId, bool isAutoTargeting, byte randomPickCount, int score) { foreach (int spawnPointId in rangeId) { MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnPointId); if (spawnPoint == null) { continue; } foreach (string npcId in spawnPoint.NpcIds) { if (!int.TryParse(npcId, out int id)) { continue; } Field.RequestNpc(id, spawnPoint.Position, spawnPoint.Rotation); } } }
public void CreateMonster(int[] spawnPointIds, bool arg2, int arg3) { foreach (int spawnPointId in spawnPointIds) { MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnPointId); if (spawnPoint == null) { continue; } for (int i = 0; i < spawnPoint.Count; i++) { foreach (string npcId in spawnPoint.NpcIds) { if (int.TryParse(npcId, out int id)) { Field.RequestNpc(id, spawnPoint.Position, spawnPoint.Rotation); } } } } }