• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python makemenus.CraftItemAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: processnode

	def processnode(self, node, menu):
		global CLOTH
		if node.name == 'cloth':
			amount = hex2dec(node.getattribute('amount', '1'))
			if amount > 0:
				self.cloth = amount
		else:
			CraftItemAction.processnode(self, node, menu)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:8,代码来源:tailoring.py


示例2: processnode

	def processnode(self, node, menu):
		if node.name == 'needoven':
			self.needoven = True
		elif node.name == 'needheat':
			self.needheat = True
		elif node.name == 'water':
			self.water = True
		else:
			CraftItemAction.processnode(self, node, menu)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:cooking.py


示例3: __init__

	def __init__(self, parent):
		CraftItemAction.__init__(self, parent, tr('Runebook'), 0x22c5, '22c5')
		self.markable = True
		self.runes = 8
		
		# Add the other requirements
		self.materials.append([['1f60'], 1, tr('Gate Travel Scrolls')])
		self.materials.append([['1f4c'], 1, tr('Recall Scrolls')])
		self.skills[INSCRIPTION] = [450, 1250, 250]
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:inscription.py


示例4: __init__

 def __init__(self, parent, title, itemid, definition):
     CraftItemAction.__init__(self, parent, title, itemid, definition)
     self.needheat = False
     self.needoven = False
     self.water = False
     self.useallres = False
     self.flour = False
     self.flouramount = 0
     self.markable = 1  # All cooking items are markable, exceptions handled through <nomark /> tag
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:cooking.py


示例5: consumematerial

    def consumematerial(self, player, arguments, half=0):
        result = CraftItemAction.consumematerial(self, player, arguments, half)
        if not result:
            return False

        if self.flour:
            result = False
            content = player.getbackpack().content
            flours = []
            for item in content:
                if item.baseid in flour and item.hastag("quantity"):
                    flours.append(item)
            toconsume = self.flouramount
            while toconsume > 0:
                for flou in flours:
                    amount = consume(flou, toconsume)
                    toconsume -= amount
                    if toconsume == 0:
                        break  # break out of for loop

                        # Check if we have enough water in our backpack
        if self.water:
            content = player.getbackpack().content
            for item in content:
                if item.hasscript("beverage") and item.gettag("fluid") == "water" and item.hastag("quantity"):
                    if beverage.consume(item):
                        return True

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

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


示例6: make

	def make(self, player, arguments, nodelay=0, clothitem = None):
		global CLOTH

		# We have not been passed a cloth reference.
		# Try to statisfy it automatically
		if self.cloth > 0:
			if not clothitem:
				backpack = player.getbackpack()
				count = 0 # Valid piles of cloth
				for item in backpack.content:
					if item.baseid in CLOTH and item.amount >= self.cloth:
						clothitem = item
						count += 1
	
				# This makes the user select a pile of cloth
				if count > 1:
					player.socket.clilocmessage(502928) # Which material would you like to work ...
					player.socket.attachtarget('skills.tailoring.ClothSelectResponse', [self, arguments])
					return
				elif count < 1:
					player.socket.clilocmessage(1044456) # You don't have any ready cloth
					return

			# Pass the clothitem on to the next function as an argument
			if len(arguments) < 2:
				arguments.append(clothitem.serial)
			else:
				arguments[1] = clothitem.serial

		return CraftItemAction.make(self, player, arguments, nodelay)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:30,代码来源:tailoring.py


示例7: getmaterialshtml

	def getmaterialshtml(self, player, arguments):
		materialshtml = CraftItemAction.getmaterialshtml(self, player, arguments)
		
		if self.cloth > 0:
			materialshtml += "%s: %u<br>" % (tr('Cloth'), self.cloth)

		return materialshtml
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:tailoring.py


示例8: getmaterialshtml

	def getmaterialshtml(self, player, arguments):
		materialshtml = CraftItemAction.getmaterialshtml(self, player, arguments)
		
		if self.water:
			materialshtml += tr("Water: 1<br>")

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


示例9: getmaterialshtml

	def getmaterialshtml(self, player, arguments):
		materialshtml = CraftItemAction.getmaterialshtml(self, player, arguments)
		
		if self.runes > 0:
			materialshtml += "%s: %u<br>" % (tr('Unmarked Runes'), self.runes)

		return materialshtml
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:inscription.py


示例10: make

	def make(self, player, arguments, nodelay=0):
		assert(len(arguments) > 0, 'Arguments has to contain a tool reference.')

		if not checktool(player, wolfpack.finditem(arguments[0])):
			return False

		return CraftItemAction.make(self, player, arguments, nodelay)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:carpentry.py


示例11: consumematerial

	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.cloth > 0:			
			if half:
				needed = int(math.ceil(self.cloth / 2))
			else:
				needed = self.cloth
		
			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 < needed:
				player.socket.clilocmessage(1044287) # You don't have enough...
				return False

			# Replace the second argument with the color of the cloth
			arguments[1] = cloth.color

			if needed == cloth.amount:
				cloth.delete()
			else:
				cloth.amount -= needed
				cloth.update()

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


示例12: getmaterialshtml

    def getmaterialshtml(self, player, arguments):
        materialshtml = CraftItemAction.getmaterialshtml(self, player, arguments)

        if self.water:
            materialshtml += tr("Water: 1<br>")
        if self.flour:
            materialshtml += tr("Flour: %i<br>" % self.flouramount)

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


示例13: make

    def make(self, player, arguments, nodelay=0):
        if self.useallres:
            found = False
            for item in player.getbackpack().content:
                if item.baseid == self.materials[0][0][0]:
                    found = True
                    nodelay = True
                    # stop if making fails
                    if not CraftItemAction.make(self, player, arguments, nodelay):
                        break

            if not found:
                # we have no material, but call make method do display error message
                # and reopen the crafting dialog
                return CraftItemAction.make(self, player, arguments, nodelay)

        else:
            return CraftItemAction.make(self, player, arguments, nodelay)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:18,代码来源:cooking.py


示例14: processnode

    def processnode(self, node, menu):
        if node.name == "needoven":
            self.needoven = True
        elif node.name == "needheat":
            self.needheat = True
        elif node.name == "water":
            self.water = True
        elif node.name == "nomark":
            self.markable = 0
        elif node.name == "useallres":
            self.useallres = True
        elif node.name == "flour":
            amount = 1
            if node.hasattribute("amount"):
                amount = hex2dec(node.getattribute("amount", "1"))
            self.flour = True
            self.flouramount = amount

        else:
            CraftItemAction.processnode(self, node, menu)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:20,代码来源:cooking.py


示例15: make

	def make(self, player, arguments, nodelay=0):
		assert(len(arguments) > 0, 'Arguments has to contain a tool reference.')

		# Look for forge and anvil
		if not checkanvilandforge(player):
			player.socket.clilocmessage(1044267)
			return False

		if not checktool(player, wolfpack.finditem(arguments[0])):
			return False

		return CraftItemAction.make(self, player, arguments, nodelay)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:12,代码来源:blacksmithing.py


示例16: checkmaterial

	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,代码行数:14,代码来源:inscription.py


示例17: checkmaterial

    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,代码行数:49,代码来源:cooking.py


示例18: checkmaterial

	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,代码行数:15,代码来源:tailoring.py


示例19: consumematerial

	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		# Check if we have enough water in our backpack
		if result and self.water:
			content = player.getbackpack().content
			for item in content:
				if item.hasscript('beverage') and item.gettag('fluid') == 'water' and item.hastag('quantity'):
					if beverage.consume(item):
						return True
						
			player.socket.clilocmessage(1044253) # You don't have the components needed to make that.
			return False

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


示例20: consumematerial

	def consumematerial(self, player, arguments, half = 0):
		result = CraftItemAction.consumematerial(self, player, arguments, half)
		
		if result and self.mana > 0:			
			if half:
				needed = int(math.ceil(self.mana / 2))
			else:
				needed = self.mana

			if player.mana >= needed:
				player.mana -= needed
				player.updatemana()
			else:
				return False

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python makemenus.MakeMenu类代码示例发布时间:2022-05-27
下一篇:
Python event_manager.EventManager类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap