本文整理汇总了Python中toontown.quest.Quests.getQuest方法的典型用法代码示例。如果您正苦于以下问题:Python Quests.getQuest方法的具体用法?Python Quests.getQuest怎么用?Python Quests.getQuest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.quest.Quests
的用法示例。
在下文中一共展示了Quests.getQuest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initQuestFrame
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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 + ' :'
示例2: toonKilledCogs
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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)
示例3: toonKilledCogs
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def toonKilledCogs(self, av, suitsKilled, zoneId, activeToonList):
# Get the avatar's current quests.
avQuests = av.getQuests()
questList = []
# Make a list of the activeToonDoIds
activeToonDoIds = [toon.doId for toon in activeToonList if not None]
# 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], av.doId)
# 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, activeToonDoIds):
# 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)
示例4: __tasksChanged
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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
示例5: recoverItems
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def recoverItems(self, toon, suitsKilled, taskZoneId):
flattenedQuests = toon.getQuests()
questList = [] #unflattened
recoveredItems = []
unrecoveredItems = []
taskZoneId = ZoneUtil.getBranchZone(taskZoneId)
for i in xrange(0, len(flattenedQuests), 5):
questDesc = flattenedQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[0])
if questClass.getCompletionStatus(toon, questDesc) == Quests.INCOMPLETE:
if isinstance(questClass, Quests.CogQuest):
for suit in suitsKilled:
if questClass.doesCogCount(toon.doId, suit, taskZoneId, suit['activeToons']):
questDesc[4] += 1
elif isinstance(questClass, Quests.RecoverItemQuest):
if questClass.getHolder() != Quests.AnyFish:
for suit in suitsKilled:
if questClass.doesCogCount(toon.doId, suit, taskZoneId, suit['activeToons']):
minchance = questClass.getPercentChance()
import random
chance = random.randint(minchance - 40, 100)
if chance <= minchance:
questDesc[4] += 1
recoveredItems.append(questClass.getItem())
else:
unrecoveredItems.append(questClass.getItem())
questList.append(questDesc)
toon.b_setQuests(questList)
return (recoveredItems, unrecoveredItems)
示例6: toonCaughtFishingItem
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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
示例7: updateQuestInfo
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def updateQuestInfo(self):
for marker in self.buildingMarkers:
marker.destroy()
self.buildingMarkers = []
dnaData = base.cr.playGame.dnaData
for questIndex in self.av.questPage.quests.keys():
questDesc = self.av.questPage.quests.get(questIndex)
if questDesc is None:
continue
mapIndex = questIndex + 1
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
quest = Quests.getQuest(questId)
fComplete = quest.getCompletionStatus(self.av, questDesc) == Quests.COMPLETE
if not fComplete:
if quest.getType() == Quests.RecoverItemQuest:
if quest.getHolder() == Quests.AnyFish:
self.putBuildingMarker(self.fishingSpotInfo, mapIndex=mapIndex)
continue
elif quest.getType() != Quests.DeliverGagQuest and quest.getType() != Quests.DeliverItemQuest and quest.getType() != Quests.VisitQuest and quest.getType() != Quests.TrackChoiceQuest:
continue
if toNpcId == Quests.ToonHQ:
self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
else:
npcZone = NPCToons.getNPCZone(toNpcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
branchId = ZoneUtil.getCanonicalBranchZone(npcZone)
if self.hoodId == hoodId and self.zoneId == branchId:
for blockId, block in dnaData.getBlocks():
zone = block.zone
branchZone = zone - zone % 100
finalZone = branchZone + 500 + blockId
if npcZone == finalZone:
building = block.node
self.putBuildingMarker(Point3(building.getPos()), building.getHpr(), mapIndex=mapIndex)
示例8: toonKilledCogs
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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)
示例9: recoverItems
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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)
示例10: hasTailorClothingTicket
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def hasTailorClothingTicket(self, toon, npc):
flattenedQuests = toon.getQuests()
for i in xrange(0, len(flattenedQuests), 5):
questDesc = flattenedQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[0])
if isinstance(questClass, Quests.DeliverItemQuest):
if questClass.getCompletionStatus(toon, questDesc, npc) == Quests.COMPLETE:
return 1
return 0
示例11: removeClothingTicket
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def removeClothingTicket(self, toon, npc):
flattenedQuests = toon.getQuests()
questList = []
for i in xrange(0, len(flattenedQuests), 5):
questDesc = flattenedQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[0])
if isinstance(questClass, Quests.DeliverItemQuest):
if questClass.getCompletionStatus(toon, questDesc, npc) == Quests.COMPLETE:
toon.removeQuest(questDesc[0])
break
示例12: requestInteract
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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
示例13: toonPlayedMinigame
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def toonPlayedMinigame(self, toon, toons):
print 'QuestManager: %s (AvId: %s) played on the trolley.'%(toon.getName(), toon.doId)
flattenedQuests = toon.getQuests()
questList = [] #unflattened
for i in xrange(0, len(flattenedQuests), 5):
questDesc = flattenedQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[0])
if isinstance(questClass, Quests.TrolleyQuest):
questDesc[4] = 1
questList.append(questDesc)
toon.b_setQuests(questList)
示例14: removeClothingTicket
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
def removeClothingTicket(self, av, npc):
# Get the avatars current quests.
avQuests = av.getQuests()
# Iterate through their current quests.
for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[QuestIdIndex])
if isinstance(questClass, Quests.DeliverItemQuest):
if questClass.getCompletionStatus(av, questDesc, npc) == Quests.COMPLETE:
av.removeQuest(questDesc[QuestIdIndex])
break
示例15: recoverItems
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import getQuest [as 别名]
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)