本文整理汇总了Python中kol.util.ParseResponseUtils.parseDrunkGained方法的典型用法代码示例。如果您正苦于以下问题:Python ParseResponseUtils.parseDrunkGained方法的具体用法?Python ParseResponseUtils.parseDrunkGained怎么用?Python ParseResponseUtils.parseDrunkGained使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kol.util.ParseResponseUtils
的用法示例。
在下文中一共展示了ParseResponseUtils.parseDrunkGained方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseResponse
# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseDrunkGained [as 别名]
def parseResponse(self):
# Check for errors.
notEnoughMeatPattern = PatternManager.getOrCompilePattern('noMeatForStore')
cannotGoPattern = PatternManager.getOrCompilePattern('userShouldNotBeHere')
notSoldPattern = PatternManager.getOrCompilePattern('notSoldHere')
if cannotGoPattern.search(self.responseText):
raise UserShouldNotBeHereError("You cannot reach that cafe")
if notSoldPattern.search(self.responseText):
raise NotSoldHereError("This cafe doesn't carry that item.")
if notEnoughMeatPattern.search(self.responseText):
raise NotEnoughMeatError("You do not have enough meat to purchase the item(s).")
response = {}
advResponse = ParseResponseUtils.parseAdventuresGained(self.responseText)
if advResponse > 0:
response["adventures"] = advResponse
drunkResponse = ParseResponseUtils.parseDrunkGained(self.responseText)
if drunkResponse > 0:
response["drunkeness"] = drunkResponse
subResponse = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)
if len(subResponse) > 0:
response["substats"] = subResponse
statResponse = ParseResponseUtils.parseStatsGainedLost(self.responseText)
if len(statResponse) > 0:
response["statPoints"] = statResponse
levelResponse = ParseResponseUtils.parseLevelsGained(self.responseText)
if levelResponse > 0:
response["level"] = levelResponse
effectResponse = ParseResponseUtils.parseEffectsGained(self.responseText)
if len(effectResponse) > 0:
response["effects"] = effectResponse
hpResponse = ParseResponseUtils.parseHPGainedLost(self.responseText)
if hpResponse != 0:
reponse["hp"] = hpResponse
mpResponse = ParseResponseUtils.parseMPGainedLost(self.responseText)
if mpResponse != 0:
reponse["mp"] = mpResponse
self.responseData = response
示例2: parseResponse
# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseDrunkGained [as 别名]
def parseResponse(self):
# First parse for errors
notEnoughPattern = PatternManager.getOrCompilePattern("notEnoughToUse")
if notEnoughPattern.search(self.responseText):
raise NotEnoughItemsError("You don't have that many of that item")
notMultiPattern = PatternManager.getOrCompilePattern("notMultiUse")
if notMultiPattern.search(self.responseText):
raise InvalidActionError("You cannot multi-use that item")
# Find out what happened
items = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
if len(items) > 0:
self.responseData["items"] = items
meat = ParseResponseUtils.parseMeatGainedLost(self.responseText)
if meat != 0:
self.responseData["meat"] = meat
hp = ParseResponseUtils.parseHPGainedLost(self.responseText)
if hp != 0:
self.responseData["hp"] = hp
mp = ParseResponseUtils.parseMPGainedLost(self.responseText)
if mp != 0:
self.responseData["mp"] = mp
drunk = ParseResponseUtils.parseDrunkGained(self.responseText)
if drunk != 0:
self.responseData["drunk"] = drunk
adventures = ParseResponseUtils.parseAdventuresGained(self.responseText)
if adventures != 0:
self.responseData["adventures"] = adventures
effects = ParseResponseUtils.parseEffectsGained(self.responseText)
if len(effects) > 0:
self.responseData["effects"] = effects
示例3: parseResponse
# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseDrunkGained [as 别名]
def parseResponse(self):
# Check for errors
tooDrunkPattern = PatternManager.getOrCompilePattern('tooDrunk')
if tooDrunkPattern.search(self.responseText):
raise TooDrunkError("You are too drunk to drink more booze")
notBoozePattern = PatternManager.getOrCompilePattern('notBooze')
if notBoozePattern.search(self.responseText):
raise InvalidActionError("That item is not booze")
boozeMissingPattern = PatternManager.getOrCompilePattern('notEnoughItems')
if boozeMissingPattern.search(self.responseText):
raise NotEnoughItemsError("Item not in inventory")
# Check the results
results = {}
results["drunkenness"] = ParseResponseUtils.parseDrunkGained(self.responseText)
results["adventures"] = ParseResponseUtils.parseAdventuresGained(self.responseText)
substats = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)
if len(substats) > 0:
results["substats"] = substats
stats = ParseResponseUtils.parseStatsGainedLost(self.responseText)
if len(stats) > 0:
results["stats"] = stats
level = ParseResponseUtils.parseLevelsGained(self.responseText)
if level != 0:
results["level"] = level
hp = ParseResponseUtils.parseHPGainedLost(self.responseText)
if hp != 0:
results["hp"] = hp
mp = ParseResponseUtils.parseMPGainedLost(self.responseText)
if mp != 0:
results["mp"] = mp
effects = ParseResponseUtils.parseEffectsGained(self.responseText)
if len(effects) > 0:
results["effects"] = effects
self.responseData = results