示例#1
0
def response( char, args, target ):
	socket = char.socket
	if not socket:
		return False

	pos = target.pos

	# Player can reach that ?
	if char.pos.map != pos.map or char.pos.distance( pos ) > MINING_MAX_DISTANCE:
		# That is too far away
		socket.clilocmessage( 500446, "", GRAY )
		return True

	tool = wolfpack.finditem(args[0])

	#Player also can't mine when riding, polymorphed and dead.
	#Mine char ?!
	if target.char:
		# You can't mine that.
		socket.clilocmessage( 501863, "", GRAY )
		return True

	#Find tile by it's position if we haven't model
	elif target.model == 0:
		map = wolfpack.map( target.pos.x, target.pos.y, target.pos.map )
		if ismountainorcave( map['id'] ):
			mining( char, target.pos, tool, sand = False )
		elif issand( map['id'] ) and char.hastag('sandmining'):
			mining( char, target.pos, tool, sand = True )
		else:
			# You can't mine there.
			socket.clilocmessage( 501862, "", GRAY )
		return True

	#Find tile by it's model
	elif target.model != 0:
		if ismountainorcave( target.model ):
			#add new ore gem here and mine
			mining( char, target.pos, tool )
		else:
			socket.clilocmessage( 501862, "", GRAY ) # You can't mine there.
		return True

	else:
		return False

	return True
示例#2
0
文件: mining.py 项目: thooge/Wolfpack
def response(char, args, target):
    socket = char.socket
    if not socket:
        return False

    pos = target.pos

    # Player can reach that ?
    if char.pos.map != pos.map or char.pos.distance(pos) > MINING_MAX_DISTANCE:
        # That is too far away
        socket.clilocmessage(500446, "", GRAY)
        return True

    tool = wolfpack.finditem(args[0])

    #Player also can't mine when riding, polymorphed and dead.
    #Mine char ?!
    if target.char:
        # You can't mine that.
        socket.clilocmessage(501863, "", GRAY)
        return True

    #Find tile by it's position if we haven't model
    elif target.model == 0:
        map = wolfpack.map(target.pos.x, target.pos.y, target.pos.map)
        ###########################
        # Searching for a Treasure
        ###########################
        bag = char.getbackpack()
        if bag.countresource(0x14eb) > 0:
            # Assign a variable to stop or not process
            foundtreas = 0
            # Loop content in player's Backpack
            for cmap in bag.content:
                if cmap.id == 0x14eb and cmap.hastag(
                        'level') and not cmap.hastag('founded'):
                    foundtreas = checktreaspoint(target.pos.x, target.pos.y,
                                                 target.pos.z, target.pos.map,
                                                 cmap, char)
                    if foundtreas == 1:
                        break
            # Stop Action
            if foundtreas == 1:
                return True

        if ismountainorcave(map['id']):
            mining(char, target.pos, tool, sand=False)
        elif issand(map['id']) and canminesand(char):
            mining(char, target.pos, tool, sand=True)
        else:
            # You can't mine there.
            socket.clilocmessage(501862, "", GRAY)
        return True

    #Find tile by it's model
    elif target.model != 0:
        ###########################
        # Searching for a Treasure
        ###########################
        bag = char.getbackpack()
        if bag.countresource(0x14eb) > 0:
            # Assign a variable to stop or not process
            foundtreas = 0
            # Loop content in player's Backpack
            for cmap in bag.content:
                if cmap.id == 0x14eb and cmap.hastag('level'):
                    foundtreas = checktreaspoint(target.pos.x, target.pos.y,
                                                 target.pos.z, target.pos.map,
                                                 cmap, char)
                    if foundtreas == 1:
                        break
            # Stop Action
            if foundtreas == 1:
                return True

        if ismountainorcave(target.model):
            #add new ore gem here and mine
            mining(char, target.pos, tool)
        else:
            socket.clilocmessage(501862, "", GRAY)  # You can't mine there.
        return True

    else:
        return False
示例#3
0
def response( char, args, target ):
	socket = char.socket
	if not socket:
		return False

	pos = target.pos

	# Player can reach that ?
	if char.pos.map != pos.map or char.pos.distance( pos ) > MINING_MAX_DISTANCE:
		# That is too far away
		socket.clilocmessage( 500446, "", GRAY )
		return True

	tool = wolfpack.finditem(args[0])

	#Player also can't mine when riding, polymorphed and dead.
	#Mine char ?!
	if target.char:
		# You can't mine that.
		socket.clilocmessage( 501863, "", GRAY )
		return True

	#Find tile by it's position if we haven't model
	elif target.model == 0:
		map = wolfpack.map( target.pos.x, target.pos.y, target.pos.map )
		###########################
		# Searching for a Treasure
		###########################
		bag = char.getbackpack()
		if bag.countresource(0x14eb) > 0:
			# Assign a variable to stop or not process
			foundtreas = 0
			# Loop content in player's Backpack
			for cmap in bag.content:
				if cmap.id == 0x14eb and cmap.hastag('level') and not cmap.hastag('founded'):
					foundtreas = checktreaspoint(target.pos.x, target.pos.y, target.pos.z, target.pos.map, cmap, char)
					if foundtreas == 1:
						break
			# Stop Action
			if foundtreas == 1:
				return True

		if ismountainorcave( map['id'] ):
			mining( char, target.pos, tool, sand = False )
		elif issand( map['id'] ) and canminesand(char):
			mining( char, target.pos, tool, sand = True )
		else:
			# You can't mine there.
			socket.clilocmessage( 501862, "", GRAY )
		return True

	#Find tile by it's model
	elif target.model != 0:
		###########################
		# Searching for a Treasure
		###########################
		bag = char.getbackpack()
		if bag.countresource(0x14eb) > 0:
			# Assign a variable to stop or not process
			foundtreas = 0
			# Loop content in player's Backpack
			for cmap in bag.content:
				if cmap.id == 0x14eb and cmap.hastag('level'):
					foundtreas = checktreaspoint(target.pos.x, target.pos.y, target.pos.z, target.pos.map, cmap, char)
					if foundtreas == 1:
						break
			# Stop Action
			if foundtreas == 1:
				return True

		if ismountainorcave( target.model ):
			#add new ore gem here and mine
			mining( char, target.pos, tool )
		else:
			socket.clilocmessage( 501862, "", GRAY ) # You can't mine there.
		return True

	else:
		return False