Skip to content

Commit

Permalink
Merge branch 'main' into sc2-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziktofel authored Mar 15, 2024
2 parents 70f8d6d + d1ef198 commit 06b8bd4
Show file tree
Hide file tree
Showing 206 changed files with 19,072 additions and 7,535 deletions.
2 changes: 2 additions & 0 deletions CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,10 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
elif cmd == 'ConnectionRefused':
errors = args["errors"]
if 'InvalidSlot' in errors:
ctx.disconnected_intentionally = True
ctx.event_invalid_slot()
elif 'InvalidGame' in errors:
ctx.disconnected_intentionally = True
ctx.event_invalid_game()
elif 'IncompatibleVersion' in errors:
raise Exception('Server reported your client version as incompatible. '
Expand Down
4 changes: 2 additions & 2 deletions Patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import ModuleUpdate
ModuleUpdate.update()

from worlds.Files import AutoPatchRegister, APPatch
from worlds.Files import AutoPatchRegister, APAutoPatchInterface


class RomMeta(TypedDict):
Expand All @@ -20,7 +20,7 @@ class RomMeta(TypedDict):
def create_rom_file(patch_file: str) -> Tuple[RomMeta, str]:
auto_handler = AutoPatchRegister.get_handler(patch_file)
if auto_handler:
handler: APPatch = auto_handler(patch_file)
handler: APAutoPatchInterface = auto_handler(patch_file)
target = os.path.splitext(patch_file)[0]+handler.result_file_ending
handler.patch(target)
return {"server": handler.server,
Expand Down
2 changes: 1 addition & 1 deletion Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def as_simple_string(self) -> str:
return ".".join(str(item) for item in self)


__version__ = "0.4.4"
__version__ = "0.4.5"
version_tuple = tuplize_version(__version__)

is_linux = sys.platform.startswith("linux")
Expand Down
2 changes: 2 additions & 0 deletions kvui.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def __init__(self, *args, **kwargs):
self.layout.bind(minimum_height=self.layout.setter("height"))
self.add_widget(self.layout)
self.effect_cls = ScrollEffect
self.bar_width = dp(12)
self.scroll_type = ["content", "bars"]


class HovererableLabel(HoverBehavior, Label):
Expand Down
39 changes: 29 additions & 10 deletions worlds/Files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import threading

from typing import ClassVar, Dict, Tuple, Any, Optional, Union, BinaryIO
from typing import ClassVar, Dict, List, Literal, Tuple, Any, Optional, Union, BinaryIO

import bsdiff4

Expand Down Expand Up @@ -38,7 +38,7 @@ def get_handler(file: str) -> Optional[AutoPatchRegister]:
return None


current_patch_version: int = 5
container_version: int = 6


class InvalidDataError(Exception):
Expand All @@ -50,7 +50,7 @@ class InvalidDataError(Exception):

class APContainer:
"""A zipfile containing at least archipelago.json"""
version: int = current_patch_version
version: int = container_version
compression_level: int = 9
compression_method: int = zipfile.ZIP_DEFLATED
game: Optional[str] = None
Expand Down Expand Up @@ -124,14 +124,31 @@ def get_manifest(self) -> Dict[str, Any]:
"game": self.game,
# minimum version of patch system expected for patching to be successful
"compatible_version": 5,
"version": current_patch_version,
"version": container_version,
}


class APPatch(APContainer, abc.ABC, metaclass=AutoPatchRegister):
class APPatch(APContainer):
"""
An abstract `APContainer` that defines the requirements for an object
to be used by the `Patch.create_rom_file` function.
An `APContainer` that represents a patch file.
It includes the `procedure` key in the manifest to indicate that it is a patch.
Your implementation should inherit from this if your output file
represents a patch file, but will not be applied with AP's `Patch.py`
"""
procedure: Union[Literal["custom"], List[Tuple[str, List[Any]]]] = "custom"

def get_manifest(self) -> Dict[str, Any]:
manifest = super(APPatch, self).get_manifest()
manifest["procedure"] = self.procedure
manifest["compatible_version"] = 6
return manifest


class APAutoPatchInterface(APPatch, abc.ABC, metaclass=AutoPatchRegister):
"""
An abstract `APPatch` that defines the requirements for a patch
to be applied with AP's `Patch.py`
"""
result_file_ending: str = ".sfc"

Expand All @@ -140,14 +157,15 @@ def patch(self, target: str) -> None:
""" create the output file with the file name `target` """


class APDeltaPatch(APPatch):
"""An APPatch that additionally has delta.bsdiff4
containing a delta patch to get the desired file, often a rom."""
class APDeltaPatch(APAutoPatchInterface):
"""An implementation of `APAutoPatchInterface` that additionally
has delta.bsdiff4 containing a delta patch to get the desired file."""

hash: Optional[str] # base checksum of source file
patch_file_ending: str = ""
delta: Optional[bytes] = None
source_data: bytes
procedure = None # delete this line when APPP is added

def __init__(self, *args: Any, patched_path: str = "", **kwargs: Any) -> None:
self.patched_path = patched_path
Expand All @@ -158,6 +176,7 @@ def get_manifest(self) -> Dict[str, Any]:
manifest["base_checksum"] = self.hash
manifest["result_file_ending"] = self.result_file_ending
manifest["patch_file_ending"] = self.patch_file_ending
manifest["compatible_version"] = 5 # delete this line when APPP is added
return manifest

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions worlds/adventure/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Utils
from .Locations import AdventureLocation, LocationData
from settings import get_settings
from worlds.Files import APDeltaPatch, AutoPatchRegister, APContainer
from worlds.Files import APPatch, AutoPatchRegister

import bsdiff4

Expand Down Expand Up @@ -78,7 +78,7 @@ def get_dict(self):
return ret_dict


class AdventureDeltaPatch(APContainer, metaclass=AutoPatchRegister):
class AdventureDeltaPatch(APPatch, metaclass=AutoPatchRegister):
hash = ADVENTUREHASH
game = "Adventure"
patch_file_ending = ".apadvn"
Expand Down
21 changes: 21 additions & 0 deletions worlds/celeste64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Celeste 64 - Changelog


## v1.1 - First Stable Release

### Features:

- Goal is to collect a certain amount of Strawberries and visit Badeline on her island
- Locations included:
- Strawberries
- Items included:
- Strawberries
- Dash Refills
- Double Dash Refills
- Feathers
- Coins
- Cassettes
- Traffic Blocks
- Springs
- Breakable Blocks
- DeathLink is supported
47 changes: 47 additions & 0 deletions worlds/dkc3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Donkey Kong Country 3 - Changelog


## v1.1

### Features:

- KONGsanity option (Collect all KONG letters in each level for a check)
- Autosave option
- Difficulty option
- MERRY option
- Handle collected/co-op locations

### Bug Fixes:

- Fixed Mekanos softlock
- Prevent Brothers Bear giving extra Banana Birds
- Fixed Banana Bird Mother check sending prematurely
- Fix Logic bug with Krematoa level costs


## v1.0

### Features:

- Goal
- Knautilus
- Scuttle the Knautilus in Krematoa and defeat Baron K. Roolenstein to win
- Banana Bird Hunt
- Find the Banana Birds and rescue their mother to win
- Locations included:
- Level Flags
- Bonuses
- DK Coins
- Banana Bird Caves
- Items included:
- Progressive Boat Upgrade
- Three are placed into the item pool (Patch -> First Ski -> Second Ski)
- Bonus Coins
- DK Coins
- Krematoa Cogs
- Bear Coins
- 1-Up Balloons
- Level Shuffle is supported
- Music Shuffle is supported
- Kong Palette options are supported
- Starting life count can be set
6 changes: 3 additions & 3 deletions worlds/ffmq/Output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from copy import deepcopy
from .Regions import object_id_table
from Utils import __version__
from worlds.Files import APContainer
from worlds.Files import APPatch
import pkgutil

settings_template = yaml.load(pkgutil.get_data(__name__, "data/settings.yaml"), yaml.Loader)
Expand Down Expand Up @@ -116,10 +116,10 @@ def tf(option):
APMQ.write_contents(zf)


class APMQFile(APContainer):
class APMQFile(APPatch):
game = "Final Fantasy Mystic Quest"

def get_manifest(self):
manifest = super().get_manifest()
manifest["patch_file_ending"] = ".apmq"
return manifest
return manifest
8 changes: 4 additions & 4 deletions worlds/lingo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

from BaseClasses import Item, ItemClassification, Tutorial
from worlds.AutoWorld import WebWorld, World
from .datatypes import Room, RoomEntrance
from .items import ALL_ITEM_TABLE, LingoItem
from .locations import ALL_LOCATION_TABLE
from .options import LingoOptions
from .player_logic import LingoPlayerLogic
from .regions import create_regions
from .static_logic import Room, RoomEntrance


class LingoWebWorld(WebWorld):
Expand Down Expand Up @@ -100,9 +100,9 @@ def create_item(self, name: str) -> Item:
item = ALL_ITEM_TABLE[name]

classification = item.classification
if hasattr(self, "options") and self.options.shuffle_paintings and len(item.painting_ids) > 0\
and len(item.door_ids) == 0 and all(painting_id not in self.player_logic.painting_mapping
for painting_id in item.painting_ids)\
if hasattr(self, "options") and self.options.shuffle_paintings and len(item.painting_ids) > 0 \
and not item.has_doors and all(painting_id not in self.player_logic.painting_mapping
for painting_id in item.painting_ids) \
and "pilgrim_painting2" not in item.painting_ids:
# If this is a "door" that just moves one or more paintings, and painting shuffle is on and those paintings
# go nowhere, then this item should not be progression. The Pilgrim Room painting is special and needs to be
Expand Down
5 changes: 5 additions & 0 deletions worlds/lingo/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# lingo data

The source of truth for the Lingo randomizer is (currently) the LL1.yaml and ids.yaml files located here. These files are used by the generator, the game client, and the tracker, in order to have logic that is consistent across them all.

The generator does not actually read in the yaml files. Instead, a compiled datafile called generated.dat is also located in this directory. If you update LL1.yaml and/or ids.yaml, you must also regenerate the datafile using `python worlds/lingo/utils/pickle_static_data.py`. A unit test will fail if you don't.
Binary file added worlds/lingo/data/generated.dat
Binary file not shown.
67 changes: 67 additions & 0 deletions worlds/lingo/datatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from typing import List, NamedTuple, Optional


class RoomAndDoor(NamedTuple):
room: Optional[str]
door: str


class RoomAndPanel(NamedTuple):
room: Optional[str]
panel: str


class RoomEntrance(NamedTuple):
room: str # source room
door: Optional[RoomAndDoor]
painting: bool


class Room(NamedTuple):
name: str
entrances: List[RoomEntrance]


class Door(NamedTuple):
name: str
item_name: str
location_name: Optional[str]
panels: Optional[List[RoomAndPanel]]
skip_location: bool
skip_item: bool
has_doors: bool
painting_ids: List[str]
event: bool
group: Optional[str]
include_reduce: bool
junk_item: bool


class Panel(NamedTuple):
required_rooms: List[str]
required_doors: List[RoomAndDoor]
required_panels: List[RoomAndPanel]
colors: List[str]
check: bool
event: bool
exclude_reduce: bool
achievement: bool
non_counting: bool


class Painting(NamedTuple):
id: str
room: str
enter_only: bool
exit_only: bool
required: bool
required_when_no_doors: bool
required_door: Optional[RoomAndDoor]
disable: bool
req_blocked: bool
req_blocked_when_no_doors: bool


class Progression(NamedTuple):
item_name: str
index: int
12 changes: 6 additions & 6 deletions worlds/lingo/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ItemData(NamedTuple):
code: int
classification: ItemClassification
mode: Optional[str]
door_ids: List[str]
has_doors: bool
painting_ids: List[str]

def should_include(self, world: "LingoWorld") -> bool:
Expand Down Expand Up @@ -61,19 +61,19 @@ def load_item_data():
door_mode = "doors"
else:
door_mode = "complex door"
door_groups.setdefault(door.group, []).extend(door.door_ids)
door_groups.setdefault(door.group, [])

if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]:
door_mode = "special"

ALL_ITEM_TABLE[door.item_name] = \
ItemData(get_door_item_id(room_name, door_name),
ItemClassification.filler if door.junk_item else ItemClassification.progression, door_mode,
door.door_ids, door.painting_ids)
door.has_doors, door.painting_ids)

for group, group_door_ids in door_groups.items():
ALL_ITEM_TABLE[group] = ItemData(get_door_group_item_id(group),
ItemClassification.progression, "door group", group_door_ids, [])
ItemClassification.progression, "door group", True, [])

special_items: Dict[str, ItemClassification] = {
":)": ItemClassification.filler,
Expand All @@ -88,11 +88,11 @@ def load_item_data():

for item_name, classification in special_items.items():
ALL_ITEM_TABLE[item_name] = ItemData(get_special_item_id(item_name), classification,
"special", [], [])
"special", False, [])

for item_name in PROGRESSIVE_ITEMS:
ALL_ITEM_TABLE[item_name] = ItemData(get_progressive_item_id(item_name),
ItemClassification.progression, "special", [], [])
ItemClassification.progression, "special", False, [])


# Initialize the item data at module scope.
Expand Down
Loading

0 comments on commit 06b8bd4

Please sign in to comment.