Skip to content

Commit

Permalink
Merge pull request #41 from apple1417/master
Browse files Browse the repository at this point in the history
more loot rando compat
  • Loading branch information
apple1417 authored Feb 17, 2025
2 parents 69b64f9 + 9ddd990 commit 16490bb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/legacy_compat/meta_path_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_importing_file() -> Path:
raise RuntimeError

@classmethod
def find_spec( # noqa: D102
def find_spec( # noqa: D102, C901
cls,
fullname: str,
path: Sequence[str] | None = None,
Expand Down Expand Up @@ -213,5 +213,36 @@ def find_spec( # noqa: D102
),
)

case ("Mod", "Mods.LootRandomizer.Mod.locations"):
return spec_with_replacements(
fullname,
path,
target,
# This one's a break just due to upgrading python. Hints were trying to be a
# string enum before StrEnum was introduced, stringifying them now returns the
# name, not the value.
(
rb"hint_text = self\.item\.hint\.formatter\(self\.item\.hint\)",
b"hint_text = self.item.hint.formatter(self.item.hint.value)",
),
)

case ("Mod", "Mods.LootRandomizer.Mod.hints"):
return spec_with_replacements(
fullname,
path,
target,
# This is a bit of a weird one. Best we can tell, in legacy sdk if you didn't
# specify a struct field, it just left it alone, so this kept whatever the old
# grades data was.
# In new sdk setting an entire struct zero-inits missing fields instead - so add
# back in what we actually want it to be set to.
(
rb"inventory_template.Manufacturers = \(\(manufacturer\),\)",
b"inventory_template.Manufacturers = [(manufacturer[0], "
b"[((1, None), (1, 100), (0.5, None, None, 1), (1, None, None, 1))])]",
),
)

case _, _:
return None
2 changes: 1 addition & 1 deletion src/mods_base
Submodule mods_base updated 1 files
+2 −2 keybinds.py

0 comments on commit 16490bb

Please sign in to comment.