mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core and Various Worlds: define patch_file_ending to APPlayerContainer (#5058)
* move to playercontainer * moves patch_file_ending handling to APPlayerContainer and updates the worlds using it to define their extensions * give oot a patch_file_ending as well
This commit is contained in:
@@ -158,6 +158,7 @@ class APContainer:
|
|||||||
class APPlayerContainer(APContainer):
|
class APPlayerContainer(APContainer):
|
||||||
"""A zipfile containing at least archipelago.json meant for a player"""
|
"""A zipfile containing at least archipelago.json meant for a player"""
|
||||||
game: ClassVar[Optional[str]] = None
|
game: ClassVar[Optional[str]] = None
|
||||||
|
patch_file_ending: str = ""
|
||||||
|
|
||||||
player: Optional[int]
|
player: Optional[int]
|
||||||
player_name: str
|
player_name: str
|
||||||
@@ -184,6 +185,7 @@ class APPlayerContainer(APContainer):
|
|||||||
"player": self.player,
|
"player": self.player,
|
||||||
"player_name": self.player_name,
|
"player_name": self.player_name,
|
||||||
"game": self.game,
|
"game": self.game,
|
||||||
|
"patch_file_ending": self.patch_file_ending,
|
||||||
})
|
})
|
||||||
return manifest
|
return manifest
|
||||||
|
|
||||||
@@ -223,7 +225,6 @@ class APProcedurePatch(APAutoPatchInterface):
|
|||||||
"""
|
"""
|
||||||
hash: Optional[str] # base checksum of source file
|
hash: Optional[str] # base checksum of source file
|
||||||
source_data: bytes
|
source_data: bytes
|
||||||
patch_file_ending: str = ""
|
|
||||||
files: Dict[str, bytes]
|
files: Dict[str, bytes]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -245,7 +246,6 @@ class APProcedurePatch(APAutoPatchInterface):
|
|||||||
manifest = super(APProcedurePatch, self).get_manifest()
|
manifest = super(APProcedurePatch, self).get_manifest()
|
||||||
manifest["base_checksum"] = self.hash
|
manifest["base_checksum"] = self.hash
|
||||||
manifest["result_file_ending"] = self.result_file_ending
|
manifest["result_file_ending"] = self.result_file_ending
|
||||||
manifest["patch_file_ending"] = self.patch_file_ending
|
|
||||||
manifest["procedure"] = self.procedure
|
manifest["procedure"] = self.procedure
|
||||||
if self.procedure == APDeltaPatch.procedure:
|
if self.procedure == APDeltaPatch.procedure:
|
||||||
manifest["compatible_version"] = 5
|
manifest["compatible_version"] = 5
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import os
|
import os
|
||||||
import io
|
|
||||||
from typing import TYPE_CHECKING, Dict, List, Optional, cast
|
from typing import TYPE_CHECKING, Dict, List, Optional, cast
|
||||||
import zipfile
|
import zipfile
|
||||||
from BaseClasses import Location
|
from BaseClasses import Location
|
||||||
from worlds.Files import APContainer, AutoPatchRegister
|
from worlds.Files import APPlayerContainer
|
||||||
|
|
||||||
from .Enum import CivVICheckType
|
from .Enum import CivVICheckType
|
||||||
from .Locations import CivVILocation, CivVILocationData
|
from .Locations import CivVILocation, CivVILocationData
|
||||||
@@ -26,18 +25,15 @@ class CivTreeItem:
|
|||||||
ui_tree_row: int
|
ui_tree_row: int
|
||||||
|
|
||||||
|
|
||||||
class CivVIContainer(APContainer, metaclass=AutoPatchRegister):
|
class CivVIContainer(APPlayerContainer):
|
||||||
"""
|
"""
|
||||||
Responsible for generating the dynamic mod files for the Civ VI multiworld
|
Responsible for generating the dynamic mod files for the Civ VI multiworld
|
||||||
"""
|
"""
|
||||||
game: Optional[str] = "Civilization VI"
|
game: Optional[str] = "Civilization VI"
|
||||||
patch_file_ending = ".apcivvi"
|
patch_file_ending = ".apcivvi"
|
||||||
|
|
||||||
def __init__(self, patch_data: Dict[str, str] | io.BytesIO, base_path: str = "", output_directory: str = "",
|
def __init__(self, patch_data: Dict[str, str], base_path: str = "", output_directory: str = "",
|
||||||
player: Optional[int] = None, player_name: str = "", server: str = ""):
|
player: Optional[int] = None, player_name: str = "", server: str = ""):
|
||||||
if isinstance(patch_data, io.BytesIO):
|
|
||||||
super().__init__(patch_data, player, player_name, server)
|
|
||||||
else:
|
|
||||||
self.patch_data = patch_data
|
self.patch_data = patch_data
|
||||||
self.file_path = base_path
|
self.file_path = base_path
|
||||||
container_path = os.path.join(output_directory, base_path + ".apcivvi")
|
container_path = os.path.join(output_directory, base_path + ".apcivvi")
|
||||||
|
@@ -67,6 +67,7 @@ class FactorioModFile(worlds.Files.APPlayerContainer):
|
|||||||
game = "Factorio"
|
game = "Factorio"
|
||||||
compression_method = zipfile.ZIP_DEFLATED # Factorio can't load LZMA archives
|
compression_method = zipfile.ZIP_DEFLATED # Factorio can't load LZMA archives
|
||||||
writing_tasks: List[Callable[[], Tuple[str, Union[str, bytes]]]]
|
writing_tasks: List[Callable[[], Tuple[str, Union[str, bytes]]]]
|
||||||
|
patch_file_ending = ".zip"
|
||||||
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any):
|
def __init__(self, *args: Any, **kwargs: Any):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@@ -13,6 +13,7 @@ from worlds.Files import APPlayerContainer
|
|||||||
|
|
||||||
class KH2Container(APPlayerContainer):
|
class KH2Container(APPlayerContainer):
|
||||||
game: str = 'Kingdom Hearts 2'
|
game: str = 'Kingdom Hearts 2'
|
||||||
|
patch_file_ending = ".zip"
|
||||||
|
|
||||||
def __init__(self, patch_data: dict, base_path: str, output_directory: str,
|
def __init__(self, patch_data: dict, base_path: str, output_directory: str,
|
||||||
player=None, player_name: str = "", server: str = ""):
|
player=None, player_name: str = "", server: str = ""):
|
||||||
|
@@ -38,6 +38,7 @@ AP_JUNK = 0xD5
|
|||||||
|
|
||||||
class OoTContainer(APPatch):
|
class OoTContainer(APPatch):
|
||||||
game: str = 'Ocarina of Time'
|
game: str = 'Ocarina of Time'
|
||||||
|
patch_file_ending = ".apz5"
|
||||||
|
|
||||||
def __init__(self, patch_data: bytes, base_path: str, output_directory: str,
|
def __init__(self, patch_data: bytes, base_path: str, output_directory: str,
|
||||||
player = None, player_name: str = "", server: str = ""):
|
player = None, player_name: str = "", server: str = ""):
|
||||||
|
@@ -11,7 +11,7 @@ from BaseClasses import ItemClassification as IC
|
|||||||
from BaseClasses import MultiWorld, Region, Tutorial
|
from BaseClasses import MultiWorld, Region, Tutorial
|
||||||
from Options import Toggle
|
from Options import Toggle
|
||||||
from worlds.AutoWorld import WebWorld, World
|
from worlds.AutoWorld import WebWorld, World
|
||||||
from worlds.Files import APPlayerContainer, AutoPatchRegister
|
from worlds.Files import APPlayerContainer
|
||||||
from worlds.generic.Rules import add_item_rule
|
from worlds.generic.Rules import add_item_rule
|
||||||
from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch_subprocess
|
from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch_subprocess
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ components.append(
|
|||||||
icon_paths["The Wind Waker"] = "ap:worlds.tww/assets/icon.png"
|
icon_paths["The Wind Waker"] = "ap:worlds.tww/assets/icon.png"
|
||||||
|
|
||||||
|
|
||||||
class TWWContainer(APPlayerContainer, metaclass=AutoPatchRegister):
|
class TWWContainer(APPlayerContainer):
|
||||||
"""
|
"""
|
||||||
This class defines the container file for The Wind Waker.
|
This class defines the container file for The Wind Waker.
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user