def createLawOffice(self, StageId, entranceId, players): for avId in players: if bboard.has('StageId-%s' % avId): StageId = bboard.get('StageId-%s' % avId) break floor = 0 layoutIndex = None for avId in players: if bboard.has('stageRoom-%s' % avId): roomId = bboard.get('stageRoom-%s' % avId) for lt in StageId2Layouts[StageId]: for i in xrange(StageLayout.getNumFloors(lt)): layout = StageLayout.StageLayout(StageId, i, stageLayout = lt) if roomId in layout.getRoomIds(): layoutIndex = lt floor = i else: StageRoomSpecs = StageRoomSpecs roomName = StageRoomSpecs.CashbotStageRoomId2RoomName[roomId] LawOfficeManagerAI.notify.warning('room %s (%s) not found in any floor of Stage %s' % (roomId, roomName, StageId)) StageZone = self.air.allocateZone() if layoutIndex is None: layoutIndex = random.choice(StageId2Layouts[StageId]) Stage = DistributedStageAI.DistributedStageAI(self.air, StageId, StageZone, floor, players, layoutIndex) Stage.generateWithRequired(StageZone) return StageZone
def createLawOffice(self, StageId, entranceId, players): for avId in players: if bboard.has('StageId-%s' % avId): StageId = bboard.get('StageId-%s' % avId) break floor = 0 layoutIndex = None for avId in players: if bboard.has('stageRoom-%s' % avId): roomId = bboard.get('stageRoom-%s' % avId) for lt in StageId2Layouts[StageId]: for i in xrange(StageLayout.getNumFloors(lt)): layout = StageLayout.StageLayout(StageId, i, stageLayout = lt) if roomId in layout.getRoomIds(): layoutIndex = lt floor = i else: StageRoomSpecs = StageRoomSpecs roomName = StageRoomSpecs.CashbotStageRoomId2RoomName[roomId] LawOfficeManagerAI.notify.warning('room %s (%s) not found in any floor of Stage %s' % (roomId, roomName, StageId)) StageZone = self.air.allocateZone() if layoutIndex is None: layoutIndex = random.choice(StageId2Layouts[StageId]) Stage = DistributedStageAI.DistributedStageAI(self.air, StageId, StageZone, floor, players, layoutIndex) Stage.generateWithRequired(StageZone) return StageZone
def createStage(self, stageId, players): for avId in players: if bboard.has('stageId-%s' % avId): stageId = bboard.get('stageId-%s' % avId) break numFloors = StageLayout.getNumFloors(stageId) floor = random.randrange(numFloors) for avId in players: if bboard.has('stageFloor-%s' % avId): floor = bboard.get('stageFloor-%s' % avId) floor = max(0, floor) floor = min(floor, numFloors - 1) break for avId in players: if bboard.has('stageRoom-%s' % avId): roomId = bboard.get('stageRoom-%s' % avId) for i in xrange(numFloors): layout = StageLayout.StageLayout(stageId, i) if roomId in layout.getRoomIds(): floor = i else: from toontown.coghq import StageRoomSpecs roomName = StageRoomSpecs.CashbotStageRoomId2RoomName[roomId] StageManagerAI.notify.warning('room %s (%s) not found in any floor of stage %s' % (roomId, roomName, stageId)) stageZone = self.air.allocateZone() stage = DistributedStageAI.DistributedStageAI(self.air, stageId, stageZone, floor, players) stage.generateWithRequired(stageZone) return stageZone