From a424719fbde97b15a51bdc427eaa35fd08bc1c1c Mon Sep 17 00:00:00 2001 From: "Mike A. Trethewey" Date: Sat, 7 Mar 2020 14:38:08 -0800 Subject: [PATCH] Wiki Doors --- .gitignore | 4 ++-- Main.py | 6 ++++-- Utils.py | 42 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 91b22ab9..ed3e8193 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,8 @@ RaceRom.py upx/ weights/ -settings.json -working_dirs.json +resources/user/* +!resources/user/.gitkeep *.exe diff --git a/Main.py b/Main.py index 0dd660b6..e8db9b73 100644 --- a/Main.py +++ b/Main.py @@ -19,10 +19,10 @@ from Doors import create_doors from DoorShuffle import link_doors from RoomData import create_rooms from Rules import set_rules -from Dungeons import create_dungeons, fill_dungeons, fill_dungeons_restrictive +from Dungeons import create_dungeons, fill_dungeons, fill_dungeons_restrictive, dungeon_regions from Fill import distribute_items_cutoff, distribute_items_staleness, distribute_items_restrictive, flood_items, balance_multiworld_progression from ItemList import generate_itempool, difficulties, fill_prizes -from Utils import output_path, parse_player_names +from Utils import output_path, parse_player_names, print_wiki_doors_by_room __version__ = '0.0.18.3d' @@ -257,6 +257,8 @@ def main(args, seed=None): logger.info('Done. Enjoy.') logger.info('Total Time: %s', time.perf_counter() - start) +# print_wiki_doors_by_room(dungeon_regions,world,1) + return world def copy_world(world): diff --git a/Utils.py b/Utils.py index c1a97ced..6755279b 100644 --- a/Utils.py +++ b/Utils.py @@ -206,7 +206,7 @@ def read_entrance_data(old_rom='Zelda no Densetsu - Kamigami no Triforce (Japan) print(string) -def print_wiki_doors(d_regions, world, player): +def print_wiki_doors_by_region(d_regions, world, player): for d, region_list in d_regions.items(): tile_map = {} @@ -222,7 +222,7 @@ def print_wiki_doors(d_regions, world, player): if tile not in tile_map: tile_map[tile] = [] tile_map[tile].append(r) - print(d) + print('') print('{| class="wikitable"') print('|-') print('! Room') @@ -244,6 +244,44 @@ def print_wiki_doors(d_regions, world, player): print('| '+'
'.join(strs_to_print)) print('|}') +def print_wiki_doors_by_room(d_regions, world, player): + for d, region_list in d_regions.items(): + tile_map = {} + for region in region_list: + tile = None + r = world.get_region(region, player) + for ext in r.exits: + door = world.check_for_door(ext.name, player) + if door is not None and door.roomIndex != -1: + tile = door.roomIndex + break + if tile is not None: + if tile not in tile_map: + tile_map[tile] = [] + tile_map[tile].append(r) + toprint = "" + toprint += ('') + "\n" + for tile, region_list in tile_map.items(): + for region in region_list: + toprint += ('') + "\n" + toprint += ('{{Infobox dungeon room') + "\n" + toprint += ('| dungeon = {{ROOTPAGENAME}}') + "\n" + toprint += ('| supertile = ' + str(tile)) + "\n" + toprint += ('| tile = x') + "\n" + toprint += ('}}') + "\n" + toprint += ('') + "\n" + toprint += ('== Doors ==') + "\n" + toprint += ('{| class="wikitable"') + "\n" + toprint += ('|-') + "\n" + toprint += ('! Door !! Room Side !! Requirement') + "\n" + for ext in region.exits: + ext_part = ext.name.replace(region.name,'') + ext_part = ext_part.strip() + toprint += ('{{DungeonRoomDoorList/Row|{{ROOTPAGENAME}}|{{SUBPAGENAME}}|' + ext_part + '|Side|}}') + "\n" + toprint += ('|}') + "\n" + toprint += ('') + "\n" + with open(os.path.join(".","resources", "user", "rooms-" + d + ".txt"),"w+") as f: + f.write(toprint) if __name__ == '__main__': pass