Example #1
0
def replaceStateFunc(oldFunc, newFunc):
    from direct.fsm import State
    res = State.redefineEnterFunc(oldFunc, newFunc)
    if res:
        print ('replaced state enter function: ' + newFunc.__name__)
    res = State.redefineExitFunc(oldFunc, newFunc)
    if res:
        print ('replaced state exit function: ' + newFunc.__name__)
Example #2
0
    def __init__(self, chatMgr):
        self.chatMgr = chatMgr
        self.firstTime = 0
        self.whisperAvatarId = None
        self.toPlayer = 0
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'),
                         buttons.find('**/ChtBx_OKBtn_DN'),
                         buttons.find('**/ChtBx_OKBtn_Rllvr'))
        self.emoteNoAccessPanel = DirectFrame(
            parent=hidden,
            relief=None,
            state='normal',
            text=OTPLocalizer.SCEmoteNoAccessMsg,
            frameSize=(-1, 1, -1, 1),
            geom=DGG.getDefaultDialogGeom(),
            geom_color=OTPGlobals.GlobalDialogColor,
            geom_scale=(0.92, 1, 0.6),
            geom_pos=(0, 0, -.08),
            text_scale=0.08)
        self.okButton = DirectButton(parent=self.emoteNoAccessPanel,
                                     image=okButtonImage,
                                     relief=None,
                                     text=OTPLocalizer.SCEmoteNoAccessOK,
                                     text_scale=0.05,
                                     text_pos=(0.0, -0.1),
                                     textMayChange=0,
                                     pos=(0.0, 0.0, -0.2),
                                     command=self.handleEmoteNoAccessDone)
        self.insidePartiesMenu = None
        self.createSpeedChat()
        self.whiteList = None
        self.allowWhiteListSpeedChat = base.config.GetBool(
            'white-list-speed-chat', 0)
        if self.allowWhiteListSpeedChat:
            self.addWhiteList()
        self.factoryMenu = None
        self.kartRacingMenu = None
        self.cogMenu = None
        self.cfoMenu = None
        self.cjMenu = None
        self.ceoMenu = None
        self.golfMenu = None
        self.boardingGroupMenu = None
        self.singingGroupMenu = None
        self.aprilToonsMenu = None
        self.victoryPartiesMenu = None
        self.sillyPhaseOneMenu = None
        self.sillyPhaseTwoMenu = None
        self.sillyPhaseThreeMenu = None
        self.sillyPhaseFourMenu = None
        self.sillyPhaseFiveMenu = None
        self.sellbotNerfMenu = None
        self.jellybeanJamMenu = None
        self.halloweenMenu = None
        self.winterMenu = None
        self.sellbotInvasionMenu = None
        self.sellbotFieldOfficeMenu = None
        self.idesOfMarchMenu = None

        def listenForSCEvent(eventBaseName, handler, self=self):
            eventName = self.speedChat.getEventName(eventBaseName)
            self.accept(eventName, handler)

        listenForSCEvent(SpeedChatGlobals.SCTerminalLinkedEmoteEvent,
                         self.handleLinkedEmote)
        listenForSCEvent(SpeedChatGlobals.SCStaticTextMsgEvent,
                         self.handleStaticTextMsg)
        listenForSCEvent(SpeedChatGlobals.SCCustomMsgEvent,
                         self.handleCustomMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteMsgEvent, self.handleEmoteMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteNoAccessEvent,
                         self.handleEmoteNoAccess)
        listenForSCEvent(TTSpeedChatGlobals.TTSCToontaskMsgEvent,
                         self.handleToontaskMsg)
        listenForSCEvent(TTSpeedChatGlobals.TTSCResistanceMsgEvent,
                         self.handleResistanceMsg)
        listenForSCEvent(TTSCSingingTerminal.TTSCSingingMsgEvent,
                         self.handleSingingMsg)
        listenForSCEvent('SpeedChatStyleChange',
                         self.handleSpeedChatStyleChange)
        listenForSCEvent(TTSCIndexedTerminal.TTSCIndexedMsgEvent,
                         self.handleStaticTextMsg)
        self.fsm = ClassicFSM.ClassicFSM('SpeedChat', [
            State.State('off', self.enterOff, self.exitOff, ['active']),
            State.State('active', self.enterActive, self.exitActive, ['off'])
        ], 'off', 'off')
        self.fsm.enterInitialState()
        return
 def __init__(self, loader, parentFSM, doneEvent):
     BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
     self.parentFSM = parentFSM
     self.zoneId = loader.mintId
     self.fsm = ClassicFSM.ClassicFSM('MintInterior', [State.State('start', self.enterStart, self.exitStart, ['walk', 'teleportIn', 'fallDown']),
      State.State('walk', self.enterWalk, self.exitWalk, ['push',
       'sit',
       'stickerBook',
       'WaitForBattle',
       'battle',
       'died',
       'teleportOut',
       'squished',
       'fallDown',
       'stopped']),
      State.State('stopped', self.enterStopped, self.exitStopped, ['walk', 'teleportOut', 'stickerBook']),
      State.State('sit', self.enterSit, self.exitSit, ['walk', 'died', 'teleportOut']),
      State.State('push', self.enterPush, self.exitPush, ['walk', 'died', 'teleportOut']),
      State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk',
       'battle',
       'WaitForBattle',
       'died',
       'teleportOut']),
      State.State('WaitForBattle', self.enterWaitForBattle, self.exitWaitForBattle, ['battle',
       'walk',
       'died',
       'teleportOut']),
      State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'teleportOut', 'died']),
      State.State('fallDown', self.enterFallDown, self.exitFallDown, ['walk', 'died', 'teleportOut']),
      State.State('squished', self.enterSquished, self.exitSquished, ['walk', 'died', 'teleportOut']),
      State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk',
       'teleportOut',
       'quietZone',
       'died']),
      State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn',
       'FLA',
       'quietZone',
       'WaitForBattle']),
      State.State('died', self.enterDied, self.exitDied, ['teleportOut']),
      State.State('FLA', self.enterFLA, self.exitFLA, ['quietZone']),
      State.State('quietZone', self.enterQuietZone, self.exitQuietZone, ['teleportIn']),
      State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
Example #4
0
    def __init__(self, cr):
        NodePath.__init__(self, 'DistributedCheckers')
        DistributedNode.DistributedNode.__init__(self, cr)
        self.cr = cr
        self.reparentTo(render)
        self.boardNode = loader.loadModel(
            'phase_6/models/golf/regular_checker_game.bam')
        self.boardNode.reparentTo(self)
        self.board = CheckersBoard()
        self.exitButton = None
        self.inGame = False
        self.waiting = True
        self.startButton = None
        self.playerNum = None
        self.turnText = None
        self.isMyTurn = False
        self.wantTimer = True
        self.leaveButton = None
        self.screenText = None
        self.turnText = None
        self.exitButton = None
        self.numRandomMoves = 0
        self.blinker = Sequence()
        self.moveList = []
        self.mySquares = []
        self.myKings = []
        self.isRotated = False
        self.accept('mouse1', self.mouseClick)
        self.traverser = base.cTrav
        self.pickerNode = CollisionNode('mouseRay')
        self.pickerNP = camera.attachNewNode(self.pickerNode)
        self.pickerNode.setFromCollideMask(ToontownGlobals.WallBitmask)
        self.pickerRay = CollisionRay()
        self.pickerNode.addSolid(self.pickerRay)
        self.myHandler = CollisionHandlerQueue()
        self.traverser.addCollider(self.pickerNP, self.myHandler)
        self.buttonModels = loader.loadModel(
            'phase_3.5/models/gui/inventory_gui')
        self.upButton = self.buttonModels.find('**//InventoryButtonUp')
        self.downButton = self.buttonModels.find('**/InventoryButtonDown')
        self.rolloverButton = self.buttonModels.find(
            '**/InventoryButtonRollover')
        self.clockNode = ToontownTimer()
        self.clockNode.setPos(1.16, 0, -0.83)
        self.clockNode.setScale(0.3)
        self.clockNode.hide()
        self.playerColors = [Vec4(0, 0, 1, 1), Vec4(0, 1, 0, 1)]
        self.tintConstant = Vec4(0.25, 0.25, 0.25, 0.5)
        self.ghostConstant = Vec4(0, 0, 0, 0.8)
        self.startingPositions = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
                                  [
                                      20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
                                      30, 31
                                  ]]
        self.knockSound = base.loader.loadSfx(
            'phase_5/audio/sfx/GUI_knock_1.mp3')
        self.clickSound = base.loader.loadSfx(
            'phase_3/audio/sfx/GUI_balloon_popup.mp3')
        self.moveSound = base.loader.loadSfx('phase_6/audio/sfx/CC_move.mp3')
        self.accept('stoppedAsleep', self.handleSleep)
        self.fsm = ClassicFSM.ClassicFSM('ChineseCheckers', [
            State.State('waitingToBegin', self.enterWaitingToBegin,
                        self.exitWaitingToBegin, ['playing', 'gameOver']),
            State.State('playing', self.enterPlaying, self.exitPlaying,
                        ['gameOver']),
            State.State('gameOver', self.enterGameOver, self.exitGameOver,
                        ['waitingToBegin'])
        ], 'waitingToBegin', 'waitingToBegin')
        x = self.boardNode.find('**/locator*')
        self.locatorList = x.getChildren()
        tempList = []
        for x in range(0, 32):
            self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
            tempList.append(self.locatorList[x].attachNewNode(
                CollisionNode('picker%d' % x)))
            tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.39))

        for z in self.locatorList:
            y = loader.loadModel(
                'phase_6/models/golf/regular_checker_piecewhite.bam')
            y.find('**/checker_k*').hide()
            zz = loader.loadModel(
                'phase_6/models/golf/regular_checker_pieceblack.bam')
            zz.find('**/checker_k*').hide()
            y.reparentTo(z)
            y.hide()
            zz.reparentTo(z)
            zz.hide()

        return
Example #5
0
    def __init__(self, loader, parentFSM, doneEvent):
        assert (MintInterior.notify.debug("MintInterior()"))
        BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
        self.parentFSM = parentFSM
        # this is put on the loader by CashbotCogHQLoader.enterMintInterior
        self.zoneId = loader.mintId
        # any state that we might be in when someone beats the mint
        # needs to have a transition to teleportout
        self.fsm = ClassicFSM.ClassicFSM(
            'MintInterior',
            [
                State.State('start', self.enterStart, self.exitStart, [
                    'walk',
                    'teleportIn',
                    'fallDown',
                ]),
                State.State('walk', self.enterWalk, self.exitWalk, [
                    'push', 'sit', 'stickerBook', 'WaitForBattle', 'battle',
                    'died', 'teleportOut', 'squished', 'DFA', 'fallDown',
                    'stopped'
                ]),
                State.State('stopped', self.enterStopped, self.exitStopped, [
                    'walk',
                    'teleportOut',
                    'stickerBook',
                ]),
                State.State('sit', self.enterSit, self.exitSit, [
                    'walk',
                    'died',
                    'teleportOut',
                ]),
                State.State('push', self.enterPush, self.exitPush, [
                    'walk',
                    'died',
                    'teleportOut',
                ]),
                State.State('stickerBook', self.enterStickerBook,
                            self.exitStickerBook, [
                                'walk',
                                'battle',
                                'DFA',
                                'WaitForBattle',
                                'died',
                                'teleportOut',
                            ]),
                # This needs a transition to teleportOut to allow
                # the toon to leave after beating the mint.
                # When localToon leaves the battle, battle gets
                # a setMembers with no localToon, enables its
                # collision sphere, collides with localToon, puts
                # localToon in WaitForBattle.
                State.State('WaitForBattle', self.enterWaitForBattle,
                            self.exitWaitForBattle, [
                                'battle',
                                'walk',
                                'died',
                                'teleportOut',
                            ]),
                State.State('battle', self.enterBattle, self.exitBattle, [
                    'walk',
                    'teleportOut',
                    'died',
                ]),
                State.State('fallDown', self.enterFallDown, self.exitFallDown,
                            [
                                'walk',
                                'died',
                                'teleportOut',
                            ]),
                State.State('squished', self.enterSquished, self.exitSquished,
                            [
                                'walk',
                                'died',
                                'teleportOut',
                            ]),
                State.State('teleportIn', self.enterTeleportIn,
                            self.exitTeleportIn, [
                                'walk',
                                'teleportOut',
                                'quietZone',
                                'died',
                            ]),
                State.State(
                    'teleportOut', self.enterTeleportOut, self.exitTeleportOut,
                    ['teleportIn', 'FLA', 'quietZone', 'WaitForBattle']),
                # Download Force Acknowledge
                State.State('DFA', self.enterDFA, self.exitDFA,
                            ['DFAReject', 'teleportOut']),
                State.State('DFAReject', self.enterDFAReject,
                            self.exitDFAReject, [
                                'walk'
                                'teleportOut',
                            ]),
                State.State('died', self.enterDied, self.exitDied,
                            ['teleportOut']),
                # Forced Leave Acknowledge
                State.State('FLA', self.enterFLA, self.exitFLA, ['quietZone']),
                State.State('quietZone', self.enterQuietZone,
                            self.exitQuietZone, ['teleportIn']),
                State.State('final', self.enterFinal, self.exitFinal,
                            ['start'])
            ],

            # Initial State
            'start',
            # Final State
            'final',
        )
Example #6
0
 def __init__(self, loader, parentFSM, doneEvent):
     Playground.Playground.__init__(self, loader, parentFSM, doneEvent)
     self.activityFsm = ClassicFSM.ClassicFSM('Activity', [State.State('off', self.enterOff, self.exitOff, ['OnPiano']), State.State('OnPiano', self.enterOnPiano, self.exitOnPiano, ['off'])], 'off', 'off')
     self.activityFsm.enterInitialState()
Example #7
0
 def load(self):
     self.fsm = ClassicFSM.ClassicFSM('FactoryExterior', [State.State('start', self.enterStart, self.exitStart, ['walk',
       'tunnelIn',
       'teleportIn',
       'doorIn']),
      State.State('walk', self.enterWalk, self.exitWalk, ['stickerBook',
       'teleportOut',
       'tunnelOut',
       'doorOut',
       'elevator',
       'stopped',
       'WaitForBattle',
       'battle']),
      State.State('stopped', self.enterStopped, self.exitStopped, ['walk', 'teleportOut', 'elevator']),
      State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk',
       'WaitForBattle',
       'battle',
       'elevator',
       'tunnelOut',
       'teleportOut']),
      State.State('WaitForBattle', self.enterWaitForBattle, self.exitWaitForBattle, ['battle', 'walk']),
      State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'teleportOut', 'died']),
      State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
      State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'final', 'WaitForBattle']),
      State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
      State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
      State.State('died', self.enterDied, self.exitDied, ['quietZone']),
      State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['walk']),
      State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['final']),
      State.State('elevator', self.enterElevator, self.exitElevator, ['walk', 'stopped']),
      State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
     self.parentFSM.getStateNamed('factoryExterior').addChild(self.fsm)
     BattlePlace.BattlePlace.load(self)
Example #8
0
 def __init__(self, loader, parentFSM, doneEvent):
     BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
     self.fsm = ClassicFSM.ClassicFSM('Street', [State.State('start', self.enterStart, self.exitStart, ['walk',
       'tunnelIn',
       'doorIn',
       'teleportIn',
       'elevatorIn']),
      State.State('walk', self.enterWalk, self.exitWalk, ['push',
       'sit',
       'stickerBook',
       'WaitForBattle',
       'battle',
       'DFA',
       'trialerFA',
       'doorOut',
       'elevator',
       'tunnelIn',
       'tunnelOut',
       'teleportOut',
       'quest',
       'stopped',
       'fishing',
       'purchase',
       'died']),
      State.State('sit', self.enterSit, self.exitSit, ['walk']),
      State.State('push', self.enterPush, self.exitPush, ['walk']),
      State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk',
       'push',
       'sit',
       'battle',
       'DFA',
       'trialerFA',
       'doorOut',
       'elevator',
       'tunnelIn',
       'tunnelOut',
       'WaitForBattle',
       'teleportOut',
       'quest',
       'stopped',
       'fishing',
       'purchase']),
      State.State('WaitForBattle', self.enterWaitForBattle, self.exitWaitForBattle, ['battle', 'walk']),
      State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'teleportOut', 'died']),
      State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
      State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
      State.State('elevatorIn', self.enterElevatorIn, self.exitElevatorIn, ['walk']),
      State.State('elevator', self.enterElevator, self.exitElevator, ['walk']),
      State.State('trialerFA', self.enterTrialerFA, self.exitTrialerFA, ['trialerFAReject', 'DFA']),
      State.State('trialerFAReject', self.enterTrialerFAReject, self.exitTrialerFAReject, ['walk']),
      State.State('DFA', self.enterDFA, self.exitDFA, ['DFAReject', 'teleportOut', 'tunnelOut']),
      State.State('DFAReject', self.enterDFAReject, self.exitDFAReject, ['walk']),
      State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk',
       'teleportOut',
       'quietZone',
       'WaitForBattle',
       'battle']),
      State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'quietZone', 'WaitForBattle']),
      State.State('died', self.enterDied, self.exitDied, ['quietZone']),
      State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['walk']),
      State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['final']),
      State.State('quietZone', self.enterQuietZone, self.exitQuietZone, ['teleportIn']),
      State.State('quest', self.enterQuest, self.exitQuest, ['walk', 'stopped']),
      State.State('stopped', self.enterStopped, self.exitStopped, ['walk']),
      State.State('stopped', self.enterStopped, self.exitStopped, ['walk']),
      State.State('fishing', self.enterFishing, self.exitFishing, ['walk']),
      State.State('purchase', self.enterPurchase, self.exitPurchase, ['walk']),
      State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
     self.parentFSM = parentFSM
     self.tunnelOriginList = []
     self.elevatorDoneEvent = 'elevatorDone'
     self.halloweenLights = []
     self.zone = 0
Example #9
0
 def __init__(self, parentFSM, doneEvent):
     StateData.StateData.__init__(self, doneEvent)
     self.place = None
     self.fsm = ClassicFSM.ClassicFSM('PlayGame', [
         State.State('start', self.enterStart, self.exitStart,
                     ['quietZone']),
         State.State('quietZone', self.enterQuietZone, self.exitQuietZone, [
             'TTHood', 'DDHood', 'BRHood', 'MMHood', 'DGHood', 'DLHood',
             'GSHood', 'OZHood', 'GZHood', 'SellbotHQ', 'CashbotHQ',
             'LawbotHQ', 'BossbotHQ', 'TutorialHood', 'EstateHood',
             'PartyHood'
         ]),
         State.State('TTHood', self.enterTTHood, self.exitTTHood,
                     ['quietZone']),
         State.State('DDHood', self.enterDDHood, self.exitDDHood,
                     ['quietZone']),
         State.State('BRHood', self.enterBRHood, self.exitBRHood,
                     ['quietZone']),
         State.State('MMHood', self.enterMMHood, self.exitMMHood,
                     ['quietZone']),
         State.State('DGHood', self.enterDGHood, self.exitDGHood,
                     ['quietZone']),
         State.State('DLHood', self.enterDLHood, self.exitDLHood,
                     ['quietZone']),
         State.State('GSHood', self.enterGSHood, self.exitGSHood,
                     ['quietZone']),
         State.State('OZHood', self.enterOZHood, self.exitOZHood,
                     ['quietZone']),
         State.State('GZHood', self.enterGZHood, self.exitGZHood,
                     ['quietZone']),
         State.State('BossbotHQ', self.enterBossbotHQ, self.exitBossbotHQ,
                     ['quietZone']),
         State.State('SellbotHQ', self.enterSellbotHQ, self.exitSellbotHQ,
                     ['quietZone']),
         State.State('CashbotHQ', self.enterCashbotHQ, self.exitCashbotHQ,
                     ['quietZone']),
         State.State('LawbotHQ', self.enterLawbotHQ, self.exitLawbotHQ,
                     ['quietZone']),
         State.State('TutorialHood', self.enterTutorialHood,
                     self.exitTutorialHood, ['quietZone']),
         State.State('EstateHood', self.enterEstateHood,
                     self.exitEstateHood, ['quietZone']),
         State.State('PartyHood', self.enterPartyHood, self.exitPartyHood,
                     ['quietZone'])
     ], 'start', 'start')
     self.fsm.enterInitialState()
     self.parentFSM = parentFSM
     self.parentFSM.getStateNamed('playGame').addChild(self.fsm)
     self.hoodDoneEvent = 'hoodDone'
     self.hood = None
     self.quietZoneDoneEvent = uniqueName('quietZoneDone')
     self.quietZoneStateData = None
     return
    def __init__(self, avId, avName, avDisableName):

        # initialize our base class.
        DirectFrame.__init__(self,
                             pos = (0.3, 0.1, 0.65),
                             image_color = ToontownGlobals.GlobalDialogColor,
                             image_scale = (1.0, 1.0, 0.6),
                             text = '',
                             text_wordwrap = 13.5,
                             text_scale = 0.06,
                             text_pos = (0.0, 0.18),
                             )

        # If we're currently in move-furniture mode, stop it.
        messenger.send("releaseDirector")

        # For some reason, we need to set this after construction to
        # get it to work properly.
        self['image'] = DGG.getDefaultDialogGeom()

        self.avId = avId
        self.avName = avName
        self.avDisableName = avDisableName

        self.fsm = ClassicFSM.ClassicFSM('ToonTeleportPanel',
                           [State.State('off',
                                        self.enterOff,
                                        self.exitOff),
                            State.State('begin',
                                        self.enterBegin,
                                        self.exitBegin),
                            State.State('checkAvailability',
                                        self.enterCheckAvailability,
                                        self.exitCheckAvailability),
                            State.State('notAvailable',
                                        self.enterNotAvailable,
                                        self.exitNotAvailable),
                            State.State('ignored',
                                        self.enterIgnored,
                                        self.exitIgnored),
                            State.State('notOnline',
                                        self.enterNotOnline,
                                        self.exitNotOnline),
                            State.State('wentAway',
                                        self.enterWentAway,
                                        self.exitWentAway),
                            State.State('self',
                                        self.enterSelf,
                                        self.exitSelf),
                            State.State('unknownHood',
                                        self.enterUnknownHood,
                                        self.exitUnknownHood),
                            State.State('unavailableHood',
                                        self.enterUnavailableHood,
                                        self.exitUnavailableHood),
                            State.State('otherShard',
                                        self.enterOtherShard,
                                        self.exitOtherShard),
                            State.State('teleport',
                                        self.enterTeleport,
                                        self.exitTeleport),
                            ],
                           # Initial State
                           'off',
                           # Final State
                           'off',
                           )


        # This is imported here instead of at the top of the file to
        # protect against circular imports.
        from toontown.friends import FriendInviter

        # Now set up the panel.
        FriendInviter.hideFriendInviter()
        ToonAvatarDetailPanel.hideAvatarDetail()

        # Create some buttons.
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')

        self.bOk = DirectButton(self,
                                image = (buttons.find('**/ChtBx_OKBtn_UP'),
                                         buttons.find('**/ChtBx_OKBtn_DN'),
                                         buttons.find('**/ChtBx_OKBtn_Rllvr')),
                                relief = None,
                                text = TTLocalizer.TeleportPanelOK,
                                text_scale = 0.05,
                                text_pos = (0.0, -0.1),
                                pos = (0.0, 0.0, -0.1),
                                command = self.__handleOk)
        self.bOk.hide()

        self.bCancel = DirectButton(self,
                                    image = (buttons.find('**/CloseBtn_UP'),
                                             buttons.find('**/CloseBtn_DN'),
                                             buttons.find('**/CloseBtn_Rllvr')),
                                    relief = None,
                                    text = TTLocalizer.TeleportPanelCancel,
                                    text_scale = 0.05,
                                    text_pos = (0.0, -0.1),
                                    pos = (0.0, 0.0, -0.1),
                                    command = self.__handleCancel)
        self.bCancel.hide()

        self.bYes = DirectButton(self,
                                 image = (buttons.find('**/ChtBx_OKBtn_UP'),
                                          buttons.find('**/ChtBx_OKBtn_DN'),
                                          buttons.find('**/ChtBx_OKBtn_Rllvr')),
                                 relief = None,
                                 text = TTLocalizer.TeleportPanelYes,
                                 text_scale = 0.05,
                                 text_pos = (0.0, -0.1),
                                 pos = (-0.15, 0.0, -0.15),
                                 command = self.__handleYes)
        self.bYes.hide()

        self.bNo = DirectButton(self,
                                image = (buttons.find('**/CloseBtn_UP'),
                                         buttons.find('**/CloseBtn_DN'),
                                         buttons.find('**/CloseBtn_Rllvr')),
                                relief = None,
                                text = TTLocalizer.TeleportPanelNo,
                                text_scale = 0.05,
                                text_pos = (0.0, -0.1),
                                pos = (0.15, 0.0, -0.15),
                                command = self.__handleNo)
        self.bNo.hide()

        buttons.removeNode()

        self.accept(self.avDisableName, self.__handleDisableAvatar)

        self.show()
        self.fsm.enterInitialState()
        self.fsm.request('begin')
Example #11
0
    def __init__(self, cr):
        try:
            self.DistributedSuit_initialized
            return
        except:
            self.DistributedSuit_initialized = 1

        DistributedSuitBase.DistributedSuitBase.__init__(self, cr)
        self.spDoId = None
        self.pathEndpointStart = 0
        self.pathEndpointEnd = 0
        self.minPathLen = 0
        self.maxPathLen = 0
        self.pathPositionIndex = 0
        self.pathPositionTimestamp = 0.0
        self.pathState = 0
        self.path = None
        self.localPathState = 0
        self.currentLeg = -1
        self.pathStartTime = 0.0
        self.legList = None
        self.initState = None
        self.finalState = None
        self.buildingSuit = 0
        self.fsm = ClassicFSM.ClassicFSM('DistributedSuit', [
            State.State('Off', self.enterOff, self.exitOff, [
                'FromSky', 'FromSuitBuilding', 'Walk', 'Battle', 'neutral',
                'ToToonBuilding', 'ToSuitBuilding', 'ToCogHQ', 'FromCogHQ',
                'ToSky', 'FlyAway', 'DanceThenFlyAway', 'WalkToStreet',
                'WalkFromStreet'
            ]),
            State.State(
                'FromSky', self.enterFromSky, self.exitFromSky,
                ['Walk', 'Battle', 'neutral', 'ToSky', 'WalkFromStreet']),
            State.State(
                'FromSuitBuilding', self.enterFromSuitBuilding,
                self.exitFromSuitBuilding,
                ['WalkToStreet', 'Walk', 'Battle', 'neutral', 'ToSky']),
            State.State(
                'WalkToStreet', self.enterWalkToStreet, self.exitWalkToStreet,
                [
                    'Walk', 'Battle', 'neutral', 'ToSky', 'ToToonBuilding',
                    'ToSuitBuilding', 'ToCogHQ', 'WalkFromStreet'
                ]),
            State.State('WalkFromStreet', self.enterWalkFromStreet,
                        self.exitWalkFromStreet, [
                            'ToToonBuilding', 'ToSuitBuilding', 'ToCogHQ',
                            'Battle', 'neutral', 'ToSky'
                        ]),
            State.State('Walk', self.enterWalk, self.exitWalk, [
                'WaitForBattle', 'Battle', 'neutral', 'WalkFromStreet',
                'ToSky', 'ToCogHQ', 'Walk'
            ]),
            State.State('Battle', self.enterBattle, self.exitBattle, [
                'Walk', 'ToToonBuilding', 'ToCogHQ', 'ToSuitBuilding', 'ToSky'
            ]),
            State.State('neutral', self.enterNeutral, self.exitNeutral, []),
            State.State('WaitForBattle', self.enterWaitForBattle,
                        self.exitWaitForBattle, [
                            'Battle', 'neutral', 'Walk', 'WalkToStreet',
                            'WalkFromStreet', 'ToToonBuilding', 'ToCogHQ',
                            'ToSuitBuilding', 'ToSky'
                        ]),
            State.State('ToToonBuilding', self.enterToToonBuilding,
                        self.exitToToonBuilding, ['neutral', 'Battle']),
            State.State('ToSuitBuilding', self.enterToSuitBuilding,
                        self.exitToSuitBuilding, ['neutral', 'Battle']),
            State.State('ToCogHQ', self.enterToCogHQ, self.exitToCogHQ,
                        ['neutral', 'Battle']),
            State.State('FromCogHQ', self.enterFromCogHQ, self.exitFromCogHQ,
                        ['neutral', 'Battle', 'Walk']),
            State.State('ToSky', self.enterToSky, self.exitToSky, ['Battle']),
            State.State('FlyAway', self.enterFlyAway, self.exitFlyAway, []),
            State.State('DanceThenFlyAway', self.enterDanceThenFlyAway,
                        self.exitDanceThenFlyAway, [])
        ], 'Off', 'Off')
        self.fsm.enterInitialState()
        self.soundSequenceList = []
        self.__currentDialogue = None
        return
Example #12
0
 def __init__(self, loader, parentFSM, doneEvent):
     BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
     self.parentFSM = parentFSM
     self.fsm = ClassicFSM.ClassicFSM('CogHQExterior', [
         State.State('start', self.enterStart, self.exitStart,
                     ['walk', 'tunnelIn', 'teleportIn', 'doorIn']),
         State.State('walk', self.enterWalk, self.exitWalk, [
             'stickerBook', 'teleportOut', 'tunnelOut', 'DFA', 'doorOut',
             'died', 'stopped', 'WaitForBattle', 'battle', 'squished',
             'stopped'
         ]),
         State.State('stopped', self.enterStopped, self.exitStopped,
                     ['walk', 'teleportOut', 'stickerBook']),
         State.State('doorIn', self.enterDoorIn, self.exitDoorIn,
                     ['walk', 'stopped']),
         State.State('doorOut', self.enterDoorOut, self.exitDoorOut,
                     ['walk', 'stopped']),
         State.State(
             'stickerBook', self.enterStickerBook, self.exitStickerBook, [
                 'walk', 'DFA', 'WaitForBattle', 'battle', 'tunnelOut',
                 'doorOut', 'squished', 'died'
             ]),
         State.State('WaitForBattle', self.enterWaitForBattle,
                     self.exitWaitForBattle, ['battle', 'walk']),
         State.State('battle', self.enterBattle, self.exitBattle,
                     ['walk', 'teleportOut', 'died']),
         State.State('DFA', self.enterDFA, self.exitDFA,
                     ['DFAReject', 'teleportOut', 'tunnelOut']),
         State.State('DFAReject', self.enterDFAReject, self.exitDFAReject,
                     ['walk']),
         State.State('squished', self.enterSquished, self.exitSquished,
                     ['walk', 'died', 'teleportOut']),
         State.State('teleportIn', self.enterTeleportIn,
                     self.exitTeleportIn,
                     ['walk', 'WaitForBattle', 'battle']),
         State.State('teleportOut', self.enterTeleportOut,
                     self.exitTeleportOut,
                     ['teleportIn', 'final', 'WaitForBattle']),
         State.State('died', self.enterDied, self.exitDied, ['quietZone']),
         State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn,
                     ['walk', 'WaitForBattle', 'battle']),
         State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut,
                     ['final']),
         State.State('final', self.enterFinal, self.exitFinal, ['start'])
     ], 'start', 'final')
Example #13
0
    def __init__(self, loader, parentFSM, doneEvent):
        """
        Playground constructor: create a play game ClassicFSM
        """
        assert (self.notify.debug("__init__()"))
        Place.Place.__init__(self, loader, doneEvent)

        self.tfaDoneEvent = "tfaDoneEvent"
        # shared state
        self.fsm = ClassicFSM.ClassicFSM(
            'Playground',
            [
                State.State('start', self.enterStart, self.exitStart,
                            ['walk', 'deathAck', 'doorIn', 'tunnelIn']),
                State.State('walk', self.enterWalk, self.exitWalk, [
                    'drive', 'sit', 'stickerBook', 'TFA', 'DFA', 'trialerFA',
                    'trolley', 'final', 'doorOut', 'options', 'quest',
                    'purchase', 'stopped', 'fishing'
                ]),
                State.State(
                    'stickerBook',
                    self.enterStickerBook,
                    self.exitStickerBook,
                    [
                        'walk',
                        'DFA',
                        'TFA',
                        # You can get to all of these by jumping over
                        # the trigger then opening your book
                        'trolley',
                        'final',
                        'doorOut',
                        'quest',
                        'purchase',
                        'stopped',
                        'fishing',
                        'trialerFA',
                    ]),
                State.State(
                    'sit',
                    self.enterSit,
                    self.exitSit,
                    [
                        'walk',
                        'DFA',  # So you can teleport to a friend
                        'trialerFA',
                    ]),
                State.State(
                    'drive',
                    self.enterDrive,
                    self.exitDrive,
                    [
                        'walk',
                        'DFA',  # So you can teleport to a friend
                        'trialerFA',
                    ]),
                State.State('trolley', self.enterTrolley, self.exitTrolley,
                            ['walk']),
                State.State('doorIn', self.enterDoorIn, self.exitDoorIn,
                            ['walk']),
                State.State('doorOut', self.enterDoorOut, self.exitDoorOut,
                            ['walk']),  # 'final'
                # Tutorial Force Acknowledge:
                State.State('TFA', self.enterTFA, self.exitTFA,
                            ['TFAReject', 'DFA']),
                State.State('TFAReject', self.enterTFAReject,
                            self.exitTFAReject, ['walk']),
                # Trialer Force Acknowledge:
                State.State('trialerFA', self.enterTrialerFA,
                            self.exitTrialerFA, ['trialerFAReject', 'DFA']),
                State.State('trialerFAReject', self.enterTrialerFAReject,
                            self.exitTrialerFAReject, ['walk']),
                # Download Force Acknowledge
                State.State('DFA', self.enterDFA, self.exitDFA,
                            ['DFAReject', 'NPCFA', 'HFA']),
                State.State('DFAReject', self.enterDFAReject,
                            self.exitDFAReject, ['walk']),
                # NPC Force Acknowledge:
                State.State('NPCFA', self.enterNPCFA, self.exitNPCFA,
                            ['NPCFAReject', 'HFA']),
                State.State('NPCFAReject', self.enterNPCFAReject,
                            self.exitNPCFAReject, ['walk']),
                # Health Force Acknowledge
                State.State('HFA', self.enterHFA, self.exitHFA,
                            ['HFAReject', 'teleportOut', 'tunnelOut']),
                State.State('HFAReject', self.enterHFAReject,
                            self.exitHFAReject, ['walk']),
                State.State('deathAck', self.enterDeathAck, self.exitDeathAck,
                            ['teleportIn']),
                State.State('teleportIn', self.enterTeleportIn,
                            self.exitTeleportIn, ['walk', 'popup']),
                State.State('popup', self.enterPopup, self.exitPopup,
                            ['walk']),
                State.State('teleportOut', self.enterTeleportOut,
                            self.exitTeleportOut,
                            ['deathAck', 'teleportIn']),  # 'final'
                State.State(
                    'died',  # No transitions to "died" in the playground.
                    self.enterDied,
                    self.exitDied,
                    ['final']),
                State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn,
                            ['walk']),
                State.State('tunnelOut', self.enterTunnelOut,
                            self.exitTunnelOut, ['final']),
                State.State('quest', self.enterQuest, self.exitQuest,
                            ['walk']),
                State.State('purchase', self.enterPurchase, self.exitPurchase,
                            ['walk']),
                State.State('stopped', self.enterStopped, self.exitStopped,
                            ['walk']),
                State.State('fishing', self.enterFishing, self.exitFishing,
                            ['walk']),
                State.State('final', self.enterFinal, self.exitFinal,
                            ['start'])
            ],

            # Initial State
            'start',
            # Final State
            'final',
        )

        self.parentFSM = parentFSM
        self.tunnelOriginList = []
        self.trolleyDoneEvent = "trolleyDone"
        self.hfaDoneEvent = "hfaDoneEvent"
        self.npcfaDoneEvent = "npcfaDoneEvent"
        self.dialog = None
        self.deathAckBox = None
Example #14
0
 def __init__(self):
     guiMain = loader.loadModel('models/gui/gui_main')
     DirectFrame.__init__(self,
                          relief=None,
                          pos=(-0.6, 0, 0.47),
                          image=guiMain.find('**/general_frame_e'),
                          image_pos=(0.25, 0, 0.275),
                          image_scale=0.25)
     self.initialiseoptions(CrewInviter)
     self.avDisableName = ''
     self.fsm = ClassicFSM.ClassicFSM('CrewInviter', [
         State.State('off', self.enterOff, self.exitOff),
         State.State('begin', self.enterBegin, self.exitBegin),
         State.State('tooMany', self.enterTooMany, self.exitTooMany),
         State.State('notYet', self.enterNotYet, self.exitNotYet),
         State.State('checkAvailability', self.enterCheckAvailability,
                     self.exitCheckAvailability),
         State.State('notAvailable', self.enterNotAvailable,
                     self.exitNotAvailable),
         State.State('notAcceptingCrews', self.enterNotAcceptingCrews,
                     self.exitNotAcceptingCrews),
         State.State('wentAway', self.enterWentAway, self.exitWentAway),
         State.State('alreadyCrewed', self.enterAlreadyCrewed,
                     self.exitAlreadyCrewed),
         State.State('alreadyInvited', self.enterAlreadyInvited,
                     self.exitAlreadyInvited),
         State.State('recentlyInvited', self.enterRecentlyInvited,
                     self.exitRecentlyInvited),
         State.State('askingNPC', self.enterAskingNPC, self.exitAskingNPC),
         State.State('endCrewship', self.enterEndCrewship,
                     self.exitEndCrewship),
         State.State('crewedNoMore', self.enterCrewedNoMore,
                     self.exitCrewedNoMore),
         State.State('leaveCrew', self.enterLeaveCrew, self.exitLeaveCrew),
         State.State('leftCrew', self.enterLeftCrew, self.exitLeftCrew),
         State.State('notCaption', self.enterNotCaption,
                     self.exitNotCaption),
         State.State('inOtherCrew', self.enterInOtherCrew,
                     self.exitInOtherCrew),
         State.State('self', self.enterSelf, self.exitSelf),
         State.State('ignored', self.enterIgnored, self.exitIgnored),
         State.State('asking', self.enterAsking, self.exitAsking),
         State.State('yes', self.enterYes, self.exitYes),
         State.State('no', self.enterNo, self.exitNo),
         State.State('otherTooMany', self.enterOtherTooMany,
                     self.exitOtherTooMany),
         State.State('maybe', self.enterMaybe, self.exitMaybe),
         State.State('down', self.enterDown, self.exitDown),
         State.State('cancel', self.enterCancel, self.exitCancel)
     ], 'off', 'off')
     self.title = DirectLabel(
         parent=self,
         relief=None,
         text=PLocalizer.CrewInviterTitle,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_align=TextNode.ACenter,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_font=PiratesGlobals.getPirateOutlineFont(),
         pos=(0.25, 0, 0.42),
         image=None,
         image_scale=0.25)
     self.message = DirectLabel(parent=self,
                                relief=None,
                                text='',
                                text_scale=PiratesGuiGlobals.TextScaleLarge,
                                text_align=TextNode.ACenter,
                                text_fg=PiratesGuiGlobals.TextFG2,
                                text_shadow=PiratesGuiGlobals.TextShadow,
                                text_wordwrap=11,
                                pos=(0.25, 0, 0.325),
                                textMayChange=1)
     self.context = None
     self.bOk = CrewInviterButton(text=PLocalizer.CrewInviterOK,
                                  command=self.__handleOk)
     self.bOk.reparentTo(self)
     self.bOk.setPos(0.2, 0, 0.05)
     self.bOk.hide()
     self.bCancel = CrewInviterButton(text=PLocalizer.CrewInviterCancel,
                                      command=self.__handleCancel)
     self.bCancel.reparentTo(self)
     self.bCancel.setPos(0.2, 0, 0.05)
     self.bCancel.hide()
     self.bStop = CrewInviterButton(
         text=PLocalizer.CrewInviterStopBeingCrewed,
         command=self.__handleStop)
     self.bStop.reparentTo(self)
     self.bStop.setPos(0.2, 0, 0.15)
     self.bStop.hide()
     self.bYes = CrewInviterButton(text=PLocalizer.CrewInviterYes,
                                   command=self.__handleYes)
     self.bYes.reparentTo(self)
     self.bYes.setPos(0.1, 0, 0.05)
     self.bYes.hide()
     self.bNo = CrewInviterButton(text=PLocalizer.CrewInviterNo,
                                  command=self.__handleNo)
     self.bNo.reparentTo(self)
     self.bNo.setPos(0.3, 0, 0.05)
     self.bNo.hide()
     return
Example #15
0
    def __init__(self,
                 avId,
                 avName,
                 playerId=None,
                 parent=base.a2dTopRight,
                 **kw):
        # Inherits from DirectFrame
        # Must specify avId and avName on creation
        print(("ToonAvatarDetailPanel %s" % (playerId)))

        # Load required models
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
        detailPanel = gui.find('**/avatarInfoPanel')
        self.playerId = playerId
        textScale = 0.095
        textWrap = 16.4
        self.playerInfo = None
        if self.playerId:
            #textScale = 0.100
            #textWrap = 18.0
            #self.isPlayer = 1
            self.playerInfo = base.cr.playerFriendsManager.playerId2Info.get(
                playerId)
        # Specify default options
        optiondefs = (
            ('pos', (-0.79, 0.0, -0.47), None),
            ('scale', 0.5, None),
            ('relief', None, None),
            ('image', detailPanel, None),
            ('image_color', GlobalDialogColor, None),
            ('text', '', None),
            ('text_wordwrap', textWrap, None),
            ('text_scale', textScale, None),
            ('text_pos', (-0.125, 0.775), None),
        )
        # Merge keyword options with default options
        self.defineoptions(kw, optiondefs)

        # initialize our base class.
        DirectFrame.__init__(self, parent)

        # Information about avatar
        self.dataText = DirectLabel(
            self,
            text='',
            text_scale=0.09,
            text_align=TextNode.ALeft,
            text_wordwrap=15,
            relief=None,
            pos=(-0.85, 0.0, 0.645),
        )

        self.avId = avId
        self.avName = avName
        self.avatar = None
        self.createdAvatar = None

        self.fsm = ClassicFSM.ClassicFSM(
            'ToonAvatarDetailPanel',
            [
                State.State('off', self.enterOff, self.exitOff, ['begin']),
                State.State('begin', self.enterBegin, self.exitBegin,
                            ['query', 'data', 'off']),
                State.State('query', self.enterQuery, self.exitQuery,
                            ['data', 'invalid', 'off']),
                State.State('data', self.enterData, self.exitData, ['off']),
                State.State('invalid', self.enterInvalid, self.exitInvalid,
                            ['off'])
            ],
            # Initial State
            'off',
            # Final State
            'off',
        )

        ToonTeleportPanel.hideTeleportPanel()
        FriendInviter.hideFriendInviter()

        # Create some buttons.
        self.bCancel = DirectButton(self,
                                    image=(buttons.find('**/CloseBtn_UP'),
                                           buttons.find('**/CloseBtn_DN'),
                                           buttons.find('**/CloseBtn_Rllvr')),
                                    image_scale=1.1,
                                    relief=None,
                                    text=TTLocalizer.AvatarDetailPanelCancel,
                                    text_scale=TTLocalizer.TADPcancelButton,
                                    text_pos=(0.12, -0.01),
                                    pos=TTLocalizer.TADPcancelPos,
                                    scale=2.0,
                                    command=self.__handleCancel)
        self.bCancel.hide()

        # Call option initialization functions
        self.initialiseoptions(ToonAvatarDetailPanel)

        # Initialize ClassicFSM
        self.fsm.enterInitialState()
        self.fsm.request('begin')

        # Clean up
        buttons.removeNode()
        gui.removeNode()
Example #16
0
 def __init__(self, avId, avName):
     guiMain = loader.loadModel('models/gui/gui_main')
     DirectFrame.__init__(self,
                          relief=None,
                          pos=(-0.59999999999999998, 0,
                               0.46999999999999997),
                          image=guiMain.find('**/general_frame_e'),
                          image_pos=(0.25, 0, 0.27500000000000002),
                          image_scale=0.25)
     self.initialiseoptions(GuildInviter)
     self.avId = avId
     self.avName = avName
     self.avDisableName = 'disable-%s' % avId
     self.fsm = ClassicFSM.ClassicFSM('GuildInviter', [
         State.State('off', self.enterOff, self.exitOff),
         State.State('getStarted', self.enterGetNewGuild,
                     self.exitGetNewGuild),
         State.State('begin', self.enterBegin, self.exitBegin),
         State.State('tooMany', self.enterTooMany, self.exitTooMany),
         State.State('notYet', self.enterNotYet, self.exitNotYet),
         State.State('checkAvailability', self.enterCheckAvailability,
                     self.exitCheckAvailability),
         State.State('notAvailable', self.enterNotAvailable,
                     self.exitNotAvailable),
         State.State('notAcceptingGuilds', self.enterNotAcceptingGuilds,
                     self.exitNotAcceptingGuilds),
         State.State('wentAway', self.enterWentAway, self.exitWentAway),
         State.State('busy', self.enterBusy, self.exitBusy),
         State.State('alreadyInGuild', self.enterAlreadyInGuild,
                     self.exitAlreadyInGuild),
         State.State('guildFull', self.enterGuildFull, self.exitGuildFull),
         State.State('alreadyInvited', self.enterAlreadyInvited,
                     self.exitAlreadyInvited),
         State.State('askingNPC', self.enterAskingNPC, self.exitAskingNPC),
         State.State('endGuildship', self.enterEndGuildship,
                     self.exitEndGuildship),
         State.State('guildNoMore', self.enterGuildsNoMore,
                     self.exitGuildsNoMore),
         State.State('self', self.enterSelf, self.exitSelf),
         State.State('ignored', self.enterIgnored, self.exitIgnored),
         State.State('asking', self.enterAsking, self.exitAsking),
         State.State('yes', self.enterYes, self.exitYes),
         State.State('no', self.enterNo, self.exitNo),
         State.State('otherTooMany', self.enterOtherTooMany,
                     self.exitOtherTooMany),
         State.State('maybe', self.enterMaybe, self.exitMaybe),
         State.State('down', self.enterDown, self.exitDown),
         State.State('cancel', self.enterCancel, self.exitCancel)
     ], 'off', 'off')
     self.title = DirectLabel(
         parent=self,
         relief=None,
         text=PLocalizer.GuildInviterTitle,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_align=TextNode.ACenter,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_font=PiratesGlobals.getPirateOutlineFont(),
         pos=(0.25, 0, 0.41999999999999998),
         image=None,
         image_scale=0.25)
     self.message = DirectLabel(parent=self,
                                relief=None,
                                text='',
                                text_scale=PiratesGuiGlobals.TextScaleLarge,
                                text_align=TextNode.ACenter,
                                text_fg=PiratesGuiGlobals.TextFG2,
                                text_shadow=PiratesGuiGlobals.TextShadow,
                                text_wordwrap=11,
                                pos=(0.25, 0, 0.32500000000000001),
                                textMayChange=1)
     self.context = None
     self.bOk = GuildInviterButton(text=OTPLocalizer.GuildInviterOK,
                                   command=self._GuildInviter__handleOk)
     self.bOk.reparentTo(self)
     self.bOk.setPos(0.20000000000000001, 0, 0.050000000000000003)
     self.bOk.hide()
     self.bCancel = GuildInviterButton(
         text=OTPLocalizer.GuildInviterCancel,
         command=self._GuildInviter__handleCancel)
     self.bCancel.reparentTo(self)
     self.bCancel.setPos(0.20000000000000001, 0, 0.050000000000000003)
     self.bCancel.hide()
     self.bYes = GuildInviterButton(text=OTPLocalizer.GuildInviterYes,
                                    command=self._GuildInviter__handleYes)
     self.bYes.reparentTo(self)
     self.bYes.setPos(0.10000000000000001, 0, 0.050000000000000003)
     self.bYes.hide()
     self.bNo = GuildInviterButton(text=OTPLocalizer.GuildInviterNo,
                                   command=self._GuildInviter__handleNo)
     self.bNo.reparentTo(self)
     self.bNo.setPos(0.29999999999999999, 0, 0.050000000000000003)
     self.bNo.hide()
     self.fsm.enterInitialState()
     if self.avId == None:
         self.fsm.request('getStarted')
     else:
         self.fsm.request('begin')
Example #17
0
    def __init__(
            self, mdip, mdport, esip, esport, dcFileNames,
            districtId, districtName, districtType, serverId,
            minChannel, maxChannel, dcSuffix = 'AI'):
        assert self.notify.debugStateCall(self)

        # Save the district Id (needed for calculations in AIRepository code)
        self.districtId = districtId
        self.districtName = districtName
        self.districtType = districtType

        AIRepository.__init__(
            self, mdip, mdport, esip, esport, dcFileNames,
            serverId,
            minChannel, maxChannel, dcSuffix)
        self.setClientDatagram(0)
        assert minChannel > districtId
        if hasattr(self, 'setVerbose'):
            if ConfigVariableBool('verbose-airepository', 0).getValue():
                self.setVerbose(1)

        # Save the state server id
        self.serverId = serverId

        # Record the reason each client leaves the shard, according to
        # the client.
        self._avatarDisconnectReasons = {}

        # A list of avIds to pretend to disconnect at the next poll
        # cycle, for debugging purposes only.
        self._debugDisconnectIds = []

        # player avatars will increment and decrement this count
        self._population = 0

        # The AI State machine
        self.fsm = ClassicFSM.ClassicFSM('AIDistrict',
                       [State.State('off',
                                    self.enterOff,
                                    self.exitOff,
                                    ['connect']),
                        State.State('connect',
                                    self.enterConnect,
                                    self.exitConnect,
                                    ['districtReset', 'noConnection',
                                     # I added this because Skyler removed the transition to
                                     # districtReset -- Joe
                                     'playGame',
                                     ]),
                        State.State('districtReset',
                                    self.enterDistrictReset,
                                    self.exitDistrictReset,
                                    ['playGame','noConnection']),
                        State.State('playGame',
                                    self.enterPlayGame,
                                    self.exitPlayGame,
                                    ['noConnection']),
                        State.State('noConnection',
                                    self.enterNoConnection,
                                    self.exitNoConnection,
                                    ['connect'])],
                       # initial state
                       'off',
                       # final state
                       'off',
                       )

        self.fsm.enterInitialState()

        self.fsm.request("connect")
 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.gameFSM = ClassicFSM.ClassicFSM('DistributedRingGame', [State.State('off', self.enterOff, self.exitOff, ['swim']), State.State('swim', self.enterSwim, self.exitSwim, ['cleanup']), State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
     self.addChildGameFSM(self.gameFSM)
    def __init__(self, cr):
        NodePath.__init__(self, 'DistributedChineseCheckers')
        DistributedNode.DistributedNode.__init__(self, cr)
        self.cr = cr
        self.reparentTo(render)
        self.boardNode = loader.loadModel(
            'phase_6/models/golf/checker_game.bam')
        self.boardNode.reparentTo(self)
        self.board = ChineseCheckersBoard()
        self.playerTags = render.attachNewNode('playerTags')
        self.playerTagList = []
        self.exitButton = None
        self.inGame = False
        self.waiting = True
        self.startButton = None
        self.playerNum = None
        self.turnText = None
        self.isMyTurn = False
        self.wantTimer = True
        self.leaveButton = None
        self.screenText = None
        self.turnText = None
        self.exitButton = None
        self.numRandomMoves = 0
        self.blinker = Sequence()
        self.playersTurnBlinker = Sequence()
        self.yourTurnBlinker = Sequence()
        self.moveList = []
        self.mySquares = []
        self.playerSeats = None
        self.accept('mouse1', self.mouseClick)
        self.traverser = base.cTrav
        self.pickerNode = CollisionNode('mouseRay')
        self.pickerNP = camera.attachNewNode(self.pickerNode)
        self.pickerNode.setFromCollideMask(ToontownGlobals.WallBitmask)
        self.pickerRay = CollisionRay()
        self.pickerNode.addSolid(self.pickerRay)
        self.myHandler = CollisionHandlerQueue()
        self.traverser.addCollider(self.pickerNP, self.myHandler)
        self.buttonModels = loader.loadModel(
            'phase_3.5/models/gui/inventory_gui')
        self.upButton = self.buttonModels.find('**//InventoryButtonUp')
        self.downButton = self.buttonModels.find('**/InventoryButtonDown')
        self.rolloverButton = self.buttonModels.find(
            '**/InventoryButtonRollover')
        self.clockNode = ToontownTimer()
        self.clockNode.setPos(1.16, 0, -0.83)
        self.clockNode.setScale(0.3)
        self.clockNode.hide()
        self.playerColors = [
            Vec4(0, 0.9, 0, 1),
            Vec4(0.9, 0.9, 0, 1),
            Vec4(0.45, 0, 0.45, 1),
            Vec4(0.2, 0.4, 0.8, 1),
            Vec4(1, 0.45, 1, 1),
            Vec4(0.8, 0, 0, 1)
        ]
        self.tintConstant = Vec4(0.25, 0.25, 0.25, 0)
        self.ghostConstant = Vec4(0, 0, 0, 0.5)
        self.startingPositions = [
            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
            [10, 11, 12, 13, 23, 24, 25, 35, 36, 46],
            [65, 75, 76, 86, 87, 88, 98, 99, 100, 101],
            [111, 112, 113, 114, 115, 116, 117, 118, 119, 120],
            [74, 84, 85, 95, 96, 97, 107, 108, 109, 110],
            [19, 20, 21, 22, 32, 33, 34, 44, 45, 55]
        ]
        self.nonOpposingPositions = []
        self.knockSound = base.loader.loadSfx(
            'phase_5/audio/sfx/GUI_knock_1.ogg')
        self.clickSound = base.loader.loadSfx(
            'phase_3/audio/sfx/GUI_balloon_popup.ogg')
        self.moveSound = base.loader.loadSfx('phase_6/audio/sfx/CC_move.ogg')
        self.accept('stoppedAsleep', self.handleSleep)
        from direct.fsm import ClassicFSM, State
        self.fsm = ClassicFSM.ClassicFSM('ChineseCheckers', [
            State.State('waitingToBegin', self.enterWaitingToBegin,
                        self.exitWaitingToBegin, ['playing', 'gameOver']),
            State.State('playing', self.enterPlaying, self.exitPlaying,
                        ['gameOver']),
            State.State('gameOver', self.enterGameOver, self.exitGameOver,
                        ['waitingToBegin'])
        ], 'waitingToBegin', 'waitingToBegin')
        x = self.boardNode.find('**/locators')
        self.locatorList = x.getChildren()
        tempList = []
        for x in xrange(0, 121):
            self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
            tempList.append(self.locatorList[x].attachNewNode(
                CollisionNode('picker%d' % x)))
            tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.115))

        for z in self.locatorList:
            y = loader.loadModel('phase_6/models/golf/checker_marble.bam')
            z.setColor(0, 0, 0, 0)
            y.reparentTo(z)
Example #20
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()
Example #21
0
    def __init__(self, cr):
        self.cr = cr
        NodePath.__init__(self, 'DistributedPicnicTable')
        DistributedNode.DistributedNode.__init__(self, cr)
        self.reparentTo(render)
        self.picnicTable = loader.loadModel(
            'phase_6/models/golf/game_table.bam')
        self.picnicTable.reparentTo(self)
        self.picnicTableSphereNodes = []
        self.numSeats = 6
        self.seats = []
        self.jumpOffsets = []
        self.inGame = False
        self.requestSeat = None
        self.gameState = None
        self.cameraBoardTrack = Func(self.doNothing)
        self.seatBumpForObserve = 0
        self.winTrack = Sequence()
        self.outTrack = Sequence()
        self.joinButton = None
        self.observeButton = None
        self.tutorialButton = None
        self.exitButton = None
        self.isPlaying = False
        self.gameMenu = None
        self.game = None
        self.gameZone = None
        self.tutorial = None
        self.timerFunc = None
        self.gameDoId = None
        self.gameWantTimer = False
        self.tableState = [None, None, None, None, None, None]
        self.haveAnimated = []
        self.winSound = base.loadSfx('phase_6/audio/sfx/KART_Applause_1.mp3')
        self.happyDance = base.loadSfx(
            'phase_5/audio/sfx/AA_heal_happydance.mp3')
        self.accept('stoppedAsleep', self.handleSleep)
        base.localAvatar.startSleepWatch(self.handleSleep)
        self._DistributedPicnicTable__toonTracks = {}
        self.fsm = ClassicFSM.ClassicFSM('PicnicTable', [
            State.State('off', self.enterOff, self.exitOff,
                        ['chooseMode', 'observing']),
            State.State('chooseMode', self.enterChooseMode,
                        self.exitChooseMode, ['sitting', 'off', 'observing']),
            State.State('sitting', self.enterSitting, self.exitSitting,
                        ['off']),
            State.State('observing', self.enterObserving, self.exitObserving,
                        ['off'])
        ], 'off', 'off')
        self.fsm.enterInitialState()
        for i in range(self.numSeats):
            self.seats.append(self.picnicTable.find('**/*seat%d' % (i + 1)))
            self.jumpOffsets.append(
                self.picnicTable.find('**/*jumpOut%d' % (i + 1)))

        self.tableCloth = self.picnicTable.find('**/basket_locator')
        self.tableclothSphereNode = self.tableCloth.attachNewNode(
            CollisionNode('tablecloth_sphere'))
        self.tableclothSphereNode.node().addSolid(
            CollisionSphere(0, 0, -2, 5.5))
        self.clockNode = ToontownTimer()
        self.clockNode.setPos(1.1599999999999999, 0, -0.82999999999999996)
        self.clockNode.setScale(0.29999999999999999)
        self.clockNode.hide()
 def __init__(self, cr):
     DistributedMinigame.__init__(self, cr)
     self.gameFSM = ClassicFSM.ClassicFSM('DistributedRaceGame', [State.State('off', self.enterOff, self.exitOff, ['inputChoice']),
      State.State('inputChoice', self.enterInputChoice, self.exitInputChoice, ['waitServerChoices', 'moveAvatars', 'cleanup']),
      State.State('waitServerChoices', self.enterWaitServerChoices, self.exitWaitServerChoices, ['moveAvatars', 'cleanup']),
      State.State('moveAvatars', self.enterMoveAvatars, self.exitMoveAvatars, ['inputChoice', 'winMovie', 'cleanup']),
      State.State('winMovie', self.enterWinMovie, self.exitWinMovie, ['cleanup']),
      State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
     self.addChildGameFSM(self.gameFSM)
     self.posHprArray = (((-9.03,
        0.06,
        0.025,
        -152.9),
       (-7.43,
        -2.76,
        0.025,
        -152.68),
       (-6.02,
        -5.48,
        0.025,
        -157.54),
       (-5.01,
        -8.32,
        0.025,
        -160.66),
       (-4.05,
        -11.36,
        0.025,
        -170.22),
       (-3.49,
        -14.18,
        0.025,
        -175.76),
       (-3.12,
        -17.15,
        0.025,
        -177.73),
       (-3.0,
        -20.32,
        0.025,
        178.49),
       (-3.09,
        -23.44,
        0.025,
        176.59),
       (-3.43,
        -26.54,
        0.025,
        171.44),
       (-4.07,
        -29.44,
        0.025,
        163.75),
       (-5.09,
        -32.27,
        0.025,
        158.2),
       (-6.11,
        -35.16,
        0.025,
        154.98),
       (-7.57,
        -37.78,
        0.025,
        154.98),
       (-9.28,
        -40.65,
        0.025,
        150.41)),
      ((-6.12,
        1.62,
        0.025,
        -152.9),
       (-4.38,
        -1.35,
        0.025,
        -150.92),
       (-3.08,
        -4.3,
        0.025,
        -157.9),
       (-1.85,
        -7.26,
        0.025,
        -162.54),
       (-0.93,
        -10.49,
        0.025,
        -167.71),
       (-0.21,
        -13.71,
        0.025,
        -171.79),
       (0.21,
        -17.08,
        0.025,
        -174.92),
       (0.31,
        -20.2,
        0.025,
        177.1),
       (0.17,
        -23.66,
        0.025,
        174.82),
       (-0.23,
        -26.91,
        0.025,
        170.51),
       (-0.99,
        -30.2,
        0.025,
        162.54),
       (-2.02,
        -33.28,
        0.025,
        160.48),
       (-3.28,
        -36.38,
        0.025,
        157.96),
       (-4.67,
        -39.17,
        0.025,
        154.13),
       (-6.31,
        -42.15,
        0.025,
        154.13)),
      ((-2.99,
        3.09,
        0.025,
        -154.37),
       (-1.38,
        -0.05,
        0.025,
        -154.75),
       (-0.19,
        -3.29,
        0.025,
        -159.22),
       (1.17,
        -6.51,
        0.025,
        -162.74),
       (2.28,
        -9.8,
        0.025,
        -168.73),
       (3.09,
        -13.28,
        0.025,
        -173.49),
       (3.46,
        -16.63,
        0.025,
        -176.81),
       (3.69,
        -20.38,
        0.025,
        179.14),
       (3.61,
        -24.12,
        0.025,
        175.78),
       (3.0,
        -27.55,
        0.025,
        170.87),
       (2.15,
        -30.72,
        0.025,
        167.41),
       (1.04,
        -34.26,
        0.025,
        162.11),
       (-0.15,
        -37.44,
        0.025,
        158.59),
       (-1.64,
        -40.52,
        0.025,
        153.89),
       (-3.42,
        -43.63,
        0.025,
        153.89)),
      ((0.0,
        4.35,
        0.025,
        -154.37),
       (1.52,
        1.3,
        0.025,
        -155.67),
       (3.17,
        -2.07,
        0.025,
        -155.67),
       (4.47,
        -5.41,
        0.025,
        -163.0),
       (5.56,
        -9.19,
        0.025,
        -168.89),
       (6.22,
        -12.66,
        0.025,
        -171.67),
       (6.67,
        -16.56,
        0.025,
        -176.53),
       (6.93,
        -20.33,
        0.025,
        179.87),
       (6.81,
        -24.32,
        0.025,
        175.19),
       (6.22,
        -27.97,
        0.025,
        170.81),
       (5.59,
        -31.73,
        0.025,
        167.54),
       (4.48,
        -35.42,
        0.025,
        161.92),
       (3.06,
        -38.82,
        0.025,
        158.56),
       (1.4,
        -42.0,
        0.025,
        154.32),
       (-0.71,
        -45.17,
        0.025,
        153.27)))
     self.avatarPositions = {}
     self.modelCount = 8
     self.cameraTopView = (-22.78,
      -41.65,
      31.53,
      -51.55,
      -42.68,
      -2.96)
     self.timer = None
     self.timerStartTime = None
     return None
 def __init__(self, cr):
     DistributedToonInterior.__init__(self, cr)
     self.sillyFSM = ClassicFSM.ClassicFSM('SillyOMeter', [State.State('Setup', self.enterSetup, self.exitSetup, ['Phase0',
       'Phase1',
       'Phase2',
       'Phase3',
       'Phase4',
       'Phase5',
       'Phase6',
       'Phase7',
       'Phase8',
       'Phase9',
       'Phase10',
       'Phase11',
       'Phase12',
       'Phase13',
       'Phase14',
       'Phase15',
       'Flat',
       'Off']),
      State.State('Phase0', self.enterPhase0, self.exitPhase0, ['Phase1', 'Flat', 'Off']),
      State.State('Phase1', self.enterPhase1, self.exitPhase1, ['Phase2', 'Flat', 'Off']),
      State.State('Phase2', self.enterPhase2, self.exitPhase2, ['Phase3', 'Flat', 'Off']),
      State.State('Phase3', self.enterPhase3, self.exitPhase3, ['Phase4', 'Flat', 'Off']),
      State.State('Phase4', self.enterPhase4, self.exitPhase4, ['Phase5', 'Flat', 'Off']),
      State.State('Phase5', self.enterPhase5, self.exitPhase5, ['Phase6', 'Flat', 'Off']),
      State.State('Phase6', self.enterPhase6, self.exitPhase6, ['Phase7', 'Flat', 'Off']),
      State.State('Phase7', self.enterPhase7, self.exitPhase7, ['Phase8', 'Flat', 'Off']),
      State.State('Phase8', self.enterPhase8, self.exitPhase8, ['Phase9', 'Flat', 'Off']),
      State.State('Phase9', self.enterPhase9, self.exitPhase9, ['Phase10', 'Flat', 'Off']),
      State.State('Phase10', self.enterPhase10, self.exitPhase10, ['Phase11', 'Flat', 'Off']),
      State.State('Phase11', self.enterPhase11, self.exitPhase11, ['Phase12', 'Flat', 'Off']),
      State.State('Phase12', self.enterPhase12, self.exitPhase12, ['Phase13', 'Flat', 'Off']),
      State.State('Phase13', self.enterPhase13, self.exitPhase13, ['Phase14', 'Flat', 'Off']),
      State.State('Phase14', self.enterPhase14, self.exitPhase14, ['Phase15', 'Flat', 'Off']),
      State.State('Phase15', self.enterPhase15, self.exitPhase15, ['Flat', 'Off']),
      State.State('Flat', self.enterFlat, self.exitFlat, ['Off', 'Phase0']),
      State.State('Off', self.enterOff, self.exitOff, [])], 'Setup', 'Off')
Example #24
0
 def __init__(self, loader, avId, parentFSMState, doneEvent):
     Place.Place.__init__(self, loader, doneEvent)
     self.id = ToontownGlobals.MyEstate
     self.ownersAvId = avId
     self.dnaFile = 'phase_7/models/modules/toon_interior'
     self.isInterior = 1
     self.tfaDoneEvent = 'tfaDoneEvent'
     self.oldStyle = None
     self.fsm = ClassicFSM.ClassicFSM('House', [State.State('start', self.enterStart, self.exitStart, ['doorIn', 'teleportIn', 'tutorial']),
      State.State('walk', self.enterWalk, self.exitWalk, ['sit',
       'stickerBook',
       'doorOut',
       'DFA',
       'teleportOut',
       'quest',
       'purchase',
       'closet',
       'banking',
       'phone',
       'stopped']),
      State.State('sit', self.enterSit, self.exitSit, ['walk']),
      State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk',
       'DFA',
       'sit',
       'doorOut',
       'teleportOut',
       'quest',
       'purchase',
       'closet',
       'banking',
       'phone',
       'stopped']),
      State.State('DFA', self.enterDFA, self.exitDFA, ['DFAReject', 'teleportOut', 'doorOut']),
      State.State('DFAReject', self.enterDFAReject, self.exitDFAReject, ['walk']),
      State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
      State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
      State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
      State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn']),
      State.State('quest', self.enterQuest, self.exitQuest, ['walk', 'doorOut']),
      State.State('tutorial', self.enterTutorial, self.exitTutorial, ['walk', 'quest']),
      State.State('purchase', self.enterPurchase, self.exitPurchase, ['walk', 'doorOut']),
      State.State('closet', self.enterCloset, self.exitCloset, ['walk']),
      State.State('banking', self.enterBanking, self.exitBanking, ['walk']),
      State.State('phone', self.enterPhone, self.exitPhone, ['walk']),
      State.State('stopped', self.enterStopped, self.exitStopped, ['walk']),
      State.State('final', self.enterFinal, self.exitFinal, ['start', 'teleportIn'])], 'start', 'final')
     self.parentFSMState = parentFSMState
     return
Example #25
0
 def __init__(self, loader, parentFSM, doneEvent):
     Place.Place.__init__(self, loader, doneEvent)
     self.tfaDoneEvent = 'tfaDoneEvent'
     self.fsm = ClassicFSM.ClassicFSM('Playground', [
         State.State('start', self.enterStart, self.exitStart,
                     ['walk', 'deathAck', 'doorIn', 'tunnelIn']),
         State.State('walk', self.enterWalk, self.exitWalk, [
             'drive', 'sit', 'stickerBook', 'TFA', 'DFA', 'trialerFA',
             'trolley', 'final', 'doorOut', 'options', 'quest', 'purchase',
             'stopped', 'fishing'
         ]),
         State.State(
             'stickerBook', self.enterStickerBook, self.exitStickerBook, [
                 'walk', 'DFA', 'TFA', 'trolley', 'final', 'doorOut',
                 'quest', 'purchase', 'stopped', 'fishing', 'trialerFA'
             ]),
         State.State('sit', self.enterSit, self.exitSit,
                     ['walk', 'DFA', 'trialerFA']),
         State.State('drive', self.enterDrive, self.exitDrive,
                     ['walk', 'DFA', 'trialerFA']),
         State.State('trolley', self.enterTrolley, self.exitTrolley,
                     ['walk']),
         State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
         State.State('doorOut', self.enterDoorOut, self.exitDoorOut,
                     ['walk']),
         State.State('TFA', self.enterTFA, self.exitTFA,
                     ['TFAReject', 'DFA']),
         State.State('TFAReject', self.enterTFAReject, self.exitTFAReject,
                     ['walk']),
         State.State('trialerFA', self.enterTrialerFA, self.exitTrialerFA,
                     ['trialerFAReject', 'DFA']),
         State.State('trialerFAReject', self.enterTrialerFAReject,
                     self.exitTrialerFAReject, ['walk']),
         State.State('DFA', self.enterDFA, self.exitDFA,
                     ['DFAReject', 'NPCFA', 'HFA']),
         State.State('DFAReject', self.enterDFAReject, self.exitDFAReject,
                     ['walk']),
         State.State('NPCFA', self.enterNPCFA, self.exitNPCFA,
                     ['NPCFAReject', 'HFA']),
         State.State('NPCFAReject', self.enterNPCFAReject,
                     self.exitNPCFAReject, ['walk']),
         State.State('HFA', self.enterHFA, self.exitHFA,
                     ['HFAReject', 'teleportOut', 'tunnelOut']),
         State.State('HFAReject', self.enterHFAReject, self.exitHFAReject,
                     ['walk']),
         State.State('deathAck', self.enterDeathAck, self.exitDeathAck,
                     ['teleportIn']),
         State.State('teleportIn', self.enterTeleportIn,
                     self.exitTeleportIn, ['walk', 'popup']),
         State.State('popup', self.enterPopup, self.exitPopup, ['walk']),
         State.State('teleportOut', self.enterTeleportOut,
                     self.exitTeleportOut, ['deathAck', 'teleportIn']),
         State.State('died', self.enterDied, self.exitDied, ['final']),
         State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn,
                     ['walk']),
         State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut,
                     ['final']),
         State.State('quest', self.enterQuest, self.exitQuest, ['walk']),
         State.State('purchase', self.enterPurchase, self.exitPurchase,
                     ['walk']),
         State.State('stopped', self.enterStopped, self.exitStopped,
                     ['walk']),
         State.State('fishing', self.enterFishing, self.exitFishing,
                     ['walk']),
         State.State('final', self.enterFinal, self.exitFinal, ['start'])
     ], 'start', 'final')
     self.parentFSM = parentFSM
     self.tunnelOriginList = []
     self.trolleyDoneEvent = 'trolleyDone'
     self.hfaDoneEvent = 'hfaDoneEvent'
     self.npcfaDoneEvent = 'npcfaDoneEvent'
     self.dialog = None
     self.deathAckBox = None
     return
Example #26
0
 def __init__(self, forGui=0):
     Avatar.Avatar.__init__(self)
     self.serialNum = Pet.SerialNum
     Pet.SerialNum += 1
     self.lockedDown = 0
     self.setPickable(1)
     self.setPlayerType(NametagGroup.CCNonPlayer)
     self.animFSM = ClassicFSM(
         'petAnimFSM',
         [
             State('off', self.enterOff, self.exitOff),
             State('neutral', self.enterNeutral, self.exitNeutral),
             State('neutralHappy', self.enterNeutralHappy,
                   self.exitNeutralHappy),
             State('neutralSad', self.enterNeutralSad, self.exitNeutralSad),
             State('run', self.enterRun, self.exitRun),
             State('swim', self.enterSwim, self.exitSwim),
             State('teleportIn', self.enterTeleportIn,
                   self.exitTeleportOut),
             State('teleportOut', self.enterTeleportOut,
                   self.exitTeleportOut),
             State('walk', self.enterWalk, self.exitWalk),
             State('walkHappy', self.enterWalkHappy, self.exitWalkHappy),
             State('walkSad', self.enterWalkSad, self.exitWalkSad),
         ],
         # init
         'off',
         # final
         'off',
     )
     self.animFSM.enterInitialState()
     self.forGui = forGui
     self.moodModel = None
     # probably don't have a name yet
     self.__blinkName = 'petblink-' + str(self.this)
     self.track = None
     self.soundBackflip = None
     self.soundRollover = None
     self.soundPlaydead = None
     self.soundTeleportIn = None
     self.soundTeleportOut = None
     self.teleportHole = None
Example #27
0
 def __init__(self, loader, avId, zoneId, parentFSMState, doneEvent):
     Place.Place.__init__(self, None, doneEvent)
     self.id = MyEstate
     self.avId = avId
     self.zoneId = zoneId
     self.loader = loader
     self.cameraSubmerged = -1
     self.toonSubmerged = -1
     self.fsm = ClassicFSM.ClassicFSM('Estate', [
         State.State('init', self.enterInit, self.exitInit,
                     ['final', 'teleportIn', 'doorIn', 'walk']),
         State.State('petTutorial', self.enterPetTutorial,
                     self.exitPetTutorial, ['walk']),
         State.State('walk', self.enterWalk, self.exitWalk, [
             'final', 'sit', 'stickerBook', 'options', 'quest', 'fishing',
             'mailbox', 'stopped', 'DFA', 'trialerFA', 'doorOut', 'push',
             'pet'
         ]),
         State.State('stopped', self.enterStopped, self.exitStopped,
                     ['walk', 'teleportOut']),
         State.State('sit', self.enterSit, self.exitSit, ['walk']),
         State.State('push', self.enterPush, self.exitPush, ['walk']),
         State.State(
             'stickerBook', self.enterStickerBook, self.exitStickerBook, [
                 'walk', 'sit', 'quest', 'fishing', 'mailbox', 'stopped',
                 'doorOut', 'push', 'pet', 'DFA', 'trialerFA'
             ]),
         State.State('teleportIn', self.enterTeleportIn,
                     self.exitTeleportIn, ['walk', 'petTutorial']),
         State.State('teleportOut', self.enterTeleportOut,
                     self.exitTeleportOut, ['teleportIn', 'walk', 'final']),
         State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']),
         State.State('doorOut', self.enterDoorOut, self.exitDoorOut,
                     ['final', 'walk']),
         State.State('final', self.enterFinal, self.exitFinal,
                     ['teleportIn']),
         State.State('quest', self.enterQuest, self.exitQuest, ['walk']),
         State.State('fishing', self.enterFishing, self.exitFishing,
                     ['walk', 'stopped']),
         State.State('mailbox', self.enterMailbox, self.exitMailbox,
                     ['walk', 'stopped']),
         State.State('stopped', self.enterStopped, self.exitStopped,
                     ['walk']),
         State.State('pet', self.enterPet, self.exitPet,
                     ['walk', 'trialerFA']),
         State.State('trialerFA', self.enterTrialerFA, self.exitTrialerFA,
                     ['trialerFAReject', 'DFA']),
         State.State('trialerFAReject', self.enterTrialerFAReject,
                     self.exitTrialerFAReject, ['walk']),
         State.State('DFA', self.enterDFA, self.exitDFA,
                     ['DFAReject', 'teleportOut']),
         State.State('DFAReject', self.enterDFAReject, self.exitDFAReject,
                     ['walk'])
     ], 'init', 'final')
     self.fsm.enterInitialState()
     self.doneEvent = doneEvent
     self.parentFSMState = parentFSMState
     return
 def generateInit(self):
     self.notify.debug('generateInit')
     BasicEntities.DistributedNodePathEntity.generateInit(self)
     self.fsm = ClassicFSM.ClassicFSM('DistributedSinkingPlatform', [State.State('off', self.enterOff, self.exitOff, ['sinking']), State.State('sinking', self.enterSinking, self.exitSinking, ['rising']), State.State('rising', self.enterRising, self.exitRising, ['sinking', 'off'])], 'off', 'off')
     self.fsm.enterInitialState()
Example #29
0
 def __init__(self, loader, parentFSM, doneEvent):
     BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
     self.parentFSM = parentFSM
     self.bossCog = None
     self.teleportInPosHpr = (0, 0, 0, 0, 0, 0)
     self.fsm = ClassicFSM.ClassicFSM('CogHQBossBattle', [State.State('start', self.enterStart, self.exitStart, ['walk',
       'tunnelIn',
       'teleportIn',
       'movie']),
      State.State('battle', self.enterBattle, self.exitBattle, ['walk', 'died', 'movie']),
      State.State('finalBattle', self.enterFinalBattle, self.exitFinalBattle, ['walk',
       'stickerBook',
       'teleportOut',
       'died',
       'tunnelOut',
       'DFA',
       'battle',
       'movie',
       'ouch',
       'crane',
       'WaitForBattle',
       'squished']),
      State.State('movie', self.enterMovie, self.exitMovie, ['walk',
       'battle',
       'finalBattle',
       'died',
       'teleportOut']),
      State.State('ouch', self.enterOuch, self.exitOuch, ['walk',
       'battle',
       'finalBattle',
       'died',
       'crane']),
      State.State('crane', self.enterCrane, self.exitCrane, ['walk',
       'battle',
       'finalBattle',
       'died',
       'ouch',
       'squished']),
      State.State('walk', self.enterWalk, self.exitWalk, ['stickerBook',
       'teleportOut',
       'died',
       'tunnelOut',
       'DFA',
       'battle',
       'movie',
       'ouch',
       'crane',
       'finalBattle',
       'WaitForBattle']),
      State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk',
       'DFA',
       'WaitForBattle',
       'movie',
       'battle']),
      State.State('WaitForBattle', self.enterWaitForBattle, self.exitWaitForBattle, ['battle', 'walk', 'movie']),
      State.State('DFA', self.enterDFA, self.exitDFA, ['DFAReject', 'teleportOut', 'tunnelOut']),
      State.State('DFAReject', self.enterDFAReject, self.exitDFAReject, ['walk']),
      State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']),
      State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'final', 'WaitForBattle']),
      State.State('died', self.enterDied, self.exitDied, ['final']),
      State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['walk']),
      State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['final']),
      State.State('squished', self.enterSquished, self.exitSquished, ['finalBattle',
       'crane',
       'died',
       'teleportOut']),
      State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
     return
Example #30
0
 def __init__(self, air, blockNumber, zoneId, trophyMgr):
     """blockNumber: the landmark building number (from the name)"""
     DistributedObjectAI.DistributedObjectAI.__init__(self, air)
     self.block = blockNumber
     assert (self.debugPrint("DistributedBuildingAI(%s, %s)" %
                             ("the air", str(blockNumber))))
     self.zoneId = zoneId
     self.canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
     self.trophyMgr = trophyMgr
     self.victorResponses = None
     self.fsm = ClassicFSM.ClassicFSM(
         'DistributedBuildingAI',
         [
             State.State('off', self.enterOff, self.exitOff, [
                 'waitForVictors',
                 'becomingToon',
                 'toon',
                 'clearOutToonInterior',
                 'becomingSuit',
                 'suit',
                 'clearOutToonInteriorForCogdo',
                 'becomingCogdo',
                 'becomingCogdoFromCogdo'
                 'cogdo',
             ]),
             State.State('waitForVictors', self.enterWaitForVictors,
                         self.exitWaitForVictors, [
                             'becomingToon',
                         ]),
             State.State(
                 'waitForVictorsFromCogdo',
                 self.enterWaitForVictorsFromCogdo,
                 self.exitWaitForVictorsFromCogdo,
                 ['becomingToonFromCogdo', 'becomingCogdoFromCogdo']),
             State.State('becomingToon', self.enterBecomingToon,
                         self.exitBecomingToon, ['toon']),
             State.State('becomingToonFromCogdo',
                         self.enterBecomingToonFromCogdo,
                         self.exitBecomingToonFromCogdo, ['toon']),
             State.State(
                 'toon', self.enterToon, self.exitToon,
                 ['clearOutToonInterior', 'clearOutToonInteriorForCogdo']),
             State.State('clearOutToonInterior',
                         self.enterClearOutToonInterior,
                         self.exitClearOutToonInterior, ['becomingSuit']),
             State.State('becomingSuit', self.enterBecomingSuit,
                         self.exitBecomingSuit, ['suit']),
             State.State(
                 'suit',
                 self.enterSuit,
                 self.exitSuit,
                 [
                     'waitForVictors',
                     'becomingToon',  # debug only
                 ]),
             State.State('clearOutToonInteriorForCogdo',
                         self.enterClearOutToonInteriorForCogdo,
                         self.exitClearOutToonInteriorForCogdo,
                         ['becomingCogdo']),
             State.State('becomingCogdo', self.enterBecomingCogdo,
                         self.exitBecomingCogdo, ['cogdo']),
             State.State('becomingCogdoFromCogdo',
                         self.enterBecomingCogdoFromCogdo,
                         self.exitBecomingCogdoFromCogdo, ['cogdo']),
             State.State(
                 'cogdo',
                 self.enterCogdo,
                 self.exitCogdo,
                 [
                     'waitForVictorsFromCogdo',
                     'becomingToonFromCogdo',  # debug only
                 ])
         ],
         # Initial State
         'off',
         # Final State
         'off',
     )
     self.fsm.enterInitialState()
     self.track = 'c'
     self.difficulty = 1
     self.numFloors = 0
     self.savedBy = None
     self.becameSuitTime = 0
     self.frontDoorPoint = None
     self.suitPlannerExt = None
Example #31
0
 def __init__(self, loader, parentFSM, doneEvent):
     Place.Place.__init__(self, loader, doneEvent)
     self.fsm = ClassicFSM.ClassicFSM('SuitInterior', [
         State.State('entrance', self.enterEntrance, self.exitEntrance,
                     ['battle', 'walk']),
         State.State('Elevator', self.enterElevator, self.exitElevator,
                     ['battle', 'walk']),
         State.State('battle', self.enterBattle, self.exitBattle,
                     ['walk', 'died']),
         State.State('walk', self.enterWalk, self.exitWalk, [
             'stickerBook', 'stopped', 'sit', 'died', 'teleportOut',
             'Elevator', 'DFA', 'trialerFA'
         ]),
         State.State('sit', self.enterSit, self.exitSit, ['walk']),
         State.State(
             'stickerBook', self.enterStickerBook, self.exitStickerBook, [
                 'walk', 'stopped', 'sit', 'died', 'DFA', 'trialerFA',
                 'teleportOut', 'Elevator'
             ]),
         State.State('trialerFA', self.enterTrialerFA, self.exitTrialerFA,
                     ['trialerFAReject', 'DFA']),
         State.State('trialerFAReject', self.enterTrialerFAReject,
                     self.exitTrialerFAReject, ['walk']),
         State.State('DFA', self.enterDFA, self.exitDFA,
                     ['DFAReject', 'teleportOut']),
         State.State('DFAReject', self.enterDFAReject, self.exitDFAReject,
                     ['walk']),
         State.State('teleportIn', self.enterTeleportIn,
                     self.exitTeleportIn, ['walk']),
         State.State('teleportOut', self.enterTeleportOut,
                     self.exitTeleportOut, ['teleportIn']),
         State.State('stopped', self.enterStopped, self.exitStopped,
                     ['walk', 'elevatorOut']),
         State.State('died', self.enterDied, self.exitDied, []),
         State.State('elevatorOut', self.enterElevatorOut,
                     self.exitElevatorOut, [])
     ], 'entrance', 'elevatorOut')
     self.parentFSM = parentFSM
     self.elevatorDoneEvent = 'elevatorDoneSI'
     self.currentFloor = 0