From b2b0d15addcfe173a96e7d8074921f79376a05de Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 9 Nov 2025 03:07:23 +0100 Subject: [PATCH] Core: add export_datapackage tool (#5609) --- worlds/LauncherComponents.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/worlds/LauncherComponents.py b/worlds/LauncherComponents.py index 2ec70832c0..3db227fd48 100644 --- a/worlds/LauncherComponents.py +++ b/worlds/LauncherComponents.py @@ -5,7 +5,7 @@ import weakref from enum import Enum, auto from typing import Optional, Callable, List, Iterable, Tuple -from Utils import local_path, open_filename, is_frozen, is_kivy_running +from Utils import local_path, open_filename, is_frozen, is_kivy_running, open_file, user_path class Type(Enum): @@ -204,6 +204,18 @@ def install_apworld(apworld_path: str = "") -> None: Utils.messagebox("Install complete.", f"Installed APWorld from {source}.") +def export_datapackage() -> None: + import json + + from worlds import network_data_package + + path = user_path("datapackage_export.json") + with open(path, "w") as f: + json.dump(network_data_package, f, indent=4) + + open_file(path) + + components: List[Component] = [ # Launcher Component('Launcher', 'Launcher', component_type=Type.HIDDEN), @@ -231,7 +243,9 @@ components: List[Component] = [ file_identifier=SuffixIdentifier('.apzl')), #MegaMan Battle Network 3 - Component('MMBN3 Client', 'MMBN3Client', file_identifier=SuffixIdentifier('.apbn3')) + Component('MMBN3 Client', 'MMBN3Client', file_identifier=SuffixIdentifier('.apbn3')), + + Component("Export Datapackage", func=export_datapackage, component_type=Type.TOOL), ]