本文整理汇总了Python中toontown.quest.Quests.calcRecoverChance方法的典型用法代码示例。如果您正苦于以下问题:Python Quests.calcRecoverChance方法的具体用法?Python Quests.calcRecoverChance怎么用?Python Quests.calcRecoverChance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.quest.Quests
的用法示例。
在下文中一共展示了Quests.calcRecoverChance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toonCaughtFishingItem
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import calcRecoverChance [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
示例2: recoverItems
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import calcRecoverChance [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)
示例3: recoverItems
# 需要导入模块: from toontown.quest import Quests [as 别名]
# 或者: from toontown.quest.Quests import calcRecoverChance [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)