def startPartyNow(self, firstStart, hostId):
        if localAvatar.hasActiveBoardingGroup():
            rejectText = TTLocalizer.BoardingCannotLeaveZone
            localAvatar.elevatorNotifier.showMe(rejectText)
            return
        base.localAvatar.creatingNewPartyWithMagicWord = False
        base.localAvatar.aboutToPlanParty = False
        hoodId = ToontownGlobals.PartyHood
        if firstStart:
            zoneId = 0
            ToontownDistrictStats.refresh('shardInfoUpdated')
            curShardTuples = base.cr.listActiveShards()
            lowestPop = 100000000000000000L
            shardId = None
            for shardInfo in curShardTuples:
                pop = shardInfo[2]
                if pop < lowestPop:
                    lowestPop = pop
                    shardId = shardInfo[0]

            if shardId == base.localAvatar.defaultShard:
                shardId = None
            base.cr.playGame.getPlace().requestLeave({'loader': 'safeZoneLoader',
             'where': 'party',
             'how': 'teleportIn',
             'hoodId': hoodId,
             'zoneId': zoneId,
             'shardId': None, # ALPHA BANDAGE: should be shardId, but this causes the AI it teleports to to die right now.
             'avId': -1})
        else:
            if hostId is None:
                hostId = base.localAvatar.doId
            base.cr.partyManager.sendAvatarToParty(hostId)
            return
        return
 def _wantShardListComplete(self):
     print self.activeDistrictMap
     if self._shardsAreReady():
         self.acceptOnce(ToontownDistrictStats.EventName(), self.shardDetailStatsComplete)
         ToontownDistrictStats.refresh()
     else:
         self.loginFSM.request('noShards')
Example #3
0
    def startPartyNow(self, firstStart, hostId):
        if localAvatar.hasActiveBoardingGroup():
            rejectText = TTLocalizer.BoardingCannotLeaveZone
            localAvatar.elevatorNotifier.showMe(rejectText)
            return
        base.localAvatar.creatingNewPartyWithMagicWord = False
        base.localAvatar.aboutToPlanParty = False
        hoodId = ToontownGlobals.PartyHood
        if firstStart:
            zoneId = 0
            ToontownDistrictStats.refresh('shardInfoUpdated')
            curShardTuples = base.cr.listActiveShards()
            lowestPop = 100000000000000000
            shardId = None
            for shardInfo in curShardTuples:
                pop = shardInfo[2]
                if pop < lowestPop:
                    lowestPop = pop
                    shardId = shardInfo[0]

            if shardId == base.localAvatar.defaultShard:
                shardId = None
            base.cr.playGame.getPlace().requestLeave({'loader': 'safeZoneLoader',
             'where': 'party',
             'how': 'teleportIn',
             'hoodId': hoodId,
             'zoneId': zoneId,
             'shardId': shardId,
             'avId': -1})
        else:
            if hostId is None:
                hostId = base.localAvatar.doId
            base.cr.partyManager.sendAvatarToParty(hostId)
            return
        return
Example #4
0
 def askForShardInfoUpdate(self, task=None):
     ToontownDistrictStats.refresh('shardInfoUpdated')
     # repeat request several seconds in the future
     taskMgr.doMethodLater(self.ShardInfoUpdateInterval,
                           self.askForShardInfoUpdate,
                           'ShardPageUpdateTask-doLater')
     return Task.done
 def _wantShardListComplete(self):
     print(self.activeDistrictMap)
     if self._shardsAreReady():
         self.acceptOnce(ToontownDistrictStats.EventName(), self.shardDetailStatsComplete)
         ToontownDistrictStats.refresh()
     else:
         self.loginFSM.request('noShards')
Example #6
0
    def doParty(self, word, av, zoneId):
        args = word.split()
        response = None
        action = None

        if len(args) == 1:
            return

        action = args[1]
        if action == 'plan':
            # We need to know if we're about to plan a party upon entering the
            # teleportIn state of the Party.py fsm. Following the pet tutorial's
            # lead by setting a boolean on the avatar.
            base.localAvatar.aboutToPlanParty = True
            base.localAvatar.creatingNewPartyWithMagicWord = False
        elif action == 'new':
            # Let's tell ourselves we're creating a new party, so we know what
            # to do with the response
            base.localAvatar.aboutToPlanParty = False
            base.localAvatar.creatingNewPartyWithMagicWord = True
        elif action == 'start':
            base.localAvatar.creatingNewPartyWithMagicWord = False
            base.localAvatar.aboutToPlanParty = False
            hoodId = ToontownGlobals.PartyHood
            ToontownDistrictStats.refresh('shardInfoUpdated')
            # We need to find the lowest populated shard and have the party there
            curShardTuples = base.cr.listActiveShards()
            # Tuple is of form : (shardId, name, pop, WelcomeValleyPopulation)
            lowestPop = 100000000000000000
            shardId = None
            for shardInfo in curShardTuples:
                pop = shardInfo[2]
                if pop < lowestPop:
                    lowestPop = pop
                    shardId = shardInfo[0]
            if shardId == base.localAvatar.defaultShard:
                shardId = None
            base.cr.playGame.getPlace().requestLeave({
                "loader": "safeZoneLoader",
                "where": "party",
                "how": "teleportIn",
                "hoodId": hoodId,
                "zoneId": -1,
                "shardId": shardId,
                "avId": -1,
            })
        elif action == 'unreleasedClient':
            newVal = base.cr.partyManager.toggleAllowUnreleasedClient()
            response = "Allow Unreleased Client = %s" % newVal
        elif action == 'showdoid':
            newVal = base.cr.partyManager.toggleShowDoid()
            response = "show doid = %s" % newVal

        if response is not None:
            self.setMagicWordResponse(response)
 def _wantShardListComplete(self):
     print self.activeDistrictMap
     if self._shardsAreReady():
         self.acceptOnce(ToontownDistrictStats.EventName(),
                         self.shardDetailStatsComplete)
         ToontownDistrictStats.refresh()
     else:
         status = ''
         if self.listFullShards():
             status = 'full'
         self.loginFSM.request('noShards', [status])
Example #8
0
 def doParty(self, word, av, zoneId):
     args = word.split()
     response = None
     action = None
     if len(args) == 1:
         return None
     
     action = args[1]
     if action == 'plan':
         base.localAvatar.aboutToPlanParty = True
         base.localAvatar.creatingNewPartyWithMagicWord = False
     elif action == 'new':
         base.localAvatar.aboutToPlanParty = False
         base.localAvatar.creatingNewPartyWithMagicWord = True
     elif action == 'start':
         base.localAvatar.creatingNewPartyWithMagicWord = False
         base.localAvatar.aboutToPlanParty = False
         hoodId = ToontownGlobals.PartyHood
         ToontownDistrictStats.refresh('shardInfoUpdated')
         curShardTuples = base.cr.listActiveShards()
         lowestPop = 0x16345785D8A0000L
         shardId = None
         for shardInfo in curShardTuples:
             pop = shardInfo[2]
             if pop < lowestPop:
                 lowestPop = pop
                 shardId = shardInfo[0]
                 continue
         
         if shardId == base.localAvatar.defaultShard:
             shardId = None
         
         base.cr.playGame.getPlace().requestLeave({
             'loader': 'safeZoneLoader',
             'where': 'party',
             'how': 'teleportIn',
             'hoodId': hoodId,
             'zoneId': -1,
             'shardId': shardId,
             'avId': -1 })
     elif action == 'unreleasedClient':
         newVal = base.cr.partyManager.toggleAllowUnreleasedClient()
         response = 'Allow Unreleased Client = %s' % newVal
     elif action == 'showdoid':
         newVal = base.cr.partyManager.toggleShowDoid()
         response = 'show doid = %s' % newVal
     elif action == 'debugGrid':
         newVal = not ConfigVariableBool('show-debug-party-grid')
         ConfigVariableBool('show-debug-party-grid').setValue(newVal)
         response = 'Grid: %s; re-enter party to see changes.' % newVal
     
     if response is not None:
         self.setMagicWordResponse(response)
 def doParty(self, word, av, zoneId):
     args = word.split()
     response = None
     action = None
     if len(args) == 1:
         return None
     
     action = args[1]
     if action == 'plan':
         base.localAvatar.aboutToPlanParty = True
         base.localAvatar.creatingNewPartyWithMagicWord = False
     elif action == 'new':
         base.localAvatar.aboutToPlanParty = False
         base.localAvatar.creatingNewPartyWithMagicWord = True
     elif action == 'start':
         base.localAvatar.creatingNewPartyWithMagicWord = False
         base.localAvatar.aboutToPlanParty = False
         hoodId = ToontownGlobals.PartyHood
         ToontownDistrictStats.refresh('shardInfoUpdated')
         curShardTuples = base.cr.listActiveShards()
         lowestPop = 0x16345785D8A0000L
         shardId = None
         for shardInfo in curShardTuples:
             pop = shardInfo[2]
             if pop < lowestPop:
                 lowestPop = pop
                 shardId = shardInfo[0]
                 continue
         
         if shardId == base.localAvatar.defaultShard:
             shardId = None
         
         base.cr.playGame.getPlace().requestLeave({
             'loader': 'safeZoneLoader',
             'where': 'party',
             'how': 'teleportIn',
             'hoodId': hoodId,
             'zoneId': -1,
             'shardId': shardId,
             'avId': -1 })
     elif action == 'unreleasedClient':
         newVal = base.cr.partyManager.toggleAllowUnreleasedClient()
         response = 'Allow Unreleased Client = %s' % newVal
     elif action == 'showdoid':
         newVal = base.cr.partyManager.toggleShowDoid()
         response = 'show doid = %s' % newVal
     elif action == 'debugGrid':
         newVal = not ConfigVariableBool('show-debug-party-grid')
         ConfigVariableBool('show-debug-party-grid').setValue(newVal)
         response = 'Grid: %s; re-enter party to see changes.' % newVal
     
     if response is not None:
         self.setMagicWordResponse(response)
    def doParty(self, word, av, zoneId):
        args = word.split()
        response = None
        action = None
        if len(args) == 1:
            return
        action = args[1]
        if action == "plan":
            base.localAvatar.aboutToPlanParty = True
            base.localAvatar.creatingNewPartyWithMagicWord = False
        elif action == "new":
            base.localAvatar.aboutToPlanParty = False
            base.localAvatar.creatingNewPartyWithMagicWord = True
        elif action == "start":
            base.localAvatar.creatingNewPartyWithMagicWord = False
            base.localAvatar.aboutToPlanParty = False
            hoodId = ToontownGlobals.PartyHood
            ToontownDistrictStats.refresh("shardInfoUpdated")
            curShardTuples = base.cr.listActiveShards()
            lowestPop = 100000000000000000L
            shardId = None
            for shardInfo in curShardTuples:
                pop = shardInfo[2]
                if pop < lowestPop:
                    lowestPop = pop
                    shardId = shardInfo[0]

            if shardId == base.localAvatar.defaultShard:
                shardId = None
            base.cr.playGame.getPlace().requestLeave(
                {
                    "loader": "safeZoneLoader",
                    "where": "party",
                    "how": "teleportIn",
                    "hoodId": hoodId,
                    "zoneId": -1,
                    "shardId": shardId,
                    "avId": -1,
                }
            )
        elif action == "unreleasedClient":
            newVal = base.cr.partyManager.toggleAllowUnreleasedClient()
            response = "Allow Unreleased Client = %s" % newVal
        elif action == "showdoid":
            newVal = base.cr.partyManager.toggleShowDoid()
            response = "show doid = %s" % newVal
        elif action == "debugGrid":
            newVal = not ConfigVariableBool("show-debug-party-grid")
            ConfigVariableBool("show-debug-party-grid").setValue(newVal)
            response = "Grid: %s; re-enter party to see changes." % newVal
        if response is not None:
            self.setMagicWordResponse(response)
        return
Example #11
0
 def askForShardInfoUpdate(self, task = None):
     ToontownDistrictStats.refresh('shardInfoUpdated')
     taskMgr.doMethodLater(self.ShardInfoUpdateInterval, self.askForShardInfoUpdate, 'ShardPageUpdateTask-doLater')
     return Task.done
 def askForShardInfoUpdate(self, task = None):
     ToontownDistrictStats.refresh('shardInfoUpdated')
     taskMgr.doMethodLater(self.ShardInfoUpdateInterval, self.askForShardInfoUpdate, 'ShardPageUpdateTask-doLater')
     return Task.done
 def exitWaitForShardList(self):
     self.ignore(ToontownDistrictStats.EventName())
     OTPClientRepository.OTPClientRepository.exitWaitForShardList(self)