Esempio n. 1
0
def targetpotion( char, args, target ):
	check = 10
	socket = char.socket
	pitem = wolfpack.finditem( args[0] )
	if not pitem:
		return False
	# Range Check Override
	if pitem.hastag( 'range' ):
		check = int( potion.gettag( 'range' ) )
	# Target Checking
	if not pitem:
		return False
	if target.char:
		if not char.cansee( target.char ):
			return False
		if char.distanceto( target.char ) > check:
			return False
		if not char.canreach( target, check ):
			return False
		pos = target.char.pos
	elif target.item:
		if not char.cansee( target.item ):
			return False
		if char.distanceto( target.item ) > check:
			return False
		if not char.canreach( target, check ):
			return False
		item = target.item.getoutmostitem()
		if item.container:
			pos = item.container.pos
		else:
			pos = item.pos
	else:
		if not char.canreach( target, check ):
			return False
		pos = target.pos
	# Distance Checking
	if char.distanceto( pos ) > check:
		socket.clilocmessage( 1005539 )
		return False
	#verify the potion still exists to be thrown...
	if pitem:
		if pitem.amount == 1:
			throwobject( char, pitem, pos, 1, 3, 5 )
		else:
			#pitem.amount -= 1
			#pitem.update()
			#throwobject( char, pitem, pos, 1, 3, 5 )
			return False

	return True
Esempio n. 2
0
def targetpotion( char, args, target ):
	check = 10
	socket = char.socket
	pitem = wolfpack.finditem( args[0] )
	if not pitem:
		return False
	# Range Check Override
	if pitem.hastag( 'range' ):
		check = int( potion.gettag( 'range' ) )
	# Target Checking
	if not pitem:
		return False
	if target.char:
		if not char.cansee( target.char ):
			return False
		if char.distanceto( target.char ) > check:
			return False
		if not char.canreach( target, check ):
			return False
		pos = target.char.pos
	elif target.item:
		if not char.cansee( target.item ):
			return False
		if char.distanceto( target.item ) > check:
			return False
		if not char.canreach( target, check ):
			return False
		item = target.item.getoutmostitem()
		if item.container:
			pos = item.container.pos
		else:
			pos = item.pos
	else:
		if not char.canreach( target, check ):
			return False
		pos = target.pos
	# Distance Checking
	if char.distanceto( pos ) > check:
		socket.clilocmessage( 1005539 )
		return False
	#verify the potion still exists to be thrown...
	if pitem:
		if pitem.amount == 1:
			throwobject( char, pitem, pos, 1, 3, 5 )
		else:
			#pitem.amount -= 1
			#pitem.update()
			#throwobject( char, pitem, pos, 1, 3, 5 )
			return False

	return True
Esempio n. 3
0
def targetexplosionpotion(char, args, target):
	socket = char.socket
	potion = args[0]
	check = 10
	if not potion:
		return 0
	if target.char:
		# i dont think we need some of these...
		if target.char.invulnerable:
			return 0
		if target.char.dead:
			return 0
		if not char.cansee(target.char):
			return 0
		if char.distanceto(target.char) > check:
			return 0
		if not char.canreach(target.char, check):
			return 0
		pos = target.char.pos
	elif target.item:
		if not char.cansee(target.item):
			return 0
		if char.distanceto(target.item) > check:
			return 0
		if not char.canreach(target.item, check):
			return 0
		item = target.item.getoutmostitem()
		if item.container:
			pos = item.container.pos
		else:
			pos = item.pos
	else:
		if not char.canreach(target.pos, check):
			return 0
		pos = target.pos

	if char.distanceto(pos) > 15:
		socket.clilocmessage(1005539)
		return

	#verify the potion still exists to be thrown...
	if potion:
		throwobject(char, potion, pos, 1, 3, 5)

	return