コード例 #1
0
ファイル: tele.py プロジェクト: BackupTheBerlios/wolfpack-svn
def teleport( char, args, target ):
	source = char.pos
	# Keeps you from teleporting to weird places.
	if target.item and target.item.container:
		target = char.pos
	else:
		target = target.pos

	if not( utilities.isValidPosition(target) ):
		char.socket.sysmessage( 'Invalid target.' )
		return False

	char.removefromview()
	char.moveto( target )
	char.update()
	if char.socket:
		char.socket.resendworld()
	utilities.smokepuff(char, source)
	utilities.smokepuff(char, target)

	if args[0]:
		char.socket.sysmessage( 'Select your teleport destination.' )
		char.socket.attachtarget( "commands.tele.teleport", [True] )

	return True
コード例 #2
0
	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

		# Check if the target tile is blocked or in a multi
		# target.validspawnspot() will automatically set the z
		# of the coord to the nearest top
		if (not target.validspawnspot() or wolfpack.findmulti(target)) and not char.gm:		
			if char.socket:
				char.socket.clilocmessage(501942)
			return

		# Line of Sight (touch!! or else we can teleport trough windows)
		if not char.canreach(target, 12):
			if char.socket:
				char.socket.clilocmessage(500237)
			return

		if not self.consumerequirements(char, mode, args, target, item):
			return

		source = char.pos

		char.removefromview()
		char.moveto(target)
		char.update()
		if char.socket:
			char.socket.resendworld()

		smokepuff(char, source)
		smokepuff(char, target)
コード例 #3
0
ファイル: tele.py プロジェクト: thooge/Wolfpack
def teleport(char, args, target):
    source = char.pos
    # Keeps you from teleporting to weird places.
    if target.item and target.item.container:
        target = char.pos
    else:
        target = target.pos

    if not (utilities.isValidPosition(target)):
        char.socket.sysmessage('Invalid target.')
        return False

    char.removefromview()
    char.moveto(target)
    char.update()
    if char.socket:
        char.socket.resendworld()
    utilities.smokepuff(char, source)
    utilities.smokepuff(char, target)

    if args[0]:
        char.socket.sysmessage('Select your teleport destination.')
        char.socket.attachtarget("commands.tele.teleport", [True])

    return True
コード例 #4
0
ファイル: gate.py プロジェクト: Mutilador/Wolfpack
def onCollide(player, item):
	if item.hastag('playersonly') and player.npc:
		return False

	if not item.hastag('target'):
		if player.socket:
			player.socket.sysmessage( tr('This gate leads nowhere...') )
		else:
			console.log(LOG_ERROR, tr("NPC [%x] using gate [%x] without target.\n") % (player.serial, item.serial))
		return False

	target = item.gettag('target').split(',')

	# Convert the target of the gate.
	try:
		target = map(int, target)
	except:
		player.socket.sysmessage( tr('This gate leads nowhere...') )
		return False

	# Validate the coord
	try:
		m = target[3]
	except:
		m = player.pos.map
	pos = wolfpack.coord( target[0], target[1], target[2], m )

	if not utilities.isValidPosition( pos ):
		player.socket.sysmessage( tr('This gate leads nowhere...') )
		return False

	if not utilities.isMapAvailableTo( player, pos.map ):
		return False

	# Move his pets if he has any
	if player.player:
		for follower in player.followers:
			if follower.wandertype == 4 and follower.distanceto(player) < 5:
				follower.removefromview()
				follower.moveto(pos)
				follower.update()

	player.removefromview()
	player.moveto(pos)
	player.update()
	if player.socket:
		player.socket.resendworld()

	# show some nice effects
	if not item.hastag('silent'):
		item.soundeffect(0x1fe)
		utilities.smokepuff(player, pos)
		utilities.smokepuff(player, item.pos)

	return True
コード例 #5
0
ファイル: gate.py プロジェクト: BackupTheBerlios/wolfpack-svn
def onCollide(player, item):
	if item.hastag('playersonly') and player.npc:
		return 0

	if not item.hastag('target'):
		if player.socket:
			player.socket.sysmessage('This gate leads nowhere...')
		else:
			console.log(LOG_ERROR, "NPC [%x] using gate [%x] without target.\n" % (player.serial, item.serial))
		return 0

	target = item.gettag('target').split(',')

	# Convert the target of the gate.
	try:
		target = map(int, target)
	except:
		player.socket.sysmessage('This gate leads nowhere...')
		return 0

	# Move the player
	pos = player.pos
	pos.x = target[0]
	pos.y = target[1]
	pos.z = target[2]
	if len(target) > 3:
		pos.map = target[3]

	if not utilities.isMapAvailableTo(player, pos.map):
		return False

	# Move his pets if he has any
	if player.player:
		for follower in player.followers:
			if follower.wandertype == 4 and follower.distanceto(player) < 5:
				follower.removefromview()
				follower.moveto(pos)
				follower.update(0)
				
	player.removefromview()
	player.moveto(pos)
	player.update(0)
	if player.socket:
		player.socket.resendworld()

	# show some nice effects
	if not item.hastag('silent'):
		item.soundeffect(0x1fe)
		utilities.smokepuff(player, pos)
		utilities.smokepuff(player, item.pos)

	return 1
コード例 #6
0
ファイル: tele.py プロジェクト: BackupTheBerlios/wolfpack-svn
def teleport( char, args, target ):
	source = char.pos
	# Keeps you from teleporting to weird places.
	if target.item and target.item.container:
		target = char.pos
	else:
		target = target.pos

	char.removefromview()
	char.moveto( target )
	char.update()
	if char.socket:
		char.socket.resendworld()
	utilities.smokepuff(char, source)
	utilities.smokepuff(char, target)
	return True
コード例 #7
0
def onCollide(player, item):
	if not item.hastag('target'):
		target = [item.pos.x, item.pos.y, item.pos.z, item.pos.map]
	else:
		target = str(item.gettag('target')).split(',')

	try:
		target = map(int, target)
	except:
		target = [item.pos.x, item.pos.y, item.pos.z, item.pos.map]

	# Den Spieler bewegen
	pos = player.pos
	pos.x = target[0]
	pos.y = target[1]
	pos.z = target[2]
	pos.map = target[3]
	
	if not utilities.isMapAvailableTo(player, pos.map):
		return False

	if not pos.validspawnspot():
		if player.socket:
			player.socket.clilocmessage(501942)
		return

	# Move his pets if he has any
	if player.player:
		for follower in player.followers:
			if follower.wandertype == 4 and follower.distanceto(player) in range(0, 6):
				follower.removefromview()
				follower.moveto(pos)
				follower.update(0)

	player.removefromview()
	player.moveto(pos)
	player.update()
	if player.socket:
		player.socket.resendworld()

	# An der alten und neuen position soundeffekt und effekt spielen
	item.soundeffect(0x1fe)
	
	utilities.smokepuff(player, player.pos)
	utilities.smokepuff(player, item.pos)
	return 1
コード例 #8
0
ファイル: circle3.py プロジェクト: thooge/Wolfpack
    def target(self, char, mode, targettype, target, args, item):
        char.turnto(target)

        # Check if the target tile is blocked or in a multi
        # target.validspawnspot() will automatically set the z
        # of the coord to the nearest top
        if (not target.validspawnspot()
                or wolfpack.findmulti(target)) and not char.gm:
            if char.socket:
                char.socket.clilocmessage(501942)
            return

        # Line of Sight (touch!! or else we can teleport trough windows)
        if not char.canreach(target, 12):
            if char.socket:
                char.socket.clilocmessage(500237)
            return

        # New Location
        region = wolfpack.region(target.x, target.y, target.map)

        # NoTeleport Region?
        if region and region.noteleport:
            if char.socket:
                char.socket.sysmessage(
                    tr("Teleport is not allowed in that Region"))
            return

        if not self.consumerequirements(char, mode, args, target, item):
            return

        source = char.pos

        char.removefromview()
        char.moveto(target)
        char.update()
        if char.socket:
            char.socket.resendworld()

        smokepuff(char, source)
        smokepuff(char, target)