Пример #1
0
def main(argv):
    args = parser.parse_args(argv)

    settings = RandomizerData(args.seed, args.difficulty, args.goal, args.logic, args.statues, args.enemizer, args.start, args.firebird, args.ohko, args.red_jewel_madness,
                              args.allow_glitches, args.boss_shuffle, args.overworld_shuffle, args.dungeon_shuffle)

    rom_filename = generate_filename(settings, "sfc")
    spoiler_filename = generate_filename(settings, "json")

    randomizer = Randomizer(args.path)
    patch = randomizer.generate_rom(rom_filename, settings)
    spoiler = randomizer.generate_spoiler()

    write_patch(patch, rom_filename, args.path)
    write_spoiler(spoiler, spoiler_filename, args.path)
Пример #2
0
def __generateSpoiler(randomizer: Randomizer, settings: Settings) -> Spoiler:
    spoiler_filename = generate_filename(settings, "txt")
    spoiler = randomizer.generate_spoiler()
    return Spoiler(spoiler, spoiler_filename)
Пример #3
0
def generate_ROM():
    rompath = ROM.get()
    seed_str = seed.get()

    def get_difficulty():
        d = difficulty.get()
        if d == "Easy":
            return Difficulty.EASY
        if d == "Normal":
            return Difficulty.NORMAL
        if d == "Hard":
            return Difficulty.HARD
        if d == "Extreme":
            return Difficulty.EXTREME

    def get_goal():
        g = goal.get()
        if g == "Dark Gaia":
            return Goal.DARK_GAIA
        if g == "Apocalypse Gaia":
            return Goal.APO_GAIA
        if g == "Random Gaia":
            return Goal.RANDOM_GAIA
        if g == "Red Jewel Hunt":
            return Goal.RED_JEWEL_HUNT

    def get_logic():
        l = logic.get()
        if l == "Completable":
            return Logic.COMPLETABLE
        if l == "Beatable":
            return Logic.BEATABLE
        if l == "Chaos":
            return Logic.CHAOS

    def get_enemizer():
        e = enemizer.get()
        if e == "None":
            return Enemizer.NONE
        if e == "Limited":
            return Enemizer.LIMITED
        if e == "Balanced":
            return Enemizer.BALANCED
        if e == "Full":
            return Enemizer.FULL
        if e == "Insane":
            return Enemizer.INSANE

    def get_start_location():
        g = start.get()
        if g == "South Cape":
            return StartLocation.SOUTH_CAPE
        if g == "Safe":
            return StartLocation.SAFE
        if g == "Unsafe":
            return StartLocation.UNSAFE
        if g == "Forced Unsafe":
            return StartLocation.FORCED_UNSAFE

    if not seed_str.isdigit():
        tkinter.messagebox.showinfo("ERROR",
                                    "Please enter or generate a valid seed")
        return

    try:
        seed_int = int(seed_str)
        settings = RandomizerData(seed_int, get_difficulty(), get_goal(),
                                  get_logic(), statues.get(), get_enemizer(),
                                  get_start_location(), firebird.get(),
                                  ohko.get(), red_jewel_madness.get(),
                                  glitches.get(), boss_shuffle.get(),
                                  open_mode.get())

        rom_filename = generate_filename(settings, "sfc")
        spoiler_filename = generate_filename(settings, "json")

        randomizer = Randomizer(rompath)

        patch = randomizer.generate_rom(rom_filename, settings)
        spoiler = randomizer.generate_spoiler()

        write_patch(patch, rompath, rom_filename)
        write_spoiler(spoiler, spoiler_filename, rompath)

        tkinter.messagebox.showinfo(
            "Success!", rom_filename + " has been successfully created!")
    except OffsetError:
        tkinter.messagebox.showerror(
            "ERROR",
            "This randomizer is only compatible with the (US) version of Illusion of Gaia"
        )
    except FileNotFoundError:
        tkinter.messagebox.showerror("ERROR", "ROM file does not exist")
    except Exception as e:
        tkinter.messagebox.showerror("ERROR", e)
Пример #4
0
def __generatePatch(randomizer: Randomizer, settings: Settings) -> Patch:
    patch_filename = generate_filename(settings, "sfc")
    patch = randomizer.generate_rom(patch_filename, settings)
    return Patch(patch, patch_filename, VERSION)