示例#1
0
def demolish( char, item ):
	if not checkAccess(char, item.multi, ACCESS_OWNER):
		char.socket.sysmessage('You are not the owner of this house.')
		return
	# If Sign has no Multi, then we have problems here
	if not item.hastag( 'house' ):
		return

	# Assign the Multi
	multi = wolfpack.findobject( item.gettag( 'house' ) )

	# 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:
		try:
			n = multiitem.player
		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()
示例#2
0
def demolish(char, item):
    if not checkAccess(char, item.multi, ACCESS_OWNER):
        char.socket.sysmessage("You are not the owner of this house.")
        return
        # If Sign has no Multi, then we have problems here
    if not item.hastag("house"):
        return

        # Assign the Multi
    multi = wolfpack.findobject(item.gettag("house"))

    # 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:
        try:
            n = multiitem.player
        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()
示例#3
0
def taginfo_callback(player, tagnames, response):
	if response.button != 1:
		return

	object = wolfpack.findobject(tagnames[0])
	if not object:
		return
	tagnames = tagnames[1:]

	switches = response.switches
	for i in range(0, len(tagnames)):
		# Should the tag be deleted?
		if i * 2 + 1 in switches:
			oldvalue = object.gettag(tagnames[i])
			player.log(LOG_MESSAGE, u"Deleting tag '%s' from object 0x%x. Was: '%s' (%s).\n" % \
				(tagnames[i], object.serial, unicode(oldvalue), type(oldvalue).__name__))
			object.deltag(tagnames[i])
			object.resendtooltip()
			continue

		if (i * 2, i * 2 + 1) in response.text:
			# Get value and name of the tag
			name = response.text[i * 2]
			value = response.text[i * 2 + 1]

			# Should the value be interpreted as a number?
			if i * 2 in switches:
				if '.' in value or ',' in value:
					try:
						value = float(value)
					except:
						player.socket.sysmessage("Invalid floating point value for tag '%s': '%s'." % (name, value))
						continue # Skip to next tag
				else:
					try:
						value = int(value)
					except:
						player.socket.sysmessage("Invalid integer value for tag '%s': '%s'." % (name, value))
						continue # Skip to next tag

			try:
				name = str(name)
			except:
				player.socket.sysmessage("Invalid tagname: '%s'." % name)
				continue # Skip to next tag

			# Set the new tag value for the player
			oldvalue = object.gettag(tagnames[i])
			change = (name != tagnames[i]) or (type(oldvalue) != type(value)) or (oldvalue != value)

			if change:
				player.log(LOG_MESSAGE, u"Setting tag '%s' on object 0x%x to '%s' (%s).\n" % (unicode(name), object.serial, unicode(value), type(value).__name__))
				object.deltag(tagnames[i])
				object.settag(name, value)
				object.resendtooltip()
	return
示例#4
0
文件: remove.py 项目: thooge/Wolfpack
def doRemoveSerial( socket, serial ):
	object = wolfpack.findobject( serial )
	if object and object.isitem():
		socket.sysmessage("Found item object 0x%x for deletion." % serial )
		socket.player.log( LOG_MESSAGE, "Removed item 0x%x.\n" % serial )
		object.delete()
		return True
	else:
		socket.sysmessage("Object 0x%x could not be found for deletion." % serial )
		return False
	return False
示例#5
0
def goname(socket, command, arguments):
    if len(arguments) == 0:
        socket.sysmessage("Usage: goname <name>")
        return

    chars = wolfpack.chariterator()

    char = chars.first
    name = hash(arguments.lower())

    found = []
    while char:
        if hash(char.name.lower()) == name:
            if not char.rank > socket.player.rank:
                found.append(char)

        char = chars.next

    if socket.hastag("goname"):
        i = socket.gettag("goname") + 1
        if i >= len(found):
            # No more chars with the same name, start from the beginning
            i = 0
        socket.settag("goname", i)
    else:
        socket.settag("goname", 0)
        i = 0

    if len(found) == 0:
        socket.sysmessage("A character with the given name was not found.")
    else:
        pos = found[i].pos
        if pos.map == 0xFF:
            if found[i].npc:
                stablemaster = wolfpack.findobject(found[i].stablemaster)
            else:
                stablemaster = None

            if not stablemaster:
                socket.sysmessage(
                    "Not going to character '%s' [Serial: 0x%x]. They are on the internal map."
                    % (found[i].name, found[i].serial)
                )
            else:
                socket.sysmessage(
                    "Character '%s' [Serial: 0x%x] is stabled in object 0x%x."
                    % (found[i].name, found[i].serial, stablemaster.serial)
                )
        else:
            socket.sysmessage("Going to character '%s' [Serial: 0x%x]." % (found[i].name, found[i].serial))
            socket.player.removefromview()
            socket.player.moveto(pos)
            socket.player.update()
            socket.resendworld()
示例#6
0
def gouid(socket, command, arguments):
	try:
		uid = hex2dec(arguments)
	except:
		socket.symsessage('Usage: gouid <serial>')
		return

	if uid > 0x40000000:
		item = wolfpack.finditem(uid)
		if item:
			container = item.getoutmostitem()

			if container.container:
				container = container.container

			# Going to container
			socket.sysmessage('Going to item 0x%x (%s) [Top: 0x%x].' % (uid, item.getname(), container.serial))
			pos = container.pos
			socket.player.removefromview()
			socket.player.moveto(pos)
			socket.player.update()
			socket.resendworld()
			
			if item.container:
				socket.sendobject(item.container)
				if item.container.isitem():
					socket.sendcontainer(item.container)
		else:
			socket.sysmessage('No item with the serial 0x%x could be found.' % uid)
		return
	elif uid > 0:
		char = wolfpack.findchar(uid)
		if char and char.rank <= socket.player.rank:
			pos = char.pos
			if pos.map == 0xFF:
				if char.npc:
					stablemaster = wolfpack.findobject(char.stablemaster)
				else:
					stablemaster = None
				if not stablemaster:
					socket.sysmessage("Not going to character '%s' [Serial: 0x%x]. They are on the internal map." % (char.name, uid))
				else:
					socket.sysmessage("Character '%s' [Serial: 0x%x] is stabled in object 0x%x." % (char.name, uid, stablemaster.serial))
			else:
				socket.sysmessage('Going to char 0x%x (%s).' % (uid, char.name))
				socket.player.removefromview()
				socket.player.moveto(pos)
				socket.player.update()
				socket.resendworld()
		else:
			socket.sysmessage('No char with the serial 0x%x could be found.' % uid)
		return

	socket.sysmessage('You specified an invalid serial: 0x%x.' % uid)
示例#7
0
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
示例#8
0
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
示例#9
0
def processGainresObject(obj, args):
	if args[2] != magic_farming:
		return # The scripts have been reloaded

	objectlist = args[0] # We keep a reference here to prevent reallocation
	index = args[1]
	upperindex = min(index + CHECKSPERCYCLE, len(objectlist))

	# Process the list of objects
	for i in range(index, upperindex):
		try:
			object = wolfpack.findobject(objectlist[i])
			if object:
				if object.hastag("resourcecount") and object.gettag("resourcecount") >= actions[ object.baseid ][1]:
					continue
				else:
					addresource(object)
		except Exception, e:
			console.log(LOG_ERROR, "An error occured while checking farming object 0x%x: %s.\n" % (object.serial, str(e)))
示例#10
0
def processGainresObject(obj, args):
    if args[2] != magic_farming:
        return  # The scripts have been reloaded

    objectlist = args[0]  # We keep a reference here to prevent reallocation
    index = args[1]
    upperindex = min(index + CHECKSPERCYCLE, len(objectlist))

    # Process the list of objects
    for i in range(index, upperindex):
        try:
            object = wolfpack.findobject(objectlist[i])
            if object:
                if object.hastag("resourcecount") and object.gettag("resourcecount") >= actions[object.baseid][1]:
                    continue
                else:
                    addresource(object)
        except Exception, e:
            console.log(
                LOG_ERROR, "An error occured while checking farming object 0x%x: %s.\n" % (object.serial, str(e))
            )
示例#11
0
def customize( char, item ):
	if not checkAccess(char, item.multi, ACCESS_OWNER):
		char.socket.sysmessage('You are not the owner of this house.')
		return
	
	if not item.hastag( 'house' ):
		return

	multi = wolfpack.findobject( item.gettag( 'house' ) )
	# I Commented the last line... it servers for what exactly? no references for this
	#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
示例#12
0
def customize(char, item):
    if not checkAccess(char, item.multi, ACCESS_OWNER):
        char.socket.sysmessage("You are not the owner of this house.")
        return

    if not item.hastag("house"):
        return

    multi = wolfpack.findobject(item.gettag("house"))
    # I Commented the last line... it servers for what exactly? no references for this
    # 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
示例#13
0
def target_response( char, args, target ):
	if char.socket:
		char.socket.deltag('cast_target')

	spell = args[0]
	mode = args[1]
	item = args[3]
	args = args[2]
	if type(item) == int:
		item = wolfpack.findobject(item)
		# Object went out of scope
		if not item:
			fizzle(char)
			return

	# Char Targets
	if target.char and (spell.validtarget == TARGET_IGNORE or spell.validtarget == TARGET_CHAR):
		if target.char.invulnerable and spell.harmful:
			if char.socket:
				char.socket.clilocmessage(1061621)
			return False
		if target.char.dead and not spell.affectdead:
			if char.socket:
				char.socket.clilocmessage(501857)
			return False
		if not char.cansee(target.char):
			if char.socket:
				char.socket.clilocmessage(500237)
			return False
		if char.distanceto(target.char) > spell.range:
			if char.socket:
				char.socket.clilocmessage(500446)
			return False
		if not char.canreach(target.char, spell.range):
			if char.socket:
				char.socket.clilocmessage(500237)
			return False

		if type(spell.spellid) == int:
			message = "Casting spell %u (%s) on character %s (0x%x).\n"  % (spell.spellid, spell.__class__.__name__, target.char.name, target.char.serial)
		else:
			message = "Casting spell %s on character %s (0x%x).\n"  % (spell.__class__.__name__, target.char.name, target.char.serial)
		char.log(LOG_MESSAGE, message)
		spell.target(char, mode, TARGET_CHAR, target.char, args, item)

	# Item Target
	elif target.item and ( spell.validtarget == TARGET_IGNORE or spell.validtarget == TARGET_ITEM ):
		if not char.cansee(target.item):
			if char.socket:
				char.socket.clilocmessage(500237)
			return False
		if not char.canreach(target.item, spell.range):
			if char.socket:
				char.socket.clilocmessage(500237)
			return False

		message = u"Casting spell %u (%s) on item %s (0x%x).\n"  % (spell.spellid, spell.__class__.__name__, target.item.getname(), target.item.serial)
		char.log(LOG_MESSAGE, message)
		spell.target(char, mode, TARGET_ITEM, target.item, args, item)

	# Ground Target
	elif (target.item or target.char or target.pos) and (spell.validtarget == TARGET_IGNORE or spell.validtarget == TARGET_GROUND):
		pos = target.pos
		if target.item:
			item = target.item.getoutmostitem()
			if not item.container:
				pos = item.pos
			else:
				pos = item.container.pos
		elif target.char:
			pos = target.char.pos

		# See if the target is accesible
		if char.distanceto(pos) > spell.range:
			if char.socket:
				char.socket.clilocmessage(500446)
			return False
		if not char.canreach(target.pos, spell.range, target.model):
			if char.socket:
				char.socket.clilocmessage(500237)
			return False

		if type(spell.spellid) == int:
			message = "Casting spell %u (%s) on coordinate %s.\n"  % (spell.spellid, spell.__class__.__name__, str(pos))
		else:
			message = "Casting spell %s on coordinate %s.\n"  % (spell.__class__.__name__, str(pos))
		char.log(LOG_MESSAGE, message)
		spell.target(char, mode, TARGET_GROUND, pos, args, item)

	else:
		char.socket.clilocmessage(501857)
		return False
示例#14
0
def gump0( char, callback, item ):

	# Lets try Multi and some informations
	multi = wolfpack.findobject( item.gettag( 'house' ) )
	builton = str(multi.gettag('builton'))
	mvalue = str(multi.gettag('value'))

	gump_params = [
	"a house",
	"sign",
	str(item.multi.owner.name),
	str(builton),
	"never",
	str(mvalue),
	"0"]

	mygump = cGump()
	mygump.addRawLayout( "{page 0}" )
	mygump.addRawLayout( "{resizepic 0 0 5054 420 440}" )
	mygump.addRawLayout( "{gumppictiled 10 10 400 100 2624}" )
	mygump.addRawLayout( "{checkertrans 10 10 400 100}" )
	mygump.addRawLayout( "{gumppictiled 10 120 400 260 2624}" )
	mygump.addRawLayout( "{checkertrans 10 120 400 260}" )
	mygump.addRawLayout( "{gumppictiled 10 390 400 40 2624}" )
	mygump.addRawLayout( "{checkertrans 10 390 400 40}" )
	mygump.addRawLayout( "{button 250 410 4005 4007 1 0 0}" ) # close 
	mygump.addRawLayout( "{xmfhtmlgumpcolor 285 410 240 20 1060675 0 0 32767}" ) #write close
	mygump.addRawLayout( "{gumppic 10 10 100}" )
	mygump.addRawLayout( "{text 62 43 0 0}" )
	mygump.addRawLayout( "{text 74 57 0 1}" )
	mygump.addRawLayout( "{button 10 390 4005 4007 1 0 31}" ) #grant access 
	mygump.addRawLayout( "{xmfhtmlgumpcolor 45 390 240 20 1060676 0 0 32767}" )# write grant access
	mygump.addRawLayout( "{button 10 410 4005 4007 1 0 46}" ) #revoke access
	mygump.addRawLayout( "{xmfhtmlgumpcolor 45 410 240 20 1060677 0 0 32767}" )
	mygump.addRawLayout( "{button 150 10 4006 4007 1 0 2}" ) #open information page
	mygump.addRawLayout( "{xmfhtmlgumpcolor 195 10 200 20 1060668 0 0 16927}" )
	mygump.addRawLayout( "{button 150 30 4005 4007 1 0 17}" )#open  security page
	mygump.addRawLayout( "{xmfhtmlgumpcolor 195 30 200 20 1060669 0 0 32767}" )
	mygump.addRawLayout( "{button 150 50 4005 4007 1 0 32}" )#open  storage page
	mygump.addRawLayout( "{xmfhtmlgumpcolor 195 50 200 20 1060670 0 0 32767}" )
	mygump.addRawLayout( "{button 150 70 4005 4007 1 0 47}" )#open  customize page
	mygump.addRawLayout( "{xmfhtmlgumpcolor 195 70 200 20 1060671 0 0 32767}" )
	mygump.addRawLayout( "{button 150 90 4005 4007 1 0 62}" )#open  ownership page
	mygump.addRawLayout( "{xmfhtmlgumpcolor 195 90 200 20 1060672 0 0 32767}" )
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 130 200 20 1011242 0 0 32767}" )#write :Owned By: 
	mygump.addRawLayout( "{text 210 130 1152 2}" )
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 170 380 20 1018032 0 0 16927}" ) #This house is properly placed.
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 190 380 20 1018035 0 0 16927}" ) #This house is of classic design.
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 210 380 20 1060681 0 0 16927}" ) #This is a custom-built house.
	if isPublic(item.multi):
		mygump.addRawLayout( "{xmfhtmlgumpcolor 20 230 380 20 1060678 0 0 16927}" ) # This house is open to the public.
	else:
		mygump.addRawLayout( "{xmfhtmlgumpcolor 20 230 380 20 1060679 0 0 16927}" ) #This house is private
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 250 380 20 1062209 0 0 16927}" ) #This house is <a href = "?ForceTopic97">Automatically</a> refreshed.
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 290 200 20 1060692 0 0 16927}" ) #Built On:
	mygump.addRawLayout( "{text 250 290 1152 3}" ) #write third parameter 3 in white
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 310 200 20 1060693 0 0 16927}" )#last traded
	mygump.addRawLayout( "{text 250 310 1152 4}" ) # write param4
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 330 200 20 1061793 0 0 16927}" )#house value
	mygump.addRawLayout( "{text 250 330 1152 5}" ) #write param5
	mygump.addRawLayout( "{xmfhtmlgumpcolor 20 360 300 20 1011241 0 0 16927}" )#nbr of visit
	mygump.addRawLayout( "{text 350 360 1152 6}" ) #write param 6
	mygump.setCallback( callback )
	mygump.setArgs( [item] )
	#Add params
	for line in gump_params:
		mygump.addRawText( line )
	mygump.send( char )
示例#15
0
def taginfo_callback(player, tagnames, response):
    if response.button != 1:
        return

    object = wolfpack.findobject(tagnames[0])
    if not object:
        return
    tagnames = tagnames[1:]

    switches = response.switches
    for i in range(0, len(tagnames)):
        # Should the tag be deleted?
        if i * 2 + 1 in switches:
            oldvalue = object.gettag(tagnames[i])
            player.log(LOG_MESSAGE, u"Deleting tag '%s' from object 0x%x. Was: '%s' (%s).\n" % \
             (tagnames[i], object.serial, unicode(oldvalue), type(oldvalue).__name__))
            object.deltag(tagnames[i])
            object.resendtooltip()
            continue

        if (i * 2, i * 2 + 1) in response.text:
            # Get value and name of the tag
            name = response.text[i * 2]
            value = response.text[i * 2 + 1]

            # Should the value be interpreted as a number?
            if i * 2 in switches:
                if '.' in value or ',' in value:
                    try:
                        value = float(value)
                    except:
                        player.socket.sysmessage(
                            "Invalid floating point value for tag '%s': '%s'."
                            % (name, value))
                        continue  # Skip to next tag
                else:
                    try:
                        value = int(value)
                    except:
                        player.socket.sysmessage(
                            "Invalid integer value for tag '%s': '%s'." %
                            (name, value))
                        continue  # Skip to next tag

            try:
                name = str(name)
            except:
                player.socket.sysmessage("Invalid tagname: '%s'." % name)
                continue  # Skip to next tag

            # Set the new tag value for the player
            oldvalue = object.gettag(tagnames[i])
            change = (name != tagnames[i]) or (
                type(oldvalue) != type(value)) or (oldvalue != value)

            if change:
                player.log(
                    LOG_MESSAGE,
                    u"Setting tag '%s' on object 0x%x to '%s' (%s).\n" %
                    (unicode(name), object.serial, unicode(value),
                     type(value).__name__))
                object.deltag(tagnames[i])
                object.settag(name, value)
                object.resendtooltip()
    return
示例#16
0
def target_response(char, args, target):
    if char.socket:
        char.socket.deltag('cast_target')

    spell = args[0]
    mode = args[1]
    item = args[3]
    args = args[2]
    if type(item) == int:
        item = wolfpack.findobject(item)
        # Object went out of scope
        if not item:
            fizzle(char)
            return

    # Char Targets
    if target.char and (spell.validtarget == TARGET_IGNORE
                        or spell.validtarget == TARGET_CHAR):
        if target.char.invulnerable and spell.harmful:
            if char.socket:
                char.socket.clilocmessage(1061621)
            return False
        if (target.char.region and target.char.region.safe) and spell.harmful:
            if char.socket:
                char.socket.clilocmessage(
                    1001018
                )  # You can not perform negative acts on your target.
            return False
        if target.char.dead and not spell.affectdead:
            if char.socket:
                char.socket.clilocmessage(501857)
            return False
        if not char.cansee(target.char):
            if char.socket:
                char.socket.clilocmessage(500237)
            return False
        if char.distanceto(target.char) > spell.range:
            if char.socket:
                char.socket.clilocmessage(500446)
            return False
        if not char.canreach(target.char, spell.range):
            if char.socket:
                char.socket.clilocmessage(500237)
            return False

        if type(spell.spellid) == int:
            message = "Casting spell %u (%s) on character %s (0x%x).\n" % (
                spell.spellid, spell.__class__.__name__, target.char.name,
                target.char.serial)
        else:
            message = "Casting spell %s on character %s (0x%x).\n" % (
                spell.__class__.__name__, target.char.name, target.char.serial)
        char.log(LOG_MESSAGE, message)
        spell.target(char, mode, TARGET_CHAR, target.char, args, item)

    # Item Target
    elif target.item and (spell.validtarget == TARGET_IGNORE
                          or spell.validtarget == TARGET_ITEM):
        if not char.cansee(target.item):
            if char.socket:
                char.socket.clilocmessage(500237)
            return False
        if not char.canreach(target.item, spell.range):
            if char.socket:
                char.socket.clilocmessage(500237)
            return False

        message = u"Casting spell %u (%s) on item %s (0x%x).\n" % (
            spell.spellid, spell.__class__.__name__, target.item.getname(),
            target.item.serial)
        char.log(LOG_MESSAGE, message)
        spell.target(char, mode, TARGET_ITEM, target.item, args, item)

    # Ground Target
    elif (target.item or target.char
          or target.pos) and (spell.validtarget == TARGET_IGNORE
                              or spell.validtarget == TARGET_GROUND):
        pos = target.pos
        if target.item:
            if target.item.getoutmostchar():
                pos = target.item.getoutmostchar().pos
            else:
                item = target.item.getoutmostitem()
                if not item.container:
                    pos = item.pos
                else:
                    pos = item.container.pos
        elif target.char:
            pos = target.char.pos

        # See if the target is accesible
        if char.distanceto(pos) > spell.range:
            if char.socket:
                char.socket.clilocmessage(500446)
            return False
        if not char.canreach(pos, spell.range, target.model):
            if char.socket:
                char.socket.clilocmessage(500237)
            return False

        if type(spell.spellid) == int:
            message = "Casting spell %u (%s) on coordinate %s.\n" % (
                spell.spellid, spell.__class__.__name__, str(pos))
        else:
            message = "Casting spell %s on coordinate %s.\n" % (
                spell.__class__.__name__, str(pos))
        char.log(LOG_MESSAGE, message)
        spell.target(char, mode, TARGET_GROUND, pos, args, item)

    else:
        char.socket.clilocmessage(501857)
        return False
示例#17
0
def gump0(char, callback, item):

    # Lets try Multi and some informations
    multi = wolfpack.findobject(item.gettag("house"))
    builton = str(multi.gettag("builton"))
    mvalue = str(multi.gettag("value"))

    gump_params = ["a house", "sign", str(item.multi.owner.name), str(builton), "never", str(mvalue), "0"]

    mygump = cGump()
    mygump.addRawLayout("{page 0}")
    mygump.addRawLayout("{resizepic 0 0 5054 420 440}")
    mygump.addRawLayout("{gumppictiled 10 10 400 100 2624}")
    mygump.addRawLayout("{checkertrans 10 10 400 100}")
    mygump.addRawLayout("{gumppictiled 10 120 400 260 2624}")
    mygump.addRawLayout("{checkertrans 10 120 400 260}")
    mygump.addRawLayout("{gumppictiled 10 390 400 40 2624}")
    mygump.addRawLayout("{checkertrans 10 390 400 40}")
    mygump.addRawLayout("{button 250 410 4005 4007 1 0 0}")  # close
    mygump.addRawLayout("{xmfhtmlgumpcolor 285 410 240 20 1060675 0 0 32767}")  # write close
    mygump.addRawLayout("{gumppic 10 10 100}")
    mygump.addRawLayout("{text 62 43 0 0}")
    mygump.addRawLayout("{text 74 57 0 1}")
    mygump.addRawLayout("{button 10 390 4005 4007 1 0 31}")  # grant access
    mygump.addRawLayout("{xmfhtmlgumpcolor 45 390 240 20 1060676 0 0 32767}")  # write grant access
    mygump.addRawLayout("{button 10 410 4005 4007 1 0 46}")  # revoke access
    mygump.addRawLayout("{xmfhtmlgumpcolor 45 410 240 20 1060677 0 0 32767}")
    mygump.addRawLayout("{button 150 10 4006 4007 1 0 2}")  # open information page
    mygump.addRawLayout("{xmfhtmlgumpcolor 195 10 200 20 1060668 0 0 16927}")
    mygump.addRawLayout("{button 150 30 4005 4007 1 0 17}")  # open  security page
    mygump.addRawLayout("{xmfhtmlgumpcolor 195 30 200 20 1060669 0 0 32767}")
    mygump.addRawLayout("{button 150 50 4005 4007 1 0 32}")  # open  storage page
    mygump.addRawLayout("{xmfhtmlgumpcolor 195 50 200 20 1060670 0 0 32767}")
    mygump.addRawLayout("{button 150 70 4005 4007 1 0 47}")  # open  customize page
    mygump.addRawLayout("{xmfhtmlgumpcolor 195 70 200 20 1060671 0 0 32767}")
    mygump.addRawLayout("{button 150 90 4005 4007 1 0 62}")  # open  ownership page
    mygump.addRawLayout("{xmfhtmlgumpcolor 195 90 200 20 1060672 0 0 32767}")
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 130 200 20 1011242 0 0 32767}")  # write :Owned By:
    mygump.addRawLayout("{text 210 130 1152 2}")
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 170 380 20 1018032 0 0 16927}")  # This house is properly placed.
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 190 380 20 1018035 0 0 16927}")  # This house is of classic design.
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 210 380 20 1060681 0 0 16927}")  # This is a custom-built house.
    if isPublic(item.multi):
        mygump.addRawLayout("{xmfhtmlgumpcolor 20 230 380 20 1060678 0 0 16927}")  # This house is open to the public.
    else:
        mygump.addRawLayout("{xmfhtmlgumpcolor 20 230 380 20 1060679 0 0 16927}")  # This house is private
    mygump.addRawLayout(
        "{xmfhtmlgumpcolor 20 250 380 20 1062209 0 0 16927}"
    )  # This house is <a href = "?ForceTopic97">Automatically</a> refreshed.
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 290 200 20 1060692 0 0 16927}")  # Built On:
    mygump.addRawLayout("{text 250 290 1152 3}")  # write third parameter 3 in white
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 310 200 20 1060693 0 0 16927}")  # last traded
    mygump.addRawLayout("{text 250 310 1152 4}")  # write param4
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 330 200 20 1061793 0 0 16927}")  # house value
    mygump.addRawLayout("{text 250 330 1152 5}")  # write param5
    mygump.addRawLayout("{xmfhtmlgumpcolor 20 360 300 20 1011241 0 0 16927}")  # nbr of visit
    mygump.addRawLayout("{text 350 360 1152 6}")  # write param 6
    mygump.setCallback(callback)
    mygump.setArgs([item])
    # Add params
    for line in gump_params:
        mygump.addRawText(line)
    mygump.send(char)