private bool CreateMobSpawners( Random rng, out String result) { bool success = true; result = SuccessMessages.GENERAL_SUCCESS; for (RoomIndexIterator iterator = new RoomIndexIterator(m_roomGrid); success && iterator.Valid; iterator.Next()) { RoomIndex roomIndex = iterator.Current; RoomLayout room = GetRoomByIndex(roomIndex); RoomTemplate roomTemplate = m_roomTemplateSet.GetTemplateByName(room.static_room_data.room_template_name); foreach (MobSpawnerTemplate mobSpawnerTemplate in roomTemplate.MobSpawnerTemplates) { MobSpawner spawner = MobSpawner.CreateMobSpawner( room.room_key, mobSpawnerTemplate, m_mobSpawnTableSet, rng); // Don't bother adding mob spawners that don't have any spawns left if (spawner.RemainingSpawnCount > 0) { room.mobSpawners.Add(spawner); } } } return(success); }
public static List <MobSpawner> GetMobSpawners( AsyncRPGDataContext context, MobSpawnTableSet mobSpawnTableSet, RoomKey roomKey) { List <MobSpawner> mobSpawners = new List <MobSpawner>(); var roomMobSpawnerQuery = from s in context.MobSpawners where s.GameID == roomKey.game_id && s.RoomX == roomKey.x && s.RoomY == roomKey.y && s.RoomZ == roomKey.z select s; foreach (MobSpawners dbMobSpawner in roomMobSpawnerQuery) { MobSpawner mobSpawner = MobSpawner.CreateMobSpawner(dbMobSpawner, mobSpawnTableSet); mobSpawners.Add(mobSpawner); } return(mobSpawners); }