Ejemplo n.º 1
0
        public string CreateRom(RandomizerOptions options)
        {
            try
            {
                if (options.Filename.Contains("\\") && !Directory.Exists(options.Filename.Substring(0, options.Filename.LastIndexOf('\\'))))
                {
                    Directory.CreateDirectory(options.Filename.Substring(0, options.Filename.LastIndexOf('\\')));
                }

                GenerateItemList();
                GenerateDungeonItems();
                GenerateItemPositions();

                if (RandomizerVersion.Debug)
                {
                    SetupTestItems(romLocations.Locations);
                }

                if (options.SpoilerOnly)
                {
                    return(log?.GetLogOutput());
                }

                WriteRom(options.Filename, options.SramTrace);

                return("");
            }
            catch (Exception ex)
            {
                var newEx = new RandomizationException(string.Format("Error creating seed: {0}.", string.Format(romLocations.SeedFileString, seed)), ex);

                throw newEx;
            }
        }
        public string CreateRom(string filename, bool spoilerOnly = false)
        {
            try
            {
                if (filename.Contains("\\") && !Directory.Exists(filename.Substring(0, filename.LastIndexOf('\\'))))
                {
                    Directory.CreateDirectory(filename.Substring(0, filename.LastIndexOf('\\')));
                }

                GenerateItemList();
                GenerateDungeonItems();
                GenerateItemPositions(true);

                if (spoilerOnly)
                {
                    return(log?.GetLogOutput());
                }

                WriteRom(filename);

                return("");
            }
            catch (Exception ex)
            {
                var newEx = new RandomizationException(string.Format("Error creating seed: {0}.", string.Format(romLocations.SeedFileString, seed)), ex);

                throw newEx;
            }
        }
Ejemplo n.º 3
0
        public string CreateRom(RandomizerOptions options)
        {
            try
            {
                String filePath = FileName.Fix(options.Filename, string.Format(romLocations.SeedFileString, seed), complexity);
                if (filePath.Contains("\\") && !Directory.Exists(filePath.Substring(0, filePath.LastIndexOf('\\'))))
                {
                    Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf('\\')));
                }

                if (!options.NoRandomization)
                {
                    GenerateItemList();
                    RandomizeQuestItems();
                    GenerateItemPositions();

                    if (log != null || options.ShowComplexity)
                    {
                        CalculateComplexity();
                    }

                    if (RandomizerVersion.Debug)
                    {
                        SetupTestItems(romLocations.Locations);
                    }

                    if (options.SpoilerOnly)
                    {
                        return(log?.GetLogOutput());
                    }
                }
                WriteRom(options);

                return("");
            }
            catch (Exception ex)
            {
                var newEx = new RandomizationException(string.Format("Error creating seed: {0}.", string.Format(romLocations.SeedFileString, seed)), ex);

                throw newEx;
            }
        }