Compare commits
No commits in common. "32d6ca18914ab21a590e5bba3af3ad6cf673e372" and "b85cc5db4b1e495c6fb28b24f39ae879730686e8" have entirely different histories.
32d6ca1891
...
b85cc5db4b
@ -2,20 +2,14 @@ from pathlib import Path
|
|||||||
from vollerei import __version__
|
from vollerei import __version__
|
||||||
from vollerei.cli.hsr import HSR
|
from vollerei.cli.hsr import HSR
|
||||||
from vollerei.hsr import PatchType
|
from vollerei.hsr import PatchType
|
||||||
from vollerei.cli import utils
|
|
||||||
|
|
||||||
|
|
||||||
class CLI:
|
class CLI:
|
||||||
def __init__(
|
def __init__(self, game_path: str = None, patch_type=None) -> None:
|
||||||
self, game_path: str = None, patch_type=None, noconfirm: bool = False
|
|
||||||
) -> None:
|
|
||||||
"""
|
"""
|
||||||
Vollerei CLI
|
Vollerei CLI
|
||||||
"""
|
"""
|
||||||
print(f"Vollerei v{__version__}")
|
print(f"Vollerei v{__version__}")
|
||||||
if noconfirm:
|
|
||||||
print("User requested to automatically answer yes to all questions.")
|
|
||||||
utils.no_confirm = noconfirm
|
|
||||||
if not game_path:
|
if not game_path:
|
||||||
game_path = Path.cwd()
|
game_path = Path.cwd()
|
||||||
game_path = Path(game_path)
|
game_path = Path(game_path)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from platform import system
|
|
||||||
from vollerei.cli.utils import ask
|
|
||||||
from vollerei.hsr import Game, Patcher
|
from vollerei.hsr import Game, Patcher
|
||||||
from vollerei.exceptions.patcher import PatcherError, PatchUpdateError
|
from vollerei.exceptions.patcher import PatcherError, PatchUpdateError
|
||||||
from vollerei.hsr.patcher import PatchType
|
from vollerei.hsr.patcher import PatchType
|
||||||
@ -28,6 +26,7 @@ class HSR:
|
|||||||
except PatchUpdateError as e:
|
except PatchUpdateError as e:
|
||||||
print("FAILED")
|
print("FAILED")
|
||||||
print(f"Patch update failed with following error: {e} ({e.__context__})")
|
print(f"Patch update failed with following error: {e} ({e.__context__})")
|
||||||
|
print_exc()
|
||||||
return False
|
return False
|
||||||
print("OK")
|
print("OK")
|
||||||
return True
|
return True
|
||||||
@ -35,49 +34,18 @@ class HSR:
|
|||||||
def update_patch(self):
|
def update_patch(self):
|
||||||
self.__update_patch()
|
self.__update_patch()
|
||||||
|
|
||||||
def __patch_jadeite(self):
|
def patch(self):
|
||||||
|
if not self.__update_patch():
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
print("Installing patch...", end=" ")
|
print("Patching game...", end=" ")
|
||||||
jadelte_dir = self._patcher.patch_game(game=self._game)
|
jadelte_dir = self._patcher.patch_game(game=self._game)
|
||||||
except PatcherError as e:
|
except PatcherError as e:
|
||||||
print("FAILED")
|
print("FAILED")
|
||||||
print(f"Patching failed with following error: {e}")
|
print(f"Patching failed with following error: {e}")
|
||||||
return
|
return
|
||||||
print("OK")
|
print("OK")
|
||||||
exe_path = jadelte_dir.joinpath("jadeite.exe")
|
print("Jadelte executable is located at:", jadelte_dir.joinpath("jadelte.exe"))
|
||||||
print("Jadelte executable is located at:", exe_path)
|
|
||||||
print(
|
print(
|
||||||
"Installation succeeded, but note that you need to run the game using "
|
"Patching succeeded, but note that you need to run the game using Jadelte to use the patch."
|
||||||
+ "Jadeite to use the patch."
|
|
||||||
)
|
)
|
||||||
print(f'E.g: I_WANT_A_BAN=1 {exe_path} "{self._game.path}"')
|
|
||||||
print(
|
|
||||||
"And for your own sake, please only use testing accounts, as there is an "
|
|
||||||
+ "extremely high risk of getting banned."
|
|
||||||
)
|
|
||||||
|
|
||||||
def __patch_astra(self):
|
|
||||||
try:
|
|
||||||
print("Patching game...", end=" ")
|
|
||||||
self._patcher.patch_game(game=self._game)
|
|
||||||
except PatcherError as e:
|
|
||||||
print("FAILED")
|
|
||||||
print(f"Patching failed with following error: {e}")
|
|
||||||
return
|
|
||||||
print("OK")
|
|
||||||
|
|
||||||
def patch(self):
|
|
||||||
if system() == "Windows":
|
|
||||||
print(
|
|
||||||
"Windows is supported officialy by the game, so no patching is needed."
|
|
||||||
)
|
|
||||||
if not ask("Do you still want to patch?"):
|
|
||||||
print("Patching aborted.")
|
|
||||||
return
|
|
||||||
if not self.__update_patch():
|
|
||||||
return
|
|
||||||
match self._patcher.patch_type:
|
|
||||||
case PatchType.Jadeite:
|
|
||||||
self.__patch_jadeite()
|
|
||||||
case PatchType.Astra:
|
|
||||||
self.__patch_astra()
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
no_confirm = False
|
|
||||||
|
|
||||||
|
|
||||||
def ask(question: str):
|
|
||||||
if no_confirm:
|
|
||||||
print(question + " [Y/n] Y")
|
|
||||||
return True
|
|
||||||
while True:
|
|
||||||
answer = input(question + " [y/n] ")
|
|
||||||
if answer.lower() in ["y", "yes"]:
|
|
||||||
return True
|
|
||||||
# Pacman way, treat all other answers as no
|
|
||||||
else:
|
|
||||||
return False
|
|
Loading…
Reference in New Issue
Block a user