v6,sm64ex: Add support for offline singeplayer seeds (#301)

This commit is contained in:
Yussur Mustafa Oraji
2022-03-12 22:05:54 +01:00
committed by GitHub
parent 15e0763ed5
commit 97b1ae5ee9
7 changed files with 78 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import typing
import os, json
from .Items import item_table, V6Item
from .Locations import location_table, V6Location
from .Options import v6_options
@@ -61,3 +61,24 @@ class V6World(World):
"DeathLink": self.world.DeathLink[self.player].value,
"DeathLink_Amnesty": self.world.DeathLinkAmnesty[self.player].value
}
def generate_output(self, output_directory: str):
if self.world.players != 1:
return
data = {
"slot_data": self.fill_slot_data(),
"location_to_item": {self.location_name_to_id[i] : item_table[self.world.get_location(i, self.player).item.name] for i in self.location_name_to_id},
"data_package": {
"data": {
"games": {
self.game: {
"item_name_to_id": self.item_name_to_id,
"location_name_to_id": self.location_name_to_id
}
}
}
}
}
filename = f"AP_{self.world.seed_name}_P{self.player}_{self.world.get_player_name(self.player)}.apv6"
with open(os.path.join(output_directory, filename), 'w') as f:
json.dump(data, f)