mirror of
https://github.com/aclist/dztui.git
synced 2026-11-07 02:20:39 +01:00
feat: load direct to menu
This commit is contained in:
1 parent
15d928026a
commit
fd9eb33714
6 files changed
+66
-8
No files matched your search
@@ -61,6 +61,8 @@ class Details:
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Record:
|
||||
# TODO: investigate whether this enum is still being used;
|
||||
# can this be frozen?
|
||||
"""
|
||||
The gameport field is manipulated by the RowType.CONN_BY_IP method
|
||||
"""
|
||||
@@ -509,6 +511,10 @@ def fqip_to_record(addr: str) -> Optional[Record]:
|
||||
return Record(r[0], int(r[1]), int(r[2]))
|
||||
|
||||
|
||||
def record_to_fqip(record: Record) -> str:
|
||||
return f"{record.ip}:{record.gameport}:{record.qport}"
|
||||
|
||||
|
||||
def response_to_fqip(res: dict) -> str:
|
||||
ip = res["addr"].split(":")[0]
|
||||
gameport = res["gameport"]
|
||||
|
||||
@@ -146,6 +146,23 @@ def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> i
|
||||
return proc.returncode
|
||||
|
||||
|
||||
def load_to_menu(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
||||
"""Loads to the menu screen with the selected mods; used for server restarts"""
|
||||
concat = concat_mods(mods)
|
||||
client_args = concat_bash_args(client)
|
||||
params = [
|
||||
"-applaunch",
|
||||
str(appid),
|
||||
"-nolauncher",
|
||||
"-nosplash",
|
||||
"-skipintro",
|
||||
f"-name={name}",
|
||||
f"-mod={concat}",
|
||||
]
|
||||
proc = subprocess.run([*client_args, *params])
|
||||
return proc.returncode
|
||||
|
||||
|
||||
def find_user_id(path: Path) -> str | None:
|
||||
resolved_path = path / "config" / "loginusers.vdf"
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user