From aa0d9fa7fc9b0674a3855db8dd0f6502e341b49e Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 10 Jun 2020 19:05:09 +0200 Subject: [PATCH] Remove plando, as there's no intention in supporting it --- Plando.py | 236 ------------------------------------- Plandomizer_Template.txt | 244 --------------------------------------- 2 files changed, 480 deletions(-) delete mode 100755 Plando.py delete mode 100644 Plandomizer_Template.txt diff --git a/Plando.py b/Plando.py deleted file mode 100755 index 1e038939..00000000 --- a/Plando.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import hashlib -import logging -import os -import random -import time -import sys - -from BaseClasses import World -from Regions import create_regions -from EntranceShuffle import link_entrances, connect_entrance, connect_two_way, connect_exit -from Rom import patch_rom, LocalRom, write_string_to_rom, apply_rom_settings, get_sprite_from_name -from Rules import set_rules -from Dungeons import create_dungeons -from Items import ItemFactory -from ItemList import difficulties -from Main import create_playthrough - -__version__ = '0.2-dev' - -def main(args): - start_time = time.perf_counter() - - # initialize the world - world = World(1, 'vanilla', 'noglitches', 'standard', 'normal', 'none', 'on', 'ganon', 'freshness', False, False, False, False, False, False, None, False) - world.player_names[1].append("Player1") - logger = logging.getLogger('') - - hasher = hashlib.md5() - with open(args.plando, 'rb') as plandofile: - buf = plandofile.read() - hasher.update(buf) - world.seed = int(hasher.hexdigest(), 16) % 1000000000 - - random.seed(world.seed) - - logger.info('ALttP Plandomizer Version %s - Seed: %s\n\n', __version__, args.plando) - - world.difficulty_requirements[1] = difficulties[world.difficulty[1]] - - create_regions(world, 1) - create_dungeons(world, 1) - - link_entrances(world, 1) - - logger.info('Calculating Access Rules.') - - set_rules(world, 1) - - logger.info('Fill the world.') - - text_patches = [] - - fill_world(world, args.plando, text_patches) - - if world.get_entrance('Dam', 1).connected_region.name != 'Dam' or world.get_entrance('Swamp Palace', 1).connected_region.name != 'Swamp Palace (Entrance)': - world.swamp_patch_required[1] = True - - logger.info('Calculating playthrough.') - - try: - create_playthrough(world) - except RuntimeError: - if args.ignore_unsolvable: - pass - else: - raise - - logger.info('Patching ROM.') - - rom = LocalRom(args.rom) - patch_rom(world, rom, 1, 1, False) - - apply_rom_settings(rom, args.heartbeep, args.heartcolor, args.quickswap, args.fastmenu, args.disablemusic, args.sprite, args.ow_palettes, args.uw_palettes) - - for textname, texttype, text in text_patches: - if texttype == 'text': - write_string_to_rom(rom, textname, text) - #elif texttype == 'credit': - # write_credits_string_to_rom(rom, textname, text) - - outfilebase = 'Plando_%s_%s' % (os.path.splitext(os.path.basename(args.plando))[0], world.seed) - - rom.write_to_file('%s.sfc' % outfilebase) - if args.create_spoiler: - world.spoiler.to_file('%s_Spoiler.txt' % outfilebase) - - logger.info('Done. Enjoy.') - logger.debug('Total Time: %s', time.perf_counter() - start_time) - - return world - - -def fill_world(world, plando, text_patches): - mm_medallion = 'Ether' - tr_medallion = 'Quake' - logger = logging.getLogger('') - with open(plando, 'r') as plandofile: - for line in plandofile.readlines(): - if line.startswith('#'): - continue - if ':' in line: - line = line.lstrip() - - if line.startswith('!'): - if line.startswith('!mm_medallion'): - _, medallionstr = line.split(':', 1) - mm_medallion = medallionstr.strip() - elif line.startswith('!tr_medallion'): - _, medallionstr = line.split(':', 1) - tr_medallion = medallionstr.strip() - elif line.startswith('!mode'): - _, modestr = line.split(':', 1) - world.mode = {1: modestr.strip()} - elif line.startswith('!logic'): - _, logicstr = line.split(':', 1) - world.logic = {1: logicstr.strip()} - elif line.startswith('!goal'): - _, goalstr = line.split(':', 1) - world.goal = {1: goalstr.strip()} - elif line.startswith('!light_cone_sewers'): - _, sewerstr = line.split(':', 1) - world.sewer_light_cone = {1: sewerstr.strip().lower() == 'true'} - elif line.startswith('!light_cone_lw'): - _, lwconestr = line.split(':', 1) - world.light_world_light_cone = lwconestr.strip().lower() == 'true' - elif line.startswith('!light_cone_dw'): - _, dwconestr = line.split(':', 1) - world.dark_world_light_cone = dwconestr.strip().lower() == 'true' - elif line.startswith('!fix_trock_doors'): - _, trdstr = line.split(':', 1) - world.fix_trock_doors = {1: trdstr.strip().lower() == 'true'} - elif line.startswith('!fix_trock_exit'): - _, trfstr = line.split(':', 1) - world.fix_trock_exit = {1: trfstr.strip().lower() == 'true'} - elif line.startswith('!fix_gtower_exit'): - _, gtfstr = line.split(':', 1) - world.fix_gtower_exit = gtfstr.strip().lower() == 'true' - elif line.startswith('!fix_pod_exit'): - _, podestr = line.split(':', 1) - world.fix_palaceofdarkness_exit = {1: podestr.strip().lower() == 'true'} - elif line.startswith('!fix_skullwoods_exit'): - _, swestr = line.split(':', 1) - world.fix_skullwoods_exit = {1: swestr.strip().lower() == 'true'} - elif line.startswith('!check_beatable_only'): - _, chkbtstr = line.split(':', 1) - world.check_beatable_only = chkbtstr.strip().lower() == 'true' - elif line.startswith('!ganon_death_pyramid_respawn'): - _, gnpstr = line.split(':', 1) - world.ganon_at_pyramid = gnpstr.strip().lower() == 'true' - elif line.startswith('!save_quit_boss'): - _, sqbstr = line.split(':', 1) - world.save_and_quite_from_boss = sqbstr.strip().lower() == 'true' - elif line.startswith('!text_'): - textname, text = line.split(':', 1) - text_patches.append([textname.lstrip('!text_').strip(), 'text', text.strip()]) - #temporarilly removed. New credits system not ready to handle this. - #elif line.startswith('!credits_'): - # textname, text = line.split(':', 1) - # text_patches.append([textname.lstrip('!credits_').strip(), 'credits', text.strip()]) - continue - - locationstr, itemstr = line.split(':', 1) - location = world.get_location(locationstr.strip(), 1) - if location is None: - logger.warning('Unknown location: %s', locationstr) - continue - else: - item = ItemFactory(itemstr.strip(), 1) - if item is not None: - world.push_item(location, item) - if item.smallkey or item.bigkey: - location.event = True - elif '<=>' in line: - entrance, exit = line.split('<=>', 1) - connect_two_way(world, entrance.strip(), exit.strip(), 1) - elif '=>' in line: - entrance, exit = line.split('=>', 1) - connect_entrance(world, entrance.strip(), exit.strip(), 1) - elif '<=' in line: - entrance, exit = line.split('<=', 1) - connect_exit(world, exit.strip(), entrance.strip(), 1) - - world.required_medallions[1] = (mm_medallion, tr_medallion) - - # set up Agahnim Events - world.get_location('Agahnim 1', 1).event = True - world.get_location('Agahnim 1', 1).item = ItemFactory('Beat Agahnim 1', 1) - world.get_location('Agahnim 2', 1).event = True - world.get_location('Agahnim 2', 1).item = ItemFactory('Beat Agahnim 2', 1) - - -def start(): - parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('--create_spoiler', help='Output a Spoiler File', action='store_true') - parser.add_argument('--ignore_unsolvable', help='Do not abort if seed is deemed unsolvable.', action='store_true') - parser.add_argument('--rom', default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc', help='Path to an ALttP JAP(1.0) rom to use as a base.') - parser.add_argument('--loglevel', default='info', const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.') - parser.add_argument('--seed', help='Define seed number to generate.', type=int) - parser.add_argument('--fastmenu', default='normal', const='normal', nargs='?', choices=['normal', 'instant', 'double', 'triple', 'quadruple', 'half'], - help='''\ - Select the rate at which the menu opens and closes. - (default: %(default)s) - ''') - parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true') - parser.add_argument('--disablemusic', help='Disables game music.', action='store_true') - parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['normal', 'half', 'quarter', 'off'], - help='Select the rate at which the heart beep sound is played at low health.') - parser.add_argument('--heartcolor', default='red', const='red', nargs='?', choices=['red', 'blue', 'green', 'yellow'], - help='Select the color of Link\'s heart meter. (default: %(default)s)') - parser.add_argument('--ow_palettes', default='default', choices=['default', 'random', 'blackout']) - parser.add_argument('--uw_palettes', default='default', choices=['default', 'random', 'blackout']) - parser.add_argument('--sprite', help='Path to a sprite sheet to use for Link. Needs to be in binary format and have a length of 0x7000 (28672) bytes.') - parser.add_argument('--plando', help='Filled out template to use for setting up the rom.') - args = parser.parse_args() - - # ToDo: Validate files further than mere existance - if not os.path.isfile(args.rom): - input('Could not find valid base rom for patching at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.' % args.rom) - sys.exit(1) - if not os.path.isfile(args.plando): - input('Could not find Plandomizer distribution at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.' % args.plando) - sys.exit(1) - if args.sprite is not None and not os.path.isfile(args.sprite) and not get_sprite_from_name(args.sprite): - input('Could not find link sprite sheet at given location. \nPress Enter to exit.') - sys.exit(1) - - # set up logger - loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[args.loglevel] - logging.basicConfig(format='%(message)s', level=loglevel) - - main(args=args) - -if __name__ == '__main__': - start() diff --git a/Plandomizer_Template.txt b/Plandomizer_Template.txt deleted file mode 100644 index a7160c9b..00000000 --- a/Plandomizer_Template.txt +++ /dev/null @@ -1,244 +0,0 @@ -# Lines starting with a # are comments and ignored by the parsers -# Lines without a : are also ignored - -# These are special instructions for setting the medallion requirements to enter the dungeons -!mm_medallion: Bombos -!tr_medallion: Quake - -# This sets the game mode -!mode: open - -# This sets the logic (for verification purposes) -!logic: noglitches - -# This sets the goal (only used for generating the spoiler log) -!goal: ganon - -# Now we fill in all locations - -Mushroom: Mushroom -Bottle Merchant: Bottle -Flute Spot: Flute -Sunken Treasure: Nothing -Purple Chest: Nothing -Blind's Hideout - Top: Nothing -Blind's Hideout - Left: Nothing -Blind's Hideout - Right: Nothing -Blind's Hideout - Far Left: Nothing -Blind's Hideout - Far Right: Nothing -Link's Uncle: Fighter Sword -Secret Passage: Nothing -King Zora: Flippers -Zora's Ledge: Nothing -King's Tomb: Cape -Floodgate Chest: Nothing -Link's House: Lamp -Kakariko Tavern: Nothing -Chicken House: Nothing -Aginah's Cave: Nothing -Sahasrahla's Hut - Left: Nothing -Sahasrahla's Hut - Middle: Nothing -Sahasrahla's Hut - Right: Nothing -Sahasrahla: Pegasus Boots -Kakariko Well - Top: Nothing -Kakariko Well - Left: Nothing -Kakariko Well - Middle: Nothing -Kakariko Well - Right: Nothing -Kakariko Well - Bottom: Nothing -Blacksmith: Tempered Sword -Magic Bat: Magic Upgrade (1/2) -Sick Kid: Bug Catching Net -Hobo: Bottle -Lost Woods Hideout: Nothing -Lumberjack Tree: Nothing -Cave 45: Nothing -Graveyard Cave: Nothing -Checkerboard Cave: Nothing -Mini Moldorm Cave - Far Left: Nothing -Mini Moldorm Cave - Left: Nothing -Mini Moldorm Cave - Right: Nothing -Mini Moldorm Cave - Far Right: Nothing -Mini Moldorm Cave - Generous Guy: Nothing -Ice Rod Cave: Ice Rod -Bonk Rock Cave: Nothing -Library: Book of Mudora -Potion Shop: Magic Powder -Lake Hylia Island: Nothing -Maze Race: Nothing -Desert Ledge: Nothing -Desert Palace - Big Chest: Power Glove -Desert Palace - Torch: Small Key (Desert Palace) -Desert Palace - Map Chest: Nothing -Desert Palace - Compass Chest: Nothing -Desert Palace - Big Key Chest: Big Key (Desert Palace) -Desert Palace - Boss: Nothing -Desert Palace - Prize: Blue Pendant -Eastern Palace - Compass Chest: Nothing -Eastern Palace - Big Chest: Bow -Eastern Palace - Cannonball Chest: Nothing -Eastern Palace - Big Key Chest: Big Key (Eastern Palace) -Eastern Palace - Map Chest: Nothing -Eastern Palace - Boss: Nothing -Eastern Palace - Prize: Green Pendant -Master Sword Pedestal: Master Sword -Hyrule Castle - Boomerang Chest: Nothing -Hyrule Castle - Map Chest: Nothing -Hyrule Castle - Zelda's Chest: Nothing -Sewers - Dark Cross: Small Key (Escape) -Sewers - Secret Room - Left: Nothing -Sewers - Secret Room - Middle: Nothing -Sewers - Secret Room - Right: Nothing -Sanctuary: Sanctuary Heart Container -Castle Tower - Room 03: Small Key (Agahnims Tower) -Castle Tower - Dark Maze: Small Key (Agahnims Tower) -Old Man: Magic Mirror -Spectacle Rock Cave: Nothing -Paradox Cave Lower - Far Left: Nothing -Paradox Cave Lower - Left: Nothing -Paradox Cave Lower - Right: Nothing -Paradox Cave Lower - Far Right: Nothing -Paradox Cave Lower - Middle: Nothing -Paradox Cave Upper - Left: Nothing -Paradox Cave Upper - Right: Nothing -Spiral Cave: Nothing -Ether Tablet: Ether -Spectacle Rock: Nothing -Tower of Hera - Basement Cage: Small Key (Tower of Hera) -Tower of Hera - Map Chest: Nothing -Tower of Hera - Big Key Chest: Big Key (Tower of Hera) -Tower of Hera - Compass Chest: Nothing -Tower of Hera - Big Chest: Moon Pearl -Tower of Hera - Boss: Nothing -Tower of Hera - Prize: Red Pendant -Pyramid: Nothing -Catfish: Quake -Stumpy: Shovel -Digging Game: Nothing -Bombos Tablet: Bombos -Hype Cave - Top: Nothing -Hype Cave - Middle Right: Nothing -Hype Cave - Middle Left: Nothing -Hype Cave - Bottom: Nothing -Hype Cave - Generous Guy: Nothing -Peg Cave: Nothing -Pyramid Fairy - Left: Golden Sword -Pyramid Fairy - Right: Silver Arrows -Brewery: Nothing -C-Shaped House: Nothing -Chest Game: Nothing -Bumper Cave Ledge: Nothing -Mire Shed - Left: Nothing -Mire Shed - Right: Nothing -Superbunny Cave - Top: Nothing -Superbunny Cave - Bottom: Nothing -Spike Cave: Cane of Byrna -Hookshot Cave - Top Right: Nothing -Hookshot Cave - Top Left: Nothing -Hookshot Cave - Bottom Right: Nothing -Hookshot Cave - Bottom Left: Nothing -Floating Island: Nothing -Mimic Cave: Nothing -Swamp Palace - Entrance: Small Key (Swamp Palace) -Swamp Palace - Map Chest: Nothing -Swamp Palace - Big Chest: Hookshot -Swamp Palace - Compass Chest: Nothing -Swamp Palace - Big Key Chest: Big Key (Swamp Palace) -Swamp Palace - West Chest: Nothing -Swamp Palace - Flooded Room - Left: Nothing -Swamp Palace - Flooded Room - Right: Nothing -Swamp Palace - Waterfall Room: Nothing -Swamp Palace - Boss: Nothing -Swamp Palace - Prize: Crystal 2 -Thieves' Town - Big Key Chest: Big Key (Thieves Town) -Thieves' Town - Map Chest: Nothing -Thieves' Town - Compass Chest: Nothing -Thieves' Town - Ambush Chest: Nothing -Thieves' Town - Attic: Nothing -Thieves' Town - Big Chest: Titans Mitts -Thieves' Town - Blind's Cell: Small Key (Thieves Town) -Thieves' Town - Boss: Nothing -Thieves' Town - Prize: Crystal 4 -Skull Woods - Compass Chest: Nothing -Skull Woods - Map Chest: Nothing -Skull Woods - Big Chest: Fire Rod -Skull Woods - Pot Prison: Small Key (Skull Woods) -Skull Woods - Pinball Room: Small Key (Skull Woods) -Skull Woods - Big Key Chest: Big Key (Skull Woods) -Skull Woods - Bridge Room: Small Key (Skull Woods) -Skull Woods - Boss: Nothing -Skull Woods - Prize: Crystal 3 -Ice Palace - Compass Chest: Nothing -Ice Palace - Freezor Chest: Nothing -Ice Palace - Big Chest: Blue Mail -Ice Palace - Iced T Room: Small Key (Ice Palace) -Ice Palace - Spike Room: Small Key (Ice Palace) -Ice Palace - Big Key Chest: Big Key (Ice Palace) -Ice Palace - Map Chest: Nothing -Ice Palace - Boss: Nothing -Ice Palace - Prize: Crystal 5 -Misery Mire - Big Chest: Cane of Somaria -Misery Mire - Map Chest: Nothing -Misery Mire - Main Lobby: Small Key (Misery Mire) -Misery Mire - Bridge Chest: Small Key (Misery Mire) -Misery Mire - Spike Chest: Small Key (Misery Mire) -Misery Mire - Compass Chest: Nothing -Misery Mire - Big Key Chest: Big Key (Misery Mire) -Misery Mire - Boss: Nothing -Misery Mire - Prize: Crystal 6 -Turtle Rock - Compass Chest: Nothing -Turtle Rock - Roller Room - Left: Nothing -Turtle Rock - Roller Room - Right: Small Key (Turtle Rock) -Turtle Rock - Chain Chomps: Small Key (Turtle Rock) -Turtle Rock - Big Key Chest: Big Key (Turtle Rock) -Turtle Rock - Big Chest: Mirror Shield -Turtle Rock - Crystaroller Room: Small Key (Turtle Rock) -Turtle Rock - Eye Bridge - Bottom Left: Small Key (Turtle Rock) -Turtle Rock - Eye Bridge - Bottom Right: Nothing -Turtle Rock - Eye Bridge - Top Left: Nothing -Turtle Rock - Eye Bridge - Top Right: Nothing -Turtle Rock - Boss: Nothing -Turtle Rock - Prize: Crystal 7 -Palace of Darkness - Shooter Room: Small Key (Palace of Darkness) -Palace of Darkness - The Arena - Bridge: Small Key (Palace of Darkness) -Palace of Darkness - Stalfos Basement: Small Key (Palace of Darkness) -Palace of Darkness - Big Key Chest: Big Key (Palace of Darkness) -Palace of Darkness - The Arena - Ledge: Small Key (Palace of Darkness) -Palace of Darkness - Map Chest: Nothing -Palace of Darkness - Compass Chest: Nothing -# logic cannot account for hammer and small key in maze -Palace of Darkness - Dark Basement - Left: Small Key (Palace of Darkness) -Palace of Darkness - Dark Basement - Right: Small Key (Palace of Darkness) -Palace of Darkness - Dark Maze - Top: Nothing -Palace of Darkness - Dark Maze - Bottom: Nothing -Palace of Darkness - Big Chest: Hammer -Palace of Darkness - Harmless Hellway: Nothing -Palace of Darkness - Boss: Nothing -Palace of Darkness - Prize: Crystal 1 -Ganons Tower - Bob's Torch: Small Key (Ganons Tower) -Ganons Tower - Hope Room - Left: Nothing -Ganons Tower - Hope Room - Right: Nothing -Ganons Tower - Tile Room: Small Key (Ganons Tower) -Ganons Tower - Compass Room - Top Left: Nothing -Ganons Tower - Compass Room - Top Right: Nothing -Ganons Tower - Compass Room - Bottom Left: Nothing -Ganons Tower - Compass Room - Bottom Right: Nothing -Ganons Tower - DMs Room - Top Left: Nothing -Ganons Tower - DMs Room - Top Right: Nothing -Ganons Tower - DMs Room - Bottom Left: Nothing -Ganons Tower - DMs Room - Bottom Right: Nothing -Ganons Tower - Map Chest: Nothing -Ganons Tower - Firesnake Room: Small Key (Ganons Tower) -Ganons Tower - Randomizer Room - Top Left: Nothing -Ganons Tower - Randomizer Room - Top Right: Nothing -Ganons Tower - Randomizer Room - Bottom Left: Nothing -Ganons Tower - Randomizer Room - Bottom Right: Nothing -Ganons Tower - Bob's Chest: Nothing -Ganons Tower - Big Chest: Red Mail -Ganons Tower - Big Key Room - Left: Nothing -Ganons Tower - Big Key Room - Right: Nothing -Ganons Tower - Big Key Chest: Big Key (Ganons Tower) -Ganons Tower - Mini Helmasaur Room - Left: Nothing -Ganons Tower - Mini Helmasaur Room - Right: Nothing -Ganons Tower - Pre-Moldorm Chest: Small Key (Ganons Tower) -Ganons Tower - Validation Chest: Nothing -Ganon: Triforce