handler = DigimonWorldHandler( inFile, logger ) print( 'Modifying data...' ) sys.stdout.flush() if( config[ 'digimon' ][ 'Enabled' ] ): if( config[ 'digimon' ][ 'MatchValue' ] ): pricecfg = config[ 'digimon' ][ 'ValuableItemCutoff' ] else: pricecfg = "10000" try: handler.randomizeDigimonData( dropItem=config[ 'digimon' ][ 'DroppedItem' ], dropRate=config[ 'digimon' ][ 'DropRate' ], price=int( pricecfg ) ) except ValueError: logger.fatalError( 'Item price cutoff must be an integer. ' + str( pricecfg ) + ' is not a valid value.' ) if( config[ 'techs' ][ 'Enabled' ] ): handler.randomizeTechData( power=config[ 'techs' ][ 'Power' ], mode=config[ 'techs' ][ 'RandomizationMode' ], cost=config[ 'techs' ][ 'Cost' ], accuracy=config[ 'techs' ][ 'Accuracy' ], effect=config[ 'techs' ][ 'Effect' ], effectChance=config[ 'techs' ][ 'EffectChance' ] ) if( config[ 'techs' ][ 'TypeEffectiveness']): handler.applyPatch( 'typeEffectiveness' ) if( config[ 'starter' ][ 'Enabled' ] ): #Use true/false values as a mask against the list of levels #to get a list of levels that are enabled
#Load settings from specified file if (settings == ''): print( 'Settings file must be provided at command line. Use [-h] for help.') exit() config = configparser.ConfigParser(allow_no_value=True) config.read(settings) verbose = config['general']['LogLevel'] logger = Logger(verbose, filename='randomize.log') if (config['general']['Input'] != ''): inFile = config['general']['Input'] else: logger.fatalError('Must provide file name in settings "Input".') exit() #If an output file was Set, use that as the output. #Otherwise, read and write the same file if (config['general']['Output'] != ''): outFile = config['general']['Output'] else: outFile = inFile #Give the user a warning when we are going to overwrite the base ROM #if( outFile == inFile ): # qa = input( 'Warning: currently set to overwrite the input file.\nAre you sure you want to continue? (y/n)' ) # if( qa != 'y' ): # print( 'Exiting. Please update settings.ini \'Output\' to select a different output location.' ) # exit()
settings = args.parse_args(sys.argv[1:]).settings #Load settings from specified file if (settings == ''): print( 'Settings file must be provided at command line. Use [-h] for help.') exit() config = json.loads(settings) verbose = config['general']['LogLevel'] logger = Logger(verbose, filename='randomize.log') if (config['general']['InputFile'] != ''): inFile = config['general']['InputFile'] else: logger.fatalError('ROM file section is required') exit() #If an output file was Set, use that as the output. #Otherwise, read and write the same file if (config['general']['OutputFile'] != ''): outFile = config['general']['OutputFile'] else: logger.fatalError('Destination file section is required') exit() print('Reading data from ' + inFile + '...') sys.stdout.flush() seedcfg = config['general']['Seed']
from builtins import input from log.logger import Logger from digimon.handler import DigimonWorldHandler config = configparser.ConfigParser(allow_no_value=True) config.read('settings.ini') verbose = config['general']['LogLevel'] logger = Logger(verbose, filename='randomize.log') if (len(sys.argv) > 1): inFile = sys.argv[1] elif (config['general']['Input'] != ''): inFile = config['general']['Input'] else: logger.fatalError('Must provide file name via command line or settings.') exit() #If an output file was passed or set, use that as the output. #Otherwise, read and write the same file if (len(sys.argv) > 2): outFile = sys.argv[2] elif (config['general']['Output'] != ''): outFile = config['general']['Output'] else: outFile = inFile #Give the user a warning when we are going to overwrite the base ROM if (outFile == inFile): qa = input( 'Warning: currently set to overwrite the input file.\nAre you sure you want to continue? (y/n)'