def checkanvilandforge(char): if char.gm: return True # Check dynamic items. forge = 0 anvil = 0 items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 5) for item in items: if item.id == 0xFAF or item.id == 0xFB0: anvil = True elif item.id == 0xFB1 or (item.id >= 0x197A and item.id <= 0x19A9): forge = True if anvil and forge: return True # Check for static items for x in range(-2, 3): for y in range(-2, 3): statics = wolfpack.statics(char.pos.x + x, char.pos.y + y, char.pos.map, True) for tile in statics: dispid = tile[0] if dispid == 0xFAF or dispid == 0xFB0: anvil = True elif dispid == 0xFB1 or (dispid >= 0x197A and dispid <= 0x19A9): forge = True if anvil and forge: return True return False
def checkanvilandforge(char): if char.gm: return True # Check dynamic items. forge = False anvil = False items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 5) for item in items: if item.id in ANVILS: anvil = True elif item.id in FORGES: forge = True if anvil and forge: return True # Check for static items for x in range(-2, 3): for y in range(-2, 3): statics = wolfpack.statics(char.pos.x + x, char.pos.y + y, char.pos.map, True) for tile in statics: dispid = tile[0] if dispid in ANVILS: anvil = True elif dispid in FORGES: forge = True if anvil and forge: return True return False
def check_spot(char): x = char.pos.x y = char.pos.y z = char.pos.z map = char.pos.map # We can build on floor # Check for dynamic items tile = wolfpack.items(x, y, map) if tile: dynamic_floor = wolfpack.tiledata(tile[0].id)["floor"] if len(tile) and not dynamic_floor: return False # Check for dynamic items tile = wolfpack.statics(x, y, map, True) if tile: for i in tile: height = i[3] > z and i[3] < ( z + 20) # something is between the ground and +20? static_floor = wolfpack.tiledata(i[0])["floor"] static_roof = wolfpack.tiledata(i[0])["flag1"] & 0x10 if len( tile ) and height: #and and not static_floor and not static_roof: # seems that the floor flag is not used for all return False return True
def isWall(x, y, z, map): tiles = wolfpack.statics(x, y, map, 1) for tile in tiles: wall = wolfpack.tiledata(tile[0])["flag1"] & 0x010 if wall and (z + 16) > tile[3] and (tile[3] + wolfpack.tiledata(tile[0])["height"]) > z: return True return False
def export(char, args, choice): if choice.button != 1 or len(args) != 4: return False filename = choice.text[1] if len(filename) == 0: char.socket.sysmessage("Error: You need to provide a valid filename.") return False # Open the output file output = open( filename, "wb" ) # Note that we *force* the output to have lines terminated with \n\r if os.name == 'posix': newline = "\n" else: newline = "\r\n" warnings = '' i = 0 # There is no iterator for static items, so we have to check each coord for x in range(args[0], args[2] + 1): for y in range(args[1], args[3] + 1): # Check for static items statics = wolfpack.statics(x, y, char.pos.map, True) for item in statics: output.write( "0x%x %i %i %i 0x%x%s" % (item[0], item[1], item[2], item[3], item[4], newline)) i = i + 1 output.close() # Show a Report gump gump = cGump(x=100, y=100) gump.addBackground(id=0x2436, width=350, height=300) text = '<basefont color="#FEFEFE"><h3>Export</h3><br><basefont color="#FEFEFE">%d items have been exported to "%s".<br><br><basefont color="#ff0000"><u>Warnings:</u><br><basefont color="#FEFEFE">%s' % ( i, filename, warnings) gump.addHtmlGump(x=20, y=20, width=310, height=200, html=text, canScroll=1) gump.addText(x=265, y=250, text='Close', hue=0x835) gump.addButton(x=310, y=250, up=0x26af, down=0x26b1, returncode=0) gump.send(char) return True
def find(char, object=None): # check for dynamic items items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 2) for item in items: if item.id in object: return True # Check for static items for x in range(-2, 3): for y in range(-2, 3): statics = wolfpack.statics(char.pos.x + x, char.pos.y + y, char.pos.map, True) for tile in statics: dispid = tile[0] if dispid in object: return True return False
def export( char, args, choice ): if choice.button != 1 or len( args ) != 4: return False filename = choice.text[1] if len( filename ) == 0: char.socket.sysmessage( "Error: You need to provide a valid filename." ) return False # Open the output file output = open( filename, "wb" ) # Note that we *force* the output to have lines terminated with \n\r if os.name == 'posix': newline = "\n" else: newline = "\r\n" warnings = '' i = 0 # There is no iterator for static items, so we have to check each coord for x in range(args[0], args[2]+1): for y in range(args[1], args[3]+1): # Check for static items statics = wolfpack.statics(x, y, char.pos.map, True) for item in statics: output.write( "0x%x %i %i %i 0x%x%s" % (item[0], item[1], item[2], item[3], item[4], newline ) ) i = i + 1 output.close() # Show a Report gump gump = cGump( x=100, y=100 ) gump.addBackground( id=0x2436, width=350, height=300 ) text = '<basefont color="#FEFEFE"><h3>Export</h3><br><basefont color="#FEFEFE">%d items have been exported to "%s".<br><br><basefont color="#ff0000"><u>Warnings:</u><br><basefont color="#FEFEFE">%s' % ( i, filename, warnings ) gump.addHtmlGump( x=20, y=20, width=310, height=200, html=text, canScroll=1 ) gump.addText( x=265, y=250, text='Close', hue=0x835 ) gump.addButton( x=310, y=250, up=0x26af, down=0x26b1, returncode=0 ) gump.send( char ) return True
def checkforge(char): if char.gm: return True # Check dynamic items. items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 5) for item in items: if item.id == 0xFB1 or (item.id >= 0x197A and item.id <= 0x19A9): return True # Check for static items for x in range(-2, 3): for y in range(-2, 3): statics = wolfpack.statics(char.pos.x + x, char.pos.y + y, char.pos.map, True) for tile in statics: dispid = tile[0] if dispid == 0xFB1 or (dispid >= 0x197A and dispid <= 0x19A9): return True return False
def checkmill( pos ): found = 0 # Dynamic items items = wolfpack.items( pos.x, pos.y, pos.map, MILL_RANGE ) for item in items: if item.id in flour_mill: found = 1 break # static items if not found: # Check for static items for x in range(-2, 3): for y in range(-2, 3): statics = wolfpack.statics(pos.x + x, pos.y + y, pos.map, True) for tile in statics: dispid = tile[0] if dispid in flour_mill: found = 1 break return found
def check_spot( char ): x = char.pos.x y = char.pos.y z = char.pos.z map = char.pos.map # We can build on floor # Check for dynamic items tile = wolfpack.items( x, y, map ) if tile: dynamic_floor = wolfpack.tiledata(tile[0].id)["floor"] if len( tile ) and not dynamic_floor: return False # Check for dynamic items tile = wolfpack.statics(x, y, map, True) if tile: for i in tile: height = i[3] > z and i[3] < (z+20) # something is between the ground and +20? static_floor = wolfpack.tiledata(i[0])["floor"] static_roof = wolfpack.tiledata(i[0])["flag1"] & 0x10 if len( tile ) and height: #and and not static_floor and not static_roof: # seems that the floor flag is not used for all return False return True
def response( char, args, target ): socket = char.socket pos = target.pos if skills.skilltable[ FISHING ][ skills.UNHIDE ] and char.hidden: char.removefromview() char.hidden = False char.update() # First: Check Distance (easiest) if char.pos.map != pos.map or char.pos.distance( pos ) > FISHING_MAX_DISTANCE: socket.clilocmessage( 0x7a4f0, "", 0x3b2, 3, char ) # You need to be closer to the water to fish! return # Second: Check Map/Static/Dynamic Water and eventual blocking stuff above it validspot = 0 blockedspot = 0 deepwater = 0 mapTile = wolfpack.map( pos.x, pos.y, pos.map ) # Simple check for saving CPU time (trusted-check) if not target.model in staticWater and not mapTile[ "id" ] in mapWater: socket.clilocmessage( 0x7a4f2, "", 0x3b2, 3, char ) # You need water to fish in! return # Check dynamics first ( And check if any objects start at z -> z + 13 ) items = wolfpack.items( pos.x, pos.y, pos.map, 1 ) # 1: Exact for item in items: if item.id in staticWater and item.pos.z == pos.z and item.visible: validspot = 1 deepwater = 0 break # Then check statics ( And check if any objects start at z -> z + 13 ) staticitems = wolfpack.statics( pos.x, pos.y, pos.map, 1 ) # Don't put this in any conditional we need it later if not validspot: for item in staticitems: if item[0] in staticWater and item[3] == pos.z: validspot = 1 deepwater = 0 break # Last resort check (Map) if not validspot and ( mapTile[ "id" ] in mapWater and mapTile[ "z" ] == pos.z ): validspot = 1 deepwater = 0 if not validspot: socket.clilocmessage( 0x7a4f2, "", 0x3b2, 3, char ) # You need water to fish in! return # Check if there is *anything* above that spot for item in items: if ( not item.id in staticWater ) and ( item.pos.z >= pos.z ) and ( item.pos.z <= pos.z + FISHING_BLOCK_RANGE ): # Check if the tiledata defines this as "impassable" or "surface" tile = wolfpack.tiledata( item.id ) if tile[ "blocking" ] or tile[ "floor" ]: blockedspot = 1 break # only check if we're not blocked already if not blockedspot: for item in staticitems: if ( not item[ 'id' ] in staticWater ) and ( item[ "z" ] >= pos.z ) and ( item[ "z" ] <= pos.z + FISHING_BLOCK_RANGE ): tile = wolfpack.tiledata( item.id ) if tile[ "blocking" ] or tile[ "floor" ]: blockedspot = 1 break # If the targetted tile is below map height check that as well mapZ = mapTile[ "z" ] if not blockedspot and pos.z < mapZ: if pos.z > ( mapZ - FISHING_BLOCK_RANGE ): blockedspot = 1 if blockedspot: socket.clilocmessage( 0x7a4f5, "", 0x3b2, 3, char ) # You can't reach the water there. return # Turn to the position we're fishing at char.turnto( pos ) # Show the Fishing animation char.action( 0x0c ) # Wearout of fishing poles ? # ID: 0x7AD86 (0) # You broke your fishing pole. socket.settag( 'is_fishing', int( wolfpack.time.currenttime() + 5000 ) ) # Times out after 5000ms char.addtimer( 2500, effecttimer, [ pos, deepwater ] ) char.addtimer( 5000, itemtimer, [ pos, deepwater, args[0] ] ) pass
def response(char, args, target): char.turnto(target.pos) item = wolfpack.finditem(args[0]) if not char.canreach(target.pos, 4) and not item.container == target.item.container: char.socket.clilocmessage(500295) return if not item: return if not item.hastag('resname'): return False else: resname = item.gettag('resname') if target.item: targetitem = target.item elif target.char: if not target.char.baseid == 'fire_beetle': char.socket.clilocmessage(501973) return else: targetchar = target.char # Static Forges can be used, too else: if char.pos.distance(target.pos) > 3: char.socket.clilocmessage(0x7A258) # You can't reach... return True statics = wolfpack.statics(target.pos.x, target.pos.y, target.pos.map, True) for tile in statics: dispid = tile[0] if dispid in FORGES: dosmelt(char, [item, resname]) return True # We found no static forge char.socket.clilocmessage(501973) return # We go onto creating ingots here. if target.item and target.item.id in FORGES: if item.baseid in DEF_ORES: if char.pos.distance(target.pos) > 3: char.socket.clilocmessage(0x7A258) # You can't reach... return True else: dosmelt(char, [item, resname]) return True # We can use Fire Beetles like a forge if target.char and target.char.baseid == 'fire_beetle': if item.baseid in DEF_ORES: if char.pos.distance(target.pos) > 3: char.socket.clilocmessage(0x7A258) # You can't reach... return True else: dosmelt(char, [item, resname]) return True # This is for merging the ore piles elif target.item and target.item.baseid in DEF_ORES: if targetitem.serial == item.serial: return False if not targetitem.hastag('resname'): char.socket.clilocmessage(501986, '', GRAY) return False # Largest Ore Pile if item.baseid == DEF_ORES[ 3] and item.color == targetitem.color and item.gettag( 'resname') == targetitem.gettag('resname'): if targetitem.getoutmostchar() != char: if char.pos.distance(target.pos) > 2: # The ore is too far away. char.socket.clilocmessage(501976, '', GRAY) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 4) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) elif targetitem.baseid == item.baseid: targetitem.amount += item.amount targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) # Just update Weight char.updatestats() return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 4) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) elif targetitem.baseid == item.baseid: targetitem.amount += item.amount targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage(501971, '', GRAY) # Just update Weight char.updatestats() return True # Second Largest Ore elif item.baseid == DEF_ORES[ 2] and item.color == targetitem.color and item.gettag( 'resname') == targetitem.gettag('resname'): if targetitem.getoutmostchar() != char: if char.pos.distance(target.pos) > 2: # The ore is too far away. char.socket.clilocmessage(501976, '', GRAY) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[ 1] or targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[3]: return False return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[3]: return False return True # Second Smallest elif item.baseid == DEF_ORES[ 1] and item.color == targetitem.color and item.gettag( 'resname') == targetitem.gettag('resname'): if targetitem.getoutmostchar() != char: if char.pos.distance(target.pos) > 2: char.socket.clilocmessage(0x7A258) # You can't reach... return True else: if targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[3]: return False return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += (item.amount * 2) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[3]: return False return True # Smallest elif item.baseid == DEF_ORES[ 0] and item.color == targetitem.color and item.gettag( 'resname') == targetitem.gettag('resname'): if targetitem.getoutmostchar() != char: if char.pos.distance(target.pos) > 2: # The ore is too far away. char.socket.clilocmessage(501976) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 1] or targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[3]: char.socket.sysmessage( tr("You can not create a larger pile from a small pile of ore." ), GRAY) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() char.socket.sysmessage( tr("You combine the two ore piles to create a single pile of ore." ), GRAY) # Just update Weight char.updatestats() return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[ 1] or targetitem.baseid == DEF_ORES[ 2] or targetitem.baseid == DEF_ORES[3]: char.socket.sysmessage( tr("You can not create a larger pile from a small pile of ore." ), GRAY) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() char.socket.sysmessage( tr("You combine the two ore piles to create a single pile of ore." ), GRAY) # Just update Weight char.updatestats() return True
def response( char, args, target ): socket = char.socket pos = target.pos if skills.skilltable[ FISHING ][ skills.UNHIDE ] and char.hidden: char.reveal() # Check Map/Static/Dynamic Water and eventual blocking stuff above it validspot = 0 blockedspot = 0 deepwater = 0 mapTile = wolfpack.map( pos.x, pos.y, pos.map ) # Simple check for saving CPU time (trusted-check) if not target.model in staticWater and not mapTile[ "id" ] in mapWater: socket.clilocmessage( 0x7a4f2, "", 0x3b2, 3, char ) # You need water to fish in! return # Check Distance if char.pos.map != pos.map or char.pos.distance( pos ) > FISHING_MAX_DISTANCE: socket.clilocmessage( 0x7a4f0, "", 0x3b2, 3, char ) # You need to be closer to the water to fish! return # Check dynamics first ( And check if any objects start at z -> z + 13 ) items = wolfpack.items( pos.x, pos.y, pos.map, 1 ) # 1: Exact for item in items: if item.id in staticWater and item.pos.z == pos.z and item.visible: validspot = 1 deepwater = 0 break # Then check statics ( And check if any objects start at z -> z + 13 ) staticitems = wolfpack.statics( pos.x, pos.y, pos.map, 1 ) # Don't put this in any conditional we need it later if not validspot: for item in staticitems: if item[0] in staticWater and item[3] == pos.z: validspot = 1 deepwater = 0 break # Last resort check (Map) if not validspot and ( mapTile[ "id" ] in mapWater and mapTile[ "z" ] == pos.z ): validspot = 1 deepwater = 0 if not validspot: socket.clilocmessage( 0x7a4f2, "", 0x3b2, 3, char ) # You need water to fish in! return # Check if there is *anything* above that spot for item in items: if ( not item.id in staticWater ) and ( item.pos.z >= pos.z ) and ( item.pos.z <= pos.z + FISHING_BLOCK_RANGE ): # Check if the tiledata defines this as "impassable" or "surface" tile = wolfpack.tiledata( item.id ) if tile[ "blocking" ] or tile[ "floor" ]: blockedspot = 1 break # only check if we're not blocked already if not blockedspot: for item in staticitems: if ( not item[ 0 ] in staticWater ) and ( item[ 3 ] >= pos.z ) and ( item[ 3 ] <= pos.z + FISHING_BLOCK_RANGE ): tile = wolfpack.tiledata( item[0] ) if tile[ "blocking" ] or tile[ "floor" ]: blockedspot = 1 break # If the targetted tile is below map height check that as well mapZ = mapTile[ "z" ] if not blockedspot and pos.z < mapZ: if pos.z > ( mapZ - FISHING_BLOCK_RANGE ): blockedspot = 1 if blockedspot: socket.clilocmessage( 0x7a4f5, "", 0x3b2, 3, char ) # You can't reach the water there. return # Turn to the position we're fishing at char.turnto( pos ) # Show the Fishing animation char.action( 0x0c ) socket.settag( 'is_fishing', int( wolfpack.time.currenttime() + 5000 ) ) # Times out after 5000ms char.addtimer( 2500, effecttimer, [ pos, deepwater ] ) char.addtimer( 5000, itemtimer, [ pos, deepwater, args[0] ] ) pass
def response( char, args, target ): char.turnto(target.pos) item = wolfpack.finditem(args[0]) if not char.canreach(target.pos, 4) and not item.container == target.item.container: char.socket.clilocmessage(500295) return if not item: return if not item.hastag( 'resname' ): return False else: resname = item.gettag( 'resname' ) if target.item: targetitem = target.item elif target.char: if not target.char.baseid == 'fire_beetle': char.socket.clilocmessage(501973) return else: targetchar = target.char # Static Forges can be used, too else: if char.pos.distance( target.pos ) > 3: char.socket.clilocmessage( 0x7A258 ) # You can't reach... return True statics = wolfpack.statics(target.pos.x, target.pos.y, target.pos.map, True) for tile in statics: dispid = tile[0] if dispid in FORGES: dosmelt( char, [ item, resname ] ) return True # We found no static forge char.socket.clilocmessage(501973) return # We go onto creating ingots here. if target.item and target.item.id in FORGES: if item.baseid in DEF_ORES: if char.pos.distance( target.pos ) > 3: char.socket.clilocmessage( 0x7A258 ) # You can't reach... return True else: dosmelt( char, [ item, resname ] ) return True # We can use Fire Beetles like a forge if target.char and target.char.baseid == 'fire_beetle': if item.baseid in DEF_ORES: if char.pos.distance( target.pos ) > 3: char.socket.clilocmessage( 0x7A258 ) # You can't reach... return True else: dosmelt( char, [ item, resname ] ) return True # This is for merging the ore piles elif target.item and target.item.baseid in DEF_ORES: if targetitem.serial == item.serial: return False if not targetitem.hastag('resname'): char.socket.clilocmessage( 501986, '', GRAY ) return False # Largest Ore Pile if item.baseid == DEF_ORES[3] and item.color == targetitem.color and item.gettag( 'resname' ) == targetitem.gettag( 'resname' ): if targetitem.getoutmostchar() != char: if char.pos.distance( target.pos ) > 2: # The ore is too far away. char.socket.clilocmessage( 501976, '', GRAY) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 4 ) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) elif targetitem.baseid == item.baseid: targetitem.amount += item.amount targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) # Just update Weight char.updatestats() return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 4 ) targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) elif targetitem.baseid == item.baseid: targetitem.amount += item.amount targetitem.update() item.delete() # Select the forge on which to smelt the ore, or another pile of ore with which to combine it. char.socket.clilocmessage( 501971, '', GRAY ) # Just update Weight char.updatestats() return True # Second Largest Ore elif item.baseid == DEF_ORES[2] and item.color == targetitem.color and item.gettag( 'resname' ) == targetitem.gettag( 'resname' ): if targetitem.getoutmostchar() != char: if char.pos.distance( target.pos ) > 2: # The ore is too far away. char.socket.clilocmessage( 501976, '', GRAY) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[1] or targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[3]: return False return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[3]: return False return True # Second Smallest elif item.baseid == DEF_ORES[1] and item.color == targetitem.color and item.gettag( 'resname' ) == targetitem.gettag( 'resname' ): if targetitem.getoutmostchar() != char: if char.pos.distance( target.pos ) > 2: char.socket.clilocmessage( 0x7A258 ) # You can't reach... return True else: if targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[3]: return False return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[1]: targetitem.amount += item.amount targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += ( item.amount * 2 ) targetitem.update() item.delete() # Just update Weight char.updatestats() return True elif targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[3]: return False return True # Smallest elif item.baseid == DEF_ORES[0] and item.color == targetitem.color and item.gettag( 'resname' ) == targetitem.gettag( 'resname' ): if targetitem.getoutmostchar() != char: if char.pos.distance( target.pos ) > 2: # The ore is too far away. char.socket.clilocmessage( 501976 ) return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[1] or targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[3]: char.socket.sysmessage( tr("You can not create a larger pile from a small pile of ore."), GRAY ) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() char.socket.sysmessage( tr("You combine the two ore piles to create a single pile of ore."), GRAY ) # Just update Weight char.updatestats() return True else: # Merge the ore piles if targetitem.baseid == DEF_ORES[1] or targetitem.baseid == DEF_ORES[2] or targetitem.baseid == DEF_ORES[3]: char.socket.sysmessage( tr("You can not create a larger pile from a small pile of ore."), GRAY ) elif targetitem.baseid == DEF_ORES[0]: targetitem.amount += item.amount targetitem.update() item.delete() char.socket.sysmessage( tr("You combine the two ore piles to create a single pile of ore."), GRAY ) # Just update Weight char.updatestats() return True