Exemplo n.º 1
0
        private void CreateRom(RandomizerDifficulty difficulty)
        {
            int parsedSeed;

            if (!int.TryParse(seedV11.Text, out parsedSeed))
            {
                MessageBox.Show("Seed must be numeric or blank.", "Seed Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                WriteOutputV11("Seed must be numeric or blank.");
            }
            else
            {
                var           romLocations = RomLocationsFactory.GetRomLocations(difficulty);
                RandomizerLog log          = null;

                if (createSpoilerLog.Checked)
                {
                    log = new RandomizerLog(string.Format(romLocations.SeedFileString, parsedSeed));
                }

                seedV11.Text = string.Format(romLocations.SeedFileString, parsedSeed);
                var randomizerV11 = new RandomizerV11(parsedSeed, romLocations, log);
                randomizerV11.CreateRom(filenameV11.Text);

                var outputString = new StringBuilder();

                outputString.AppendFormat("Done!{0}{0}{0}Seed: ", Environment.NewLine);
                outputString.AppendFormat(romLocations.SeedFileString, parsedSeed);
                outputString.AppendFormat(" ({0} Difficulty){1}{1}", romLocations.DifficultyName, Environment.NewLine);

                WriteOutputV11(outputString.ToString());
            }
        }
Exemplo n.º 2
0
        private void CreateSpoilerLog(RandomizerDifficulty difficulty)
        {
            int parsedSeed;

            if (!int.TryParse(seed.Text, out parsedSeed))
            {
                MessageBox.Show("Seed must be numeric or blank.", "Seed Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                WriteOutput("Seed must be numeric or blank.");
            }
            else
            {
                var           romPlms = RomLocationsFactory.GetRomLocations(difficulty);
                RandomizerLog log     = new RandomizerLog(string.Format(romPlms.SeedFileString, parsedSeed));

                seed.Text = string.Format(romPlms.SeedFileString, parsedSeed);

                try
                {
                    var randomizer = new Randomizer(parsedSeed, romPlms, log);

                    WriteOutput(CreateRomThread(randomizer, new RandomizerOptions {
                        SpoilerOnly = true, Difficulty = difficulty
                    }));
                }
                catch (RandomizationException ex)
                {
                    WriteOutput(ex.ToString());
                }
            }
        }
Exemplo n.º 3
0
        private void CreateSpoilerLog(RandomizerDifficulty difficulty)
        {
            if (!int.TryParse(seedField.StringValue, out int parsedSeed))
            {
                var alert = new NSAlert
                {
                    MessageText     = "Seed Error",
                    InformativeText = "Seed must be numeric or blank.",
                    AlertStyle      = NSAlertStyle.Warning
                };
                alert.BeginSheet(this.View.Window);
                WriteOutput("Seed must be numeric or blank.", true);
            }
            else
            {
                var romPlms = RomLocationsFactory.GetRomLocations(difficulty);
                var log     = new RandomizerLog(string.Format(romPlms.SeedFileString, parsedSeed));

                seedField.StringValue = string.Format(romPlms.SeedFileString, parsedSeed);

                try
                {
                    var randomizer = new Randomizer(parsedSeed, romPlms, log);

                    WriteOutput(CreateRomThread(randomizer, new RandomizerOptions {
                        SpoilerOnly = true, Difficulty = difficulty
                    }));
                }
                catch (RandomizationException ex)
                {
                    WriteOutput(ex.ToString(), true);
                }
            }
        }
        public static IRomLocations GetRomPlms(RandomizerDifficulty difficulty)
        {
            switch (difficulty)
            {
            case RandomizerDifficulty.Casual:
                return(new RomLocationsCasual());

            default:
                throw new ArgumentException("Difficulty must be set.", "difficulty");
            }
        }
Exemplo n.º 5
0
        private byte GetWarningFlags(RandomizerDifficulty difficulty)
        {
            switch (difficulty)
            {
            case RandomizerDifficulty.Casual:
                return(0x00);

            case RandomizerDifficulty.Glitched:
                return(0x40);
            }

            return(0x00);
        }
Exemplo n.º 6
0
        public static IRomLocations GetRomLocations(RandomizerDifficulty difficulty)
        {
            switch (difficulty)
            {
            case RandomizerDifficulty.Casual:
                return(new RomLocationsCasual());

            case RandomizerDifficulty.M*******t:
                return(new RomLocationsMasochist());

            case RandomizerDifficulty.Insane:
                return(new RomLocationsInsane());

            default:
                return(new RomLocationsSpeedrunner());
            }
        }
Exemplo n.º 7
0
        private void CreateRom(RandomizerDifficulty difficulty)
        {
            int parsedSeed;

            if (!int.TryParse(seed.Text, out parsedSeed))
            {
                MessageBox.Show("Seed must be numeric or blank.", "Seed Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                WriteOutput("Seed must be numeric or blank.");
            }
            else
            {
                var           romPlms = RomLocationsFactory.GetRomLocations(difficulty);
                RandomizerLog log     = null;

                if (createSpoilerLog.Checked)
                {
                    log = new RandomizerLog(string.Format(romPlms.SeedFileString, parsedSeed));
                }

                seed.Text = string.Format(romPlms.SeedFileString, parsedSeed);

                try
                {
                    var randomizer = new Randomizer(parsedSeed, romPlms, log);
                    randomizer.CreateRom(new RandomizerOptions {
                        Filename = filename.Text, SramTrace = sramTrace.Checked
                    });

                    var outputString = new StringBuilder();

                    outputString.AppendFormat("Done!{0}{0}{0}Seed: ", Environment.NewLine);
                    outputString.AppendFormat(romPlms.SeedFileString, parsedSeed);
                    outputString.AppendFormat(" ({0} Difficulty){1}{1}", romPlms.DifficultyName, Environment.NewLine);

                    WriteOutput(outputString.ToString());
                }
                catch (RandomizationException ex)
                {
                    WriteOutput(ex.ToString());
                }
            }
        }
Exemplo n.º 8
0
        private void CreateSpoilerLog(RandomizerDifficulty difficulty)
        {
            int parsedSeed;

            if (!int.TryParse(seedV11.Text, out parsedSeed))
            {
                MessageBox.Show("Seed must be numeric or blank.", "Seed Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                WriteOutputV11("Seed must be numeric or blank.");
            }
            else
            {
                var           romPlms = RomLocationsFactory.GetRomLocations(difficulty);
                RandomizerLog log     = new RandomizerLog(string.Format(romPlms.SeedFileString, parsedSeed));

                seedV11.Text = string.Format(romPlms.SeedFileString, parsedSeed);

                var randomizer = new RandomizerV11(parsedSeed, romPlms, log);
                WriteOutputV11(randomizer.CreateRom(filenameV11.Text, true));
            }
        }
Exemplo n.º 9
0
 public static IRomLocations GetRomLocations(RandomizerDifficulty difficulty)
 {
     return(new RomLocationsSpeedrunner());
 }