Skip to content

Commit

Permalink
Consider ArknightsAssets the primary source of yostar flatbuffer schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
thesadru committed Feb 7, 2025
1 parent 2cb9e4d commit 2295296
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions arkprts/assets/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@ def run_flatbuffers(
return pathlib.Path(output_directory) / (pathlib.Path(fbs_path).stem + ".json")


def resolve_fbs_schema_directory(server: typing.Literal["cn", "yostar", "tw"]) -> pathlib.Path:
def resolve_fbs_schema_directory(
server: typing.Literal["cn", "yostar", "tw"],
prefer_guess: bool = True,
) -> pathlib.Path:
"""Resolve the flatbuffers schema directory."""
if server == "tw":
return netn.APPDATA_DIR / "ArknightsFlatbuffers" / "tw"
if server == "tw" or (server == "yostar" and prefer_guess):
return netn.APPDATA_DIR / "ArknightsFlatbuffers" / server

core_path = netn.APPDATA_DIR / "ArknightsFBS"
core_path.mkdir(parents=True, exist_ok=True)
Expand All @@ -140,11 +143,12 @@ def resolve_fbs_schema_directory(server: typing.Literal["cn", "yostar", "tw"]) -
async def update_fbs_schema(*, force: bool = False) -> None:
"""Download or otherwise update FBS files."""
for server, branch in [("cn", "main"), ("yostar", "YoStar")]:
assert server in ("cn", "yostar") # pyright regression
if UPDATED_FBS[server] and not force:
continue

UPDATED_FBS[server] = True
directory = resolve_fbs_schema_directory(server).parent # pyright: ignore[reportArgumentType]
directory = resolve_fbs_schema_directory(server, prefer_guess=False).parent
await git.download_repository("MooncellWiki/OpenArknightsFBS", directory, branch=branch, force=force)

if not UPDATED_FBS["tw"] or force:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "arkprts"
requires-python = ">=3.9"
version = "0.3.13"
version = "0.3.14"
dynamic = [
"dependencies",
"description",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="arkprts",
version="0.3.13",
version="0.3.14",
description="Arknights python wrapper.",
url="https://github.com/thesadru/arkprts",
packages=find_packages(exclude=["tests", "tests.*"]),
Expand Down

0 comments on commit 2295296

Please sign in to comment.