Exemple #1
0
 def tournamentDefeated(self, hood):
     for questId in self.quests.keys():
         quest = self.quests[questId]
         objective = quest.getCurrentObjective()
         if objective.type == Quests.DefeatCogTournament:
             if not objective.isComplete():
                 if (objective.area == Quests.Any
                         or ZoneUtil.getHoodId(objective.area, 1) == hood
                         or ZoneUtil.getHoodId(
                             objective.area, 1) == CIGlobals.ToontownCentral
                         and hood == CIGlobals.BattleTTC):
                     self.incrementQuestObjectiveProgress(questId)
                     self.checkIfObjectiveIsComplete(questId)
 def makeMoreDetailsPanel(self):
     self.actionFSM.request('off')
     self.removeMoreDetailsPanel()
     self.removeActionPanel()
     self.makeActionPanel()
     zoneId = self.avatarInfo[5]
     shardId = self.avatarInfo[6]
     isOnline = self.avatarInfo[7]
     shardName = 'Unknown District'
     hoodName = ZoneUtil.getHoodId(zoneId, 1)
     for district in base.cr.activeDistricts.values():
         if district.doId == shardId:
             shardName = district.getDistrictName()
             break
     if not isOnline:
         hoodName = 'Offline'
         shardName = 'Offline'
     self.locationText = OnscreenText('Location: {0}'.format(hoodName),
                                      parent=self.actionFrame,
                                      pos=(-0.3, 0.05, 0),
                                      align=TextNode.ALeft,
                                      scale=0.04)
     self.shardText = OnscreenText('District: {0}'.format(shardName),
                                   parent=self.actionFrame,
                                   pos=(-0.3, 0.0, 0),
                                   align=TextNode.ALeft,
                                   scale=0.04)
     self.detailsExitBtn = DirectButton(geom=CIGlobals.getCancelBtnGeom(),
                                        parent=self.actionFrame,
                                        relief=None,
                                        scale=0.8,
                                        pos=(-0.3, 0.0, -0.175),
                                        command=self.removeMoreDetailsPanel)
Exemple #3
0
 def enterPlayingGame(self):
     zoneId = localAvatar.getLastHood()
     hoodId = ZoneUtil.getHoodId(zoneId)
     status = {'hoodId': hoodId, 'zoneId': zoneId, 
        'avId': self.localAvId}
     shardId = self.myDistrict.doId
     self.gameFSM.request('waitForGameEnterResponse', [status, shardId])
 def finished(self, zone, shardId=None):
     if base.localAvatar.getHealth() < 1 and type(zone) == type(1):
         return
     doneStatus = {}
     if zone in [
             CIGlobals.ToontownCentralId, CIGlobals.MinigameAreaId,
             CIGlobals.TheBrrrghId, CIGlobals.DonaldsDreamlandId,
             CIGlobals.MinniesMelodylandId, CIGlobals.DaisyGardensId,
             CIGlobals.DonaldsDockId
     ]:
         doneStatus['mode'] = 'teleport'
         doneStatus['zoneId'] = zone
         doneStatus['hoodId'] = ZoneUtil.getHoodId(zone)
         doneStatus['where'] = ZoneUtil.getWhereName(zone)
         doneStatus['how'] = 'teleportIn'
         doneStatus['avId'] = base.localAvatar.doId
         doneStatus['shardId'] = None
         doneStatus['loader'] = ZoneUtil.getLoaderName(zone)
     else:
         doneStatus['mode'] = zone
         if zone == 'switchShard':
             doneStatus['shardId'] = shardId
     self.doneStatus = doneStatus
     messenger.send(self.doneEvent)
     return
Exemple #5
0
 def onDoorCloseFinish(self):
     if self.index == 1:
         if self.localAvOnElevator:
             base.transitions.fadeScreen(1)
             self.thebldg.d_readyForNextFloor()
             self.localAvOnElevator = False
         else:
             requestStatus = {
                 'zoneId':
                 ZoneUtil.getZoneId(
                     ZoneUtil.getHoodId(self.zoneId, street=1)),
                 'hoodId':
                 self.cr.playGame.hood.hoodId,
                 'where':
                 'playground',
                 'avId':
                 base.localAvatar.doId,
                 'loader':
                 'safeZoneLoader',
                 'shardId':
                 None,
                 'wantLaffMeter':
                 1,
                 'world':
                 base.cr.playGame.getCurrentWorldName(),
                 'how':
                 'teleportIn'
             }
             self.cr.playGame.getPlace().doneStatus = requestStatus
             messenger.send(self.cr.playGame.getPlace().doneEvent)
Exemple #6
0
 def monitorHealth(self, task):
     if self.isDead():
         base.taskMgr.remove('LT.attackReactionDone')
         if self.cr.playGame.hood.id != ZoneUtil.getHoodId(self.zoneId):
             self.cr.playGame.getPlace().fsm.request('died', [{}, self.diedStateDone])
         return task.done
     return task.cont
Exemple #7
0
 def finished(self, zone, shardId = None):
     if base.localAvatar.getHealth() < 1 and type(zone) == type(1):
         return
     else:
         doneStatus = {}
         if zone in [CIGlobals.ToontownCentralId,
          CIGlobals.MinigameAreaId,
          CIGlobals.TheBrrrghId,
          CIGlobals.DonaldsDreamlandId,
          CIGlobals.MinniesMelodylandId,
          CIGlobals.DaisyGardensId,
          CIGlobals.DonaldsDockId]:
             doneStatus['mode'] = 'teleport'
             doneStatus['zoneId'] = zone
             doneStatus['hoodId'] = ZoneUtil.getHoodId(zone)
             doneStatus['where'] = ZoneUtil.getWhereName(zone)
             doneStatus['how'] = 'teleportIn'
             doneStatus['avId'] = base.localAvatar.doId
             doneStatus['shardId'] = None
             doneStatus['loader'] = ZoneUtil.getLoaderName(zone)
         else:
             doneStatus['mode'] = zone
             if zone == 'switchShard':
                 doneStatus['shardId'] = shardId
         self.doneStatus = doneStatus
         messenger.send(self.doneEvent)
         return
Exemple #8
0
 def monitorHealth(self, task):
     if self.isDead():
         base.taskMgr.remove('LT.attackReactionDone')
         if self.cr.playGame.hood.id != ZoneUtil.getHoodId(self.zoneId):
             self.cr.playGame.getPlace().fsm.request(
                 'died', [{}, self.diedStateDone])
         return task.done
     return task.cont
Exemple #9
0
 def tournamentDefeated(self, hood):
     for questId in self.quests.keys():
         quest = self.quests[questId]
         objective = quest.getCurrentObjective()
         if objective.type == Quests.DefeatCogTournament:
             if not objective.isComplete():
                 if ZoneUtil.getHoodId(objective.area, 1) == hood or objective.area == Quests.Any:
                     self.incrementQuestObjectiveProgress(questId)
                     self.checkIfObjectiveIsComplete(questId)
Exemple #10
0
 def monitorHealth(self, task):
     if self.isDead():
         base.taskMgr.remove("LT.attackReactionDone")
         if (self.cr.playGame.hood.id != ZoneUtil.getHoodId(self.zoneId)):
             self.cr.playGame.getPlace().fsm.request(
                 'died', [{}, self.diedStateDone])
             messenger.send(PCTMM.getLocalAvDiedEvent())
         return task.done
     return task.cont
Exemple #11
0
 def cogDefeated(self, cog):
     for questId in self.quests.keys():
         quest = self.quests[questId]
         objective = quest.getCurrentObjective()
         if objective.type in Quests.DefeatCogObjectives:
             if not objective.isComplete():
                 if objective.type == Quests.DefeatCog:
                     if objective.subject == Quests.Any:
                         if objective.area == Quests.Any or ZoneUtil.getHoodId(objective.area, 1) == cog.getHood():
                             self.incrementQuestObjectiveProgress(questId)
                     elif objective.subject == cog.head:
                         if objective.area == Quests.Any or ZoneUtil.getHoodId(objective.area, 1) == cog.getHood():
                             self.incrementQuestObjectiveProgress(questId)
                 elif objective.type == Quests.DefeatCogLevel:
                     if cog.getLevel() >= objective.minCogLevel:
                         if objective.area == Quests.Any or ZoneUtil.getHoodId(objective.area, 1) == cog.getHood():
                             self.incrementQuestObjectiveProgress(questId)
                 elif objective.type == Quests.DefeatCogDept:
                     if objective.subject == cog.team:
                         if objective.area == Quests.Any or ZoneUtil.getHoodId(objective.area, 1) == cog.getHood():
                             self.incrementQuestObjectiveProgress(questId)
             self.checkIfObjectiveIsComplete(questId)
Exemple #12
0
    def cogDefeated(self, cog):
        for questId in self.quests.keys():
            quest = self.quests[questId]
            objective = quest.getCurrentObjective()
            if objective.type in Quests.DefeatCogObjectives:
                if not objective.isComplete():
                    if objective.type == Quests.DefeatCog:
                        if objective.subject == Quests.Any:
                            if (objective.area == Quests.Any
                                    or ZoneUtil.getHoodId(objective.area,
                                                          1) == cog.getHood()
                                    or ZoneUtil.getHoodId(objective.area, 1)
                                    == CIGlobals.ToontownCentral
                                    and cog.getHood() == CIGlobals.BattleTTC):
                                self.incrementQuestObjectiveProgress(questId)
                        elif objective.subject == cog.head:
                            if (objective.area == Quests.Any
                                    or ZoneUtil.getHoodId(objective.area,
                                                          1) == cog.getHood()
                                    or ZoneUtil.getHoodId(objective.area, 1)
                                    == CIGlobals.ToontownCentral
                                    and cog.getHood() == CIGlobals.BattleTTC):
                                self.incrementQuestObjectiveProgress(questId)
                    elif objective.type == Quests.DefeatCogLevel:
                        if cog.getLevel() >= objective.minCogLevel:
                            if (objective.area == Quests.Any
                                    or ZoneUtil.getHoodId(objective.area,
                                                          1) == cog.getHood()
                                    or ZoneUtil.getHoodId(objective.area, 1)
                                    == CIGlobals.ToontownCentral
                                    and cog.getHood() == CIGlobals.BattleTTC):
                                self.incrementQuestObjectiveProgress(questId)
                    elif objective.type == Quests.DefeatCogDept:
                        if objective.subject == cog.team:
                            if (objective.area == Quests.Any
                                    or ZoneUtil.getHoodId(objective.area,
                                                          1) == cog.getHood()
                                    or ZoneUtil.getHoodId(objective.area, 1)
                                    == CIGlobals.ToontownCentral
                                    and cog.getHood() == CIGlobals.BattleTTC):
                                self.incrementQuestObjectiveProgress(questId)

                self.checkIfObjectiveIsComplete(questId)
 def handleTeleportResponse(self, avatarId, shardId, zoneId):
     if self.avatarInfo[0] == avatarId:
         requestStatus = {}
         whereName = ZoneUtil.getWhereName(zoneId)
         loaderName = ZoneUtil.getLoaderName(zoneId)
         requestStatus['zoneId'] = zoneId
         if base.localAvatar.parentId == shardId:
             requestStatus['shardId'] = None
         else:
             requestStatus['shardId'] = shardId
         requestStatus['hoodId'] = ZoneUtil.getHoodId(zoneId, 1)
         requestStatus['where'] = whereName
         requestStatus['loader'] = loaderName
         requestStatus['how'] = 'teleportIn'
         requestStatus['avId'] = avatarId
         base.cr.playGame.getPlace().fsm.request('teleportOut',
                                                 [requestStatus])
         self.cleanup()
Exemple #14
0
 def handleTeleportResponse(self, avatarId, shardId, zoneId):
     if self.avatarInfo[0] == avatarId:
         requestStatus = {}
         whereName = ZoneUtil.getWhereName(zoneId)
         loaderName = ZoneUtil.getLoaderName(zoneId)
         requestStatus['zoneId'] = zoneId
         if base.localAvatar.parentId == shardId:
             requestStatus['shardId'] = None
         else:
             requestStatus['shardId'] = shardId
         requestStatus['hoodId'] = ZoneUtil.getHoodId(zoneId, 1)
         requestStatus['where'] = whereName
         requestStatus['loader'] = loaderName
         requestStatus['how'] = 'teleportIn'
         requestStatus['avId'] = avatarId
         base.cr.playGame.getPlace().fsm.request('teleportOut', [requestStatus])
         self.cleanup()
     return
Exemple #15
0
    def makeQuestNotes(self, quests = None):
        notes = []
        if not quests:
            quests = self.quests.values()
        for quest in quests:
            objective = quest.currentObjective
            note = QuestNote.QuestNote(quest.index)
            isDefeatObjective = objective.type in (Quests.DefeatCog,
             Quests.DefeatCogDept,
             Quests.DefeatCogInvasion,
             Quests.DefeatCogTournament,
             Quests.DefeatCogLevel)
            heading = None
            if isDefeatObjective:
                heading = Quests.DefeatText
            elif objective.type in [Quests.VisitNPC, Quests.VisitHQOfficer]:
                heading = Quests.VisitText
            note.setHeading(heading)
            taskInfo = None
            if isDefeatObjective:
                if objective.goal > 1:
                    taskInfo = '%d ' % objective.goal
                else:
                    taskInfo = 'a '
                if objective.type == Quests.DefeatCog:
                    if objective.subject == Quests.Any:
                        taskInfo += CIGlobals.Suits
                    elif objective.goal > 1:
                        taskInfo += QuestGlobals.makePlural(CIGlobals.SuitNames[objective.subject])
                    else:
                        taskInfo += CIGlobals.SuitNames[objective.subject]
                elif objective.type in (Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogDept):
                    if objective.goal > 1:
                        if objective.type == Quests.DefeatCogDept:
                            taskInfo += QuestGlobals.AbbrToDept[objective.subject]
                        else:
                            taskInfo += QuestGlobals.makePlural(objective.subject)
                    elif objective.type == Quests.DefeatCogDept:
                        taskInfo += QuestGlobals.makeSingular(QuestGlobals.AbbrToDept[objective.subject])
                    else:
                        taskInfo += objective.subject
                elif objective.type == Quests.DefeatCogLevel:
                    if objective.goal > 1:
                        taskInfo += 'Level %d+ %s' % (objective.minCogLevel, CIGlobals.Suits)
                    else:
                        taskInfo += 'Level %d+ %s' % (objective.minCogLevel, CIGlobals.Suit)
                if objective.area == Quests.Any:
                    taskInfo += '\nAnywhere'
                else:
                    taskInfo += '\nin ' + ZoneUtil.getHoodId(objective.area)
            elif objective.type == Quests.VisitNPC:
                nameOfNPC = CIGlobals.NPCToonNames[objective.npcId]
                placeOfNPC = CIGlobals.zone2TitleDict[objective.npcZone][0]
                taskInfo = nameOfNPC + '\nat ' + placeOfNPC
            elif objective.type == Quests.VisitHQOfficer:
                taskInfo = 'an HQ Officer\nat a Toon HQ'
            note.setTaskInfo(taskInfo)
            progress = ''
            if isDefeatObjective:
                if not objective.isComplete():
                    if isDefeatObjective:
                        progress = '%d of %d ' % (objective.progress, objective.goal) + QuestGlobals.makePastTense(Quests.DefeatText)
                        note.setProgress(progress)
                else:
                    note.setCompleted(1)
            elif objective.type == Quests.VisitNPC:
                streetZone = ZoneUtil.getBranchZone(objective.npcZone)
                if streetZone % 1000 >= 100:
                    streetName = CIGlobals.BranchZone2StreetName[streetZone]
                else:
                    streetName = 'the Playground'
                hoodName = ZoneUtil.getHoodId(streetZone, 1)
                progress = 'on %s\nin %s' % (streetName, hoodName)
                note.setProgress(progress)
            elif objective.type == Quests.VisitHQOfficer:
                progress = 'Any Street\nAny Playground'
                note.setProgress(progress)
            reward = ''
            if quest.rewardType == Quests.RewardJellybeans:
                reward = 'For %d jellybeans'
            elif quest.rewardType == Quests.RewardHealth:
                reward = 'For a %d point Laff boost'
            elif quest.rewardType == Quests.RewardAccess:
                reward = 'For access to %s'
            elif quest.rewardType == Quests.RewardNone:
                reward = 'For no reward'
            if '%s' in reward or '%d' in reward:
                note.setReward(reward % quest.rewardValue)
            else:
                note.setReward(reward)
            notes.append(note)

        return notes
    def makeQuestNotes(self, quests = None):
        notes = []
        if not quests:
            quests = self.quests.values()
        for quest in quests:

            objective = quest.currentObjective

            note = QuestNote.QuestNote(quest.index)

            isDefeatObjective = objective.type in (Quests.DefeatCog, Quests.DefeatCogDept,
                Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogLevel)

            heading = None
            if isDefeatObjective:
                heading = Quests.DefeatText
            elif objective.type in [Quests.VisitNPC, Quests.VisitHQOfficer]:
                heading = Quests.VisitText
            note.setHeading(heading)

            taskInfo = None
            if isDefeatObjective:
                if objective.goal > 1:
                    taskInfo = "%d " % objective.goal
                else:
                    taskInfo = "a "
                if objective.type == Quests.DefeatCog:
                    if objective.subject == Quests.Any:
                        taskInfo += CIGlobals.Suits
                    else:
                        if objective.goal > 1:
                            taskInfo += QuestGlobals.makePlural(CIGlobals.SuitNames[objective.subject])
                        else:
                            taskInfo += CIGlobals.SuitNames[objective.subject]
                elif objective.type in (Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogDept):
                    if objective.goal > 1:
                        if objective.type == Quests.DefeatCogDept:
                            taskInfo += QuestGlobals.AbbrToDept[objective.subject]
                        elif objective.type == Quests.DefeatCogInvasion:
                            taskInfo += QuestGlobals.QuestSubjects[1]
                        elif objective.type == Quests.DefeatCogTournament:
                            taskInfo += QuestGlobals.QuestSubjects[6]
                    else:
                        if objective.type == Quests.DefeatCogDept:
                            taskInfo += QuestGlobals.makeSingular(QuestGlobals.AbbrToDept[objective.subject])
                        elif objective.type == Quests.DefeatCogInvasion:
                            taskInfo += QuestGlobals.makeSingular(QuestGlobals.QuestSubjects[1])
                        elif objective.type == Quests.DefeatCogTournament:
                            taskInfo += QuestGlobals.makeSingular(QuestGlobals.QuestSubjects[6])
                elif objective.type == Quests.DefeatCogLevel:
                    if objective.goal > 1:
                        taskInfo += "Level %d+ %s" % (objective.minCogLevel, CIGlobals.Suits)
                    else:
                        taskInfo += "Level %d+ %s" % (objective.minCogLevel, CIGlobals.Suit)
                if objective.area == Quests.Any:
                    taskInfo += "\nAnywhere"
                else:
                    taskInfo += "\nin " + ZoneUtil.getHoodId(objective.area)
            elif objective.type == Quests.VisitNPC:
                nameOfNPC = CIGlobals.NPCToonNames[objective.npcId]
                placeOfNPC = CIGlobals.zone2TitleDict[objective.npcZone][0]
                taskInfo = nameOfNPC + "\nat " + placeOfNPC
            elif objective.type == Quests.VisitHQOfficer:
                taskInfo = "an HQ Officer\nat a Toon HQ"
            note.setTaskInfo(taskInfo)

            progress = ""
            if isDefeatObjective:
                if not objective.isComplete():
                    if isDefeatObjective:
                        progress = "%d of %d " % (objective.progress, objective.goal) + QuestGlobals.makePastTense(Quests.DefeatText)
                        note.setProgress(progress)
                else:
                    note.setCompleted(1)
            elif objective.type == Quests.VisitNPC:
                streetZone = ZoneUtil.getBranchZone(objective.npcZone)
                if streetZone % 1000 >= 100:
                    streetName = CIGlobals.BranchZone2StreetName[streetZone]
                else:
                    streetName = "the Playground"
                hoodName = ZoneUtil.getHoodId(streetZone, 1)
                progress = "on %s\nin %s" % (streetName, hoodName)
                note.setProgress(progress)
            elif objective.type == Quests.VisitHQOfficer:
                progress = "Any Street\nAny Playground"
                note.setProgress(progress)

            reward = ""
            if quest.rewardType == Quests.RewardJellybeans:
                reward = "For %d jellybeans"
            elif quest.rewardType == Quests.RewardHealth:
                reward = "For a %d point Laff boost"
            elif quest.rewardType == Quests.RewardAccess:
                reward = "For access to %s"
            elif quest.rewardType == Quests.RewardNone:
                reward = "For no reward"
            if '%s' in reward or '%d' in reward:
                note.setReward(reward % quest.rewardValue)
            else:
                note.setReward(reward)

            notes.append(note)
        return notes