当前位置: 首页>>代码示例>>Python>>正文


Python wolfpack.coord函数代码示例

本文整理汇总了Python中wolfpack.coord函数的典型用法代码示例。如果您正苦于以下问题:Python coord函数的具体用法?Python coord怎么用?Python coord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了coord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onUse

def onUse( player, item ):

    if ( player.distanceto( item ) > 8 ):
        return False

    boat_serial = item.gettag( 'boat_serial' )

    if ( player.multi != None and player.multi.serial == boat_serial ):
        if ( item.hastag('plank_open') ):
            closePlank( item )
        else:
            openPlank( item )
    else:
        if not item.hastag('plank_open'):
            if not item.hastag('plank_locked'):
                openPlank( item )
            elif player.gm:
                player.say( 502502 ); # That is locked but your godly powers allow access
            else:
                player.say( 502503 ); # That is locked.
        elif not item.hastag('plank_locked'):
            newpos = wolfpack.coord( item.pos.x, item.pos.y, item.pos.z + 5, item.pos.map )
            player.moveto( newpos )
            player.update()
        elif player.gm:
            player.say( 502502 ); # That is locked but your godly powers allow access
            newpos = wolfpack.coord( item.pos.x, item.pos.y, item.pos.z + 5, item.pos.map )
            player.moveto( newpos )
            player.update()
        else:
            player.say( 502503 ); # That is locked.
    return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:plank.py

示例2: response

def response( char, args, target ):
	socket = char.socket
	xmod = int( args[0] )
	ymod = int( args[1] )
	zmod = int( args[2] )
	if( args[3] == None ):
		newmap = None
	else:
		newmap = int( args[3] )

	if target.item:
		item = target.item
		pos = item.pos
		if newmap != None:
			newposition = "%i,%i,%i,%i" % ( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), newmap )
		else:
			newposition = "%i,%i,%i,%i" % ( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), pos.map )
		item.pos = newposition
		item.update()
		return True
	elif target.char:
		char = target.char
		pos = char.pos
		if newmap != None:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), newmap )
		else:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), pos.map )
		char.removefromview()
		char.moveto( newposition )
		char.update()
		if char.socket:
			char.socket.resendworld()
		return True
	return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:34,代码来源:move.py

示例3: target

	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

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

		xdiff = abs(target.x - char.pos.x)
		ydiff = abs(target.y - char.pos.y)

		if xdiff > ydiff:
			positions = [ wolfpack.coord(target.x, target.y - 1, target.z, target.map), wolfpack.coord(target.x, target.y, target.z, target.map), wolfpack.coord(target.x, target.y + 1, target.z, target.map) ]
		else:
			positions = [ wolfpack.coord(target.x - 1, target.y, target.z, target.map), wolfpack.coord(target.x, target.y, target.z, target.map), wolfpack.coord(target.x + 1, target.y, target.z, target.map) ]

		# At least one spell should look fancy
		# Calculate the Angle here
		serials = []

		char.soundeffect(0x1f6)

		for pos in positions:
			newitem = wolfpack.newitem(1)
			newitem.id = 0x80
			newitem.moveto(pos)
			newitem.decay = 0 # Dont decay. TempEffect will take care of them
			newitem.update()
			newitem.settag('dispellable_field', 1)
			serials.append(newitem.serial)
			wolfpack.effect(0x376a, pos, 9, 10)

		wolfpack.addtimer(10000, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:circle3.py

示例4: target

	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

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

		xdiff = abs(target.x - char.pos.x)
		ydiff = abs(target.y - char.pos.y)

		positions = []

		# North/South
		if xdiff > ydiff:
			itemid = 0x3922
			for i in range(-2, 3):
				positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))

		# West/East
		else:
			itemid = 0x3915
			for i in range(-2, 3):
				positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))

		serials = []
		char.soundeffect(0x20c)

		total = (char.skill[MAGERY] + char.skill[POISONING]) / 2.0
		if total >= 1000:
			level = 3
		elif total > 850:
			level = 2
		elif total > 650:
			level = 1
		else:
			level = 0

		for pos in positions:
			newitem = wolfpack.newitem(1)
			newitem.id = itemid
			#newitem.direction = 29
			newitem.moveto(pos)
			newitem.decay = 0 # Dont decay. TempEffect will take care of them
			newitem.settag('dispellable_field', 1)
			newitem.settag('level', level)
			newitem.addscript( 'magic.poisonfield' )
			newitem.update()
			serials.append(newitem.serial)

			# Affect chars who are occupying the field cells
			chars = wolfpack.chars( newitem.pos.x, newitem.pos.y, newitem.pos.map, 0 )
			for affected in chars:
				if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
					newitem.callevent(EVENT_COLLIDE, (affected, newitem))

		duration = int((3 + char.skill[MAGERY] / 25.0) * 1000)
		wolfpack.addtimer(duration, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:56,代码来源:circle5.py

示例5: target

    def target(self, char, mode, targettype, target, args, item):
        char.turnto(target)

        if not char.canreach(target, 10):
            char.message(500237)
            return

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

        xdiff = abs(target.x - char.pos.x)
        ydiff = abs(target.y - char.pos.y)

        positions = []

        # West / East
        if xdiff > ydiff:
            itemid = 0x3996
            for i in range(-2, 3):
                positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))

                # North South
        else:
            itemid = 0x398C
            for i in range(-2, 3):
                positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))

        serials = []

        char.soundeffect(0x20C)

        for pos in positions:
            newitem = wolfpack.newitem(1)
            newitem.id = itemid
            # newitem.direction = 29
            newitem.moveto(pos)
            newitem.decay = 0  # Dont decay. TempEffect will take care of them
            newitem.settag("dispellable_field", 1)
            newitem.settag("source", char.serial)
            newitem.addscript("magic.firefield")
            newitem.update()
            serials.append(newitem.serial)

            # Affect chars who are occupying the field cells
            chars = wolfpack.chars(newitem.pos.x, newitem.pos.y, newitem.pos.map, 0)
            if len(chars) > 0:
                for affected in chars:
                    if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
                        newitem.callevent(EVENT_COLLIDE, (affected, newitem))

        duration = int((4 + char.skill[MAGERY] * 0.05) * 1000)
        wolfpack.addtimer(duration, "magic.utilities.field_expire", serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:52,代码来源:circle4.py

示例6: go

def go(socket, command, arguments):
    player = socket.player

    if len(arguments) == 0:
        global generated
        if not generated:
            socket.sysmessage("Generating go menu.")
            socket.sysmessage("Please wait...")
            generateGoMenu()
            generated = 1

        menu = findmenu("GOMENU")
        if menu:
            socket.sysmessage("Bringing up the travel gump.")
            menu.send(player)
        else:
            socket.sysmessage("Didn't find the GOMENU menu.")
        return
    elif arguments.count(",") >= 1:
        parts = arguments.split(",")
        pos = player.pos

        try:
            pos.x = int(parts[0])
            pos.y = int(parts[1])
            if len(parts) >= 3:
                pos.z = int(parts[2])

            if len(parts) >= 4:
                pos.map = int(parts[3])

            if not isValidPosition(pos):
                socket.sysmessage("Error: Destination invalid!")
                return False

            player.removefromview()
            player.moveto(pos)
            player.update()
            player.socket.resendworld()
            return
        except:
            pass

            # If we reach this point it was no valid coordinate
            # See if we can get a def
    location = wolfpack.getdefinition(WPDT_LOCATION, arguments)

    if location:
        (x, y, z, map) = location.text.split(",")
        pos = wolfpack.coord(int(x), int(y), int(z), int(map))
        if not isValidPosition(pos):
            socket.sysmessage("Error: Destination invalid!")
            return False
        player.removefromview()
        player.moveto(pos)
        player.update()
        player.socket.resendworld()
    else:
        socket.sysmessage("Usage: <x, y, z, map>|<location>")
    return
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:60,代码来源:go.py

示例7: onCHLevelChange

def onCHLevelChange( char, level ):
	if not char.hastag( 'customizing' ):
		return
	multi = wolfpack.findmulti( int( char.gettag( 'customizing' ) ) )

	char.socket.sysmessage( 'multi at: ' + str( multi.pos.z ) )
	char.socket.sysmessage( 'char at: ' + str( char.pos.z ) )
	alt = (level-1) * 49
	if level == 3:
		char.moveto( wolfpack.coord( multi.pos.x, multi.pos.y, char.pos.z+1, multi.pos.map ) )
	if level == 2:
		char.moveto( wolfpack.coord( multi.pos.x+4, multi.pos.y+4, multi.pos.z+alt, multi.pos.map ) )
	if level == 1:
		char.moveto( wolfpack.coord( multi.pos.x, multi.pos.y, char.pos.z-1, multi.pos.map ) )
	char.update()
	return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:16,代码来源:signpost.py

示例8: __init__

	def __init__(self, char):
		if type(char) == str:
			values = char.split(';')
			self.account = unquote( values[0] )
			self.serial = int(values[1])
			self.name = unquote(values[2])
			(x, y, z, m) = values[3].split(',')
			self.pos = wolfpack.coord(int(x), int(y), int(z), int(m))
			self.category = unquote(values[4])
			self.message = ['', '', '', '']
			self.message[0] = unicode(unquote(values[5]))
			self.message[1] = unicode(unquote(values[6]))
			self.message[2] = unicode(unquote(values[7]))
			self.message[3] = unicode(unquote(values[8]))
			self.created = float(values[9])		
		else:
			self.account = char.account.name
			self.serial = char.serial
			self.name = char.name
			self.pos = char.pos
			self.category = ''
			self.message = ['', '', '', '']
			self.created = 0

		self.assigned = None
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:pages.py

示例9: target

	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

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

		xdiff = abs(target.x - char.pos.x)
		ydiff = abs(target.y - char.pos.y)

		positions = []

		# West / East
		if xdiff > ydiff:
			itemid = 0x3967
			for i in range(-2, 3):
				positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))

		# North South
		else:
			itemid = 0x3979
			for i in range(-2, 3):
				positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))

		serials = []

		char.soundeffect(0x20b)

		for pos in positions:
			newitem = wolfpack.newitem(1)
			newitem.id = itemid
			newitem.moveto(pos)
			newitem.decay = 0 # Dont decay. TempEffect will take care of them
			newitem.settag('dispellable_field', 1)
			newitem.settag('strength', char.skill[self.damageskill])
			newitem.addscript( 'magic.paralyzefield' )
			newitem.update()
			serials.append(newitem.serial)
			wolfpack.effect(0x376A, newitem.pos, 9, 10)

			# Affect chars who are occupying the field cells
			chars = wolfpack.chars( newitem.pos.x, newitem.pos.y, newitem.pos.map, 0 )
			for affected in chars:
				if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
					newitem.callevent(EVENT_COLLIDE, (affected, newitem))

		duration = int((3 + char.skill[MAGERY] / 30.0) * 1000)
		wolfpack.addtimer(duration, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:47,代码来源:circle6.py

示例10: foundation

def foundation( char, target, width, height, multiid ):
	multi = wolfpack.multi( CUSTOMHOUSE )
	char.socket.sysmessage( str( multi.serial ) )
	multi.id = multiid + 0x4000
	multi.decay = FALSE
	multi.moveto( target.pos )

	left = width/2
	right = left - ( width-1 )
	bottom = height/2
	top = bottom - ( height-1 )

	#Draw floor
	for y in xrange( top+1,bottom+1 ):
		for x in xrange( right+1,left+1 ):
			if x == 0 and y == 0:
				multi.addchtile( 0x1, 0, 0, 0 )
			multi.addchtile( 0x31f4, x, y, 7 )

	#Draw corners
	multi.addchtile( 0x66, right, top, 0 )
	multi.addchtile( 0x65, left, bottom, 0 )

	#Draw sides
	for x in xrange( right+1,left+1 ):
		multi.addchtile( 0x63, x, top, 0 )
		if x < left:
			multi.addchtile( 0x63, x, bottom, 0 )

	for y in xrange( top+1, bottom+1 ):
		multi.addchtile( 0x64, right, y, 0 )
		multi.addchtile( 0x64, left, y, 0 )

	#Draw stairs
	for x in xrange( right+1,left+1 ):
		multi.addchtile( 0x0751, x, bottom+1, 0 )


	multi.sendcustomhouse( char )
	#woodenpost = wolfpack.additem( "9" )
	signpost = wolfpack.additem( "b98" )
	sign = wolfpack.additem( "bd2" )
	#woodenpost.decay = FALSE
	signpost.decay = FALSE
	sign.decay = FALSE
	x = multi.pos.x + right
	y = multi.pos.y + bottom
	z = multi.pos.z + 7
	map = multi.pos.map
	newpos = wolfpack.coord( x, y, z, map )
	#woodenpost.moveto( newpos )
	newpos.y += 1
	signpost.moveto( newpos )
	sign.moveto( newpos )
	sign.settag( 'house', multi.serial )
	sign.addscript( 'signpost' )
	#woodenpost.update()
	signpost.update()
	sign.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:59,代码来源:multideed.py

示例11: parseTxt

def parseTxt( file, map ):
	warnings = ''
	count = 0

	parseTickCount = 0
	createTickCount = 0
	propTickCount = 0
	moveTickCount = 0

	for line in file:
		step1 = wolfpack.tickcount()

		# Replace \r and \n's
		line = line.replace( "\r", "" )
		line = line.replace( "\n", "" )

		( id, x, y, z, color ) = line.split( ' ' )

		id = hex2dec( id )
		baseid = '%x' % id
		color = hex2dec( color )
		x = int( x )
		y = int( y )
		z = int( z )

		step2 = wolfpack.tickcount()
		newitem = wolfpack.additem( '%s' % baseid ) # Generate a new serial for us
		step3 = wolfpack.tickcount()

		newitem.decay = 0
		newitem.color = color
		newitem.id = id

		step4 = wolfpack.tickcount()

		newposition = wolfpack.coord( x, y, z, map )
		if not isValidPosition( newposition ):
			newitem.delete()
			continue
		newitem.moveto( newposition )

		step5 = wolfpack.tickcount()

		parseTickCount += step2 - step1
		createTickCount += step3 - step2
		propTickCount += step4 - step3
		moveTickCount += step5 - step4

		newitem.update()

		count += 1

	print "Parsing: %i ticks" % parseTickCount
	print "Creating: %i ticks" % createTickCount
	print "Prop: %i ticks" % propTickCount
	print "Move: %i ticks" % moveTickCount

	return ( count, warnings )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:58,代码来源:import.py

示例12: onDropOnItem

def onDropOnItem(runebook, item):
	if not isRunebook(runebook):
		return False # Only handle for dropping something on the runebook

	if not item.container or not item.container.ischar():
		return False # Some internal error or script before us

	player = item.container

	if runebook.getoutmostchar() != player:
		player.socket.sysmessage(tr('The runebook has to be in your belongings to modify it.'))
	else:
		if isRune(item):
			location = None
			if item.hastag('marked') and item.hastag('location'):
				try:
					(x, y, z, map) = item.gettag('location').split(',')
					location = wolfpack.coord(int(x), int(y), int(z), int(map))
				except:
					pass

			if location:
				index = getFreeIndex(runebook)
				
				if index != -1:
					tagname = 'entry%u' % index
					name = item.name.strip()
					if len(name) != 0:
						runebook.settag(tagname + 'name', name)
					else:
						runebook.deltag(tagname + 'name') # Make sure there is no old name
					runebook.settag(tagname, str(location))
					player.soundeffect(0x42)
					item.delete()
					return True

				else:
					player.socket.clilocmessage(502401) # This runebook is full.
			else:
				player.socket.clilocmessage(502409)

		elif isRecallScroll(item):
			# Recharge if possible
			(charges, maxcharges) = getCharges(runebook)
			if charges < maxcharges:
				consume = min(item.amount, maxcharges - charges)
				runebook.settag('charges', charges + consume)
				player.soundeffect(0x249)

				if consume == item.amount:
					item.delete()
					return True # The item has been removed
				else:
					item.amount -= consume
			else:
				player.socket.clilocmessage(502410)
	return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:57,代码来源:runebook.py

示例13: Rotate

def Rotate( boat, coord, count ):
    rx = coord.x - boat.pos.x
    ry = coord.y - boat.pos.y

    for i in range( 0, count ):
        temp = rx
        rx = -ry
        ry = temp
    return wolfpack.coord( boat.pos.x + rx, boat.pos.y + ry, coord.z, coord.map )
开发者ID:Mutilador,项目名称:Wolfpack,代码行数:9,代码来源:tillerman.py

示例14: onCHLevelChange

def onCHLevelChange(char, level):
    if not char.hastag("customizing"):
        return
    multi = wolfpack.findobject(char.gettag("customizing"))

    char.socket.sysmessage("Level selected: " + str(level))
    char.socket.sysmessage("multi at: " + str(multi.pos.z))
    char.socket.sysmessage("char at: " + str(char.pos.z))

    # alt = (level-1) * 49

    if level == 3:
        char.moveto(wolfpack.coord(multi.pos.x, multi.pos.y, multi.pos.z + 47, multi.pos.map))
    if level == 2:
        char.moveto(wolfpack.coord(multi.pos.x, multi.pos.y, multi.pos.z + 27, multi.pos.map))
    if level == 1:
        char.moveto(wolfpack.coord(multi.pos.x, multi.pos.y, multi.pos.z + 7, multi.pos.map))
    char.update()
    return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:19,代码来源:signpost.py

示例15: response

def response( char, args, target ):
	socket = char.socket
	xmod = int( args[0] )
	ymod = int( args[1] )
	zmod = int( args[2] )
	if( args[3] == None ):
		newmap = None
	else:
		newmap = int( args[3] )

	if target.item:
		item = target.item
		pos = item.pos
		if newmap != None:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), newmap )
		else:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), pos.map )

		if not( utilities.isValidPosition(newposition) ):
			char.socket.sysmessage( "Error: Destination invalid!"  )
			return False

		item.moveto( newposition )
		item.update()
		return True
	elif target.char:
		char = target.char
		pos = char.pos
		if newmap != None:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), newmap )
		else:
			newposition = wolfpack.coord( (pos.x + xmod) , (pos.y + ymod ), (pos.z + zmod), pos.map )
		
		if not( utilities.isValidPosition(newposition) ):
			return False
		
		char.removefromview()
		char.moveto( newposition )
		char.update()
		if char.socket:
			char.socket.resendworld()
		return True
	return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:43,代码来源:move.py


注:本文中的wolfpack.coord函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。