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


Python ParseResponseUtils.parseSubstatsGainedLost方法代码示例

本文整理汇总了Python中kol.util.ParseResponseUtils.parseSubstatsGainedLost方法的典型用法代码示例。如果您正苦于以下问题:Python ParseResponseUtils.parseSubstatsGainedLost方法的具体用法?Python ParseResponseUtils.parseSubstatsGainedLost怎么用?Python ParseResponseUtils.parseSubstatsGainedLost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kol.util.ParseResponseUtils的用法示例。


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

示例1: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
 def parseResponse(self):
     self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(
         self.responseText, checkMuscle=False, checkMysticality=False
     )
     self.responseData["stats"] = ParseResponseUtils.parseStatsGainedLost(
         self.responseText, checkMuscle=False, checkMysticality=False
     )
     self.responseData["level"] = ParseResponseUtils.parseLevelsGained(self.responseText)
开发者ID:Cairnarvon,项目名称:pykol,代码行数:10,代码来源:TanULotsRequest.py

示例2: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
    def parseResponse(self):
        if len(self.responseText) == 0:
            raise Error.Error("You cannot use the Mind Control Device yet.", Error.INVALID_LOCATION)

        noAdventuresPattern = PatternManager.getOrCompilePattern('noAdvInstitue')
        invalidTurnsPattern = PatternManager.getOrCompilePattern('invalidAdvInstitute')
        if noAdventuresPattern.search(self.responseText):
            raise Error.Error("You don't have enough adventures to study at the institute.", Error.NOT_ENOUGH_ADVENTURES)
        if invalidTurnsPattern.search(self.responseText):
            raise Error.Error("That is an invalid number of turns for studying." Error.REQUEST_GENERIC)

        self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText, checkMuscle=False, checkMoxie=False)
        self.responseData["stats"] = ParseResponseUtils.ParseResponseUtils.parseStatsGainedLost(self.responseText, checkMuscle=False, checkMoxie=False)
        self.responseData["level"] = ParseResponseUtils.parseLevelsGained(self.responseText)
开发者ID:nchusid,项目名称:pykol,代码行数:16,代码来源:CanadianStudiesRequest.py

示例3: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
	def parseResponse(self):
		if len(self.responseText) == 0:
			raise UserShouldNotBeHereError("You cannot use the Mind Control Device yet.")
		
		NoAdventuresPattern = PatternManager.getOrCompilePattern('noAdvInstitue')
		InvalidTurnsPattern = PatternManager.getOrCompilePattern('invalidAdvInstitute')
		
		if NoAdventuresPattern.search(self.responseText):
			raise NotEnoughAdventuresLeftError("You don't have enough adventures to study at the institute.")
		if InvalidTurnsPattern.search(self.responseText):
			raise RequestError("That is an invalid number of turns for studying")
		
		self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText, checkMuscle=False, checkMoxie=False)
		self.responseData["stats"] = ParseResponseUtils.ParseResponseUtils.parseStatsGainedLost(self.responseText, checkMuscle=False, checkMoxie=False)
		self.responseData["level"] = ParseResponseUtils.parseLevelsGained(self.responseText)
开发者ID:NardoLoopa,项目名称:pykol,代码行数:17,代码来源:CanadianStudiesRequest.py

示例4: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [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
开发者ID:camperdave,项目名称:pykol,代码行数:50,代码来源:CafeRequest.py

示例5: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
    def parseResponse(self):
        notBarrelPattern = PatternManager.getOrCompilePattern('usedBarrel')
        noAdventuresPattern = PatternManager.getOrCompilePattern('noAdventures')
        if notBarrelPattern.match(self.responseText):
            raise InvalidActionError("Barrel already opened or doesn't exist. (#%s)" % self.requestData['smash'])
        if noAdventuresPattern.match(self.responseText):
            raise NotEnoughAdventuresLeftError("You don't have enough adventures to smash that")

        url = self.response.geturl()
        if url.find("/fight.php") >= 0:
            # Get the monster's name.
            self.responseData["adventureType"] = "combat"
            monsterNamePattern = PatternManager.getOrCompilePattern('monsterName')
            monsterNameMatch = monsterNamePattern.search(self.responseText)
            self.responseData["monsterName"] = monsterNameMatch.group(1)

            # Check to see if the fight was won or lost.
            fightWonPattern = PatternManager.getOrCompilePattern('fightWon')
            if fightWonPattern.search(self.responseText):
                self.responseData["fightWon"] = True
            else:
                fightLostPattern = PatternManager.getOrCompilePattern('fightLost')
                if fightLostPattern.search(self.responseText):
                    self.responseData["fightLost"] = True

            # Get items, meat, and substats gained. We always need to check these since they can
            # happen at any point during the fight.
            self.responseData["items"] = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
            self.responseData["meat"] = ParseResponseUtils.parseMeatGainedLost(self.responseText)
            self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)


        item = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
        if len(item) > 0:
            self.responseData["items"] = item

        hp = ParseResponseUtils.parseHPGainedLost(self.responseText)
        if hp != 0:
            self.responseData["hp"] = hp
开发者ID:camperdave,项目名称:pykol,代码行数:41,代码来源:BarrelRequest.py

示例6: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [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
开发者ID:NardoLoopa,项目名称:pykol,代码行数:40,代码来源:DrinkBoozeRequest.py

示例7: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
	def parseResponse(self):
		# Check for errors
		tooFullPattern = PatternManager.getOrCompilePattern('tooFull')
		if tooFullPattern.search(self.responseText):
			raise TooFullError("You are too full to eat that.")
		notFoodPattern = PatternManager.getOrCompilePattern('notFood')
		if notFoodPattern.search(self.responseText):
			raise InvalidActionError("That item is not food")
		foodMissingPattern = PatternManager.getOrCompilePattern('notEnoughItems')
		if foodMissingPattern.search(self.responseText):
		 raise NotEnoughItemsError("Item not in inventory")

		# Check the results
		results = {}
		
		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
开发者ID:NardoLoopa,项目名称:pykol,代码行数:39,代码来源:EatFoodRequest.py

示例8: parseResponse

# 需要导入模块: from kol.util import ParseResponseUtils [as 别名]
# 或者: from kol.util.ParseResponseUtils import parseSubstatsGainedLost [as 别名]
    def parseResponse(self):
        """
        Default response method for adventuring.
        """

        shouldNotBeHerePattern = PatternManager.getOrCompilePattern('userShouldNotBeHere')
        if shouldNotBeHerePattern.search(self.responseText):
            raise Error.Error("Unable to adventure. You should not be here.", Error.INVALID_LOCATION)

        url = self.response.geturl()
        if url.find("/fight.php") >= 0:
            # See if the user tried to perform an invalid action.
            twiddlingThumbsPattern = PatternManager.getOrCompilePattern('twiddlingThumbs')
            if twiddlingThumbsPattern.search(self.responseText):
                raise Error.Error("Could not perform action. Thumbs were twiddled.", Error.INVALID_ACTION)

            # Get the monster's name.
            self.responseData["adventureType"] = "combat"
            monsterNamePattern = PatternManager.getOrCompilePattern('monsterName')
            monsterNameMatch = monsterNamePattern.search(self.responseText)
            self.responseData["monsterName"] = monsterNameMatch.group(1)

            # Check to see if the fight was won or lost.
            fightWonPattern = PatternManager.getOrCompilePattern('fightWon')
            if fightWonPattern.search(self.responseText):
                self.responseData["fightWon"] = True
            else:
                fightLostPattern = PatternManager.getOrCompilePattern('fightLost')
                if fightLostPattern.search(self.responseText):
                    self.responseData["fightLost"] = True

            # Get items, meat, and substats gained. We always need to check these since they can
            # happen at any point during the fight.
            self.responseData["items"] = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
            self.responseData["meat"] = ParseResponseUtils.parseMeatGainedLost(self.responseText)
            self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)

            # The same goes for HP and MP
            self.responseData["hp"] = ParseResponseUtils.parseHPGainedLost(self.responseText)
            self.responseData["mp"] = ParseResponseUtils.parseMPGainedLost(self.responseText)

        elif url.find("/choice.php") >= 0:
            self.responseData["adventureType"] = "choice"
            choiceIdentifierPattern = PatternManager.getOrCompilePattern('choiceIdentifier')
            choiceIdentifierMatch = choiceIdentifierPattern.search(self.responseText)
            if choiceIdentifierMatch:
                choiceNamePattern = PatternManager.getOrCompilePattern('choiceName')
                self.responseData["choiceId"] = choiceIdentifierMatch.group(1)
                self.responseData["choiceName"] = choiceNamePattern.search(self.responseText).group(1)
            else:
                self.responseData["items"] = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
                self.responseData["meat"] = ParseResponseUtils.parseMeatGainedLost(self.responseText)
                self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)

        elif url.find("/adventure.php") >= 0:
            self.responseData["adventureType"] = "noncombat"
            noncombatNamePattern = PatternManager.getOrCompilePattern('noncombatName')
            noncombatNameMatch = noncombatNamePattern.search(self.responseText)
            if noncombatNameMatch:
                self.responseData["noncombatName"] = noncombatNameMatch.group(1)
            self.responseData["items"] = ParseResponseUtils.parseItemsReceived(self.responseText, self.session)
            self.responseData["meat"] = ParseResponseUtils.parseMeatGainedLost(self.responseText)
            self.responseData["substats"] = ParseResponseUtils.parseSubstatsGainedLost(self.responseText)
        else:
            raise Error.Error("Adventure URL not recognized: %s" % url, Error.REQUEST_GENERIC)
开发者ID:Alecat,项目名称:pykol,代码行数:67,代码来源:GenericAdventuringRequest.py


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