当前位置: 首页>>代码示例>>Python>>正文


Python quest.Quests类代码示例

本文整理汇总了Python中toontown.quest.Quests的典型用法代码示例。如果您正苦于以下问题:Python Quests类的具体用法?Python Quests怎么用?Python Quests使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Quests类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: recoverItems

    def recoverItems(self, av, suitsKilled, taskZoneId):
        # Get the avatars current quests.
        avQuests = av.getQuests()
        questList = []
        recoveredItems = []
        unrecoveredItems = []
        taskZoneId = ZoneUtil.getBranchZone(taskZoneId)

        # Iterate through the avatars current quests.
        for i in xrange(0, len(avQuests), 5):
            questDesc = avQuests[i : i + 5]
            questClass = Quests.getQuest(questDesc[QuestIdIndex])
            if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:
                if isinstance(questClass, Quests.CogQuest):
                    for suit in suitsKilled:
                        if questClass.doesCogCount(av.doId, suit, taskZoneId, suit['activeToons']):
                            questDesc[QuestProgressIndex] += 1
                elif isinstance(questClass, Quests.RecoverItemQuest):
                    if questClass.getHolder() != Quests.AnyFish:
                        for suit in suitsKilled:
                            if questClass.doesCogCount(av.doId, suit, taskZoneId, suit['activeToons']):
                                baseChance = questClass.getPercentChance()
                                amountRemaining = questClass.getNumItems() - questDesc[QuestProgressIndex]
                                chance = Quests.calcRecoverChance(amountRemaining, baseChance)
                                if chance >= baseChance:
                                    questDesc[QuestProgressIndex] += 1
                                    recoveredItems.append(questClass.getItem())
                                else:
                                    unrecoveredItems.append(questClass.getItem())
            questList.append(questDesc)

        av.b_setQuests(questList)
        return (recoveredItems, unrecoveredItems)
开发者ID:Toontown-Electrified,项目名称:src-feature-the-experiment,代码行数:33,代码来源:QuestManagerAI.py

示例2: initQuestFrame

    def initQuestFrame(self, toon, avQuests):
        self.endTrackFrame.hide()
        self.gagExpFrame.hide()
        self.newGagFrame.hide()
        self.promotionFrame.hide()
        self.questFrame.show()
        self.itemFrame.hide()
        self.cogPartFrame.hide()
        self.missedItemFrame.hide()
        for i in xrange(ToontownGlobals.MaxQuestCarryLimit):
            questLabel = self.questLabelList[i]
            questLabel['text_fg'] = (0, 0, 0, 1)
            questLabel.hide()

        for i in xrange(len(avQuests)):
            questDesc = avQuests[i]
            questId, npcId, toNpcId, rewardId, toonProgress = questDesc
            quest = Quests.getQuest(questId)
            if quest:
                questString = quest.getString()
                progressString = quest.getProgressString(toon, questDesc)
                rewardString = quest.getRewardString(progressString)
                rewardString = Quests.fillInQuestNames(rewardString, toNpcId=toNpcId)
                completed = quest.getCompletionStatus(toon, questDesc) == Quests.COMPLETE
                questLabel = self.questLabelList[i]
                questLabel.show()
                if base.localAvatar.tutorialAck:
                    questLabel['text'] = rewardString
                    if completed:
                        questLabel['text_fg'] = (0, 0.3, 0, 1)
                else:
                    questLabel['text'] = questString + ' :'
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:32,代码来源:RewardPanel.py

示例3: toonCaughtFishingItem

    def toonCaughtFishingItem(self, av):
        # Get the avatars current quests.
        avQuests = av.getQuests()
        fishingItem = -1
        questList = []

        # Iterate through their current quests.
        for i in xrange(0, len(avQuests), 5):
            questDesc = avQuests[i : i + 5]
            questClass = Quests.getQuest(questDesc[QuestIdIndex])
            if fishingItem != -1:
                questList.append(questDesc)
                continue
            if isinstance(questClass, Quests.RecoverItemQuest):
                if not hasattr(questClass, 'getItem'):
                    questList.append(questDesc)
                    continue
                if questClass.getHolder() == Quests.AnyFish:
                    if not questClass.getCompletionStatus(av, questDesc) == Quests.COMPLETE:
                        baseChance = questClass.getPercentChance()
                        amountRemaining = questClass.getNumItems() - questDesc[QuestProgressIndex]
                        chance = Quests.calcRecoverChance(amountRemaining, baseChance)
                        if chance >= baseChance:
                            questDesc[QuestProgressIndex] += 1
                            fishingItem = questClass.getItem()
            questList.append(questDesc)

        av.b_setQuests(questList)
        return fishingItem
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:29,代码来源:QuestManagerAI.py

示例4: trolleyLeft

 def trolleyLeft(self):
     numPlayers = self.countFullSeats()
     if numPlayers > 0:
         newbieIds = []
         for avId in self.seats:
             if avId:
                 toon = self.air.doId2do.get(avId)
                 if toon:
                     if Quests.avatarHasTrolleyQuest(toon):
                         if not Quests.avatarHasCompletedTrolleyQuest(toon):
                             newbieIds.append(avId)
         playerArray = []
         for i in self.seats:
             if i not in [None, 0]:
                 playerArray.append(i)
         mgDict = MinigameCreatorAI.createMinigame(
             self.air, playerArray, self.zoneId, newbieIds=newbieIds)
         minigameZone = mgDict['minigameZone']
         minigameId = mgDict['minigameId']
         for seatIndex in xrange(len(self.seats)):
             avId = self.seats[seatIndex]
             if avId:
                 self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId])
                 self.clearFullNow(seatIndex)
     else:
         self.notify.warning('The trolley left, but was empty.')
     self.enter()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:27,代码来源:DistributedTrolleyAI.py

示例5: avatarChoseQuest

 def avatarChoseQuest(self, avId, npc, questId, rewardId, building):
     toon = self.air.doId2do.get(avId)
     if not toon:
         return
     fromNpc = Quests.getQuestFromNpcId(questId)
     toNpc = Quests.getQuestToNpcId(questId)
     toon.addQuest([questId, fromNpc, toNpc, rewardId, 0], 0,
                     recordHistory = 0)
     npc.assignQuest(avId, questId, rewardId, toNpc)
     taskMgr.remove(npc.uniqueName('clearMovie'))
开发者ID:InvisbleMario,项目名称:Toontown-Community,代码行数:10,代码来源:QuestManagerAI.py

示例6: requestInteract

 def requestInteract(self, avId, npc):
     toon = self.air.doId2do.get(avId)
     if not toon:
         return
     toonQuestPocketSize = toon.getQuestCarryLimit()
     self.avatarProgressTier(toon)
     toonQuests = toon.getQuests()
     for i in xrange(0, len(toonQuests), 5):
         questDesc = toonQuests[i:i + 5]
         questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
         questClass = Quests.getQuest(questId)
         if questClass:
             completeStatus = questClass.getCompletionStatus(toon, questDesc, npc)
         else:
             continue
         if completeStatus == Quests.COMPLETE:
             print 'QuestManager: %s (AvId: %s) Completed QuestId: %s'%(toon.getName(), toon.doId, questId)
             toon.toonUp(toon.maxHp)
             if isinstance(questClass, Quests.TrackChoiceQuest):
                 npc.presentTrackChoice(avId, questId, questClass.getChoices())
                 break
             elif Quests.getNextQuest(questId, npc, toon)[0] != Quests.NA:
                 self.nextQuest(toon, npc, questId)
             else:
                 npc.completeQuest(avId, questId, rewardId)
                 self.completeQuest(toon, questId)
             if isinstance(npc, DistributedNPCSpecialQuestGiverAI):
                 if npc.tutorial and (npc.npcId == 20002):
                     messenger.send('intHqDoor0-{0}'.format(npc.zoneId), [FADoorCodes.WRONG_DOOR_HQ])
                     messenger.send('intHqDoor1-{0}'.format(npc.zoneId), [FADoorCodes.UNLOCKED])
                     streetZone = self.air.tutorialManager.currentAllocatedZones[avId][0]
                     messenger.send('extHqDoor0-{0}'.format(streetZone), [FADoorCodes.GO_TO_PLAYGROUND])
                     messenger.send('extHqDoor1-{0}'.format(streetZone), [FADoorCodes.GO_TO_PLAYGROUND])
                     messenger.send('extShopDoor-{0}'.format(streetZone), [FADoorCodes.GO_TO_PLAYGROUND])
             break
     else:
         if (len(toonQuests) == toonQuestPocketSize*5):
             npc.rejectAvatar(avId)
             return
         elif isinstance(npc, DistributedNPCSpecialQuestGiverAI):
             choices = self.avatarQuestChoice(toon, npc)
             quest = choices[0]
             self.avatarChoseQuest(avId, npc, quest[0], quest[1], 0)
             if npc.tutorial:
                 if npc.npcId == 20000:
                     messenger.send('intShopDoor-{0}'.format(npc.zoneId), [FADoorCodes.UNLOCKED])
             return
         else:
             choices = self.avatarQuestChoice(toon, npc)
             if choices != []:
                 npc.presentQuestChoice(avId, choices)
                 return
             else:
                 npc.rejectAvatar(avId)
                 return
开发者ID:InvisbleMario,项目名称:Toontown-Community,代码行数:55,代码来源:QuestManagerAI.py

示例7: giveReward

 def giveReward(self, toon, questId, rewardId):
     #Actual reward giving.
     rewardClass = Quests.getReward(rewardId)
     rewardClass.sendRewardAI(toon)
     #Add it to reward history.
     realRewardId = Quests.transformReward(rewardId, toon)
     tier, rewardList = toon.getRewardHistory()
     rewardList.append(rewardId)
     if realRewardId != rewardId:
         rewardList.append(realRewardId)
     toon.b_setRewardHistory(tier, rewardList)
开发者ID:InvisbleMario,项目名称:Toontown-Community,代码行数:11,代码来源:QuestManagerAI.py

示例8: requestSkipTutorial

 def requestSkipTutorial(self):
     avId = self.air.getAvatarIdFromSender()
     av = self.air.doId2do.get(avId)
     if av:
         av.b_setTutorialAck(1)
         av.b_setQuestHistory([110, 100])
         av.addQuest((110, Quests.getQuestFromNpcId(110), Quests.getQuestToNpcId(110), Quests.getQuestReward(110, av), 0), 0)
         self.air.questManager.toonRodeTrolleyFirstTime(av) #gg hacky
         self.d_skipTutorialResponse(avId, 1)
     else:
         self.d_skipTutorialResponse(avId, 0)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:11,代码来源:TutorialManagerAI.py

示例9: recoverItems

    def recoverItems(self, av, suitsKilled, taskZoneId):
        # Get the avatars current quests.
        avQuests = av.getQuests()
        questList = []
        recoveredItems = []
        unrecoveredItems = []
        taskZoneId = ZoneUtil.getBranchZone(taskZoneId)

        # Iterate through the avatars current quests.
        for i in xrange(0, len(avQuests), 5):
            questDesc = avQuests[i : i + 5]
            questClass = Quests.getQuest(questDesc[QuestIdIndex])

            # Check if the Quest isnt already complete
            if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:

                # Check if we are dealing with a RecoverItemQuest
                if isinstance(questClass, Quests.RecoverItemQuest):

                    # Iterate through all the Cogs that were killed in the battle
                    for suit in suitsKilled:

                        # Because the RecoveItemQuest class doesn't have a
                        # function to see if a Cog counts. We need to manually
                        # check if the Cog is valid for the Quest
                        if (questClass.getHolder() == Quests.Any) or \
                            (questClass.getHolderType() == 'type' and \
                            questClass.getHolder() == suit['type']) or \
                            (questClass.getHolderType() == 'track' and \
                            questClass.getHolder() == suit['track']) or \
                            (questClass.getHolderType() == 'level' and \
                            questClass.getHolder() <= suit['level']):

                            # It looks like the Cog was valid. Lets see if they
                            # found what they were looking for.
                            baseChance = questClass.getPercentChance()
                            amountRemaining = questClass.getNumItems() - questDesc[QuestProgressIndex]
                            chance = Quests.calcRecoverChance(amountRemaining, baseChance)

                            # They found it! Give them their reward!
                            if chance >= baseChance:
                                questDesc[QuestProgressIndex] += 1
                                recoveredItems.append(questClass.getItem())

                            # Better luck next time :(
                            else:
                                unrecoveredItems.append(questClass.getItem())

            questList.append(questDesc)

        av.b_setQuests(questList)

        return (recoveredItems, unrecoveredItems)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:53,代码来源:QuestManagerAI.py

示例10: __applyReward

    def __applyReward(self, av, questId, rewardId):
        Quests.getReward(rewardId).sendRewardAI(av)

        transId = Quests.transformReward(rewardId, av)
        
        tier, rewardList = av.getRewardHistory()
        
        rewardList.append(rewardId)
        if transId != rewardId:
            rewardList.append(transId)
            
        av.b_setRewardHistory(tier, rewardList)
开发者ID:Teku16,项目名称:MikeyTheRepository,代码行数:12,代码来源:QuestManagerAI.py

示例11: requestInteract

 def requestInteract(self, avId, npc):
     av = self.air.doId2do.get(avId)
     if not av:
         self.notify.warning("Got requestInteract with unknown avId: %s" % avId)
         return
                     
     # check if the avatar wants to turn in a quest
     quests = av.getQuests()
     for i in xrange(0, len(quests), 5):
         quest = quests[i:i + 5]
         klass = Quests.getQuest(quest[0])
         
         if not klass:
             self.notify.debug('Quest %s has no class.' % quest[0])
             continue
             
         if klass.getCompletionStatus(av, quest, npc) == Quests.COMPLETE:
             # complete quest, the avatar is turning it in
             self.notify.debug("Toon %s completed quest %s" % (av.doId, quest[0]))
             
             # fill the laff
             av.toonUp(av.maxHp)
             
             if isinstance(klass, Quests.TrackChoiceQuest):
                 npc.presentTrackChoice(avId, quest[0], klass.getChoices())
                 return 1
                 
             nextQuest = Quests.getNextQuest(quest[0], npc, av)
             if nextQuest[0] != Quests.NA:
                 self.__goToNextQuest(av, npc, quest[0], nextQuest)
                 
             else:
                 npc.completeQuest(avId, quest[0], quest[-2])
                 self.__questCompleted(av, quest[0])
                 
             return 1
             
     if self.__considerProgressTier(av):
         npc.rejectAvatarTierNotDone(avId)
         return 0
             
     # give choices if the av doesn't have enough quests already
     if len(quests) / 5 < av.getQuestCarryLimit():
         choices = Quests.chooseBestQuests(av.getRewardTier(), npc, av)
         if choices:
             npc.presentQuestChoice(avId, choices)
             return 1
     
     return 0
开发者ID:Teku16,项目名称:MikeyTheRepository,代码行数:49,代码来源:QuestManagerAI.py

示例12: giveReward

    def giveReward(self, av, questId, rewardId):
        # Give the reward.
        rewardClass = Quests.getReward(rewardId)
        if rewardClass is None:
            self.notify.warning('rewardClass was None for rewardId: %s.' % rewardId)
        else:
            rewardClass.sendRewardAI(av)

        # Add the rewardId to the avatars rewardHistory.
        rewardTier, rewardHistory = av.getRewardHistory()
        transformedRewardId = Quests.transformReward(rewardId, av)
        if transformedRewardId != rewardId:
            rewardHistory.append(rewardId)

        av.b_setRewardHistory(rewardTier, rewardHistory)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:15,代码来源:QuestManagerAI.py

示例13: __tasksChanged

    def __tasksChanged(self):
        self.clearMenu()
        try:
            lt = base.localAvatar
        except:
            return

        phrases = []

        def addTerminal(terminal, self=self, phrases=phrases):
            displayText = terminal.getDisplayText()
            if displayText not in phrases:
                self.append(terminal)
                phrases.append(displayText)

        for task in lt.quests:
            taskId, fromNpcId, toNpcId, rewardId, toonProgress = task
            q = Quests.getQuest(taskId)
            if q is None:
                continue
            msgs = q.getSCStrings(toNpcId, toonProgress)
            if type(msgs) != type([]):
                msgs = [msgs]
            for i in xrange(len(msgs)):
                addTerminal(TTSCToontaskTerminal(msgs[i], taskId, toNpcId, toonProgress, i))

        needToontask = 1
        if hasattr(lt, "questCarryLimit"):
            needToontask = len(lt.quests) != lt.questCarryLimit
        if needToontask:
            addTerminal(SCStaticTextTerminal(1299))
        return
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:32,代码来源:TTSCToontaskMenu.py

示例14: toonKilledCogs

 def toonKilledCogs(self, av, suits, zoneId, activeToons):
     if self.air.topToonsMgr:
         self.air.topToonsMgr.toonKilledCogs(av, suits)
         
     quests = av.getQuests()
     newQuests = []
     
     for i in xrange(0, len(quests), 5):
         quest = quests[i:i + 5]
         klass = Quests.getQuest(quest[0])
         
         if not klass:
             continue
                         
         if isinstance(klass, Quests.CogQuest):
             for suit in suits:
                 if klass.getCompletionStatus(av, quest) == Quests.COMPLETE:
                     break
                     
                 if klass.doesCogCount(av.doId, suit, zoneId, suit['activeToons']):
                     quest[4] += 1
         
         newQuests.append(quest)
         
     av.b_setQuests(newQuests)
开发者ID:vincent15k,项目名称:Toontown-House,代码行数:25,代码来源:QuestManagerAI.py

示例15: toonKilledCogs

    def toonKilledCogs(self, av, suitsKilled, zoneId):
        # Get the avatar's current quests.
        messenger.send("topToonsManager-event", [av.doId, TopToonsGlobals.CAT_COGS, len(suitsKilled)])
        avQuests = av.getQuests()
        questList = []

        # Iterate through the avatar's current quests.
        for i in xrange(0, len(avQuests), 5):
            questDesc = avQuests[i : i + 5]
            questClass = Quests.getQuest(questDesc[QuestIdIndex])

            # Check if they are doing a cog quest
            if isinstance(questClass, Quests.CogQuest):
                # Check if the cog counts...
                for suit in suitsKilled:
                    if questClass.doesCogCount(av.doId, suit, zoneId):
                        # Looks like the cog counts!
                        if questClass.getCompletionStatus(av, questDesc) != Quests.COMPLETE:
                            questDesc[QuestProgressIndex] += 1

            # Add the quest to the questList
            questList.append(questDesc)

        # Update the avatar's quests
        av.b_setQuests(questList)
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:25,代码来源:QuestManagerAI.py


注:本文中的toontown.quest.Quests类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。