From 68daeb4d1faad694f8527c1807813e977ccce146 Mon Sep 17 00:00:00 2001 From: Marechal-l Date: Thu, 4 Aug 2022 20:00:41 +0200 Subject: [PATCH 1/2] Revert "WebHost: Add the DarkSouls3 entry to upload and download the client file" This reverts commit 5e7c2d4cee485e373ffe60932134013548192c8e. --- WebHostLib/downloads.py | 2 -- WebHostLib/templates/macros.html | 3 --- WebHostLib/upload.py | 5 ----- 3 files changed, 10 deletions(-) diff --git a/WebHostLib/downloads.py b/WebHostLib/downloads.py index c3a373c2e9..b222ae984f 100644 --- a/WebHostLib/downloads.py +++ b/WebHostLib/downloads.py @@ -81,8 +81,6 @@ def download_slot_file(room_id, player_id: int): fname = f"AP_{app.jinja_env.filters['suuid'](room_id)}_SP.apv6" elif slot_data.game == "Super Mario 64": fname = f"AP_{app.jinja_env.filters['suuid'](room_id)}_SP.apsm64ex" - elif slot_data.game == "Dark Souls III": - fname = f"AP_{app.jinja_env.filters['suuid'](room_id)}.json" else: return "Game download not supported." return send_file(io.BytesIO(slot_data.data), as_attachment=True, download_name=fname) diff --git a/WebHostLib/templates/macros.html b/WebHostLib/templates/macros.html index 9a92edbbf1..4840cb1383 100644 --- a/WebHostLib/templates/macros.html +++ b/WebHostLib/templates/macros.html @@ -43,9 +43,6 @@ {% elif patch.game | supports_apdeltapatch %} Download Patch File... - {% elif patch.game == "Dark Souls III" %} - - Download JSON File... {% else %} No file to download for this game. {% endif %} diff --git a/WebHostLib/upload.py b/WebHostLib/upload.py index 00825df47b..e6b2c7de95 100644 --- a/WebHostLib/upload.py +++ b/WebHostLib/upload.py @@ -80,11 +80,6 @@ def upload_zip_to_db(zfile: zipfile.ZipFile, owner=None, meta={"race": False}, s slots.add(Slot(data=zfile.open(file, "r").read(), player_name=slot_name, player_id=int(slot_id[1:]), game="Ocarina of Time")) - elif file.filename.endswith(".json"): - _, seed_name, slot_id, slot_name = file.filename.split('.')[0].split('-', 3) - slots.add(Slot(data=zfile.open(file, "r").read(), player_name=slot_name, - player_id=int(slot_id[1:]), game="Dark Souls III")) - elif file.filename.endswith(".txt"): spoiler = zfile.open(file, "r").read().decode("utf-8-sig") From 23101a36eca3caa9e0e65b47c2a1c80f371a4a18 Mon Sep 17 00:00:00 2001 From: Marechal-l Date: Sat, 17 Sep 2022 20:03:58 +0200 Subject: [PATCH 2/2] ds3: Use fill_slot_data instead of generate_output --- worlds/dark_souls_3/__init__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/worlds/dark_souls_3/__init__.py b/worlds/dark_souls_3/__init__.py index fc3f77dbc7..04c0b8dcb3 100644 --- a/worlds/dark_souls_3/__init__.py +++ b/worlds/dark_souls_3/__init__.py @@ -1,6 +1,7 @@ # world/dark_souls_3/__init__.py import json import os +from typing import Dict from .Options import dark_souls_options from .data.items_data import weapons_upgrade_5_table, weapons_upgrade_10_table, item_dictionary_table, key_items_list @@ -237,7 +238,9 @@ class DarkSouls3World(World): for i in range(item_pool_len, total_required_locations): self.world.itempool += [self.create_item("Soul of an Intrepid Hero")] - def generate_output(self, output_directory: str): + def fill_slot_data(self) -> Dict[str, object]: + slot_data: Dict[str, object] = {} + # Depending on the specified option, modify items hexadecimal value to add an upgrade level item_dictionary = item_dictionary_table.copy() if self.world.randomize_weapons_level[self.player]: @@ -271,7 +274,7 @@ class DarkSouls3World(World): else: locations_target.append(0) - data = { + slot_data = { "options": { "auto_equip": self.world.auto_equip[self.player].value, "lock_equip": self.world.lock_equip[self.player].value, @@ -287,10 +290,10 @@ class DarkSouls3World(World): "itemsAddress": items_address } - # generate the file - filename = f"AP-{self.world.seed_name}-P{self.player}-{self.world.player_name[self.player]}.json" - with open(os.path.join(output_directory, filename), 'w') as outfile: - json.dump(data, outfile) + return slot_data + + def generate_output(self, output_directory: str): + pass class DarkSouls3Location(Location):