def __init__(self): """ __init__() """ self.pos = Point3(0, 0, 0) self.initialSuitPos = Point3(0, 1, 0) self.timer = Timer() self.resetLists()
def __init__(self, air, furnitureMgr, catalogItem): DistributedFurnitureItemAI.__init__(self, air, furnitureMgr, catalogItem) self.ownerId = 0 self.currAvId = 0 self.currAvDNA = None self.inUse = False self.timer = Timer('DistributedClosetAITimer')
def activate(self): self.collectTimer = Timer.Timer() self.collectTimer.startCallback(CogdoBarrelRoomConsts.CollectionTime, self.__endCollectionPhase) for barrel in self.spawnedBarrels: barrel.interactive = True taskMgr.remove(self.allBarrelsCollectedTask) taskMgr.doMethodLater(CogdoBarrelRoomConsts.AllBarrelsCollectedTime, self.__checkAllBarrelsCollected, self.allBarrelsCollectedTask)
def __init__(self, air, exterior): DistributedObjectAI.__init__(self, air) FSM.FSM.__init__(self, 'CogdoInteriorAIFSM') self.toons = filter(None, exterior.elevator.seats[:]) self.responses = {} self.bldgDoId = exterior.doId self.numFloors = NUM_FLOORS_DICT[exterior.track] self.sosNPC = self.__generateSOS(exterior.difficulty) self.shopOwnerNpcId = 0 self.extZoneId, self.zoneId = exterior.getExteriorAndInteriorZoneId() npcIdList = NPCToons.zone2NpcDict.get(self.zoneId, []) if len(npcIdList) == 0: self.notify.info('No NPC in taken cogdo at %s' % self.zoneId) else: if len(npcIdList) > 1: self.notify.warning('Multiple NPCs in taken cogdo at %s' % self.zoneId) self.shopOwnerNpcId = npcIdList[0] self.gameDone = 0 self.bossBattleDone = 0 self.curFloor = 0 self.topFloor = 2 self.timer = Timer.Timer() self.exterior = exterior self.planner = self.exterior.planner self.savedByMap = {} self.battle = None self.FOType = exterior.track self.gameFloor = 1 self.battleFloor = 2 self.barrelFloor = -1 if self.FOType == 'l': self.battleFloor = 3 self.barrelFloor = 2 self.topFloor += 1 self.toonSkillPtsGained = {} self.toonExp = {} self.toonOrigQuests = {} self.toonItems = {} self.toonOrigMerits = {} self.toonMerits = {} self.toonParts = {} self.helpfulToons = [] self.barrels = [] self.suits = [] self.activeSuits = [] self.reserveSuits = [] self.joinedReserves = [] self.suitsKilled = [] self.suitsKilledPerFloor = [] self.ignoreResponses = 0 self.ignoreElevatorDone = 0 self.ignoreReserveJoinDone = 0
def __init__(self, air, elevator): self.air = air DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.extZoneId, self.zoneId = elevator.bldg.getExteriorAndInteriorZoneId() self.numFloors = elevator.bldg.planner.numFloors self.avatarExitEvents = [] self.toons = [] self.toonSkillPtsGained = {} self.toonExp = {} self.toonOrigQuests = {} self.toonItems = {} self.toonOrigMerits = {} self.toonMerits = {} self.toonParts = {} self.helpfulToons = [] self.currentFloor = 0 self.topFloor = self.numFloors - 1 self.bldg = elevator.bldg self.elevator = elevator self.suits = [] self.activeSuits = [] self.reserveSuits = [] self.joinedReserves = [] self.suitsKilled = [] self.suitsKilledPerFloor = [] self.battle = None self.timer = Timer.Timer() self.responses = {} self.ignoreResponses = 0 self.ignoreElevatorDone = 0 self.ignoreReserveJoinDone = 0 self.toonIds = copy.copy(elevator.seats) for toonId in self.toonIds: if toonId != None: self.__addToon(toonId) self.savedByMap = {} self.fsm = ClassicFSM.ClassicFSM('DistributedSuitInteriorAI', [ State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, [ 'Elevator']), State.State('Elevator', self.enterElevator, self.exitElevator, [ 'Battle']), State.State('Battle', self.enterBattle, self.exitBattle, [ 'ReservesJoining', 'BattleDone']), State.State('ReservesJoining', self.enterReservesJoining, self.exitReservesJoining, [ 'Battle']), State.State('BattleDone', self.enterBattleDone, self.exitBattleDone, [ 'Resting', 'Reward']), State.State('Resting', self.enterResting, self.exitResting, [ 'Elevator']), State.State('Reward', self.enterReward, self.exitReward, [ 'Off']), State.State('Off', self.enterOff, self.exitOff, [ 'WaitForAllToonsInside'])], 'Off', 'Off', onUndefTransition=ClassicFSM.ClassicFSM.ALLOW) self.fsm.enterInitialState() return
def __init__(self, air): DistCogdoGameAI.__init__(self, air) self.numSuits = (0, 0, 0) self.timer = Timer.Timer() self.doorRevealed = False self.toonsInDoor = [] self.bosses = {} self.fastMinions = {} self.slowMinions = {} self.suitTypes = [self.bosses, self.fastMinions, self.slowMinions] self.numJokes = {}
def __init__(self, air, elevator): self.air = air DistributedObjectAI.DistributedObjectAI.__init__(self, air) (self.extZoneId, self.zoneId) = elevator.bldg.getExteriorAndInteriorZoneId() self._numFloors = elevator.bldg.planner.numFloors self.layout = elevator.bldg._cogdoLayout self.avatarExitEvents = [] self.toons = [] self.toonSkillPtsGained = {} self.toonExp = {} self.toonOrigQuests = {} self.toonItems = {} self.toonOrigMerits = {} self.toonMerits = {} self.toonParts = {} self.helpfulToons = [] self.shopOwnerNpcId = 0 npcDesc = NPCToons.zone2NpcDict.get(self.zoneId) if npcDesc: self.shopOwnerNpcId = npcDesc[0] if not self.shopOwnerNpcId: self.notify.warning('No npcs found for current cogdo building') self.currentFloor = 0 self.bldg = elevator.bldg self.elevator = elevator self._game = None self._CogdoGameRepeat = config.GetBool('cogdo-game-repeat', 0) self.suits = [] self.activeSuits = [] self.reserveSuits = [] self.joinedReserves = [] self.suitsKilled = [] self.suitsKilledPerFloor = [] self.battle = None self.timer = Timer.Timer() self._wantBarrelRoom = config.GetBool('cogdo-want-barrel-room', 1) self.barrelRoom = None self.responses = {} self.ignoreResponses = 0 self.ignoreElevatorDone = 0 self.ignoreReserveJoinDone = 0 self.toonIds = copy.copy(elevator.seats) for toonId in self.toonIds: if toonId != None: self.__addToon(toonId) self.savedByMap = {} self.fsm = ClassicFSM.ClassicFSM( 'DistributedCogdoInteriorAI', [ State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']), State.State('Elevator', self.enterElevator, self.exitElevator, ['Game']), State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro', 'Off']), State.State('BarrelRoomIntro', self.enterBarrelRoomIntro, self.exitBarrelRoomIntro, ['CollectBarrels', 'Off']), State.State('CollectBarrels', self.enterCollectBarrels, self.exitCollectBarrels, ['BarrelRoomReward', 'Off']), State.State( 'BarrelRoomReward', self.enterBarrelRoomReward, self.exitBarrelRoomReward, ['Battle', 'ReservesJoining', 'BattleIntro', 'Off']), State.State( 'BattleIntro', self.enterBattleIntro, self.exitBattleIntro, ['Battle', 'ReservesJoining', 'Off']), State.State('Battle', self.enterBattle, self.exitBattle, ['ReservesJoining', 'BattleDone', 'Off']), State.State('ReservesJoining', self.enterReservesJoining, self.exitReservesJoining, ['Battle', 'Off']), State.State('BattleDone', self.enterBattleDone, self.exitBattleDone, ['Resting', 'Reward', 'Off']), State.State('Resting', self.enterResting, self.exitResting, ['Elevator', 'Off', 'BarrelRoomIntro']), State.State('Reward', self.enterReward, self.exitReward, ['Off']), State.State('Failed', self.enterFailed, self.exitFailed, ['Off']), State.State('Off', self.enterOff, self.exitOff, ['WaitForAllToonsInside']) ], 'Off', 'Off', onUndefTransition=ClassicFSM.ClassicFSM.ALLOW) self.fsm.enterInitialState() safeZone = ZoneUtil.getCanonicalHoodId(self.extZoneId) self.difficulty = SafeZones.index(safeZone) self.SOSCard = self.chooseSOSCard(self.difficulty) self.barrelRoomDone = False self.intElevator = None self.memoCount = 0
def __init__(self, air, elevator): self.air = air DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.extZoneId, self.zoneId = elevator.bldg.getExteriorAndInteriorZoneId( ) self.numFloors = elevator.bldg.planner.numFloors assert (len(elevator.seats) == 4) self.avatarExitEvents = [] self.toons = [] self.toonSkillPtsGained = {} self.toonExp = {} self.toonOrigQuests = {} self.toonItems = {} self.toonOrigMerits = {} self.toonMerits = {} self.toonParts = {} self.helpfulToons = [] self.currentFloor = 0 self.topFloor = self.numFloors - 1 self.bldg = elevator.bldg self.elevator = elevator self.suits = [] self.activeSuits = [] self.reserveSuits = [] self.joinedReserves = [] self.suitsKilled = [] self.suitsKilledPerFloor = [] self.battle = None self.timer = Timer.Timer() self.responses = {} self.ignoreResponses = 0 self.ignoreElevatorDone = 0 self.ignoreReserveJoinDone = 0 # Register all the toons self.toonIds = copy.copy(elevator.seats) for toonId in self.toonIds: if (toonId != None): self.__addToon(toonId) assert (len(self.toons) > 0) # Build a map of id:(name, style) pairs to have around for the # end in case the toons are successful. These elements are # filled in as each toon registers with the building. self.savedByMap = {} self.fsm = ClassicFSM.ClassicFSM( 'DistributedSuitInteriorAI', [ State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']), State.State('Elevator', self.enterElevator, self.exitElevator, ['Battle']), State.State('Battle', self.enterBattle, self.exitBattle, ['ReservesJoining', 'BattleDone']), State.State('ReservesJoining', self.enterReservesJoining, self.exitReservesJoining, ['Battle']), State.State('BattleDone', self.enterBattleDone, self.exitBattleDone, ['Resting', 'Reward']), State.State('Resting', self.enterResting, self.exitResting, ['Elevator']), State.State('Reward', self.enterReward, self.exitReward, ['Off']), State.State('Off', self.enterOff, self.exitOff, ['WaitForAllToonsInside']) ], # Initial state 'Off', # Final state 'Off', onUndefTransition=ClassicFSM.ClassicFSM.ALLOW) self.fsm.enterInitialState()
def __init__(self, air, elevator): self.air = air DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.extZoneId, self.zoneId = elevator.bldg.getExteriorAndInteriorZoneId() self._numFloors = elevator.bldg.planner.numFloors self.layout = elevator.bldg._cogdoLayout assert(len(elevator.seats) == 4) self.avatarExitEvents = [] self.toons = [] self.toonSkillPtsGained = {} self.toonExp = {} self.toonOrigQuests = {} self.toonItems = {} self.toonOrigMerits = {} self.toonMerits = {} self.toonParts = {} self.helpfulToons = [] self.shopOwnerNpcId = 0 npcDesc = NPCToons.zone2NpcDict.get(self.zoneId) if npcDesc: self.shopOwnerNpcId = npcDesc[0] if not self.shopOwnerNpcId: self.notify.warning('No npcs found for current cogdo building') self.currentFloor = 0 self.bldg = elevator.bldg self.elevator = elevator self._game = None self._CogdoGameRepeat = ConfigVariableBool('cogdo-game-repeat', 0).getValue() self.suits = [] self.activeSuits = [] self.reserveSuits = [] self.joinedReserves = [] self.suitsKilled = [] self.suitsKilledPerFloor = [] self.battle = None self.timer = Timer.Timer() self._wantBarrelRoom = ConfigVariableBool('cogdo-want-barrel-room', 0).getValue() self.barrelRoom = None self.responses = {} self.ignoreResponses = 0 self.ignoreElevatorDone = 0 self.ignoreReserveJoinDone = 0 # Register all the toons self.toonIds = copy.copy(elevator.seats) for toonId in self.toonIds: if (toonId != None): self.__addToon(toonId) assert(len(self.toons) > 0) # Build a map of id:(name, style) pairs to have around for the # end in case the toons are successful. These elements are # filled in as each toon registers with the building. self.savedByMap = {} self.fsm = ClassicFSM.ClassicFSM( 'DistributedCogdoInteriorAI', [State.State('WaitForAllToonsInside', self.enterWaitForAllToonsInside, self.exitWaitForAllToonsInside, ['Elevator']), State.State('Elevator', self.enterElevator, self.exitElevator, ['Game']), State.State('Game', self.enterGame, self.exitGame, ['Resting', 'Failed', 'BattleIntro', 'Off']), State.State('BarrelRoomIntro', self.enterBarrelRoomIntro, self.exitBarrelRoomIntro, ['CollectBarrels', 'Off']), State.State('CollectBarrels', self.enterCollectBarrels, self.exitCollectBarrels, ['BarrelRoomReward', 'Off']), State.State('BarrelRoomReward', self.enterBarrelRoomReward, self.exitBarrelRoomReward, ['Battle', 'ReservesJoining', 'BattleIntro', 'Off']), State.State('BattleIntro', self.enterBattleIntro, self.exitBattleIntro, ['Battle', 'ReservesJoining', 'Off']), State.State('Battle', self.enterBattle, self.exitBattle, ['ReservesJoining', 'BattleDone']), State.State('ReservesJoining', self.enterReservesJoining, self.exitReservesJoining, ['Battle']), State.State('BattleDone', self.enterBattleDone, self.exitBattleDone, ['Resting', 'Reward']), State.State('Resting', self.enterResting, self.exitResting, ['Elevator']), State.State('Reward', self.enterReward, self.exitReward, ['Off']), State.State('Failed', self.enterFailed, self.exitFailed, [ 'Off']), State.State('Off', self.enterOff, self.exitOff, ['WaitForAllToonsInside'])], # Initial state 'Off', # Final state 'Off', onUndefTransition = ClassicFSM.ClassicFSM.ALLOW) self.fsm.enterInitialState() safeZone = ZoneUtil.getCanonicalHoodId(self.extZoneId) difficulty = SafeZones.index(safeZone) self.SOSCard = self.chooseSOSCard(difficulty)