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


Python CraftItemAction.checkmaterial方法代码示例

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


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

示例1: checkmaterial

# 需要导入模块: from system.makemenus import CraftItemAction [as 别名]
# 或者: from system.makemenus.CraftItemAction import checkmaterial [as 别名]
	def checkmaterial(self, player, arguments, silent = 0):
		result = CraftItemAction.checkmaterial(self, player, arguments, silent)
		
		if result:
			# Check for mana
			if self.mana > 0 and player.mana < self.mana:
				player.socket.clilocmessage(1044380) # You don't have enough mana to inscribe that spell.
				return False
			
			# Check for availability of spell
			if self.spellid > 0 and not magic.utilities.hasSpell(player, self.spellid - 1, False):
				return False
		
		return result
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:16,代码来源:inscription.py

示例2: checkmaterial

# 需要导入模块: from system.makemenus import CraftItemAction [as 别名]
# 或者: from system.makemenus.CraftItemAction import checkmaterial [as 别名]
    def checkmaterial(self, player, arguments, silent=0):
        result = CraftItemAction.checkmaterial(self, player, arguments, silent)
        if not result:
            return False

        if self.flour:
            found = False
            backpack = player.getbackpack()
            amount = 0
            for item in backpack.content:
                if item.baseid in flour and item.hastag("quantity"):
                    quantity = int(item.gettag("quantity"))
                    if quantity > 0:
                        amount += quantity
                        found = True
            if not found:
                if not silent:
                    player.socket.clilocmessage(1044253)  # You don't have the components needed to make that.
                return False

            if amount < self.flouramount:
                player.socket.sysmessage(tr("You don't have enough material to make that."))
                return False

                # Check if we have enough water in our backpack
        if self.water:
            found = False  # Found at least one unit of water?
            backpack = player.getbackpack()
            for item in backpack.content:
                if item.hasscript("beverage") and item.gettag("fluid") == "water" and item.hastag("quantity"):
                    quantity = int(item.gettag("quantity"))
                    if quantity > 0:
                        found = True
                        break

            if not found:
                if not silent:
                    player.socket.clilocmessage(1044253)  # You don't have the components needed to make that.
                return False

        if self.needheat and not find(player, fires):
            player.socket.clilocmessage(1044487)  # You must be near a fire source to cook.
            return False

        if self.needoven and not find(player, ovens):
            player.socket.clilocmessage(1044493)  # You must be near an oven to bake that.
            return False

        return result
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:51,代码来源:cooking.py

示例3: checkmaterial

# 需要导入模块: from system.makemenus import CraftItemAction [as 别名]
# 或者: from system.makemenus.CraftItemAction import checkmaterial [as 别名]
	def checkmaterial(self, player, arguments, silent = 0):
		result = CraftItemAction.checkmaterial(self, player, arguments, silent)
		
		# Check for cloth
		if result and self.cloth > 0:
			assert(len(arguments) >= 2)
			cloth = wolfpack.finditem(arguments[1])
			if not player.canreach(cloth, -1):
				player.socket.clilocmessage(1044456) # You don't have any ready cloth...
				return False
			elif cloth.amount < self.cloth:
				player.socket.clilocmessage(1044287) # You don't have enough...
				return False
		
		return result
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:17,代码来源:tailoring.py

示例4: checkmaterial

# 需要导入模块: from system.makemenus import CraftItemAction [as 别名]
# 或者: from system.makemenus.CraftItemAction import checkmaterial [as 别名]
	def checkmaterial(self, player, arguments, silent = 0):
		result = CraftItemAction.checkmaterial(self, player, arguments, silent)
		
		# Check if we have enough water in our backpack
		if result and self.water:
			found = False # Found at laest one unit of water?
			backpack = player.getbackpack()
			for item in backpack.content:
				if item.hasscript('beverage') and item.gettag('fluid') == 'water' and item.hastag('quantity'):
					quantity = int(item.gettag('quantity'))
					if quantity > 0:
						found = True
						break
						
			if not found:
				if not silent:
					player.socket.clilocmessage(1044253) # You don't have the components needed to make that.
				return False

		return result
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:22,代码来源:cooking.py


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