本文整理汇总了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
示例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
示例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
示例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