本文整理汇总了Python中system.makemenus.CraftItemAction类的典型用法代码示例。如果您正苦于以下问题:Python CraftItemAction类的具体用法?Python CraftItemAction怎么用?Python CraftItemAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CraftItemAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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]
示例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
示例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
示例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)
示例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
示例8: getmaterialshtml
def getmaterialshtml(self, player, arguments):
materialshtml = CraftItemAction.getmaterialshtml(self, player, arguments)
if self.water:
materialshtml += tr("Water: 1<br>")
return materialshtml
示例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
示例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)
示例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
示例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
示例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)
示例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)
示例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)