def setup(self):
     print 'Setting up Toontorial dna! :D'
     self.dnaStore = base.cr.playGame.dnaStore
     self.randomGenerator = random.Random()
     self.randomGenerator.seed(self.zoneId)
     self.interior = loader.loadModel('phase_3.5/models/modules/toon_interior_tutorial')
     self.interior.reparentTo(render)
     dnaStore = DNAStorage()
     node = loader.loadDNAFile(self.cr.playGame.hood.dnaStore, 'phase_3.5/dna/tutorial_street.dna')
     self.street = render.attachNewNode(node)
     self.street.flattenMedium()
     self.street.setPosHpr(-17, 42, -0.5, 180, 0, 0)
     self.street.find('**/tb2:toon_landmark_TT_A1_DNARoot').stash()
     self.street.find('**/tb1:toon_landmark_hqTT_DNARoot/**/door_flat_0').stash()
     self.street.findAllMatches('**/+CollisionNode').stash()
     self.skyFile = 'phase_3.5/models/props/TT_sky'
     self.sky = loader.loadModel(self.skyFile)
     self.sky.setScale(0.8)
     self.sky.reparentTo(render)
     self.sky.setDepthTest(0)
     self.sky.setDepthWrite(0)
     self.sky.setBin('background', 100)
     self.sky.find('**/Sky').reparentTo(self.sky, -1)
     hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
     self.colors = ToonInteriorColors.colors[hoodId]
     self.replaceRandomInModel(self.interior)
     doorModelName = 'door_double_round_ul'
     if doorModelName[-1:] == 'r':
         doorModelName = doorModelName[:-1] + 'l'
     else:
         doorModelName = doorModelName[:-1] + 'r'
     door = self.dnaStore.findNode(doorModelName)
     door_origin = render.find('**/door_origin;+s')
     doorNP = door.copyTo(door_origin)
     door_origin.setScale(0.8, 0.8, 0.8)
     door_origin.setPos(door_origin, 0, -0.025, 0)
     color = self.randomGenerator.choice(self.colors['TI_door'])
     DNADoor.setupDoor(doorNP, self.interior, door_origin, self.dnaStore, str(self.block), color)
     doorFrame = doorNP.find('door_*_flat')
     doorFrame.wrtReparentTo(self.interior)
     doorFrame.setColor(color)
     del self.colors
     del self.dnaStore
     del self.randomGenerator
     self.interior.flattenMedium()
     npcOrigin = self.interior.find('**/npc_origin_' + `(self.npc.posIndex)`)
     if not npcOrigin.isEmpty():
         self.npc.reparentTo(npcOrigin)
         self.npc.clearMat()
     self.createSuit()
     self.mickeyMovie = QuestParser.NPCMoviePlayer('tutorial_mickey', base.localAvatar, self.npc)
     place = base.cr.playGame.getPlace()
     if place and hasattr(place, 'fsm') and place.fsm.getCurrentState().getName():
         self.notify.info('Tutorial movie: Place ready.')
         self.playMovie()
     else:
         self.notify.info('Tutorial movie: Waiting for place=%s, has fsm=%s' % (place, hasattr(place, 'fsm')))
         if hasattr(place, 'fsm'):
             self.notify.info('Tutorial movie: place state=%s' % place.fsm.getCurrentState().getName())
         self.acceptOnce('enterTutorialInterior', self.playMovie)
Beispiel #2
0
    def setMovie(self, mode, npcId, avId, timestamp):
        """
        This is a message from the AI describing a movie between this NPC
        and a Toon that has approached us.
        """
        timeStamp = ClockDelta.globalClockDelta.localElapsedTime(timestamp)

        self.npcId = npcId

        # See if this is the local toon
        self.isLocalToon = (avId == base.localAvatar.doId)

        if (mode == NPCToons.BLOCKER_MOVIE_CLEAR):
            assert self.notify.debug('BLOCKER_MOVIE_CLEAR')
            return

        elif (mode == NPCToons.BLOCKER_MOVIE_START):
            assert self.notify.debug('BLOCKER_MOVIE_PLAY')
            self.movie = QuestParser.NPCMoviePlayer("tutorial_blocker",
                                                    base.localAvatar, self)
            self.movie.play()

        elif (mode == NPCToons.BLOCKER_MOVIE_TIMEOUT):
            assert self.notify.debug('BLOCKER_MOVIE_TIMEOUT')
            return

        return
Beispiel #3
0
 def playMovie(self):
     self.movie = QuestParser.NPCMoviePlayer('gag_intro', base.localAvatar,
                                             self.npc)
     self.movie.setVar('backToPlaygroundButton',
                       self.purchase.backToPlayground)
     self.movie.setVar('playAgainButton', self.purchase.playAgain)
     self.movie.setVar('purchaseBg', self.purchase.bg)
     self.movie.play()
Beispiel #4
0
 def setMovie(self, mode, npcId, avId, timestamp):
     timeStamp = ClockDelta.globalClockDelta.localElapsedTime(timestamp)
     self.npcId = npcId
     self.isLocalToon = avId == base.localAvatar.doId
     if mode == NPCToons.BLOCKER_MOVIE_CLEAR:
         return None
     elif mode == NPCToons.BLOCKER_MOVIE_START:
         self.movie = QuestParser.NPCMoviePlayer('tutorial_blocker', base.localAvatar, self)
         self.movie.play()
     elif mode == NPCToons.BLOCKER_MOVIE_TIMEOUT:
         return None
Beispiel #5
0
 def setMovie(self, mode, npcId, avId, timestamp):
     self.npcId = npcId
     self.isLocalToon = avId == base.localAvatar.doId
     if mode == NPCToons.BLOCKER_MOVIE_CLEAR:
         return
     elif mode == NPCToons.BLOCKER_MOVIE_START:
         if self.isLocalToon:
             self.hideNametag2d()
         self.movie = QuestParser.NPCMoviePlayer('tutorial_blocker', base.localAvatar, self)
         self.movie.play()
     elif mode == NPCToons.BLOCKER_MOVIE_TIMEOUT:
         return
    def setMovie(self, mode, npcId, avId, quests, timestamp):
        timeStamp = ClockDelta.globalClockDelta.localElapsedTime(timestamp)
        isLocalToon = avId == base.localAvatar.doId
        if mode == NPCToons.QUEST_MOVIE_CLEAR:
            self.cleanupMovie()
            return

        if mode == NPCToons.QUEST_MOVIE_TIMEOUT:
            self.cleanupMovie()
            if isLocalToon:
                self.freeAvatar()
            self.setPageNumber(0, -1)
            self.clearChat()
            self.startLookAround()
            self.detectAvatars()
            return

        av = base.cr.doId2do.get(avId)
        if av is None:
            self.notify.warning('Avatar %d not found in doId' % avId)
            return

        if mode == NPCToons.QUEST_MOVIE_REJECT:
            rejectString = Quests.chooseQuestDialogReject()
            rejectString = Quests.fillInQuestNames(rejectString,
                                                   avName=av.name)
            self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
            if isLocalToon:
                base.localAvatar.posCamera(0, 0)
                base.cr.playGame.getPlace().setState('walk')
            return

        if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
            rejectString = Quests.chooseQuestDialogTierNotDone()
            rejectString = Quests.fillInQuestNames(rejectString,
                                                   avName=av.name)
            self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
            if isLocalToon:
                base.localAvatar.posCamera(0, 0)
                base.cr.playGame.getPlace().setState('walk')
            return

        self.setupAvatars(av)
        fullString = ''
        toNpcId = None

        if mode == NPCToons.QUEST_MOVIE_COMPLETE:
            questId, rewardId, toNpcId = quests
            scriptId = 'quest_complete_' + str(questId)

            if QuestParser.questDefined(scriptId):
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return

            if isLocalToon:
                self.setupCamera(mode)

            greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)

            if greetingString:
                fullString += greetingString + '\x07'

            fullString += Quests.chooseQuestDialog(questId,
                                                   Quests.COMPLETE) + '\x07'
            if rewardId:
                fullString += Quests.getReward(rewardId).getString()

            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += '\x07' + leavingString

        elif mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE_CANCEL:
            fullString = TTLocalizer.QuestMovieQuestChoiceCancel

        elif mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE_CANCEL:
            fullString = TTLocalizer.QuestMovieTrackChoiceCancel

        elif mode == NPCToons.QUEST_MOVIE_INCOMPLETE:
            questId, completeStatus, toNpcId = quests
            scriptId = 'quest_incomplete_' + str(questId)
            if QuestParser.questDefined(scriptId):
                if self.curQuestMovie:
                    self.curQuestMovie.timeout()
                    self.curQuestMovie.cleanup()
                    self.curQuestMovie = None
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return
            if isLocalToon:
                self.setupCamera(mode)
            greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
            if greetingString:
                fullString += greetingString + '\x07'
            fullString += Quests.chooseQuestDialog(questId, completeStatus)
            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += '\x07' + leavingString

        elif mode == NPCToons.QUEST_MOVIE_ASSIGN:
            questId, rewardId, toNpcId = quests
            scriptId = 'quest_assign_' + str(questId)
            if QuestParser.questDefined(scriptId):
                if self.curQuestMovie:
                    self.curQuestMovie.timeout()
                    self.curQuestMovie.cleanup()
                    self.curQuestMovie = None
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return
            if isLocalToon:
                self.setupCamera(mode)
            fullString += Quests.chooseQuestDialog(questId, Quests.QUEST)
            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += '\x07' + leavingString

        elif mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE:
            if isLocalToon:
                self.setupCamera(mode)
            self.setChatAbsolute(TTLocalizer.QuestMovieQuestChoice, CFSpeech)
            if isLocalToon:
                self.acceptOnce('chooseQuest', self.sendChooseQuest)
                self.questChoiceGui = QuestChoiceGui.QuestChoiceGui()
                self.questChoiceGui.setQuests(quests, npcId, ChoiceTimeout)
            return

        elif mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE:
            if isLocalToon:
                self.setupCamera(mode)
            tracks = quests
            self.setChatAbsolute(TTLocalizer.QuestMovieTrackChoice, CFSpeech)
            if isLocalToon:
                self.acceptOnce('chooseTrack', self.sendChooseTrack)
                self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(
                    tracks, ChoiceTimeout)
            return

        fullString = Quests.fillInQuestNames(fullString,
                                             avName=av.name,
                                             fromNpcId=npcId,
                                             toNpcId=toNpcId)
        self.acceptOnce(self.uniqueName('doneChatPage'),
                        self.finishMovie,
                        extraArgs=[av, isLocalToon])
        self.clearChat()
        self.setPageChat(avId, 0, fullString, 1)
        return
 def setMovie(self, mode, npcId, avId, quests, timestamp):
     isLocalToon = avId == base.localAvatar.doId
     if mode == NPCToons.QUEST_MOVIE_CLEAR:
         self.cleanupMovie()
         return
     if mode == NPCToons.QUEST_MOVIE_TIMEOUT:
         self.cleanupMovie()
         if isLocalToon:
             self.freeAvatar()
         self.setPageNumber(0, -1)
         self.clearChat()
         self.startLookAround()
         self.detectAvatars()
         return
     av = base.cr.doId2do.get(avId)
     if av is None:
         self.notify.warning('Avatar %d not found in doId' % avId)
         return
     if mode == NPCToons.QUEST_MOVIE_REJECT:
         rejectString = Quests.chooseQuestDialogReject()
         rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
         self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
         if isLocalToon:
             base.localAvatar.posCamera(0, 0)
             base.cr.playGame.getPlace().setState('walk')
         return
     if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
         rejectString = Quests.chooseQuestDialogTierNotDone()
         rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
         self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
         if isLocalToon:
             base.localAvatar.posCamera(0, 0)
             base.cr.playGame.getPlace().setState('walk')
         return
     self.setupAvatars(av)
     fullString = ''
     toNpcId = None
     if isLocalToon:
         self.hideNametag2d()
     if mode == NPCToons.QUEST_MOVIE_COMPLETE:
         questId, rewardId, toNpcId = quests
         scriptId = 'quest_complete_' + str(questId)
         if QuestParser.questDefined(scriptId):
             self.curQuestMovie = QuestParser.NPCMoviePlayer(scriptId, av, self)
             self.curQuestMovie.play()
             return
         if isLocalToon:
             self.setupCamera(mode)
         greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
         if greetingString:
             fullString += greetingString + '\x07'
         fullString += Quests.chooseQuestDialog(questId, Quests.COMPLETE) + '\x07'
         if rewardId:
             fullString += Quests.getReward(rewardId).getString()
         leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
         if leavingString:
             fullString += '\x07' + leavingString
     elif mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE_CANCEL:
         fullString = TTLocalizer.QuestMovieQuestChoiceCancel
     elif mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE_CANCEL:
         fullString = TTLocalizer.QuestMovieTrackChoiceCancel
     elif mode == NPCToons.QUEST_MOVIE_INCOMPLETE:
         questId, completeStatus, toNpcId = quests
         scriptId = 'quest_incomplete_' + str(questId)
         if QuestParser.questDefined(scriptId):
             if self.curQuestMovie:
                 self.curQuestMovie.timeout()
                 self.curQuestMovie.cleanup()
                 self.curQuestMovie = None
             self.curQuestMovie = QuestParser.NPCMoviePlayer(scriptId, av, self)
             self.curQuestMovie.play()
             return
         if isLocalToon:
             self.setupCamera(mode)
         greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
         if greetingString:
             fullString += greetingString + '\x07'
         fullString += Quests.chooseQuestDialog(questId, completeStatus)
         leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
         if leavingString:
             fullString += '\x07' + leavingString
     elif mode == NPCToons.QUEST_MOVIE_ASSIGN:
         questId, rewardId, toNpcId = quests
         scriptId = 'quest_assign_' + str(questId)
         if QuestParser.questDefined(scriptId):
             if self.curQuestMovie:
                 self.curQuestMovie.timeout()
                 self.curQuestMovie.cleanup()
                 self.curQuestMovie = None
             self.curQuestMovie = QuestParser.NPCMoviePlayer(scriptId, av, self)
             self.curQuestMovie.play()
             return
         if isLocalToon:
             self.setupCamera(mode)
         fullString += Quests.chooseQuestDialog(questId, Quests.QUEST)
         leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
         if leavingString:
             fullString += '\x07' + leavingString
     elif mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE:
         if isLocalToon:
             self.setupCamera(mode)
         self.setChatAbsolute(TTLocalizer.QuestMovieQuestChoice, CFSpeech)
         if isLocalToon:
             self.acceptOnce('chooseQuest', self.sendChooseQuest)
             self.questChoiceGui = QuestChoiceGui.QuestChoiceGui()
             self.questChoiceGui.setQuests(quests, npcId, ChoiceTimeout)
         return
     elif mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE:
         if isLocalToon:
             self.setupCamera(mode)
         tracks = quests
         self.setChatAbsolute(TTLocalizer.QuestMovieTrackChoice, CFSpeech)
         if isLocalToon:
             self.acceptOnce('chooseTrack', self.sendChooseTrack)
             self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(tracks, ChoiceTimeout)
         return
     fullString = Quests.fillInQuestNames(fullString, avName=av.name, fromNpcId=npcId, toNpcId=toNpcId)
     self.acceptOnce(self.uniqueName('doneChatPage'), self.finishMovie, extraArgs=[av, isLocalToon])
     self.clearChat()
     self.setPageChat(avId, 0, fullString, 1)
Beispiel #8
0
    def setMovie(self, mode, npcId, avId, quests, timestamp):
        """
        This is a message from the AI describing a movie between this NPC
        and a Toon that has approached us.
        """
        timeStamp = ClockDelta.globalClockDelta.localElapsedTime(timestamp)

        # See if this is the local toon
        isLocalToon = (avId == base.localAvatar.doId)

        assert (self.notify.debug(
            "setMovie: %s %s %s %s %s %s" %
            (mode, npcId, avId, quests, timeStamp, isLocalToon)))

        # This is an old movie in the server ram that has been cleared.
        # Just return and do nothing
        if (mode == NPCToons.QUEST_MOVIE_CLEAR):
            assert self.notify.debug("setMovie: movie cleared")
            self.cleanupMovie()
            return

        # This is an old movie in the server ram that has been cleared.
        # Just return and do nothing
        if (mode == NPCToons.QUEST_MOVIE_TIMEOUT):
            assert self.notify.debug("setMovie: movie timeout")
            self.cleanupMovie()
            # If we are the local toon and we have simply taken too long
            # to read through the chat balloons, just free us
            if isLocalToon:
                self.freeAvatar()
            # Act like we finished the chat pages by setting the page number to -1
            self.setPageNumber(0, -1)
            self.clearChat()
            self.startLookAround()
            self.detectAvatars()
            return

        av = base.cr.doId2do.get(avId)
        if av is None:
            self.notify.warning("Avatar %d not found in doId" % (avId))
            return

        # Reject is simpler, so lets get that out of the way
        if (mode == NPCToons.QUEST_MOVIE_REJECT):
            rejectString = Quests.chooseQuestDialogReject()
            rejectString = Quests.fillInQuestNames(rejectString,
                                                   avName=av.name)
            # No need for page chat here, just setChatAbsolute
            self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
            if isLocalToon:
                # Go back into walk mode
                base.localAvatar.posCamera(0, 0)
                base.cr.playGame.getPlace().setState("walk")
            return

        # Reject is simpler, so lets get that out of the way
        if (mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE):
            rejectString = Quests.chooseQuestDialogTierNotDone()
            rejectString = Quests.fillInQuestNames(rejectString,
                                                   avName=av.name)
            # No need for page chat here, just setChatAbsolute
            self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
            if isLocalToon:
                # Go back into walk mode
                base.localAvatar.posCamera(0, 0)
                base.cr.playGame.getPlace().setState("walk")
            return

        self.setupAvatars(av)

        fullString = ""
        toNpcId = None
        if (mode == NPCToons.QUEST_MOVIE_COMPLETE):
            questId, rewardId, toNpcId = quests

            # Try out the new quest script system
            scriptId = "quest_complete_" + str(questId)
            if QuestParser.questDefined(scriptId):
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return

            if isLocalToon:
                self.setupCamera(mode)
            greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
            if greetingString:
                fullString += greetingString + "\a"
            fullString += Quests.chooseQuestDialog(questId,
                                                   Quests.COMPLETE) + "\a"
            if rewardId:
                fullString += Quests.getReward(rewardId).getString()
            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += "\a" + leavingString

        elif (mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE_CANCEL):
            fullString = TTLocalizer.QuestMovieQuestChoiceCancel

        elif (mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE_CANCEL):
            fullString = TTLocalizer.QuestMovieTrackChoiceCancel

        elif (mode == NPCToons.QUEST_MOVIE_INCOMPLETE):
            questId, completeStatus, toNpcId = quests

            # Try out the new quest script system
            scriptId = "quest_incomplete_" + str(questId)
            if QuestParser.questDefined(scriptId):
                if self.curQuestMovie:
                    self.curQuestMovie.timeout()
                    self.curQuestMovie.cleanup()
                    self.curQuestMovie = None
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return

            if isLocalToon:
                self.setupCamera(mode)
            greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
            if greetingString:
                fullString += greetingString + "\a"

            fullString += Quests.chooseQuestDialog(questId, completeStatus)
            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += "\a" + leavingString

        elif (mode == NPCToons.QUEST_MOVIE_ASSIGN):
            questId, rewardId, toNpcId = quests

            # Try out the new quest script system
            scriptId = "quest_assign_" + str(questId)
            if QuestParser.questDefined(scriptId):
                if self.curQuestMovie:
                    self.curQuestMovie.timeout()
                    self.curQuestMovie.cleanup()
                    self.curQuestMovie = None
                self.curQuestMovie = QuestParser.NPCMoviePlayer(
                    scriptId, av, self)
                self.curQuestMovie.play()
                return

            if isLocalToon:
                self.setupCamera(mode)
            #greetingString = Quests.chooseQuestDialog(questId, Quests.GREETING)
            #if greetingString:
            #    fullString += greetingString + "\a"
            fullString += Quests.chooseQuestDialog(questId, Quests.QUEST)
            leavingString = Quests.chooseQuestDialog(questId, Quests.LEAVING)
            if leavingString:
                fullString += "\a" + leavingString

        elif (mode == NPCToons.QUEST_MOVIE_QUEST_CHOICE):
            # Quest choice movie
            if isLocalToon:
                self.setupCamera(mode)
            assert self.notify.debug("QUEST_MOVIE_QUEST_CHOICE: %s" % quests)
            self.setChatAbsolute(TTLocalizer.QuestMovieQuestChoice, CFSpeech)
            if isLocalToon:
                self.acceptOnce("chooseQuest", self.sendChooseQuest)
                self.questChoiceGui = QuestChoiceGui.QuestChoiceGui()
                self.questChoiceGui.setQuests(quests, npcId, ChoiceTimeout)
            return

        elif (mode == NPCToons.QUEST_MOVIE_TRACK_CHOICE):
            # If this is a TrackChoiceQuest, complete simply means we are at the
            # avatar that will allow us to chose. If the localToon cancels the
            # choice, we are not really complete yet
            # In this case, the quests are really the track choices
            if isLocalToon:
                self.setupCamera(mode)
            tracks = quests
            assert self.notify.debug("QUEST_MOVIE_TRACK_CHOICE: %s" % tracks)
            self.setChatAbsolute(TTLocalizer.QuestMovieTrackChoice, CFSpeech)
            if isLocalToon:
                self.acceptOnce("chooseTrack", self.sendChooseTrack)
                self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(
                    tracks, ChoiceTimeout)
            return

        fullString = Quests.fillInQuestNames(fullString,
                                             avName=av.name,
                                             fromNpcId=npcId,
                                             toNpcId=toNpcId)

        self.acceptOnce(self.uniqueName("doneChatPage"),
                        self.finishMovie,
                        extraArgs=[av, isLocalToon])
        self.setPageChat(avId, 0, fullString, 1)
    def setup(self):
        self.dnaStore = base.cr.playGame.dnaStore
        self.randomGenerator = random.Random()

        # The math here is a little arbitrary.  I'm trying to get a
        # substantially different seed for each zondId, even on the
        # same street.  But we don't want to weigh to much on the
        # block number, because we want the same block number on
        # different streets to be different.
        # Here we use the block number and a little of the branchId:
        # seedX=self.zoneId&0x00ff
        # Here we're using only the branchId:
        # seedY=self.zoneId/100
        # Here we're using only the block number:
        # seedZ=256-int(self.block)

        self.randomGenerator.seed(self.zoneId)

        self.interior = loader.loadModel(
            "phase_3.5/models/modules/toon_interior_tutorial")
        self.interior.reparentTo(render)
        dnaStore = DNAStorage()
        node = loader.loadDNAFile(self.cr.playGame.hood.dnaStore,
                                  "phase_3.5/dna/tutorial_street.dna")
        self.street = render.attachNewNode(node)
        self.street.flattenMedium()
        self.street.setPosHpr(-17, 42, -0.5, 180, 0, 0)
        # Get rid of the building we are in
        self.street.find("**/tb2:toon_landmark_TT_A1_DNARoot").stash()
        # Get rid of the flashing doors on the HQ building
        self.street.find(
            "**/tb1:toon_landmark_hqTT_DNARoot/**/door_flat_0").stash()
        # Get rid of collisions because we do not need them and they get in the way
        self.street.findAllMatches("**/+CollisionNode").stash()
        self.skyFile = "phase_3.5/models/props/TT_sky"
        self.sky = loader.loadModel(self.skyFile)
        self.sky.setScale(0.8)
        # Parent the sky to our camera, the task will counter rotate it
        self.sky.reparentTo(render)
        # Turn off depth tests on the sky because as the cloud layers interpenetrate
        # we do not want to see the polys cutoff. Since there is nothing behing them
        # we can get away with this.
        self.sky.setDepthTest(0)
        self.sky.setDepthWrite(0)
        self.sky.setBin("background", 100)
        # Make sure they are drawn in the correct order in the hierarchy
        # The sky should be first, then the clouds
        self.sky.find("**/Sky").reparentTo(self.sky, -1)

        # Load a color dictionary for this hood:
        hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
        self.colors = ToonInteriorColors.colors[hoodId]
        # Replace all the "random_xxx_" nodes:
        self.replaceRandomInModel(self.interior)

        # Door:
        doorModelName = "door_double_round_ul"  # hack  zzzzzzz
        # Switch leaning of the door:
        if doorModelName[-1:] == "r":
            doorModelName = doorModelName[:-1] + "l"
        else:
            doorModelName = doorModelName[:-1] + "r"
        door = self.dnaStore.findNode(doorModelName)
        # Determine where should we put the door:
        door_origin = render.find("**/door_origin;+s")
        doorNP = door.copyTo(door_origin)
        assert (not doorNP.isEmpty())
        assert (not door_origin.isEmpty())
        # The rooms are too small for doors:
        door_origin.setScale(0.8, 0.8, 0.8)
        # Move the origin away from the wall so it does not shimmer
        # We do this instead of decals
        door_origin.setPos(door_origin, 0, -0.025, 0)
        color = self.randomGenerator.choice(self.colors["TI_door"])
        DNADoor.setupDoor(doorNP, self.interior, door_origin, self.dnaStore,
                          str(self.block), color)
        # Setting the wallpaper texture with a priority overrides
        # the door texture, if it's decalled.  So, we're going to
        # move it out from the decal, and float it in front of
        # the wall:
        doorFrame = doorNP.find("door_*_flat")
        doorFrame.wrtReparentTo(self.interior)
        doorFrame.setColor(color)

        del self.colors
        del self.dnaStore
        del self.randomGenerator

        # Get rid of any transitions and extra nodes
        self.interior.flattenMedium()

        # Ok, this is a hack, but I'm tired of this freakin tutorial.
        # The problem is the interior must be created first so the npc can find the origin
        # of where to stand, but in this case the npc must be created first so the tutorial
        # can get a handle on him. Instead, I'll let the npc be created first which means
        # he will not find his origin. We'll just do that work here again.
        npcOrigin = self.interior.find("**/npc_origin_" +
                                       ` self.npc.posIndex `)
        # Now he's no longer parented to render, but no one minds.
        if not npcOrigin.isEmpty():
            self.npc.reparentTo(npcOrigin)
            self.npc.clearMat()

        # TODO: no suit if you have already beat him
        self.createSuit()

        self.mickeyMovie = QuestParser.NPCMoviePlayer("tutorial_mickey",
                                                      base.localAvatar,
                                                      self.npc)
        self.acceptOnce("enterTutorialInterior", self.mickeyMovie.play)
import PurchaseManager
from toontown.quest import QuestParser
from toontown.toon import NPCToons
"""
npm=base.cr.doFind('Newbie')

from toontown.quest import QuestParser
QuestParser.lineDict = {}
QuestParser.readFile(QuestParser.scriptFile)

npm.playMovie()
"""


class NewbiePurchaseManager(PurchaseManager.PurchaseManager):
    def setOwnedNewbieId(self, ownedNewbieId):
        self.ownedNewbieId = ownedNewbieId

    def calcHasLocalToon(self):
        return base.localAvatar.doId == self.ownedNewbieId

    def announceGenerate(self):
        PurchaseManager.PurchaseManager.announceGenerate(self)
        if self.hasLocalToon:
            self.npc = NPCToons.createLocalNPC(2011)
            self.npc.addActive()

            # the quest parser wants to call some distributedToon funcs
            def getDoId():
                return 0