mirror of
https://github.com/aclist/dztui.git
synced 2026-11-02 16:12:11 +01:00
feat: parse server details
This commit is contained in:
1 parent
acc356d3a0
commit
51308e788e
1 file changed
+40
-1
+40
-1
@@ -206,6 +206,19 @@ class Details:
|
|||||||
success: bool
|
success: bool
|
||||||
|
|
||||||
|
|
||||||
|
def is_passworded(ip: str, qport: int) -> bool:
|
||||||
|
try:
|
||||||
|
info = a2s.info((ip, qport))
|
||||||
|
except TimeoutError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
password = info.password_protected
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
return password
|
||||||
|
|
||||||
|
|
||||||
def details(ip: str, qport: int) -> Details:
|
def details(ip: str, qport: int) -> Details:
|
||||||
default_str = "None provided"
|
default_str = "None provided"
|
||||||
|
|
||||||
@@ -237,6 +250,29 @@ def details(ip: str, qport: int) -> Details:
|
|||||||
night_accel = float(keyword.lstrip("entm"))
|
night_accel = float(keyword.lstrip("entm"))
|
||||||
night_accel = f"{night_accel:g}"
|
night_accel = f"{night_accel:g}"
|
||||||
|
|
||||||
|
try:
|
||||||
|
password = info.password_protected
|
||||||
|
if password is False:
|
||||||
|
password = "Disabled"
|
||||||
|
else:
|
||||||
|
password = "Enabled"
|
||||||
|
except AttributeError:
|
||||||
|
password = "-"
|
||||||
|
|
||||||
|
try:
|
||||||
|
vac = info.vac_enabled
|
||||||
|
if vac is False:
|
||||||
|
vac = "Disabled"
|
||||||
|
else:
|
||||||
|
vac = "Enabled"
|
||||||
|
except AttributeError:
|
||||||
|
vac = "-"
|
||||||
|
|
||||||
|
try:
|
||||||
|
version = info.version
|
||||||
|
except AttributeError:
|
||||||
|
version = "-"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dlc = rules.dlc_flags
|
dlc = rules.dlc_flags
|
||||||
if dlc == 0:
|
if dlc == 0:
|
||||||
@@ -263,11 +299,14 @@ def details(ip: str, qport: int) -> Details:
|
|||||||
description = default_str
|
description = default_str
|
||||||
|
|
||||||
rows = [
|
rows = [
|
||||||
["DLC", dlc],
|
|
||||||
["Battleye", battleye],
|
["Battleye", battleye],
|
||||||
["Daytime acceleration", f"{day_accel}x"],
|
["Daytime acceleration", f"{day_accel}x"],
|
||||||
|
["DLC", dlc],
|
||||||
["Night-time acceleration", f"{night_accel}x"],
|
["Night-time acceleration", f"{night_accel}x"],
|
||||||
|
["Password", password],
|
||||||
["Platform", platform],
|
["Platform", platform],
|
||||||
|
["Valve Anti-Cheat", vac],
|
||||||
|
["Version", version],
|
||||||
]
|
]
|
||||||
|
|
||||||
return Details(rows, description, True)
|
return Details(rows, description, True)
|
||||||
|
|||||||
Reference in new issue
Block a user