Exemplo n.º 1
0
    def postGroupInfo(self, leaderId, memberList, inviteeList, kickedList):
        self.notify.debug('postgroupInfo')
        isMyGroup = 0
        removedMemberIdList = []
        if leaderId in self.groupListDict:
            oldGroupEntry = self.groupListDict[leaderId]
        else:
            oldGroupEntry = [[], [], []]
        oldMemberList = oldGroupEntry[0]
        newGroupEntry = [memberList, inviteeList, kickedList]
        self.groupListDict[leaderId] = newGroupEntry
        if not len(oldMemberList) == len(memberList):
            for oldMember in oldMemberList:
                if oldMember not in memberList:
                    if oldMember in self.avIdDict:
                        if self.avIdDict[oldMember] == leaderId:
                            self.avIdDict.pop(oldMember)
                            removedMemberIdList.append(oldMember)

        self.avIdDict[leaderId] = leaderId
        if leaderId == localAvatar.doId:
            isMyGroup = 1
        for memberId in memberList:
            self.avIdDict[memberId] = leaderId
            if memberId == localAvatar.doId:
                isMyGroup = 1

        if newGroupEntry[0] == [0] or not newGroupEntry[0]:
            dgroup = self.groupListDict.pop(leaderId)
            for memberId in dgroup[0]:
                if memberId in self.avIdDict:
                    self.avIdDict.pop(memberId)

        if isMyGroup:
            self.notify.debug('new info posted on my group')
            # update the leaderId in case it has changed (group merge)
            if self.groupPanel and self.groupPanel.leaderId == localAvatar.doId and leaderId != localAvatar.doId:
                self.groupPanel.cleanup()
                self.groupPanel = None
            if not self.groupPanel:
                self.groupPanel = GroupPanel.GroupPanel(self)
            messenger.send('updateGroupStatus')
            for removedMemberId in removedMemberIdList:
                removedMember = base.cr.doId2do.get(removedMemberId)
                if not removedMember:
                    removedMember = base.cr.identifyFriend(removedMemberId)
                if removedMember:
                    removedMemberName = removedMember.name
                    messageText = TTLocalizer.BoardingMessageLeftGroup % removedMemberName
                    localAvatar.setSystemMessage(0, messageText,
                                                 WTToontownBoardingGroup)

        elif localAvatar.doId in oldMemberList and localAvatar.doId not in memberList:
            messenger.send('updateGroupStatus')
            if self.groupPanel:
                self.groupPanel.cleanup()
            self.groupPanel = None
        else:
            self.notify.debug('new info posted on some other group')
        return
    def doMagicWord(self, word, avId, zoneId):
        wordIs = Functor(self.wordIs, word)
        if MagicWordManager.MagicWordManager.doMagicWord(
                self, word, avId, zoneId) == 1:
            pass
        elif wordIs('~fanfare'):
            go = Fanfare.makeFanfareWithMessageImage(
                0, base.localAvatar, 1,
                "You just did a ~fanfare.  Here's a rake.", Vec2(0, 0.2), 0.08,
                base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0, 0,
                                                                    0), 4)
            Sequence(
                go[0], Func(go[1].show),
                LerpColorScaleInterval(go[1],
                                       duration=0.5,
                                       startColorScale=Vec4(1, 1, 1, 0),
                                       colorScale=Vec4(1, 1, 1, 1)), Wait(2),
                LerpColorScaleInterval(go[1],
                                       duration=0.5,
                                       startColorScale=Vec4(1, 1, 1, 1),
                                       colorScale=Vec4(1, 1, 1, 0)),
                Func(go[1].remove)).start()
        elif wordIs('~endgame'):
            print('Requesting minigame abort...')
            messenger.send('minigameAbort')
        elif wordIs('~wingame'):
            print('Requesting minigame victory...')
            messenger.send('minigameVictory')
        elif wordIs('~walk'):
            try:
                fsm = base.cr.playGame.getPlace().fsm
                fsm.forceTransition('walk')
            except:
                pass

        elif wordIs('~movie'):
            try:
                fsm = base.cr.playGame.getPlace().fsm
                fsm.forceTransition('movie')
            except:
                pass

        elif wordIs('~sit'):
            try:
                base.cr.playGame.getPlace().fsm.request('sit')
            except:
                pass

        elif wordIs('~rogues'):
            suitname = None
            if len(word) > 7:
                suitname = word[7:].split(' ')[1]
            self.rogues = RoguesGallery.RoguesGallery(suitname)
            self.rogues.enter()
            if suitname != None:
                self.rogues.animate()
            self.acceptOnce('mouse1', self.exit_rogues)
        elif wordIs('~showPaths'):
            for obj in list(self.cr.doId2do.values()):
                if isinstance(obj,
                              DistributedSuitPlanner.DistributedSuitPlanner):
                    obj.showPaths()

            place = base.cr.playGame.getPlace()
            if hasattr(place, 'showPaths'):
                place.showPaths()
        elif wordIs('~hidePaths'):
            for obj in list(self.cr.doId2do.values()):
                if isinstance(obj,
                              DistributedSuitPlanner.DistributedSuitPlanner):
                    obj.hidePaths()

            place = base.cr.playGame.getPlace()
            if hasattr(place, 'hidePaths'):
                place.hidePaths()
        elif wordIs('~raceForever'):
            base.raceForever = True
        elif wordIs('~listen'):
            base.localAvatar.garbleChat = 0
        elif wordIs('~nochat') or wordIs('~chat') or wordIs('~superchat'):
            base.localAvatar.garbleChat = 1
        elif wordIs('~exec'):
            ChatManager.ChatManager.execChat = 1
        elif wordIs('~photoshoot'):
            base.cr.playGame.hood.sky.hide()
            base.cr.playGame.getPlace().loader.geom.hide()
            base.win.setClearColor(VBase4(1, 1, 1, 1))
            base.localAvatar.stopLookAroundNow()
            base.localAvatar.stopBlink()
            base.localAvatar.setNameVisible(0)
        elif wordIs('~hideAttack'):
            TownBattleAttackPanel.hideAttackPanel(1)
        elif wordIs('~showAttack'):
            TownBattleAttackPanel.hideAttackPanel(0)
        elif wordIs('~collisions_on'):
            base.localAvatar.collisionsOn()
        elif wordIs('~collisions_off'):
            base.localAvatar.collisionsOff()
        elif wordIs('~battle_detect_off'):
            from toontown.suit import DistributedSuit
            DistributedSuit.ALLOW_BATTLE_DETECT = 0
        elif wordIs('~battle_detect_on'):
            from toontown.suit import DistributedSuit
            DistributedSuit.ALLOW_BATTLE_DETECT = 1
        elif wordIs('~battles'):
            base.localAvatar.setWantBattles(not base.localAvatar.wantBattles)
            if base.localAvatar.wantBattles:
                response = 'battles ON'
            else:
                response = 'battles OFF'
            self.setMagicWordResponse(response)
        elif wordIs('~skipBattleMovie') or wordIs('~sbm'):
            ToontownBattleGlobals.SkipMovie = not ToontownBattleGlobals.SkipMovie
            if ToontownBattleGlobals.SkipMovie:
                response = 'battle movies will be skipped'
            else:
                response = 'battle movies will be played'
            self.setMagicWordResponse(response)
        elif wordIs('~addCameraPosition'):
            base.localAvatar.addCameraPosition()
        elif wordIs('~removeCameraPosition'):
            base.localAvatar.removeCameraPosition()
        elif wordIs('~printCameraPosition'):
            base.localAvatar.printCameraPosition(base.localAvatar.cameraIndex)
        elif wordIs('~printCameraPositions'):
            base.localAvatar.printCameraPositions()
        elif wordIs('~worldCam') or wordIs('~wc'):
            myCam = render.find('**/camera')
            if not myCam.isEmpty():
                camParent = myCam.getParent()
                myCam.wrtReparentTo(render)
                pos = myCam.getPos()
                hpr = myCam.getHpr()
                response = '(%.2f, %.2f, %.2f,) (%.2f, %.2f, %.2f)' % (
                    pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
                if not camParent.isEmpty():
                    myCam.wrtReparentTo(camParent)
                self.setMagicWordResponse(response)
                print(response)
        elif wordIs('~sync'):
            tm = base.cr.timeManager
            if tm == None:
                response = 'No TimeManager.'
                self.setMagicWordResponse(response)
            else:
                tm.extraSkew = 0.0
                skew = string.strip(word[5:])
                if skew != '':
                    tm.extraSkew = float(skew)
                globalClockDelta.clear()
                tm.handleHotkey()
        elif wordIs('~period'):
            timeout = string.strip(word[7:])
            if timeout != '':
                seconds = int(timeout)
                base.cr.stopPeriodTimer()
                base.cr.resetPeriodTimer(seconds)
                base.cr.startPeriodTimer()
            if base.cr.periodTimerExpired:
                response = 'Period timer has expired.'
            elif base.cr.periodTimerStarted:
                elapsed = globalClock.getFrameTime(
                ) - base.cr.periodTimerStarted
                secondsRemaining = base.cr.periodTimerSecondsRemaining - elapsed
                response = 'Period timer expires in %s seconds.' % int(
                    secondsRemaining)
            else:
                response = 'Period timer not set.'
            self.setMagicWordResponse(response)
        elif wordIs('~net'):
            if base.cr.networkPlugPulled():
                base.cr.restoreNetworkPlug()
                base.cr.startHeartbeat()
                response = 'Network restored.'
            else:
                base.cr.pullNetworkPlug()
                base.cr.stopHeartbeat()
                response = 'Network disconnected.'
            self.setMagicWordResponse(response)
        elif wordIs('~lag'):
            if not hasattr(base.cr, 'magicLag'):
                base.cr.startDelay(0.1, 0.35)
                base.cr.magicLag = None
                response = 'Simulated Lag On'
            else:
                base.cr.stopDelay()
                del base.cr.magicLag
                response = 'Simulated Lag Off'
            self.setMagicWordResponse(response)
        elif wordIs('~endlessquietzone'):
            base.endlessQuietZone = not base.endlessQuietZone
            response = 'endless quiet zone %s' % choice(
                base.endlessQuietZone, 'ON', 'OFF')
            self.setMagicWordResponse(response)
        elif wordIs('~cogPageFull'):
            base.localAvatar.suitPage.updateAllCogs(3)
        elif wordIs('~mintId'):
            args = word.split()
            postName = 'mintIdOverride'
            if len(args) < 2:
                if bboard.has(postName):
                    bboard.remove(postName)
            else:
                try:
                    id = int(args[1])
                    foo = ToontownGlobals.MintNumRooms[id]
                except:
                    pass
                else:
                    bboard.post(postName, id)

        elif wordIs('~mintRoom'):
            args = word.split()
            postName = 'mintRoom'
            if len(args) < 2:
                if bboard.has(postName):
                    bboard.remove(postName)
            else:
                try:
                    id = int(args[1])
                except:
                    pass
                else:
                    bboard.post(postName, id)

        elif wordIs('~mintWarp'):
            args = word.split()
            if len(args) < 2:
                self.setMagicWordResponse('Usage: ~mintWarp roomId')
                return
            try:
                roomNum = int(args[1])
            except:
                self.setMagicWordResponse('roomId not found: %s' % args[1])
                return

            if not bboard.has('mint'):
                self.setMagicWordResponse('not in a mint')
                return
            mint = bboard.get('mint')
            if not mint.warpToRoom(roomNum):
                self.setMagicWordResponse(
                    'invalid roomId or roomId not in this mint: %s' % args[1])
                return
        elif wordIs('~mintLayouts'):
            from toontown.coghq import MintLayout
            MintLayout.printAllCashbotInfo()
            self.setMagicWordResponse('logged mint layouts')
        elif wordIs('~edit'):
            if not __dev__:
                self.setMagicWordResponse('client not running in dev mode')
                return
            from otp.level import EditorGlobals
            level = bboard.get(EditorGlobals.EditTargetPostName)
            if level == None:
                self.setMagicWordResponse('no level available for editing')
                return
            from toontown.coghq import DistributedInGameEditor
            EditorGlobals.assertReadyToEdit()
            editUsername = EditorGlobals.getEditUsername()
            editors = base.cr.doFindAll('DistributedInGameEditor')
            for e in editors:
                if isinstance(e,
                              DistributedInGameEditor.DistributedInGameEditor):
                    if e.getLevelDoId() == level.doId:
                        if e.editorIsLocalToon() or e.getEditUsername(
                        ) == editUsername:
                            self.setMagicWordResponse(
                                "you ('%s') are already editing this level" %
                                editUsername)
                            return

            cmd = '~inGameEdit %s %s' % (level.doId, editUsername)
            self.b_setMagicWord(cmd)
        elif wordIs('~fshow'):
            from toontown.coghq import DistributedFactory
            factories = base.cr.doFindAll('DistributedFactory')
            factory = None
            for f in factories:
                if isinstance(f, DistributedFactory.DistributedFactory):
                    factory = f
                    break

            if factory is None:
                self.setMagicWordResponse('factory not found')
                return
            factory.setColorZones(not factory.fColorZones)
        elif wordIs('~fzone'):
            args = word.split()
            if len(args) < 2:
                self.setMagicWordResponse('Usage: ~fzone <zoneNum>')
                return
            zoneId = int(args[1])
            from toontown.coghq import DistributedFactory
            factories = base.cr.doFindAll('DistributedFactory')
            factory = None
            for f in factories:
                if isinstance(f, DistributedFactory.DistributedFactory):
                    factory = f
                    break

            if factory is None:
                self.setMagicWordResponse('factory not found')
                return
            factory.warpToZone(zoneId)
        elif wordIs('~undead'):
            try:
                goons = base.cr.doFindAll('Goon')
                for goon in goons:
                    goon.undead()

            except:
                self.notify.warning('Error in undead')

        elif wordIs('~resyncGoons'):
            try:
                goons = base.cr.doFindAll('Goon')
                for goon in goons:
                    goon.resync()

            except:
                self.notify.warning('Error in resyncing')

        elif wordIs('~catalog'):
            self.doCatalog(word)
        elif wordIs('~petCam') and base.wantPets:
            if hasattr(base, 'petCamPrevParent'):
                base.cam.reparentTo(base.petCamPrevParent)
                del base.petCamPrevParent
            else:
                petId = base.localAvatar.getPetId()
                pet = self.cr.doId2do.get(petId)
                if pet:
                    if not hasattr(pet, 'camNode'):
                        pet.camNode = pet.attachNewNode('camNode')
                        pet.camNode.setPos(0, 0, 2.5)
                    base.petCamPrevParent = base.cam.getParent()
                    base.cam.reparentTo(pet.camNode)
        elif wordIs('~lockPet') and base.wantPets:
            petId = base.localAvatar.getPetId()
            pet = self.cr.doId2do.get(petId)
            if pet:
                if not pet.isLockedDown():
                    pet.lockPet()
        elif wordIs('~unlockPet') and base.wantPets:
            petId = base.localAvatar.getPetId()
            pet = self.cr.doId2do.get(petId)
            if pet:
                if pet.isLockedDown():
                    pet.unlockPet()
        elif wordIs('~resetPetTutorial') and base.wantPets:
            base.localAvatar.setPetTutorialDone(False)
            response = 'Pet Tutorial flag reset'
            self.setMagicWordResponse(response)
        elif wordIs('~bossBattle'):
            self.doBossBattle(word)
        elif wordIs('~RaceChat'):
            base.localAvatar.chatMgr.chatInputSpeedChat.addKartRacingMenu()
        elif wordIs('~BuyKart'):
            if base.wantKarts:

                def doShtikerLater(task):
                    base.localAvatar.addKartPage()
                    return 0

                if base.localAvatar.hasKart():
                    response = 'Returning Kart %s' % base.localAvatar.getKartBodyType(
                    )
                    base.localAvatar.requestKartDNAFieldUpdate(
                        KartDNA.bodyType, InvalidEntry)
                    self.setMagicWordResponse(response)
                else:
                    base.localAvatar.requestKartDNAFieldUpdate(
                        KartDNA.rimsType, getDefaultRim())
                    taskMgr.doMethodLater(1.0, doShtikerLater,
                                          'doShtikerLater')
                response = 'Kart %s has been purchased with body and accessory color %s.' % (
                    word[9], getDefaultColor())
                base.localAvatar.requestKartDNAFieldUpdate(
                    KartDNA.bodyType, int(word[9]))
                self.setMagicWordResponse(response)
            else:
                self.setMagicWordResponse('Enable wantKarts in Config.prc')
        elif wordIs('~leaveRace'):
            messenger.send('leaveRace')
        elif wordIs('~kartParticles'):
            b = ConfigVariableBool('want-kart-particles', 0)
            b.setValue(not b)
        elif wordIs('~gardenGame'):
            messenger.send('gardenGame')
            response = 'You must be on your estate'
            self.setMagicWordResponse(response)
        elif wordIs('~verboseState'):
            base.localAvatar.verboseState()
        elif wordIs('~golf'):
            self.doGolf(word)
        elif wordIs('~whiteList'):
            base.localAvatar.chatMgr.chatInputSpeedChat.addWhiteList()
        elif wordIs('~updateWhiteList'):
            self.notify.info('Updating WhiteList')
            base.whiteList.redownloadWhitelist()
        elif wordIs('~noWhiteList'):
            base.localAvatar.chatMgr.chatInputSpeedChat.removeWhiteList()
        elif wordIs('~setPaid'):
            args = word.split()
            if len(args) > 1:
                paid = int(args[1])
                statusString = base.config.GetString('force-paid-status',
                                                     'none')
                if paid:
                    paid = 1
                    if statusString != 'none':
                        if statusString == 'VELVET':
                            ConfigVariableString('force-paid-status').setValue(
                                'FULL')
                        elif statusString == 'unpaid':
                            ConfigVariableString('force-paid-status').setValue(
                                'paid')
                    base.cr.setIsPaid(1)
                else:
                    paid = 0
                    if statusString != 'none':
                        if statusString == 'FULL':
                            ConfigVariableString('force-paid-status').setValue(
                                'VELVET')
                        elif statusString == 'paid':
                            ConfigVariableString('force-paid-status').setValue(
                                'unpaid')
                    base.cr.setIsPaid(0)
            else:
                return
        elif wordIs('~party'):
            self.doParty(word, avId, zoneId)
        elif wordIs('~news'):
            self.doNews(word, avId, zoneId)
        elif wordIs('~bgui'):
            if not hasattr(self, 'groupPanel'):
                from toontown.toon import GroupPanel
                self.groupPanel = GroupPanel.GroupPanel(
                    base.localAvatar.boardingParty)
                self.groupPanel.frame.show()
            else:
                self.groupPanel.frame.hide()
                self.groupPanel.cleanup()
                del self.groupPanel
        elif wordIs('~generateOrder'):
            args = word.split()
            if len(args) > 1:
                newOrder = int(args[1])
                if newOrder >= 0 and newOrder <= 2:
                    datagram = PyDatagram.PyDatagram()
                    datagram.addUint16(
                        MsgName2Id['CLIENT_CHANGE_GENERATE_ORDER'])
                    datagram.addUint32(newOrder)
                    base.cr.send(datagram)
                    response = 'changing generate order to %s' % newOrder
                    self.setMagicWordResponse(response)
            else:
                response = 'args: 0 default, 1 reversed, 2 shuffled'
                self.setMagicWordResponse(response)
        elif wordIs('~ruler'):
            response = 'Each unit is equal to one foot'
            self.setMagicWordResponse(response)
            if self.ruler:
                self.ruler.detachNode()
                del self.ruler
            self.ruler = loader.loadModel('phase_3/models/props/xyzAxis')
            self.ruler.reparentTo(render)
            self.ruler.setPos(base.localAvatar.getPos())
            self.ruler.place()
        elif wordIs('~toonIdTags'):
            otherToons = base.cr.doFindAllOfType('DistributedToon')
            if otherToons:
                for toon in otherToons[0]:
                    toon.setNametagStyle(0)

            messenger.send('nameTagShowAvId', [])
            base.idTags = 1
        elif wordIs('~code'):
            args = word.split()
            if len(args) > 1:
                code = word[len(args[0]) + 1:]
                base.codeRedemptionMgr.redeemCode(
                    code, self._handleCodeRedemptionResponse)
                response = 'sending code %s to server...' % code
            else:
                response = '~code <code>'
            self.setMagicWordResponse(response)
        return
Exemplo n.º 3
0
    def postGroupInfo(self, leaderId, memberList, inviteeList, kickedList):
        """
        A group has changed so the AI is sending us new information on it
        """
        self.notify.debug("postgroupInfo")
        isMyGroup = 0
        removedMemberIdList = []
        if self.groupListDict.has_key(leaderId):
            oldGroupEntry = self.groupListDict[leaderId]
        else:
            oldGroupEntry = [[], [], []]
        oldMemberList = oldGroupEntry[0]

        newGroupEntry = [memberList, inviteeList, kickedList]
        self.groupListDict[leaderId] = newGroupEntry

        # Comb the avIdDict if there is a change in the number of members in the group.
        # Remove any avId that has left the group or has been kicked out.
        if not (len(oldMemberList) == len(memberList)):
            for oldMember in oldMemberList:
                if not oldMember in memberList:
                    # This member has been removed.
                    if oldMember in self.avIdDict:
                        # Remove this member from the avIdDict ONLY if we doesn't have a different leader.
                        # This means he hasn't joined a different group.
                        if (self.avIdDict[oldMember] == leaderId):
                            self.avIdDict.pop(oldMember)
                            removedMemberIdList.append(oldMember)

        self.avIdDict[leaderId] = leaderId
        if leaderId == localAvatar.doId:
            isMyGroup = 1
        for memberId in memberList:
            self.avIdDict[memberId] = leaderId
            if memberId == localAvatar.doId:
                isMyGroup = 1

        if (newGroupEntry[0]) == [
                0
        ] or (not newGroupEntry[0]):  # if the new memberList is empty
            dgroup = self.groupListDict.pop(leaderId)
            for memberId in dgroup[0]:
                if self.avIdDict.has_key(memberId):
                    self.avIdDict.pop(memberId)

        if isMyGroup:
            self.notify.debug("new info posted on my group")
            if not self.groupPanel:
                self.groupPanel = GroupPanel.GroupPanel(self)
            messenger.send('updateGroupStatus')
            for removedMemberId in removedMemberIdList:
                removedMember = base.cr.doId2do.get(removedMemberId)
                # Send the message to the members only if you can find the removedMember.
                # This means that this would work only if the removedMember left the
                # group using the leave button. It won't work if the removedMember Alt+F4ed out.
                if not removedMember:
                    # Try second time, just in case removedMemberId is a friend.
                    removedMember = base.cr.identifyFriend(removedMemberId)
                if removedMember:
                    removedMemberName = removedMember.name
                    # Message to the members in the group that the removedMember has left the Boarding Group.
                    messageText = TTLocalizer.BoardingMessageLeftGroup % (
                        removedMemberName)
                    localAvatar.setSystemMessage(
                        0, messageText, WhisperPopup.WTToontownBoardingGroup)

        elif (localAvatar.doId
              in oldMemberList) and not (localAvatar.doId in memberList):
            # localAvatar's doId was there in the old list but is not there in the new list
            # This must mean that he has either left the group or kicked out.
            messenger.send('updateGroupStatus')
            # Cleanup the GroupPanel.
            if self.groupPanel:
                self.groupPanel.cleanup()
            self.groupPanel = None
        else:
            self.notify.debug("new info posted on some other group")
Exemplo n.º 4
0
    def doMagicWord(self, word, avId, zoneId):
        wordIs = Functor(self.wordIs, word)

        if (MagicWordManager.MagicWordManager.doMagicWord(
                self, word, avId, zoneId) == 1):
            pass
        elif wordIs("~fanfare"):
            go = Fanfare.makeFanfareWithMessageImage(
                0, base.localAvatar, 1,
                "You just did a ~fanfare.  Here's a rake.", Vec2(0, 0.2), 0.08,
                base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0, 0,
                                                                    0), 4)
            Sequence(
                go[0], Func(go[1].show),
                LerpColorScaleInterval(go[1],
                                       duration=.5,
                                       startColorScale=Vec4(1, 1, 1, 0),
                                       colorScale=Vec4(1, 1, 1, 1)), Wait(2),
                LerpColorScaleInterval(go[1],
                                       duration=.5,
                                       startColorScale=Vec4(1, 1, 1, 1),
                                       colorScale=Vec4(1, 1, 1, 0)),
                Func(go[1].remove)).start()
            #go[0].start()
            #Fanfare.makeFanfareWithMessageImage(0, base.localAvatar, 1, "This is the message", Vec2(0,0.2), 0.08, base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0,0,0), 4)[0].start()
            #Fanfare.makeFanfare(0, base.localAvatar).start()
        elif wordIs("~endgame"):
            print("Requesting minigame abort...")
            messenger.send("minigameAbort")
        elif wordIs("~wingame"):
            print("Requesting minigame victory...")
            messenger.send("minigameVictory")
        elif wordIs("~walk"):
            try:
                fsm = base.cr.playGame.getPlace().fsm
                fsm.forceTransition('walk')
            except:
                pass
        elif wordIs("~movie"):
            try:
                fsm = base.cr.playGame.getPlace().fsm
                fsm.forceTransition('movie')
            except:
                pass
        elif wordIs("~sit"):
            try:
                base.cr.playGame.getPlace().fsm.request('sit')
            except:
                pass
        elif wordIs("~rogues"):
            suitname = None
            if (len(word) > 7):
                suitname = word[7:].split(' ')[1]
            self.rogues = RoguesGallery.RoguesGallery(suitname)
            self.rogues.enter()
            if suitname != None:
                self.rogues.animate()
            self.acceptOnce('mouse1', self.exit_rogues)
            # no longer keep rogues obj around after creation, so we can make a different one

        elif wordIs("~showPaths"):
            for obj in list(self.cr.doId2do.values()):
                if isinstance(obj,
                              DistributedSuitPlanner.DistributedSuitPlanner):
                    obj.showPaths()
            place = base.cr.playGame.getPlace()
            if hasattr(place, "showPaths"):
                place.showPaths()

        elif wordIs("~hidePaths"):
            for obj in list(self.cr.doId2do.values()):
                if isinstance(obj,
                              DistributedSuitPlanner.DistributedSuitPlanner):
                    obj.hidePaths()
            place = base.cr.playGame.getPlace()
            if hasattr(place, "hidePaths"):
                place.hidePaths()
        elif wordIs("~raceForever"):
            base.raceForever = True
        elif wordIs("~listen"):
            base.localAvatar.garbleChat = 0

        elif wordIs("~nochat") or wordIs("~chat") or wordIs("~superchat"):
            base.localAvatar.garbleChat = 1

        elif wordIs("~exec"):
            # Enable execChat.
            ChatManager.ChatManager.execChat = 1

        elif wordIs("~photoshoot"):
            # Empty the world for screenshots of the localToon
            base.cr.playGame.hood.sky.hide()
            base.cr.playGame.getPlace().loader.geom.hide()
            base.win.setClearColor(VBase4(1, 1, 1, 1))
            base.localAvatar.stopLookAroundNow()
            base.localAvatar.stopBlink()
            base.localAvatar.setNameVisible(0)

        elif wordIs("~hideAttack"):
            # Hide the attack panel so we can see around it.
            TownBattleAttackPanel.hideAttackPanel(1)

        elif wordIs("~showAttack"):
            # Reveal the attack panel again.
            TownBattleAttackPanel.hideAttackPanel(0)

        elif wordIs("~collisions_on"):
            base.localAvatar.collisionsOn()

        elif wordIs("~collisions_off"):
            base.localAvatar.collisionsOff()

        elif wordIs('~battle_detect_off'):
            from toontown.suit import DistributedSuit
            DistributedSuit.ALLOW_BATTLE_DETECT = 0

        elif wordIs('~battle_detect_on'):
            from toontown.suit import DistributedSuit
            DistributedSuit.ALLOW_BATTLE_DETECT = 1

        elif wordIs('~battles'):
            base.localAvatar.setWantBattles(not base.localAvatar.wantBattles)
            if base.localAvatar.wantBattles:
                response = 'battles ON'
            else:
                response = 'battles OFF'
            self.setMagicWordResponse(response)

        elif wordIs('~skipBattleMovie') or wordIs('~sbm'):
            ToontownBattleGlobals.SkipMovie = not ToontownBattleGlobals.SkipMovie
            if ToontownBattleGlobals.SkipMovie:
                response = "battle movies will be skipped"
            else:
                response = "battle movies will be played"
            self.setMagicWordResponse(response)

        elif wordIs('~addCameraPosition'):
            base.localAvatar.addCameraPosition()

        elif wordIs('~removeCameraPosition'):
            base.localAvatar.removeCameraPosition()

        elif wordIs('~printCameraPosition'):
            base.localAvatar.printCameraPosition(base.localAvatar.cameraIndex)

        elif wordIs('~printCameraPositions'):
            base.localAvatar.printCameraPositions()

        elif wordIs('~worldCam') or wordIs('~wc'):
            #print the camera position and hpr in world coordinates
            myCam = render.find('**/camera')
            if not myCam.isEmpty():
                camParent = myCam.getParent()
                myCam.wrtReparentTo(render)
                pos = myCam.getPos()
                hpr = myCam.getHpr()
                response = "(%.2f, %.2f, %.2f,) (%.2f, %.2f, %.2f)" % (
                    pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
                if not camParent.isEmpty():
                    myCam.wrtReparentTo(camParent)
                self.setMagicWordResponse(response)
                print(response)

        elif wordIs("~sync"):
            # Sync with the AI, like F6, but rather than accumulating
            # sync informatoin, throw away whatever information was
            # there from before.  If a second parameter is supplied,
            # it is a number of seconds of temporary extra skew to
            # apply; the default is 0.

            tm = base.cr.timeManager
            if tm == None:
                response = "No TimeManager."
                self.setMagicWordResponse(response)

            else:
                tm.extraSkew = 0.0
                skew = string.strip(word[5:])
                if skew != "":
                    tm.extraSkew = float(skew)
                globalClockDelta.clear()
                tm.handleHotkey()

        elif wordIs("~period"):
            # Reset the period timer to expire in the indicated number
            # of seconds, or with no parameter, report the number of
            # seconds remaining.

            timeout = string.strip(word[7:])
            if timeout != "":
                seconds = int(timeout)
                base.cr.stopPeriodTimer()
                base.cr.resetPeriodTimer(seconds)
                base.cr.startPeriodTimer()

            # Now report the number of seconds remaining.
            if base.cr.periodTimerExpired:
                response = "Period timer has expired."

            elif base.cr.periodTimerStarted:
                elapsed = globalClock.getFrameTime(
                ) - base.cr.periodTimerStarted
                secondsRemaining = base.cr.periodTimerSecondsRemaining - elapsed
                response = "Period timer expires in %s seconds." % (
                    int(secondsRemaining))
            else:
                response = "Period timer not set."

            self.setMagicWordResponse(response)

        elif wordIs("~net"):
            # Simulate pulling or restoring the network plug.
            if base.cr.networkPlugPulled():
                base.cr.restoreNetworkPlug()
                base.cr.startHeartbeat()
                response = "Network restored."
            else:
                base.cr.pullNetworkPlug()
                base.cr.stopHeartbeat()
                response = "Network disconnected."
            self.setMagicWordResponse(response)

        elif wordIs("~lag"):
            if not hasattr(base.cr, "magicLag"):
                base.cr.startDelay(0.1, 0.35)
                base.cr.magicLag = None
                response = "Simulated Lag On"
            else:
                base.cr.stopDelay()
                del base.cr.magicLag
                response = "Simulated Lag Off"
            self.setMagicWordResponse(response)

        elif wordIs("~cogPageFull"):
            # show all panels on cog page of Shticker book
            base.localAvatar.suitPage.updateAllCogs(3)

        elif wordIs('~mintId'):
            # the AI is going to listen for this also, but let's keep a local
            # copy
            args = word.split()
            postName = 'mintIdOverride'
            if len(args) < 2:
                if bboard.has(postName):
                    bboard.remove(postName)
            else:
                try:
                    id = int(args[1])
                    # make sure it's a valid id
                    foo = ToontownGlobals.MintNumRooms[id]
                except:
                    pass
                else:
                    bboard.post(postName, id)

        elif wordIs('~mintRoom'):
            # the AI is going to listen for this also, but let's keep a local
            # copy
            args = word.split()
            postName = 'mintRoom'
            if len(args) < 2:
                if bboard.has(postName):
                    bboard.remove(postName)
            else:
                try:
                    id = int(args[1])
                except:
                    pass
                else:
                    bboard.post(postName, id)

        elif wordIs('~mintWarp'):
            args = word.split()
            if len(args) < 2:
                self.setMagicWordResponse('Usage: ~mintWarp roomId')
                return
            try:
                roomNum = int(args[1])
            except:
                self.setMagicWordResponse('roomId not found: %s' % args[1])
                return
            if not bboard.has('mint'):
                self.setMagicWordResponse('not in a mint')
                return
            mint = bboard.get('mint')
            if not mint.warpToRoom(roomNum):
                self.setMagicWordResponse(
                    'invalid roomId or roomId not in this mint: %s' % args[1])
                return

        elif wordIs('~mintLayouts'):
            from toontown.coghq import MintLayout
            MintLayout.printAllCashbotInfo()
            self.setMagicWordResponse('logged mint layouts')

        elif wordIs("~edit"):
            if not __dev__:
                self.setMagicWordResponse("client not running in dev mode")
                return

            from otp.level import EditorGlobals
            # Is there a level that has made itself available for editing?
            level = bboard.get(EditorGlobals.EditTargetPostName)
            if level == None:
                self.setMagicWordResponse('no level available for editing')
                return

            from toontown.coghq import DistributedInGameEditor
            EditorGlobals.assertReadyToEdit()
            editUsername = EditorGlobals.getEditUsername()
            # make sure we're not already editing this level
            editors = base.cr.doFindAll('DistributedInGameEditor')
            for e in editors:
                if isinstance(e,
                              DistributedInGameEditor.DistributedInGameEditor):
                    if e.getLevelDoId() == level.doId:
                        if (e.editorIsLocalToon()
                                or e.getEditUsername() == editUsername):
                            self.setMagicWordResponse(
                                "you ('%s') are already editing this level" %
                                editUsername)
                            return
            cmd = "~inGameEdit %s %s" % (level.doId, editUsername)
            # Now send the real magic word with the doId etc. also
            self.b_setMagicWord(cmd)

        elif wordIs('~fshow'):
            from toontown.coghq import DistributedFactory
            factories = base.cr.doFindAll("DistributedFactory")
            factory = None
            for f in factories:
                if isinstance(f, DistributedFactory.DistributedFactory):
                    factory = f
                    break
            if factory is None:
                self.setMagicWordResponse('factory not found')
                return
            factory.setColorZones(not factory.fColorZones)

        elif wordIs('~fzone'):
            args = word.split()
            if len(args) < 2:
                self.setMagicWordResponse('Usage: ~fzone <zoneNum>')
                return
            zoneId = int(args[1])

            from toontown.coghq import DistributedFactory
            factories = base.cr.doFindAll("DistributedFactory")
            factory = None
            for f in factories:
                if isinstance(f, DistributedFactory.DistributedFactory):
                    factory = f
                    break
            if factory is None:
                self.setMagicWordResponse('factory not found')
                return
            factory.warpToZone(zoneId)

        elif wordIs("~undead"):
            # regenerate dead goons
            try:
                goons = base.cr.doFindAll("Goon")
                for goon in goons:
                    goon.undead()
            except:
                self.notify.warning("Error in undead")
        elif wordIs("~resyncGoons"):
            try:
                goons = base.cr.doFindAll("Goon")
                for goon in goons:
                    goon.resync()
            except:
                self.notify.warning("Error in resyncing")
        elif wordIs("~catalog"):
            self.doCatalog(word)

        elif wordIs('~petCam') and base.wantPets:
            if hasattr(base, 'petCamPrevParent'):
                base.cam.reparentTo(base.petCamPrevParent)
                del base.petCamPrevParent
            else:
                petId = base.localAvatar.getPetId()
                pet = self.cr.doId2do.get(petId)
                if pet:
                    if not hasattr(pet, 'camNode'):
                        pet.camNode = pet.attachNewNode('camNode')
                        pet.camNode.setPos(0, 0, 2.5)
                    base.petCamPrevParent = base.cam.getParent()
                    base.cam.reparentTo(pet.camNode)

        elif wordIs('~lockPet') and base.wantPets:
            petId = base.localAvatar.getPetId()
            pet = self.cr.doId2do.get(petId)
            if pet:
                if not pet.isLockedDown():
                    pet.lockPet()

        elif wordIs('~unlockPet') and base.wantPets:
            petId = base.localAvatar.getPetId()
            pet = self.cr.doId2do.get(petId)
            if pet:
                if pet.isLockedDown():
                    pet.unlockPet()

        elif wordIs('~resetPetTutorial') and base.wantPets:
            base.localAvatar.setPetTutorialDone(False)
            response = "Pet Tutorial flag reset"
            self.setMagicWordResponse(response)

        elif wordIs('~bossBattle'):
            self.doBossBattle(word)

        elif wordIs("~RaceChat"):
            #loadup chat phrases
            base.localAvatar.chatMgr.chatInputSpeedChat.addKartRacingMenu()
        elif wordIs('~BuyKart'):
            if base.wantKarts:

                def doShtikerLater(task):
                    base.localAvatar.addKartPage()
                    return 0

                if (base.localAvatar.hasKart()):
                    response = "Returning Kart %s" % (
                        base.localAvatar.getKartBodyType())
                    base.localAvatar.requestKartDNAFieldUpdate(
                        KartDNA.bodyType, InvalidEntry)
                    self.setMagicWordResponse(response)
                else:
                    base.localAvatar.requestKartDNAFieldUpdate(
                        KartDNA.rimsType, getDefaultRim())
                    taskMgr.doMethodLater(1.0, doShtikerLater,
                                          "doShtikerLater")

                # NOTE - BE SURE TO CHECK AI VERSION OF THIS AS IT SETS ACCESSSORIES OWNED FOR THE TOONAI.
                response = "Kart %s has been purchased with body and accessory color %s." % (
                    word[9], getDefaultColor())
                base.localAvatar.requestKartDNAFieldUpdate(
                    KartDNA.bodyType, int(word[9]))
                self.setMagicWordResponse(response)
            else:
                self.setMagicWordResponse("Enable wantKarts in Config.prc")
        elif wordIs('~leaveRace'):
            messenger.send('leaveRace')
        elif wordIs('~kartParticles'):
            b = ConfigVariableBool('want-kart-particles', 0)
            b.setValue(not b)
        elif wordIs('~gardenGame'):
            messenger.send("gardenGame")
            response = "You must be on your estate"
            self.setMagicWordResponse(response)

        elif wordIs("~verboseState"):
            # show all panels on cog page of Shticker book
            base.localAvatar.verboseState()

        elif wordIs('~golf'):
            self.doGolf(word)

        elif wordIs('~whiteList'):
            base.localAvatar.chatMgr.chatInputSpeedChat.addWhiteList()

        elif wordIs('~noWhiteList'):
            base.localAvatar.chatMgr.chatInputSpeedChat.removeWhiteList()

        elif wordIs("~setPaid"):
            args = word.split()
            if len(args) > 1:
                paid = int(args[1])
                statusString = base.config.GetString('force-paid-status',
                                                     'none')
                if paid:
                    paid = 1
                    if statusString != 'none':
                        if statusString == 'VELVET':
                            ConfigVariableString('force-paid-status').setValue(
                                "FULL")
                        elif statusString == 'unpaid':
                            ConfigVariableString('force-paid-status').setValue(
                                "paid")
                    base.cr.setIsPaid(1)
                else:
                    paid = 0
                    if statusString != 'none':
                        if statusString == 'FULL':
                            ConfigVariableString('force-paid-status').setValue(
                                "VELVET")
                        elif statusString == 'paid':
                            ConfigVariableString('force-paid-status').setValue(
                                "unpaid")
                    base.cr.setIsPaid(0)
            else:
                #self.setMagicWordResponse(senderId, "0 for unpaid 1 for paid")
                return

        # Parties
        elif wordIs("~party"):
            self.doParty(word, avId, zoneId)

        # In Game News
        elif wordIs("~news"):
            self.doNews(word, avId, zoneId)

        # Boarding Party GUI
        elif wordIs('~bgui'):
            if not hasattr(self, 'groupPanel'):
                from toontown.toon import GroupPanel
                self.groupPanel = GroupPanel.GroupPanel(
                    base.localAvatar.boardingParty)
                self.groupPanel.frame.show()
            else:
                self.groupPanel.frame.hide()
                self.groupPanel.cleanup()
                del self.groupPanel

        elif wordIs('~generateOrder'):
            args = word.split()
            if len(args) > 1:
                newOrder = int(args[1])
                if newOrder >= 0 and newOrder <= 2:
                    datagram = PyDatagram.PyDatagram()
                    datagram.addUint16(
                        MsgName2Id["CLIENT_CHANGE_GENERATE_ORDER"])
                    datagram.addUint32(newOrder)
                    base.cr.send(datagram)
                    response = "changing generate order to %s" % newOrder
                    self.setMagicWordResponse(response)
            else:
                response = "args: 0 default, 1 reversed, 2 shuffled"
                self.setMagicWordResponse(response)

        # Ruler
        elif wordIs('~ruler'):
            response = "Each unit is equal to one foot"
            self.setMagicWordResponse(response)
            if self.ruler:
                self.ruler.detachNode()
                del self.ruler

            self.ruler = loader.loadModel("phase_3/models/props/xyzAxis")
            self.ruler.reparentTo(render)
            self.ruler.setPos(base.localAvatar.getPos())
            self.ruler.place()

        elif wordIs("~toonIdTags"):
            otherToons = base.cr.doFindAllOfType('DistributedToon')
            if otherToons:
                for toon in otherToons[0]:
                    # this forces the nametag font to be the basic font that has numbers
                    toon.setNametagStyle(0)
            messenger.send('nameTagShowAvId', [])
            base.idTags = 1

        elif wordIs('~code'):
            # code redemption
            args = word.split()
            if len(args) > 1:
                code = word[len(args[0]) + 1:]
                base.codeRedemptionMgr.redeemCode(
                    code, self._handleCodeRedemptionResponse)
                response = 'sending code %s to server...' % code
            else:
                response = '~code <code>'
            self.setMagicWordResponse(response)