Example #1
0
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)
Example #2
0
def carve_corpse( char, tool, corpse ):
	if corpse.container:
		char.socket.sysmessage( tr("You can't carve corpses in a container") )
		return

	if not char.canreach(corpse, 3):
		char.socket.clilocmessage( 500312, "", 0x3b2, 3, corpse ) # You cannot reach that
		return

	# Human Bodies can always be carved
	if corpse.bodyid in PLAYER_BODIES_ALIVE:
		if corpse.hastag('carved') or not corpse.owner:
			char.socket.clilocmessage(500485) # You see nothing useful to carve from the corpse.
		else:	
			ITEMS = ['1d9f', '1da4', '1da2', '1da3', '1da1'] # Components of the carved body
			for item in ITEMS:
				item = wolfpack.additem(item)
				item.moveto(corpse.pos)
				item.decay = True # Make sure they decay
				item.movable = 1 # Make sure they are movable
				item.update()

			# Blood should not be movable
			blooditem = wolfpack.additem('122d')
			blooditem.moveto(corpse.pos)
			blooditem.decay = True
			blooditem.movable = 3
			blooditem.update()

			# Add the head
			head = wolfpack.additem('1da0')
			head.moveto(corpse.pos)
			head.decay = True
			head.movable = 3
			head.name = tr("the head of %s") % (corpse.owner.orgname)
			head.update()

			# Turn the corpse into a pile of bones
			corpse.removefromview()
			corpse.movable = 3 # The corpse is not movable
			corpse.id = random.randrange(0xeca, 0xed3)
			corpse.color = 0
			corpse.update()
		return

	# Not carvable or already carved
	if corpse.hastag('carved'):
		char.socket.clilocmessage( 500485, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	basedef = wolfpack.charbase(corpse.charbaseid)

	if not basedef:
		char.socket.clilocmessage( 500485, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	feathers = basedef.getintproperty('carve_feathers', 0)
	wool = basedef.getintproperty('carve_wool', 0)
	hides = basedef.getintproperty('carve_hides', 0)
	hides_type = basedef.getstrproperty('carve_hides_type', 'leather')
	scales = basedef.getintproperty('carve_scales', 0)
	scales_type = basedef.getstrproperty('carve_scales_type', 'red')
	meat = basedef.getintproperty('carve_meat', 0)
	meat_type = basedef.getstrproperty('carve_meat_type', 'ribs')

	if feathers == 0 and wool == 0 and hides == 0 and scales == 0 and meat == 0:
		char.socket.clilocmessage( 500485, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	# See if the corpse has blood
	bloodcolor = basedef.getintproperty('bloodcolor', 0)

	if bloodcolor != -1:
		try:
			if basedef.hasstrproperty('bloodcolor'):
				(minv, maxv) = basedef.getstrproperty('bloodcolor', '0,0').split(',')
				bloodcolor = random.randint(int(minv), int(maxv))
		except:
			pass

		# Create Random Blood
		bloodid = random.choice( blood )
		blooditem = wolfpack.additem( bloodid )
		blooditem.color = bloodcolor
		blooditem.decay = True
		blooditem.moveto( corpse.pos )
		blooditem.update()

	# Mark the corpse as carved
	corpse.settag('carved', 1)

	# Feathers
	if feathers != 0:
		carve_feathers( char, corpse, tool, feathers )

	# Wool
	if wool != 0:
		carve_wool( char, corpse, tool, wool )

	# Meat
	if meat != 0:
		carve_meat( char, corpse, tool, meat_type, meat )

	# Hides
	if hides != 0:
		carve_hides( char, corpse, tool, hides_type, hides )

	# Scales
	if scales != 0:
		carve_scales( char, corpse, tool, scales_type, scales )
Example #3
0
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
    if corpse.hastag("carved"):
        char.socket.clilocmessage(0x7A305, "", 0x3B2, 3, corpse)  # You see nothing useful to carve..
        return

    basedef = wolfpack.charbase(corpse.charbaseid)

    if not basedef:
        char.socket.clilocmessage(0x7A305, "", 0x3B2, 3, corpse)  # You see nothing useful to carve..

    feathers = basedef.getintproperty("carve_feathers", 0)
    wool = basedef.getintproperty("carve_wool", 0)
    hides = basedef.getintproperty("carve_hides", 0)
    hides_type = basedef.getstrproperty("carve_hides_type", "leather")
    scales = basedef.getintproperty("carve_scales", 0)
    scales_type = basedef.getstrproperty("carve_scales_type", "red")
    meat = basedef.getintproperty("carve_meat", 0)
    meat_type = basedef.getstrproperty("carve_meat_type", "ribs")

    if feathers == 0 and wool == 0 and hides == 0 and scales == 0 and meat == 0:
        char.socket.clilocmessage(0x7A305, "", 0x3B2, 3, corpse)  # You see nothing useful to carve..
        return

        # Create Random Blood
    bloodid = random.choice(blood)
    blooditem = wolfpack.additem(bloodid)
    blooditem.moveto(corpse.pos)
    blooditem.decay = 1
    blooditem.update()

    # Mark the corpse as carved
    corpse.settag("carved", 1)

    # Feathers
    if feathers != 0:
        item = wolfpack.additem("1bd1")
        item.amount = feathers
        if not wolfpack.utilities.tocontainer(item, corpse):
            item.update()

        char.socket.clilocmessage(500479, "", 0x3B2, 3)

        # Wool
    if wool != 0:
        item = wolfpack.additem("df8")
        item.amount = wool
        if not wolfpack.utilities.tocontainer(item, corpse):
            item.update()

        char.socket.clilocmessage(500483, "", 0x3B2, 3)

        # Meat
    if meat != 0:
        if meat_type == "bird":
            item = wolfpack.additem("9b9")  # Raw Bird
        elif meat_type == "lambleg":
            item = wolfpack.additem("1609")  # Raw Lamb Leg
        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)

        # Hides
    if hides != 0:
        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)

        # Scales
    if scales != 0:
        # Random scales type
        if "," in scales_type:
            scales_type = random.choice(scales_type.split(","))

        items = []
        if scales_type in ["blue", "all"]:
            items.append(wolfpack.additem("blue_scales"))
        if scales_type in ["green", "all"]:
            items.append(wolfpack.additem("green_scales"))
        if scales_type in ["yellow", "all"]:
            items.append(wolfpack.additem("yellow_scales"))
        if scales_type in ["black", "all"]:
            items.append(wolfpack.additem("black_scales"))
        if scales_type in ["white", "all"]:
            items.append(wolfpack.additem("white_scales"))
        if scales_type in ["red", "all"]:
            items.append(wolfpack.additem("red_scales"))

        for item in items:
            item.amount = scales
            if not wolfpack.utilities.tocontainer(item, corpse):
                item.update()

        char.socket.sysmessage("You cut away some scales, but they remain on the corpse.")
Example #4
0
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:
		if corpse.hastag('carved') or not corpse.owner:
			char.socket.clilocmessage(500485) # You see nothing useful to carve from the corpse.
		else:	
			ITEMS = ['122d', '1d9f', '1da4', '1da2', '1da3', '1da1'] # Components of the carved body
			for item in ITEMS:
				item = wolfpack.additem(item)
				item.moveto(corpse.pos)
				item.decay = True # Make sure they decay
				item.movable = 1 # Make sure they are movable
				item.update()
				
			# Add the head
			head = wolfpack.additem('1da0')
			head.moveto(corpse.pos)
			head.decay = True
			head.movable = 3
			head.name = tr("the head of %s") % (corpse.owner.orgname)
			head.update()
			
			# Turn the corpse into a pile of bones
			corpse.removefromview()
			corpse.movable = 3 # The corpse is not movable
			corpse.id = random.randrange(0xeca, 0xed3)
			corpse.color = 0
			corpse.update()
		return

	# Not carvable or already carved
	if corpse.hastag('carved'):
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return
	
	basedef = wolfpack.charbase(corpse.charbaseid)
	
	if not basedef:
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	feathers = basedef.getintproperty('carve_feathers', 0)
	wool = basedef.getintproperty('carve_wool', 0)
	hides = basedef.getintproperty('carve_hides', 0)
	hides_type = basedef.getstrproperty('carve_hides_type', 'leather')
	scales = basedef.getintproperty('carve_scales', 0)
	scales_type = basedef.getstrproperty('carve_scales_type', 'red')
	meat = basedef.getintproperty('carve_meat', 0)
	meat_type = basedef.getstrproperty('carve_meat_type', 'ribs')
		
	if feathers == 0 and wool == 0 and hides == 0 and scales == 0 and meat == 0:
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	# See if the corpse has blood
	bloodcolor = basedef.getintproperty('bloodcolor', 0)
	
	if bloodcolor != -1:
		try:
			if basedef.hasstrproperty('bloodcolor'):
				(minv, maxv) = basedef.getstrproperty('bloodcolor', '0,0').split(',')
				bloodcolor = random.randint(int(minv), int(maxv))
		except:
			pass

		# Create Random Blood
		bloodid = random.choice( blood )
		blooditem = wolfpack.additem( bloodid )
		blooditem.color = bloodcolor
		blooditem.decay = True
		blooditem.moveto( corpse.pos )
		blooditem.update()

	# Mark the corpse as carved
	corpse.settag('carved', 1)
	
	# Feathers
	if feathers != 0:
		item = wolfpack.additem('1bd1')
		item.amount = feathers
		if not wolfpack.utilities.tocontainer(item, corpse):
			item.update()
			
		char.socket.clilocmessage( 500479, "", 0x3b2, 3 )
		
	# Wool
	if wool != 0:
		item = wolfpack.additem('df8')
		item.amount = wool
		if not wolfpack.utilities.tocontainer(item, corpse):
			item.update()
			
		char.socket.clilocmessage( 500483, "", 0x3b2, 3 )
		
	# Meat
	if meat != 0:
		if meat_type == 'bird':			
			item = wolfpack.additem('9b9') # Raw Bird
		elif meat_type == 'lambleg':
			item = wolfpack.additem('1609') # Raw Lamb Leg
		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 )
		
	# Hides
	if hides != 0:
		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 )
		
	# Scales
	if scales != 0:
		# Random scales type
		if ',' in scales_type:
			scales_type = random.choice(scales_type.split(','))
	
		items = []
		if scales_type in ['blue', 'all']:
			items.append(wolfpack.additem('blue_scales'))
		if scales_type in ['green', 'all']:
			items.append(wolfpack.additem('green_scales'))
		if scales_type in ['yellow', 'all']:
			items.append(wolfpack.additem('yellow_scales'))
		if scales_type in ['black', 'all']:
			items.append(wolfpack.additem('black_scales'))
		if scales_type in ['white', 'all']:
			items.append(wolfpack.additem('white_scales'))
		if scales_type in ['red', 'all']:
			items.append(wolfpack.additem('red_scales'))
			
		for item in items:
			item.amount = scales
			if not wolfpack.utilities.tocontainer(item, corpse):
				item.update()
				
		char.socket.sysmessage("You cut away some scales, but they remain on the corpse.")
Example #5
0
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
	if corpse.hastag('carved'):
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return
	
	basedef = wolfpack.charbase(corpse.charbaseid)
	
	if not basedef:
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	feathers = basedef.getintproperty('carve_feathers', 0)
	wool = basedef.getintproperty('carve_wool', 0)
	hides = basedef.getintproperty('carve_hides', 0)
	hides_type = basedef.getstrproperty('carve_hides_type', 'leather')
	scales = basedef.getintproperty('carve_scales', 0)
	scales_type = basedef.getstrproperty('carve_scales_type', 'red')
	meat = basedef.getintproperty('carve_meat', 0)
	meat_type = basedef.getstrproperty('carve_meat_type', 'ribs')
		
	if feathers == 0 and wool == 0 and hides == 0 and scales == 0 and meat == 0:
		char.socket.clilocmessage( 0x7A305, "", 0x3b2, 3, corpse ) # You see nothing useful to carve..
		return

	# See if the corpse has blood
	bloodcolor = basedef.getintproperty('bloodcolor', 0)
	
	if bloodcolor != -1:
		try:
			if basedef.hasstrproperty('bloodcolor'):
				(minv, maxv) = basedef.getstrproperty('bloodcolor', '0,0').split(',')
				bloodcolor = random.randint(int(minv), int(maxv))
		except:
			pass

		# Create Random Blood
		bloodid = random.choice( blood )
		blooditem = wolfpack.additem( bloodid )
		blooditem.color = bloodcolor
		blooditem.decay = True
		blooditem.moveto( corpse.pos )
		blooditem.update()

	# Mark the corpse as carved
	corpse.settag('carved', 1)
	
	# Feathers
	if feathers != 0:
		item = wolfpack.additem('1bd1')
		item.amount = feathers
		if not wolfpack.utilities.tocontainer(item, corpse):
			item.update()
			
		char.socket.clilocmessage( 500479, "", 0x3b2, 3 )
		
	# Wool
	if wool != 0:
		item = wolfpack.additem('df8')
		item.amount = wool
		if not wolfpack.utilities.tocontainer(item, corpse):
			item.update()
			
		char.socket.clilocmessage( 500483, "", 0x3b2, 3 )
		
	# Meat
	if meat != 0:
		if meat_type == 'bird':			
			item = wolfpack.additem('9b9') # Raw Bird
		elif meat_type == 'lambleg':
			item = wolfpack.additem('1609') # Raw Lamb Leg
		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 )
		
	# Hides
	if hides != 0:
		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 )
		
	# Scales
	if scales != 0:
		# Random scales type
		if ',' in scales_type:
			scales_type = random.choice(scales_type.split(','))
	
		items = []
		if scales_type in ['blue', 'all']:
			items.append(wolfpack.additem('blue_scales'))
		if scales_type in ['green', 'all']:
			items.append(wolfpack.additem('green_scales'))
		if scales_type in ['yellow', 'all']:
			items.append(wolfpack.additem('yellow_scales'))
		if scales_type in ['black', 'all']:
			items.append(wolfpack.additem('black_scales'))
		if scales_type in ['white', 'all']:
			items.append(wolfpack.additem('white_scales'))
		if scales_type in ['red', 'all']:
			items.append(wolfpack.additem('red_scales'))
			
		for item in items:
			item.amount = scales
			if not wolfpack.utilities.tocontainer(item, corpse):
				item.update()
				
		char.socket.sysmessage("You cut away some scales, but they remain on the corpse.")