本文整理汇总了Python中wolfpack.additem函数的典型用法代码示例。如果您正苦于以下问题:Python additem函数的具体用法?Python additem怎么用?Python additem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了additem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createItems
def createItems(self, vendor, player, item, amount = 1):
if amount <= 0:
return # Unable to comply
backpack = player.getbackpack()
# We will at the very least require one item,
# so create that one here.
bought = wolfpack.additem(self.baseid)
stackable = bought.canstack(bought) # Check if bought could stack with bought
if stackable:
bought.amount = amount
if not wolfpack.utilities.tobackpack(bought, player):
bought.update()
elif not stackable:
if not wolfpack.utilities.tobackpack(bought, player):
bought.update()
# Create amount - 1 items
for i in range(0, amount - 1):
bought = wolfpack.additem(self.baseid)
if not wolfpack.utilities.tobackpack(bought, player):
bought.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:buyitem.py
示例2: giveAmmo
def giveAmmo( char, item ):
# morex: Arrow count
# morey: Bolt count
boltCount = item.gettag( "bolt_count" )
arrowCount = item.gettag( "arrow_count" )
if not boltCount and not arrowCount:
char.message( tr("The butte is empty.") )
return True
if arrowCount:
if arrowCount > 1:
arrow = wolfpack.additem( "f3f" )
arrow.container = char.getbackpack()
arrow.amount = arrowCount
arrow.update()
if boltCount:
if boltCount > 1:
bolt = wolfpack.additem( "1bfb" )
bolt.container = char.getbackpack()
bolt.amount = boltCount
bolt.update()
#You gather the arrows and bolts.
char.socket.clilocmessage(500592)
# Reset the counters
item.settag( "arrow_count", 0 )
item.settag( "bolt_count", 0 )
return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:archery_butte.py
示例3: createpack
def createpack(char, killer, corpse, pack):
# A pack is actually a list of lists
for item in pack:
packchance = item[ PACK_CHANCE ]
packstackable = item[ PACK_STACKABLE ]
packamount = item[ PACK_AMOUNT ]
packitem = item[ PACK_ITEM ]
if packchance >= random.random():
if type( packamount ) == str:
amount = utilities.rolldice( packamount )
else:
amount = int( packamount )
if packstackable == True:
if type( packitem ) == list:
itemid = random.choice( packitem )
elif type( packitem ) == str:
itemid = str( packitem )
item = wolfpack.additem( itemid )
item.amount = amount
dropitem(item, char, corpse)
else:
for i in range(0, amount):
if type( packitem ) == list:
itemid = random.choice( packitem )
elif type( packitem ) == str:
itemid = str( packitem )
item = wolfpack.additem(itemid)
dropitem(item, char, corpse)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:34,代码来源:loot.py
示例4: sextant_parts
def sextant_parts( char, item ):
if not char.checkskill( TINKERING, 0, 500 ):
if random.randint( 1, 100 ) <= 25:
additional = localemsg( 15 )
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
else:
additional = localemsg( 16 )
char.message( "%s%s" % ( localemsg( 14 ), additional ) )
else:
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
if item.id == 0x1059:
item = wolfpack.additem( '1057' )
else:
item = wolfpack.additem( '1058' )
char.getbackpack().additem( item, 1, 1, 0 )
item.update()
char.message( localemsg( 17 ) )
return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:environment.py
示例5: JarHoney
def JarHoney(char, args, target):
honey = wolfpack.finditem(args[0])
if not honey or not target.item:
return False
if not target.item.getoutmostchar() == char:
char.socket.clilocmessage(1042001) # That must be in your pack for you to use it.
return True
backpack = char.getbackpack()
# Dough
if target.item.baseid == "103d":
sweet_dough = wolfpack.additem("sweet_dough")
if not tobackpack(sweet_dough, char):
sweet_dough.update()
# Bowl Flour
elif target.item.baseid == "a1e":
cookie_mix = wolfpack.additem("103f")
if not tobackpack(cookie_mix, char):
cookie_mix.update()
else:
return False
if honey.amount > 1:
honey.amount = honey.amount - 1
honey.update()
else:
honey.delete()
target.item.delete()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:30,代码来源:cooking.py
示例6: incognito_expire
def incognito_expire(char, arguments):
if not char.incognito or char.polymorph:
return
(oldhair, oldhaircolor, oldfacial, oldfacialcolor) = arguments
hair = char.itemonlayer(LAYER_HAIR)
if hair:
hair.delete()
if len(oldhair) != 0:
hair = wolfpack.additem(oldhair)
hair.color = oldhaircolor
char.additem(LAYER_HAIR, hair)
hair.update()
facial = char.itemonlayer(LAYER_BEARD)
if facial:
facial.delete()
if len(oldfacial) != 0:
facial = wolfpack.additem(oldfacial)
facial.color = oldfacialcolor
char.additem(LAYER_BEARD, facial)
facial.update()
char.name = char.orgname
char.skin = char.orgskin
char.id = char.orgid
char.incognito = 0
char.resendtooltip()
char.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:33,代码来源:circle5.py
示例7: SackFlourOpen
def SackFlourOpen(char, args, target):
item = wolfpack.finditem(args[0])
if not item or not target.item:
return False
if not target.item.getoutmostchar() == char:
char.socket.clilocmessage(1042001) # That must be in your pack for you to use it.
return True
backpack = char.getbackpack()
# wooden bowl
if target.item.baseid == "15f8":
bowl_flour = wolfpack.additem("a1e")
if not tobackpack(bowl_flour, char):
bowl_flour.update()
# tribal berry
elif target.item.baseid == "tribal_berry":
if char.skill[COOKING] >= 800:
tribal_paint = wolfpack.additem("tribal_paint")
if not tobackpack(tribal_paint, char):
tribal_paint.update()
char.socket.clilocmessage(
1042002
) # You combine the berry and the flour into the tribal paint worn by the savages.
else:
char.socket.clilocmessage(1042003) # You don't have the cooking skill to create the body paint.
else:
return False
target.item.delete()
consume(item)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:cooking.py
示例8: sextant_parts
def sextant_parts( char, item ):
if not char.checkskill( TINKERING, 0, 500 ):
if random.randint( 1, 100 ) <= 25:
additional = tr(" and break the parts.")
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
else:
additional = "."
char.message( "%s%s" % ( tr("You fail to create the sextant"), additional ) )
else:
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
if item.id == 0x1059:
item = wolfpack.additem( '1057' )
else:
item = wolfpack.additem( '1058' )
char.getbackpack().additem( item, 1, 1, 0 )
item.update()
char.message( tr("You put the sextant into your backpack") )
return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:environment.py
示例9: create_leaves
def create_leaves(serial, fruittype="apple"):
object = wolfpack.finditem(serial)
# Lets figure out what kind of leaves we need
if object.id == 0xD94:
leaves = wolfpack.additem("d95")
elif object.id == 0xD98:
leaves = wolfpack.additem("d99")
if leaves:
object.settag("leaf_serial", leaves.serial)
leaves = None
leaves = wolfpack.finditem(object.gettag("leaf_serial"))
leaves.pos = "%i,%i,%i,%i" % (object.pos.x, object.pos.y, object.pos.z, object.pos.map)
if leaves.pos != object.pos:
leaves.moveto(object.pos)
# leaves.visible = 0
object.update()
# 2 - 15 minutes
leaves.addtimer(int(60000 * random.randint(2, 15)), leaves_progress, [])
leaves.update()
leaves.settag("fruit_count", 0)
leaves.settag("fruit_type", str(fruittype))
leaves.settag("stage", 0)
return True
else:
object.update()
return False
开发者ID:BackupTheBerlios,项目名称:rayonnant-shard-svn,代码行数:27,代码来源:trees.py
示例10: water
def water(char, args, target):
item = wolfpack.finditem( args[0] )
cprops = args[1]
quantity = args[2]
if not item:
return False
if target.char and target.char == char:
return drink(char, item)
# Bowl Flour -> make dough
elif target.item:
if target.item.baseid == 'a1e':
if not target.item.getoutmostchar() == char:
char.socket.clilocmessage( 1042001 ) # That must be in your pack for you to use it.
return True
dough = wolfpack.additem( "103d" )
if not tobackpack( dough, char ):
dough.update()
wooden_bowl = wolfpack.additem( "15f8" )
if not tobackpack( wooden_bowl, char ):
wooden_bowl.update()
target.item.delete()
consume(item)
elif quantity < cprops[1]:
fillfromitem( target, item, cprops )
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:beverage.py
示例11: createKeys
def createKeys( plank1, plank2, hold, boat, player ):
rkeyid = createkeysecret()
packkey = wolfpack.additem('1010')
packkey.settag('lock', rkeyid)
packkey.name = "a ship key"
packkey.settag('recall.link', boat.serial)
tobackpack( packkey, player )
packkey.update()
player.say( 502485, socket = player.socket ) # A ship's key is now in my backpack.
bankkey = wolfpack.additem('1010')
bankkey.settag('lock', rkeyid)
bankkey.name = "a ship key"
bankkey.settag('recall.link', boat.serial)
tobankbox( bankkey, player )
player.say( 502484, socket = player.socket ) # A ship's key is now in my safety deposit box.
# Plank Section
plank1.settag('lock', rkeyid)
plank1.addscript( 'lock' )
plank1.settag('locked',1)
plank2.settag('lock', rkeyid)
plank2.addscript( 'lock' )
plank2.settag('locked',1)
# Hold Section
hold.settag('lock', rkeyid)
hold.addscript( 'lock' )
hold.settag('locked',1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:26,代码来源:deed.py
示例12: foundation
def foundation( char, target, width, height, multiid ):
multi = wolfpack.multi( CUSTOMHOUSE )
char.socket.sysmessage( str( multi.serial ) )
multi.id = multiid + 0x4000
multi.decay = FALSE
multi.moveto( target.pos )
left = width/2
right = left - ( width-1 )
bottom = height/2
top = bottom - ( height-1 )
#Draw floor
for y in xrange( top+1,bottom+1 ):
for x in xrange( right+1,left+1 ):
if x == 0 and y == 0:
multi.addchtile( 0x1, 0, 0, 0 )
multi.addchtile( 0x31f4, x, y, 7 )
#Draw corners
multi.addchtile( 0x66, right, top, 0 )
multi.addchtile( 0x65, left, bottom, 0 )
#Draw sides
for x in xrange( right+1,left+1 ):
multi.addchtile( 0x63, x, top, 0 )
if x < left:
multi.addchtile( 0x63, x, bottom, 0 )
for y in xrange( top+1, bottom+1 ):
multi.addchtile( 0x64, right, y, 0 )
multi.addchtile( 0x64, left, y, 0 )
#Draw stairs
for x in xrange( right+1,left+1 ):
multi.addchtile( 0x0751, x, bottom+1, 0 )
multi.sendcustomhouse( char )
#woodenpost = wolfpack.additem( "9" )
signpost = wolfpack.additem( "b98" )
sign = wolfpack.additem( "bd2" )
#woodenpost.decay = FALSE
signpost.decay = FALSE
sign.decay = FALSE
x = multi.pos.x + right
y = multi.pos.y + bottom
z = multi.pos.z + 7
map = multi.pos.map
newpos = wolfpack.coord( x, y, z, map )
#woodenpost.moveto( newpos )
newpos.y += 1
signpost.moveto( newpos )
sign.moveto( newpos )
sign.settag( 'house', multi.serial )
sign.addscript( 'signpost' )
#woodenpost.update()
signpost.update()
sign.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:59,代码来源:multideed.py
示例13: buildHouse
def buildHouse(house, definition):
node = wolfpack.getdefinition(WPDT_MULTI, definition)
if not node:
return
if node.hasattribute('inherit'):
value = str(node.getattribute('inherit'))
buildHouse(house, value) # Recursion
for i in range(0, node.childcount):
child = node.getchild(i)
# Inherit another definition
if child.name == 'inherit':
if child.hasattribute('id'):
buildHouse(house, child.getattribute('id'))
else:
buildHouse(house, child.value)
# Add a normal item to the house
elif child.name == 'item':
x = int(child.getattribute('x', '0'))
y = int(child.getattribute('y', '0'))
z = int(child.getattribute('z', '0'))
id = str(child.getattribute('id', ''))
item = wolfpack.additem(id)
item.moveto(house.pos.x + x, house.pos.y + y, house.pos.z + z, house.pos.map)
item.update()
# Add a house door to the house
elif child.name == 'door':
x = int(child.getattribute('x', '0'))
y = int(child.getattribute('y', '0'))
z = int(child.getattribute('z', '0'))
id = hex2dec(child.getattribute('id', ''))
item = wolfpack.additem('housedoor')
item.id = id
item.moveto(house.pos.x + x, house.pos.y + y, house.pos.z + z, house.pos.map)
item.update()
# Add a sign to the house
elif child.name == 'sign':
x = int(child.getattribute('x', '0'))
y = int(child.getattribute('y', '0'))
z = int(child.getattribute('z', '0'))
sign = wolfpack.additem('housesign')
if child.hasattribute('id'):
sign.id = hex2dec(child.getattribute('id', ''))
sign.moveto(house.pos.x + x, house.pos.y + y, house.pos.z + z, house.pos.map)
sign.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:54,代码来源:house.py
示例14: response
def response( char, args, target ):
direction = char.directionto( target.pos )
if char.direction != direction:
char.direction = direction
char.update()
item = wolfpack.finditem( args[0] ) # What we want to cook
id = item.id
if not item or item.getoutmostchar() != char:
char.socket.clilocmessage( 0x7ACA2 ) # That belongs to someone else.
return 1
# Are we too far away from the target ?
if ( ( char.pos.x-target.pos.x )**2 + ( char.pos.y-target.pos.y )**2 > 4):
char.socket.clilocmessage( 0x7A247 ) # You are too far away to do that.
return 1
if abs( char.pos.z - target.pos.z ) > 5:
char.socket.clilocmessage( 0x7A247 ) # You are too far away to do that.
return 1
# We can only cook on dynamic ovens/fireplaces
if not target.item or not target.item.id in ids_heat:
char.socket.clilocmessage( 0x7A3D2 ) # You can't cook on that.
return 1
# We're cooking one by one
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
# Succeess ?
if char.checkskill( COOKING, 0, 1000 ):
item = wolfpack.additem( ids[ id ][0] )
if not wolfpack.utilities.tobackpack( item, char ):
item.update()
char.socket.clilocmessage( random.choice( [ 0x7A3CF, 0x7A3D0 ] ) ) # Either "Looks delicious." or "Mmmm, smells good."
char.socket.clilocmessage( 0x7A3D1 ) # You put the cooked food into your backpack.
else:
burned_id = ids[ id ][1]
if burned_id != "":
burned = wolfpack.additem( burned_id )
if not wolfpack.utilities.tobackpack( burned, char ):
burned.update()
char.socket.clilocmessage( 0x7A3CE ) # You burn the food to a crisp! It's ruined.
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:53,代码来源:cooking.py
示例15: carve_corpse
def carve_corpse( char, corpse ):
if corpse.container:
char.socket.sysmessage( "You can't carve corpses in a container" )
return
if not char.canreach(corpse, 3):
char.socket.clilocmessage( 0x7A258, "", 0x3b2, 3, corpse ) # You cannot reach that
return
# Human Bodies can always be carved
if corpse.bodyid == 0x190 or corpse.bodyid == 0x191:
char.message( "You can't carve a human body right now" )
return
# Not carvable or already carved
try:
charbase = wolfpack.charbase(corpse.charbaseid)
carve = charbase['carve']
except:
char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
return
if corpse.hastag('carved') or carve == '':
char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
return
# Create all items in the carve list
carve = wolfpack.list(str(carve))
for id in carve:
amount = 1
# Is amount contained in it ?
if id.find( "," ) != -1:
parts = id.split( "," )
id = parts[0]
amount = int( parts[1] )
item = wolfpack.additem( id )
item.amount = amount
if not utilities.tocontainer( item, corpse ):
item.update()
# Create Random Blood
bloodid = whrandom.choice( blood )
blooditem = wolfpack.additem( bloodid )
blooditem.moveto( corpse.pos )
blooditem.decay = 1
blooditem.update()
char.socket.clilocmessage( 0x7A2F3, "", 0x3b2, 3, corpse ) # You carve away some meat which remains on the corpse
corpse.settag('carved', 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:51,代码来源:blades.py
示例16: carve_hides
def carve_hides( char, corpse, tool, hides_type, hides ):
if hides_type == 'spined':
item = wolfpack.additem('spined_leather_hides')
elif hides_type == 'horned':
item = wolfpack.additem('horned_leather_hides')
elif hides_type == 'barbed':
item = wolfpack.additem('barbed_leather_hides')
else:
item = wolfpack.additem('leather_hides')
item.amount = hides
if not wolfpack.utilities.tocontainer(item, corpse):
item.update()
char.socket.clilocmessage( 500471, "", 0x3b2, 3 ) # You skin it, and the hides are now in the corpse.
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:14,代码来源:blades.py
示例17: carve_meat
def carve_meat( char, corpse, tool, meat_type, meat ):
if meat_type == 'bird':
item = wolfpack.additem('9b9') # Raw Bird
elif meat_type == 'lambleg':
item = wolfpack.additem('1609') # Raw Lamb Leg
elif meat_type == 'fishsteak':
item = wolfpack.additem('97a') # Raw Fish Steak
else:
item = wolfpack.additem('9f1') # Raw Ribs
item.amount = meat
if not wolfpack.utilities.tocontainer(item, corpse):
item.update()
char.socket.clilocmessage( 500467, "", 0x3b2, 3 ) # You carve some meat, which remains on the corpse.
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:14,代码来源:blades.py
示例18: successmining
def successmining(char, gem, resname, size):
if not char:
return False
if skills.skilltable[MINING][skills.UNHIDE] and char.hidden:
char.removefromview()
char.hidden = False
char.update()
# Create the ore and put it into the players backpack
if size == 1:
item = wolfpack.additem("19b7")
elif size == 2:
item = wolfpack.additem(random.choice(["19b8", "19ba"]))
elif size == 3:
item = wolfpack.additem("19b9")
else:
raise RuntimeException, "Invalid ore size: %u" % size
item.settag("resname", resname)
item.color = ORES[resname][COLORID]
if FELUCIA2XRESGAIN and char.pos.map == 0:
item.amount = 2
else:
item.amount = 1
if not tobackpack(item, char):
item.update()
# Resend weight
char.socket.resendstatus()
resourcecount = max(1, int(gem.gettag("resourcecount")))
gem.settag("resourcecount", resourcecount - 1)
# Start respawning the ore
if not gem.hastag("resource_empty") and resourcecount <= 1:
delay = random.randint(MINING_REFILLTIME[0], MINING_REFILLTIME[1])
gem.addtimer(delay, "skills.mining.respawnvein", [], True)
gem.settag("resource_empty", 1)
message = ORES[resname][SUCCESSMESSAGE]
# You dig some %s and put it in your backpack.
if type(message) == int:
char.socket.clilocmessage(message, "", GRAY)
else:
char.socket.sysmessage(unicode(message))
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:49,代码来源:mining.py
示例19: createkey
def createkey(char, id):
keys = ['100e', '100f', '1010', '1013']
key = wolfpack.additem(random.choice(keys))
key.settag('lock', id)
key.container = char.getbackpack()
key.update()
char.socket.sysmessage('A key has been added to your backpack.')
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:lock.py
示例20: polymorph_expire
def polymorph_expire(char, arguments):
# Remove all timers from this char
char.dispel(None, True, 'POLYMORPH_EXPIRE')
# Hidden beard?
if char.hastag('polymorph_beard_id'):
current = char.itemonlayer(LAYER_BEARD)
if current:
current.delete()
newid = char.gettag('polymorph_beard_id')
color = 0
if char.hastag('polymorph_beard_color'):
color = int(char.gettag('polymorph_beard_color'))
item = wolfpack.additem(newid)
item.color = color
char.additem(LAYER_BEARD, item)
item.update()
char.deltag('polymorph_beard_id')
char.deltag('polymorph_beard_color')
char.id = char.orgid
char.skin = char.orgskin
char.polymorph = 0
char.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:26,代码来源:circle7.py
注:本文中的wolfpack.additem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论