feat: add hi3 stub
HI3 isn't working atm, don't expect too much
This commit is contained in:
parent
ca03718bf1
commit
70eb0e9443
@ -16,10 +16,12 @@ cleo = "^2.1.0"
|
||||
pytest = "^7.3.1"
|
||||
pre-commit = "^3.3.3"
|
||||
|
||||
|
||||
[tool.poetry.group.cli.dependencies]
|
||||
tqdm = "^4.65.0"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
vollerei = 'vollerei.cli:run'
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
24
vollerei/hi3/constants.py
Normal file
24
vollerei/hi3/constants.py
Normal file
@ -0,0 +1,24 @@
|
||||
class LAUNCHER_API:
|
||||
"""Launcher API constants."""
|
||||
|
||||
RESOURCE_PATH: str = "mdk/launcher/api/resource"
|
||||
OS: dict = {
|
||||
"url": "https://hkrpg-launcher-static.hoyoverse.com/hkrpg_global/",
|
||||
"params": {
|
||||
"channel_id": 1,
|
||||
"key": "vplOVX8Vn7cwG8yb",
|
||||
"launcher_id": 35,
|
||||
},
|
||||
}
|
||||
ASIA: dict = {}
|
||||
CN: dict = {
|
||||
"url": "https://api-launcher.mihoyo.com/hkrpg_cn/mdk/launcher/api/resource",
|
||||
"params": {
|
||||
"channel_id": 1,
|
||||
"key": "6KcVuOkbcqjJomjZ",
|
||||
"launcher_id": 33,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
LATEST_VERSION = (7, 2, 0)
|
9
vollerei/hi3/launcher/enums.py
Normal file
9
vollerei/hi3/launcher/enums.py
Normal file
@ -0,0 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class GameChannel(Enum):
|
||||
Global = 0
|
||||
Asia = 1
|
||||
Taiwan = 2
|
||||
Korea = 3
|
||||
China = 4
|
73
vollerei/hi3/launcher/game.py
Normal file
73
vollerei/hi3/launcher/game.py
Normal file
@ -0,0 +1,73 @@
|
||||
from configparser import ConfigParser
|
||||
from io import IOBase
|
||||
from os import PathLike
|
||||
from pathlib import Path
|
||||
from vollerei.abc.launcher.game import GameABC
|
||||
from vollerei.common import ConfigFile, functions
|
||||
from vollerei.common.api import resource
|
||||
from vollerei.common.enums import VoicePackLanguage
|
||||
from vollerei.exceptions.game import (
|
||||
GameAlreadyUpdatedError,
|
||||
GameNotInstalledError,
|
||||
PreDownloadNotAvailable,
|
||||
ScatteredFilesNotAvailableError,
|
||||
)
|
||||
from vollerei.hi3.launcher.enums import GameChannel
|
||||
from vollerei.hsr.launcher import api
|
||||
from vollerei import paths
|
||||
from vollerei.utils import download
|
||||
|
||||
|
||||
class Game(GameABC):
|
||||
"""
|
||||
Manages the game installation
|
||||
|
||||
Since channel detection isn't implemented yet, most functions assume you're
|
||||
using the overseas version of the game. You can override channel by setting
|
||||
the property `channel_override` to the channel you want to use.
|
||||
"""
|
||||
|
||||
def __init__(self, path: PathLike = None, cache_path: PathLike = None):
|
||||
self._path: Path | None = Path(path) if path else None
|
||||
if not cache_path:
|
||||
cache_path = paths.cache_path
|
||||
cache_path = Path(cache_path)
|
||||
self.cache: Path = cache_path.joinpath("game/hi3/")
|
||||
self.cache.mkdir(parents=True, exist_ok=True)
|
||||
self._version_override: tuple[int, int, int] | None = None
|
||||
self._channel_override: GameChannel | None = None
|
||||
|
||||
@property
|
||||
def version_override(self) -> tuple[int, int, int] | None:
|
||||
"""
|
||||
Overrides the game version.
|
||||
|
||||
This can be useful if you want to override the version of the game
|
||||
and additionally working around bugs.
|
||||
"""
|
||||
return self._version_override
|
||||
|
||||
@version_override.setter
|
||||
def version_override(self, version: tuple[int, int, int] | str | None):
|
||||
if isinstance(version, str):
|
||||
version = tuple(int(i) for i in version.split("."))
|
||||
self._version_override = version
|
||||
|
||||
@property
|
||||
def channel_override(self) -> GameChannel | None:
|
||||
"""
|
||||
Overrides the game channel.
|
||||
|
||||
Because game channel detection isn't implemented yet, you may need
|
||||
to use this for some functions to work.
|
||||
|
||||
This can be useful if you want to override the channel of the game
|
||||
and additionally working around bugs.
|
||||
"""
|
||||
return self._channel_override
|
||||
|
||||
@channel_override.setter
|
||||
def channel_override(self, channel: GameChannel | str | None):
|
||||
if isinstance(channel, str):
|
||||
channel = GameChannel[channel]
|
||||
self._channel_override = channel
|
6
vollerei/hi3/patcher.py
Normal file
6
vollerei/hi3/patcher.py
Normal file
@ -0,0 +1,6 @@
|
||||
from vollerei.hsr.patcher import Patcher, PatchType
|
||||
|
||||
|
||||
# Re-exports Patcher and PatchType from HSR because they use the same patcher
|
||||
# which is Jadeite.
|
||||
__all__ = ["Patcher", "PatchType"]
|
@ -188,6 +188,8 @@ class Patcher(PatcherABC):
|
||||
Unpatch the game
|
||||
|
||||
If you use Jadeite (by default), this will just delete Jadeite files.
|
||||
Note that Honkai Impact 3rd uses Jadeite too, so executing this will
|
||||
delete the files needed by both games.
|
||||
|
||||
Args:
|
||||
game (Game): The game to unpatch
|
||||
|
Loading…
Reference in New Issue
Block a user