def wipe(char, args, choice): if not args or not choice: return False if choice.button != 1 or len(args) != 4: return False if len(choice.switches) != 1: char.socket.sysmessage("Error: You did not confirm your wipe.") char.socket.sysmessage("Safeguard: Wipe has been canceled.") return False if len(args) == 4 and len(choice.switches) == 1 and choice.button == 1: format = choice.switches[0] iterator = wolfpack.itemregion(args[0], args[1], args[2], args[3], char.pos.map) item = iterator.first icount = 0 while item: if format == 1: # Confirmed Wipe item.delete() icount += 1 else: char.socket.sysmessage("Error: You did not confirm your wipe.") item = iterator.next char.socket.sysmessage("Deleted %i objects during the wipe." % icount) return True else: return False
def wipeBoundingBox( socket, target1, target2, argstring ): if target1.pos.map != target2.pos.map: return False x1 = min( target1.pos.x, target2.pos.x ) x2 = max( target1.pos.x, target2.pos.x ) y1 = min( target1.pos.y, target2.pos.y ) y2 = max( target1.pos.y, target2.pos.y ) iterator = wolfpack.itemregion( x1, y1, x2, y2, target2.pos.map ) item = iterator.first count = 0 if( argstring and len(argstring) == 2 ): (z, baseid) = argstring else: baseid = argstring z = None while item: if (not z or z == item.pos.z) and (not baseid or item.baseid == baseid): item.delete() count += 1 item = iterator.next socket.sysmessage( "%i items removed" % count ) return True
def wipe( char, args, choice ): if not args or not choice: return False if choice.button != 1 or len( args ) != 4: return False if len( choice.switches ) != 1: char.socket.sysmessage( "Error: You did not confirm your wipe." ) char.socket.sysmessage( "Safeguard: Wipe has been canceled." ) return False if len(args) == 4 and len(choice.switches) == 1 and choice.button == 1: format = choice.switches[0] iterator = wolfpack.itemregion( args[0], args[1], args[2], args[3], char.pos.map ) item = iterator.first icount = 0 while item: if format == 1: # Confirmed Wipe item.delete() icount += 1 else: char.socket.sysmessage( "Error: You did not confirm your wipe." ) item = iterator.next char.socket.sysmessage( "Deleted %i objects during the wipe." % icount ) return True else: return False
def tileResponse(player, arguments, target): if( len(arguments) < 6 ): player.socket.sysmessage( "Please select the second corner." ) player.socket.attachtarget( "commands.tilemove.tileResponse", list(arguments) + [target.pos] ) return socket = player.socket xmod = int( arguments[0] ) ymod = int( arguments[1] ) zmod = int( arguments[2] ) if( arguments[3] == None ): newmap = None else: newmap = int( arguments[3] ) if( arguments[4] == None ): z0 = None else: z0 = int( arguments[4] ) x1 = min( arguments[5].x, target.pos.x ) x2 = max( arguments[5].x, target.pos.x ) y1 = min( arguments[5].y, target.pos.y ) y2 = max( arguments[5].y, target.pos.y ) unlimited = player.account.authorized("Misc", "Unlimited Tile") count = ((x2 - x1) + 1) * ((y2 - y1) + 1) # Cap at 250 items if not an admin is using it if( not unlimited and count > 250 ): player.socket.sysmessage( "You are not allowed to move more than 250 items at once." ) return count = 0 items = [] iterator = wolfpack.itemregion( x1, y1, x2, y2, target.pos.map ) item = iterator.first # We have to copy the items in a list # because moving them inside the rectangle will change the iterator while item: if( z0 == None or z0 == item.pos.z ): items.append( item ) item = iterator.next for item in items: 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() count += 1 socket.sysmessage( "%i items moved" % count )
def wipeBoundingBox( socket, target1, target2 ): count = 0 iterator = wolfpack.itemregion( target1.pos.x, target1.pos.y, target2.pos.x, target2.pos.y, target2.pos.map ) item = iterator.first while item: item.delete() item = iterator.next count += 1; socket.sysmessage( "%i items removed" % count ) return 1
def wipeBoundingBox(socket, target1, target2, argstring): if target1.pos.map != target2.pos.map: return False x1 = min(target1.pos.x, target2.pos.x) x2 = max(target1.pos.x, target2.pos.x) y1 = min(target1.pos.y, target2.pos.y) y2 = max(target1.pos.y, target2.pos.y) iterator = wolfpack.itemregion(x1, y1, x2, y2, target2.pos.map) item = iterator.first count = 0 if (argstring and (type(argstring) == list or type(argstring) == tuple)): (z, baseid) = argstring else: baseid = argstring z = None while item: if (type(z) != int or z == item.pos.z) and (not baseid or item.baseid == baseid): item.delete() count += 1 else: if baseid and baseid.lower() == "nomulti": if not item.multi: item.delete() count += 1 else: if baseid and baseid.lower() == "onlymulti": if item.multi: item.delete() count += 1 item = iterator.next socket.sysmessage(tr("%i items removed") % count) if socket.player: socket.player.log( wolfpack.consts.LOG_MESSAGE, tr("Nuking from (%d,%d) to (%d,%d). %d items deleted. Arguments given: %s \n" ) % (x1, y1, x2, y2, count, argstring)) else: wolfpack.log( wolfpack.consts.LOG_MESSAGE, tr("Nuking from (%d,%d) to (%d,%d). %d items deleted. Arguments given: %s (Socket-ID: %s)\n" ) % (x1, y1, x2, y2, count, argstring, socket.id)) return True
def wipeBoundingBox( socket, target1, target2, argstring ): if target1.pos.map != target2.pos.map: return False x1 = min( target1.pos.x, target2.pos.x ) x2 = max( target1.pos.x, target2.pos.x ) y1 = min( target1.pos.y, target2.pos.y ) y2 = max( target1.pos.y, target2.pos.y ) iterator = wolfpack.itemregion( x1, y1, x2, y2, target2.pos.map ) item = iterator.first count = 0 if( argstring and (type(argstring) == list or type(argstring) == tuple) ): (z, baseid) = argstring else: baseid = argstring z = None while item: if (type(z) != int or z == item.pos.z) and (not baseid or item.baseid == baseid): item.delete() count += 1 else: if baseid and baseid.lower() == "nomulti": if not item.multi: item.delete() count += 1 else: if baseid and baseid.lower() == "onlymulti": if item.multi: item.delete() count += 1 item = iterator.next socket.sysmessage( tr("%i items removed") % count ) if socket.player: socket.player.log(wolfpack.consts.LOG_MESSAGE, tr("Nuking from (%d,%d) to (%d,%d). %d items deleted. Arguments given: %s \n") % (x1,y1,x2,y2,count,argstring) ) else: wolfpack.log(wolfpack.consts.LOG_MESSAGE, tr("Nuking from (%d,%d) to (%d,%d). %d items deleted. Arguments given: %s (Socket-ID: %s)\n") % (x1,y1,x2,y2,count,argstring,socket.id) ) return True
def export( char, args, choice ): if choice.button != 1 or len( args ) != 4: return 1 filename = choice.text[1] if len( choice.switches ) != 1: char.socket.sysmessage( "Error: len(choice.switches) != 1." ) return 1 format = choice.switches[0] if len( filename ) == 0: char.socket.sysmessage( "Error: You need to provide a valid filename." ) return 1 # Open the output file output = open( filename, "wb" ) # Note that we *force* the output to have lines terminated with \n\r iterator = wolfpack.itemregion( args[0], args[1], args[2], args[3], char.pos.map ) warnings = '' if os.name == 'posix': newline = "\n" else: newline = "\r\n" item = iterator.first i = 0 while item: if not item.baseid in nonsaves and not item.corpse and len( item.spawnregion ) == 0: # Build our string if format == 1: # Sphere 51a output.write( "[WORLDITEM 0%x]%s" % ( item.id, newline ) ) output.write( "SERIAL=0%x%s" % ( item.serial, newline ) ) if item.name != '#': output.write( "NAME=%s%s" % ( item.name, newline ) ) output.write( "ID=0%x%s" % ( item.id, newline ) ) output.write( "COLOR=0%x%s" % ( item.color, newline ) ) output.write( "P=%i,%i,%i%s%s" % ( item.pos.x, item.pos.y, item.pos.z, newline, newline ) ) elif format == 2: # WSC, Lonewolf Style, Compatible with Linux Worldforge output.write( "SECTION WORLDITEM%s" % newline ) output.write( "{%s" % newline ) output.write( "SERIAL %i%s" % ( item.serial, newline ) ) output.write( "ID %i%s" % ( item.id, newline ) ) if item.baseid != '': output.write( "BASEID %s%s" % ( item.baseid, newline ) ) if item.name != '#' or item.name != '': output.write( "NAME %s%s" % ( item.name, newline ) ) output.write( "X %i%s" % ( item.pos.x, newline ) ) output.write( "Y %i%s" % ( item.pos.y, newline ) ) output.write( "Z %i%s" % ( item.pos.z, newline ) ) output.write( "MAP %i%s" % ( item.pos.map, newline ) ) if item.type: output.write( "TYPE %i%s" % ( item.type, newline ) ) # World Freeze Requirement else: output.write( "TYPE 255%s" % newline ) # World Freeze Requirement output.write( "COLOR %i%s" % ( item.color, newline ) ) output.write( "CONT -1%s" % newline ) output.write( "}%s%s" % ( newline, newline ) ) else: # Text output.write( "%s 0x%x %i %i %i %i 0x%x%s" % ( item.baseid, item.id, item.pos.x, item.pos.y, item.pos.z, item.pos.map, item.color, newline ) ) # Older Format, no baseid/map saved #output.write( "0x%x %i %i %i 0x%x%s" % ( item.id, item.pos.x, item.pos.y, item.pos.z, item.color, newline ) ) if item.amount > 1: warnings += 'Item %s has an amount of %i. This information will be lost when made static.<br><br>' % ( hex( item.serial ), item.amount ) eventlist = item.scripts if len( eventlist ) > 0: warnings += 'Item %s has events (%s) assigned to it. It wont be usable when made static.<br><br>' % ( hex( item.serial ), eventlist ) if item.type != 0: warnings += 'Item %s is of type %i. It wont be usable when made static.<br><br>' % ( hex( item.serial ), item.type ) i += 1 item = iterator.next output.close() # Show a Report gump gump = cGump( x=100, y=100 ) gump.addBackground( id=0x2436, width=350, height=300 ) #gump.addCheckerTrans( 15, 15, 320, 270 ) 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 )
def potionregion( cserial, iserial, bonus=0 ): char = wolfpack.findchar( cserial ) item = wolfpack.finditem( iserial ) if not item or not char: return False ppos = item.pos # Defaults outradius = 0 potiontype = 11 kegfill = 0 iskeg = False potiontype = getPotionType( item ) if not potiontype in [ 11, 12, 13 ]: potiontype = 11 if potiontype == 11: outradius = 1 elif potiontype == 12: outradius = 2 elif potiontype == 13: outradius = randint( 2, 3 ) else: outradius = 1 # Potion Keg Radius Override! if isPotionkeg( item ): kegfill = int( item.gettag( 'kegfill' ) ) if potiontype in [11, 12, 13] and kegfill >= 1: if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 outradius = max( 1, outradius ) # Potion is thrown on the ground if not item.container: x1 = min( int( ppos.x - outradius ), int( ppos.x + outradius ) ) x2 = max( int( ppos.x - outradius ), int( ppos.x + outradius ) ) y1 = min( int( ppos.y - outradius ), int( ppos.y + outradius ) ) y2 = max( int( ppos.y - outradius ), int( ppos.y + outradius ) ) # Character Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, ppos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( target, item, outradius ): potiondamage( cserial, target, iserial, bonus, potiontype ) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, ppos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( cserial, iserial, chainbomb.serial, outradius ) chainbomb = chainregion.next return # Potion is in a container else: x1 = min( int(char.pos.x - outradius), int(char.pos.x + outradius) ) x2 = max( int(char.pos.x - outradius), int(char.pos.x + outradius) ) y1 = min( int(char.pos.y - outradius), int(char.pos.y + outradius) ) y2 = max( int(char.pos.y - outradius), int(char.pos.y + outradius) ) # Area Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, char.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( char, target, outradius ): potiondamage( cserial, target, iserial, bonus, potiontype ) target = damageregion.next else: target = damageregion.next potion_chainlist = [] # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( cserial, iserial, chainbomb.serial, outradius ) chainbomb = chainregion.next return True
def DoMapRegion( x_start, y_start, squareregionsize, mapid ): x_end = x_start + squareregionsize y_end = y_start + squareregionsize if mapid == 0: if x_start >= MAP0_WIDTH: return if y_start >= MAP0_HEIGHT: return if x_end > MAP0_WIDTH: x_end = MAP0_WIDTH if y_end > MAP0_HEIGHT: y_end = MAP0_HEIGHT elif mapid == 1: if x_start >= MAP1_WIDTH: return if y_start >= MAP1_HEIGHT: return if x_end > MAP1_WIDTH: x_end = MAP1_WIDTH if y_end > MAP1_HEIGHT: y_end = MAP1_HEIGHT elif mapid == 2: if x_start >= MAP2_WIDTH: return if y_start >= MAP2_HEIGHT: return if x_end > MAP2_WIDTH: x_end = MAP2_WIDTH if y_end > MAP2_HEIGHT: y_end = MAP2_HEIGHT elif mapid == 3: if x_start >= MAP3_WIDTH: return if y_start >= MAP3_HEIGHT: return if x_end > MAP3_WIDTH: x_end = MAP3_WIDTH if y_end > MAP3_HEIGHT: y_end = MAP3_HEIGHT else: return iter = wolfpack.itemregion(x_start, y_start, x_end, y_end, mapid) items = [] item = iter.first while item: items.append(item) item = iter.next todelete = [] item = iter.first while item: for itemb in items: if item == itemb: continue if item.pos != itemb.pos or item.id != itemb.id: continue if itemb not in todelete: todelete.append(itemb) items.remove(itemb) if item in items: items.remove(item) item = iter.next for item in todelete: item.delete() item.update() return
def backupWorld( char, args, choice ): if choice.button != 1 or len( args ) != 4: return True filename = choice.text[1] if len( choice.switches ) != 1: char.socket.sysmessage( "Error: len(choice.switches) != 1." ) return True format = choice.switches[0] if len( filename ) == 0: char.socket.sysmessage( "Error: You need to provide a valid filename." ) return True # Open the output file output = open( filename, "wb" ) iterator = wolfpack.itemregion( args[0], args[1], args[2], args[3], 0 ) warnings = '' if os.name == 'posix': newline = "\n" else: newline = "\r\n" item = iterator.first i = 0 while item: if not item.baseid in nonsaves and not item.corpse and len( item.spawnregion ) == 0: if format == 2: # WSC, Lonewolf Style, Compatible with Linux Worldforge output.write( "SECTION WORLDITEM%s" % newline ) output.write( "{%s" % newline ) output.write( "SERIAL %i%s" % ( item.serial, newline ) ) output.write( "ID %i%s" % ( item.id, newline ) ) if item.baseid != '': output.write( "BASEID %s%s" % ( item.baseid, newline ) ) if item.name != '#' or item.name != '': output.write( "NAME %s%s" % ( item.name, newline ) ) output.write( "X %i%s" % ( item.pos.x, newline ) ) output.write( "Y %i%s" % ( item.pos.y, newline ) ) output.write( "Z %i%s" % ( item.pos.z, newline ) ) output.write( "MAP %i%s" % ( item.pos.map, newline ) ) if item.type: output.write( "TYPE %i%s" % ( item.type, newline ) ) # World Freeze Requirement else: output.write( "TYPE 255%s" % newline ) # World Freeze Requirement output.write( "COLOR %i%s" % ( item.color, newline ) ) output.write( "CONT -1%s" % newline ) output.write( "}%s" % ( newline ) ) # TXT FORMAT elif format == 3: output.write( "0x%x %i %i %i 0x%x%s" % ( item.id, item.pos.x, item.pos.y, item.pos.z, item.color, newline ) ) # WARNINGS if item.amount > 1: warnings += 'Item %s has an amount of %i. This information will be lost when made static.<br><br>' % ( hex( item.serial ), item.amount ) scriptlist = item.scriptlist if len( scriptlist ) > 0: warnings += 'Item %s has scripts (%s) assigned to it. It will not be usable when made static.<br><br>' % ( hex( item.serial ), scriptlist ) if item.type != 0: warnings += 'Item %s is of type %i. It will not be usable when made static.<br><br>' % ( hex( item.serial ), item.type ) i += 1 item = iterator.next output.close() # Show a Report gump gump = cGump( x=100, y=100 ) gump.addBackground( id=0x2436, width=350, height=300 ) #gump.addCheckerTrans( 15, 15, 320, 270 ) text = '<basefont color="#FEFEFE"><h3>Export</h3><br><basefont color="#FEFEFE">' text += '%d items have been exported to "%s".<br><br>' % ( i, filename ) text += '<basefont color="#ff0000"><u>Warnings:</u><br>' text += '<basefont color="#FEFEFE">%s' % ( 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 tileResponse(player, arguments, target): if( len(arguments) < 7 ): player.socket.sysmessage( "Please select the second corner." ) player.socket.attachtarget( "commands.tilemove.tileResponse", list(arguments) + [target.pos] ) return socket = player.socket xmod = int( arguments[0] ) ymod = int( arguments[1] ) zmod = int( arguments[2] ) if( arguments[3] == None ): newmap = None else: newmap = int( arguments[3] ) z0 = arguments[5] mode = arguments[4] x1 = min( arguments[6].x, target.pos.x ) x2 = max( arguments[6].x, target.pos.x ) y1 = min( arguments[6].y, target.pos.y ) y2 = max( arguments[6].y, target.pos.y ) unlimited = player.account.authorized("Misc", "Unlimited Tile") count = ((x2 - x1) + 1) * ((y2 - y1) + 1) # Cap at 250 items if not an admin is using it if( not unlimited and count > 250 ): player.socket.sysmessage( "You are not allowed to move more than 250 items at once." ) return count = 0 items = [] iterator = wolfpack.itemregion( x1, y1, x2, y2, target.pos.map ) item = iterator.first # We have to copy the items in a list # because moving them inside the rectangle will change the iterator while item: z = item.pos.z if mode == MODE_NONE: items.append( item ) elif mode == MODE_EQUAL and z == z0: items.append( item ) elif mode == MODE_NOTEQUAL and z != z0: items.append( item ) elif mode == MODE_LESSER and z < z0: items.append( item ) elif mode == MODE_GREATER and z > z0: items.append( item ) elif mode == MODE_LESSEREQUAL and z <= z0: items.append( item ) elif mode == MODE_GREATEREQUAL and z >= z0: items.append( item ) item = iterator.next for item in items: 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() count += 1 socket.sysmessage( "%i items moved" % count ) return
def export(char, args, choice): if choice.button != 1 or len(args) != 4: return False filename = choice.text[1] if len(choice.switches) != 1: char.socket.sysmessage("Error: len(choice.switches) != 1.") return False format = choice.switches[0] 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 iterator = wolfpack.itemregion(args[0], args[1], args[2], args[3], char.pos.map) warnings = '' if os.name == 'posix': newline = "\n" else: newline = "\r\n" item = iterator.first i = 0 while item: if not item.baseid in nonsaves and not item.corpse and len( item.spawnregion) == 0: # Build our string if format == 1: # Sphere 51a output.write("[WORLDITEM 0%x]%s" % (item.id, newline)) output.write("SERIAL=0%x%s" % (item.serial, newline)) if item.name != '#': output.write("NAME=%s%s" % (item.name, newline)) output.write("ID=0%x%s" % (item.id, newline)) output.write("COLOR=0%x%s" % (item.color, newline)) output.write( "P=%i,%i,%i%s%s" % (item.pos.x, item.pos.y, item.pos.z, newline, newline)) elif format == 2: # WSC, Lonewolf Style, Compatible with Linux Worldforge output.write("SECTION WORLDITEM%s" % newline) output.write("{%s" % newline) output.write("SERIAL %i%s" % (item.serial, newline)) output.write("ID %i%s" % (item.id, newline)) if item.baseid != '': output.write("BASEID %s%s" % (item.baseid, newline)) if item.name != '#' or item.name != '': output.write("NAME %s%s" % (item.name, newline)) output.write("X %i%s" % (item.pos.x, newline)) output.write("Y %i%s" % (item.pos.y, newline)) output.write("Z %i%s" % (item.pos.z, newline)) output.write("MAP %i%s" % (item.pos.map, newline)) if item.type: output.write( "TYPE %i%s" % (item.type, newline)) # World Freeze Requirement else: output.write("TYPE 255%s" % newline) # World Freeze Requirement output.write("COLOR %i%s" % (item.color, newline)) output.write("CONT -1%s" % newline) output.write("}%s%s" % (newline, newline)) else: # Text # Who the hell changed this? # This format is for static exchange, no need for baseids or maps damnit! # output.write( "%s 0x%x %i %i %i %i 0x%x%s" % ( item.baseid, item.id, item.pos.x, item.pos.y, item.pos.z, item.pos.map, item.color, newline ) ) # Older Format, no baseid/map saved output.write("0x%x %i %i %i 0x%x%s" % (item.id, item.pos.x, item.pos.y, item.pos.z, item.color, newline)) if item.amount > 1: warnings += 'Item %s has an amount of %i. This information will be lost when made static.<br><br>' % ( hex(item.serial), item.amount) eventlist = list(item.scripts) + item.basescripts.split(',') if len(eventlist) > 0: warnings += 'Item %s has events (%s) assigned to it. It wont be usable when made static.<br><br>' % ( hex(item.serial), eventlist) if item.type != 0: warnings += 'Item %s is of type %i. It wont be usable when made static.<br><br>' % ( hex(item.serial), item.type) i += 1 item = iterator.next output.close() # Show a Report gump gump = cGump(x=100, y=100) gump.addBackground(id=0x2436, width=350, height=300) #gump.addCheckerTrans( 15, 15, 320, 270 ) 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 potionregion( args ): char = args[0] potion = args[1] bonus = args[2] if potion.gettag('potiontype') == 11: outradius = 1 elif potion.gettag('potiontype') == 12: outradius = 2 elif potion.gettag('potiontype') == 13: outradius = randint(2,3) else: outradius = 1 # Potion Keg Radius Override! if potion.hastag('kegfill') and potion.hastag('potiontype'): if potion.gettag('potiontype') in [11, 12, 13] and potion.gettag('kegfill') >= 1: kegfill = potion.gettag('kegfill') if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 # Potion thrown on the ground if not potion.container: x1 = int(potion.pos.x - outradius) y1 = int(potion.pos.y - outradius) x2 = int(potion.pos.x + outradius) y2 = int(potion.pos.y + outradius) damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) # Character Bombing target = damageregion.first while target: if checkLoS( target, potion, outradius ): potiondamage(char, target, potion, bonus) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, potion.pos.map ) chainbomb= chainregion.first while chainbomb: if checkLoS( potion, chainbomb, outradius ) and not chainbomb.hastag('exploding'): if chainbomb.baseid in explodables: chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 0, chainbomb.amount] ) chainbomb = chainregion.next # Potion Kegs elif (chainbomb.hastag('kegfill') and chainbomb.hastag('potiontype')) and ( chainbomb.gettag('potiontype') in [11, 12, 13] and chainbomb.gettag('kegfill') >= 1 ): chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 11, chainbomb.gettag('kegfill') ] ) chainbomb = chainregion.next else: chainbomb = chainregion.next else: chainbomb = chainregion.next return # Potion is in a container else: x1 = int(char.pos.x - outradius) y1 = int(char.pos.y - outradius) x2 = int(char.pos.x + outradius) y2 = int(char.pos.y + outradius) damageregion = wolfpack.charregion( x1, y1, x2, y2, char.pos.map ) # Area Bombing target = damageregion.first while target: if checkLoS( char, target, outradius ): potiondamage(char, target, potion, bonus) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first while chainbomb: if checkLoS( char, chainbomb, outradius ) and not chainbomb.hastag('exploding'): if chainbomb.baseid in explodables: chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 0, chainbomb.amount] ) chainbomb = chainregion.next elif ( chainbomb.hastag('kegfill') and chainbomb.hastag('potiontype') ) and ( chainbomb.gettag('potiontype') in [11, 12, 13] and chainbomb.gettag('kegfill') >= 1 ): chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 11, chainbomb.gettag('kegfill') ] ) chainbomb = chainregion.next else: chainbomb = chainregion.next else: chainbomb = chainregion.next # Potion Kegs return
def potionregion( char, potion, bonus=0 ): if potion.gettag('potiontype') == 11: outradius = 1 elif potion.gettag('potiontype') == 12: outradius = 2 elif potion.gettag('potiontype') == 13: outradius = randint(2,3) else: outradius = 1 # Potion Keg Radius Override! if potion.hastag('kegfill') and potion.hastag('potiontype'): if potion.gettag('potiontype') in [11, 12, 13] and potion.gettag('kegfill') >= 1: kegfill = potion.gettag('kegfill') if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 outradius = max( 1, outradius ) # Potion is thrown on the ground if not potion.container: x1 = min( int(potion.pos.x - outradius), int(potion.pos.x + outradius) ) x2 = max( int(potion.pos.x - outradius), int(potion.pos.x + outradius) ) y1 = min( int(potion.pos.y - outradius), int(potion.pos.y + outradius) ) y2 = max( int(potion.pos.y - outradius), int(potion.pos.y + outradius) ) # Character Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( target, potion, outradius ): potiondamage( char, target, potion, bonus ) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, potion.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( char, potion, chainbomb, outradius ) chainbomb = chainregion.next return # Potion is in a container else: x1 = min( int(char.pos.x - outradius), int(char.pos.x + outradius) ) x2 = max( int(char.pos.x - outradius), int(char.pos.x + outradius) ) y1 = min( int(char.pos.y - outradius), int(char.pos.y + outradius) ) y2 = max( int(char.pos.y - outradius), int(char.pos.y + outradius) ) # Area Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( char, target, outradius ): potiondamage( char, target, potion, bonus ) target = damageregion.next else: target = damageregion.next potion_chainlist = [] # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( char, potion, chainbomb, outradius ) chainbomb = chainregion.next return