Esempio n. 1
0
def dropitem(item, char, container):
    item.decay = True  # Make SURE the item decays
    item.movable = 1  # Also make sure the item is movable

    console.log(
        LOG_MESSAGE, "Dropped item 0x%x (%s, %u) for npc 0x%x.\n" %
        (item.serial, item.baseid, item.amount, char.serial))

    if container:
        if not utilities.tocontainer(item, container):
            item.update()
    else:
        items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
        for stackable in items:
            if stackable.pos.z == item.pos.z:
                if item.canstack(stackable):
                    # We can completely stack the item
                    if stackable.amount + item.amount <= 65535:
                        stackable.amount += item.amount
                        stackable.update()
                        item.delete()
                        return

        item.moveto(char.pos)
        item.update()
Esempio n. 2
0
def cut_fish( char, item ):
	item_new = wolfpack.additem( "97a" )
	if item.baseid == "big_fish":
		item_new.amount = random.randint(16, item.gettag('animalweight')/4)
	else:
		item_new.amount = item.amount * 2
	if not utilities.tocontainer( item_new, char.getbackpack() ):
		item_new.update()
	item.delete()
Esempio n. 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
	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)
Esempio n. 4
0
def dropitem(item, char, container):
	if container:
		if not utilities.tocontainer(item, container):
			item.update()
	else:
		items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
		for stackable in items:
			if stackable.pos.z == item.pos.z:
				if item.canstack(stackable):
					# We can completely stack the item
					if stackable.amount + item.amount <= 65535:
						stackable.amount += item.amount
						stackable.update()
						item.delete()
						return

		item.moveto(char.pos)
		item.update()
Esempio n. 5
0
def dropitem(item, char, container):	
	item.decay = True # Make SURE the item decays
	item.movable = 1 # Also make sure the item is movable

	console.log(LOG_MESSAGE, "Dropped item 0x%x (%s, %u) for npc 0x%x.\n" % (item.serial, item.baseid, item.amount, char.serial))

	if container:
		if not utilities.tocontainer(item, container):
			item.update()
	else:
		items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
		for stackable in items:
			if stackable.pos.z == item.pos.z:
				if item.canstack(stackable):
					# We can completely stack the item
					if stackable.amount + item.amount <= 65535:
						stackable.amount += item.amount
						stackable.update()
						item.delete()
						return

		item.moveto(char.pos)
		item.update()
Esempio n. 6
0
def cut_fish(char, item):
    item_new = wolfpack.additem("97a")
    item_new.amount = item.amount * 2
    if not utilities.tocontainer(item_new, char.getbackpack()):
        item_new.update()
    item.delete()