Esempio n. 1
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.socketclilocmessage(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()

		wolfpack.effect(0x3728, source, 10, 15)
		wolfpack.effect(0x3728, target, 10, 15)
		char.soundeffect(0x1fe)
Esempio n. 2
0
def doRemovemulti(char, args, target):

    # finding the multi
    multi = wolfpack.findmulti(target.pos)

    # Now we have the multi... or not
    if not multi:
        char.socket.sysmessage("No Multi here for removal!")
        return True
    else:
        # Lets make similar to demolish:
        # Looking for the list of items in the Multi
        listitems = multi.objects

        # Now... the Loop to remove all items
        contador = 0
        for multiitem in listitems:
            # A bad but necessary way to check if its Char or item for a while (IsChar and IsItem have some problems on objects list)
            try:
                dir = multiitem.direction
            except:
                multiitem.delete()
                contador += 1

        # Message about how many items are deleted in the house
        char.socket.sysmessage("Deleted %i items in house!" % contador)

        # Unregistering the House
        housing.unregisterHouse(multi)

        # Erasing Multi
        multi.delete()

        return True
def doRemovemulti(char, args, target):

    # finding the multi
    multi = wolfpack.findmulti(target.pos)

    # Now we have the multi... or not
    if not multi:
        char.socket.sysmessage("No Multi here for removal!")
        return True
    else:
        # Lets make similar to demolish:
        # Looking for the list of items in the Multi
        listitems = multi.objects

        # Now... the Loop to remove all items
        contador = 0
        for multiitem in listitems:
            # A bad but necessary way to check if its Char or item for a while (IsChar and IsItem have some problems on objects list)
            try:
                dir = multiitem.direction
            except:
                multiitem.delete()
                contador += 1

                # Message about how many items are deleted in the house
        char.socket.sysmessage("Deleted %i items in house!" % contador)

        # Unregistering the House
        housing.unregisterHouse(multi)

        # Erasing Multi
        multi.delete()

        return True
Esempio n. 4
0
def onUse( char, item ):
	# Adding the UID of the Multi here
	if not item.hastag( 'house' ):
		# I found a house here?
		multi = wolfpack.findmulti(item.pos)

		if not multi:
			return True
		
		item.settag( 'house', multi.serial )

	gump0( char, gumpcallback, item )
	return True
Esempio n. 5
0
def onUse(char, item):
    # Adding the UID of the Multi here
    if not item.hastag('house'):
        # I found a house here?
        multi = wolfpack.findmulti(item.pos)

        if not multi:
            return True

        item.settag('house', multi.serial)

    gump0(char, gumpcallback, item)
    return True
Esempio n. 6
0
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
Esempio n. 7
0
def customize( char, item ):
	if not item.hastag( 'house' ):
		return

	multi = wolfpack.findmulti( int( item.gettag( 'house' ) ) )
	multi.sendcustomhouse( char )
	char.socket.sysmessage( str( multi.serial ) )
	#char.socket.sysmessage( "Multi serial : %i" % multi.serial )
	char.moveto( wolfpack.coord( multi.pos.x, multi.pos.y, multi.pos.z+7, multi.pos.map ) )
	char.update()
	#woodenpost = wolfpack.finditem( item.morez )
	#woodenpost.delete()
	char.socket.customize( item )
	char.settag( 'customizing', multi.serial )

	return 1
Esempio n. 8
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

        # 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)
Esempio n. 9
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

		# 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)
def response( char, args, target ):
	if not char:
		return

	if skills.skilltable[ DETECTINGHIDDEN ][ skills.UNHIDE ] and char.hidden:
		char.removefromview()
		char.hidden = False
		char.update()

	# if we are in our house : reveal all hidden chars in this house
	# w/o checking skill
	house = wolfpack.findmulti( char.pos )
	# it's our house
	if house and house.owner == char.serial:
		# get all chars in this house
		chars = house.chars()
		# set visible to the chars
		for echar in chars:
			if echar.hidden and echar.serial != char.serial:
				echar.hidden = 0
				echar.update()
		# do we need to checkskill ?
		return

	char.socket.settag( 'skill_delay', int( wolfpack.time.currenttime() + DETECTHIDDEN_DELAY ) )

	success = char.checkskill( DETECTINGHIDDEN, 0, 1000 )
	# You can see nothing hidden there
	if not success:
		char.socket.clilocmessage( 500817, "", 0x3b2, 3 )
		return

	pos = None
	item = None
	if target.pos:
		pos = target.pos
	elif target.item:
		item = target.item
	# when we target at a position : hidden people, dungeon trap, faction trap
	if pos:
		x = pos.x
		y = pos.y
		map = pos.map
		skill = char.skill[ DETECTINGHIDDEN ]
		reveal_range = 1 + skill / 100
		# first, we test hidden chars
		chars = wolfpack.chars( x, y, map, reveal_range )
		for tchar in chars:
			if not tchar.priv2 & 0x08:
				# hidden using hiding skill
				if tchar.hidden == 1:
					# FIXME : only hidden with lower skill will be revealed
					if tchar.skill[ HIDING ] <= skill:
						reveal_char( tchar )
				# hidden using invisibility spell
				elif tchar.hidden == 2:
					# FIXME : only hidden with lower skill will be revealed
					if tchar.skill[ MAGERY ] <= skill:
						reveal_char( tchar )
		# next, dungeon / factoin traps
		items = wolfpack.items( x, y, map, reveal_range )
		for titem in items:
			if titem.id in dungeon_traps:
				if titem.visible:
					if titem.hastag( 'level' ):
						level = item.gettag( 'level' )
					else:
						level = 1
					# level from 1 to 5
					if skill / 2 >= level:
						titem.addtimer( DUNGEON_TRAP_REVEAL_DURATION, "skills.detectinghidden.hide_trap", [ titem.visible ] )
						titem.visible = 0
						titem.update()
			# faction trap : no idea yet
	# now, we deal with the trap boxes - show trap items as color
	elif item:
		char.socket.sysmessage( "detecting trap box is not implemented yet." )
Esempio n. 11
0
def response(char, args, target):
    if not char:
        return

    if skills.skilltable[DETECTINGHIDDEN][skills.UNHIDE] and char.hidden:
        char.reveal()

    # if we are in our house : reveal all hidden chars in this house
    # w/o checking skill
    house = wolfpack.findmulti(char.pos)
    # it's our house
    if house and house.owner == char.serial:
        # get all chars in this house
        chars = house.chars()
        # set visible to the chars
        for echar in chars:
            if echar.hidden and echar.serial != char.serial:
                echar.hidden = 0
                echar.update()
        # do we need to checkskill ?
        return

    char.socket.settag('skill_delay',
                       int(wolfpack.time.currenttime() + DETECTHIDDEN_DELAY))

    skill = char.skill[DETECTINGHIDDEN]
    reveal_range = int(skill / 100)

    success = char.checkskill(DETECTINGHIDDEN, 0, 1000)
    if not success:
        reveal_range /= 2

    pos = None
    item = None
    found = False
    if target.pos:
        pos = target.pos
    if target.item:
        item = target.item
    # when we target at a position : hidden people, dungeon trap, faction trap
    if pos:
        x = pos.x
        y = pos.y
        map = pos.map
        # first, we test hidden chars
        chars = wolfpack.chars(x, y, map, reveal_range)
        for tchar in chars:
            if not tchar.gm:
                # hidden using hiding skill
                if tchar.hidden:
                    ss = skill + random.randint(0, 21) - 10
                    ts = tchar.skill[HIDING] + random.randint(0, 21) - 10
                    if ss >= ts:
                        reveal_char(tchar)
                        found = True
                # hidden using invisibility spell
                #elif tchar.hasscript('skills.stealth'):
                #	# FIXME : only hidden with lower skill will be revealed
                #	if tchar.skill[ MAGERY ] <= skill:
                #		reveal_char( tchar )
        # next, dungeon / faction traps
        items = wolfpack.items(x, y, map, reveal_range)
        for titem in items:
            if titem.id in dungeon_traps:
                if not titem.visible:
                    if titem.hastag('level'):
                        level = item.gettag('level')
                    else:
                        level = 1
                    # level from 1 to 5
                    if skill / 2 >= level:
                        titem.addtimer(DUNGEON_TRAP_REVEAL_DURATION, hide_trap,
                                       [titem.visible])
                        titem.visible = 1
                        titem.update()
                        found = True
            # faction trap : no idea yet
    # now, we deal with the trap boxes - show trap items as color
    if item:
        char.socket.sysmessage("detecting trap box is not implemented yet.")
    elif not found:
        char.socket.clilocmessage(500817)  # You can see nothing hidden there.