Example #1
0
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
Example #2
0
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
Example #3
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
Example #4
0
	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

		# Runebook recall support
		runebook = magic.runebook.isRunebook(target) and len(args) == 1		

		# We can only recall from recall runes or via the runebook
		if not runebook:
			if not target.hasscript('magic.rune'):
				char.message(502357)
				return
	
			if not target.hastag('marked') or target.gettag('marked') != 1:
				char.message(502354)
				return

			location = target.gettag('location')
			location = location.split(",")
			location = wolfpack.coord(int(location[0]), int(location[1]), int(location[2]), int(location[3]))
			char.log(LOG_MESSAGE, 'Tries to recall to %s using rune.\n' % str(location))
		else:
			location = args[0]
			char.log(LOG_MESSAGE, 'Tries to recall to %s using runebook.\n' % str(location))

		# Check if we can go there.
		if not isMapAvailableTo(char, location.map):
			return

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

		region = None
		region = wolfpack.region(char.pos.x, char.pos.y, char.pos.map)

		if region and region.norecallout:
			char.message(501802)
			fizzle(char)
			return

		region = None
		region = wolfpack.region(location.x, location.y, location.map)

		if not location.validspawnspot():
			char.message(501942)
			fizzle(char)
			return

		if region and region.norecallin:
			char.message(1019004)
			fizzle(char)
			return

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

		char.soundeffect(0x1fc)
		char.removefromview()
		char.moveto(location)
		char.update()
		char.socket.resendworld()
		char.soundeffect(0x1fc)
Example #5
0
    def target(self, char, mode, targettype, target, args, item):
        char.turnto(target)

        # Runebook recall support
        runebook = magic.runebook.isRunebook(target) and len(args) == 1

        # We can only recall from recall runes or via the runebook
        if not runebook:
            if not target.hasscript('magic.rune') and not target.hastag(
                    'recall.link'):
                char.message(502357)
                return

            if (not target.hastag('marked') or target.gettag('marked') != 1
                ) and not target.hastag('recall.link'):
                char.message(502354)
                return

            if target.hastag('recall.link'):
                litem = wolfpack.finditem(target.gettag('recall.link'))
                if not litem:
                    char.message(502357)
                    return
                else:
                    location = wolfpack.coord(litem.pos.x, litem.pos.y,
                                              litem.pos.z, litem.pos.map)
            else:
                location = target.gettag('location')
                location = location.split(",")
                location = wolfpack.coord(int(location[0]), int(location[1]),
                                          int(location[2]), int(location[3]))

            char.log(LOG_MESSAGE,
                     'Tries to recall to %s using rune.\n' % str(location))
        else:
            location = args[0]
            char.log(LOG_MESSAGE,
                     'Tries to recall to %s using runebook.\n' % str(location))

        # Check if we can go there.
        if not isMapAvailableTo(char, location.map):
            return

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

        region = None
        region = wolfpack.region(char.pos.x, char.pos.y, char.pos.map)

        if region and region.norecallout:
            char.message(501802)
            fizzle(char)
            return

        region = None
        region = wolfpack.region(location.x, location.y, location.map)

        if not location.validspawnspot() and not litem:
            char.message(501942)
            fizzle(char)
            return

        if region and region.norecallin:
            char.message(1019004)
            fizzle(char)
            return

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

        char.soundeffect(0x1fc)
        char.removefromview()
        char.moveto(location)
        char.update()
        char.socket.resendworld()
        char.soundeffect(0x1fc)