aboutsummaryrefslogtreecommitdiff
path: root/south_browser
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-10-19 10:40:56 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-10-19 10:40:56 +0200
commitd70acd840aec24a72855d3daa8321f4bd1177f3c (patch)
tree70a82d37fa453b34e6b6ad76c029e3254df1bc48 /south_browser
parent3cbb708b3a43b6ac41e75c6cf1941d5729eea3a6 (diff)
downloadsouthbrowser-d70acd840aec24a72855d3daa8321f4bd1177f3c.tar.gz
southbrowser-d70acd840aec24a72855d3daa8321f4bd1177f3c.zip
simplify server fetching logicHEADmaster
Diffstat (limited to 'south_browser')
-rw-r--r--south_browser/rpc.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/south_browser/rpc.py b/south_browser/rpc.py
index fe76829..db87d35 100644
--- a/south_browser/rpc.py
+++ b/south_browser/rpc.py
@@ -49,21 +49,19 @@ def NSGetServerCount(repeat: bool = True):
def NSGetGameServers():
# work around Squirrel closure bullshit
server_count = NSGetServerCount()
+ if not server_count:
+ return []
- for i in range(server_count):
+ primret = []
+ for c in range(server_count):
+ primret.append(f"[s[{c}].index, s[{c}].id, s[{c}].name, s[{c}].description, s[{c}].map, s[{c}].playlist, s[{c}].playerCount, s[{c}].maxPlayerCount, s[{c}].requiresPassword, s[{c}].region]")
- primret = []
+ ret = "[" + ",".join(primret) + "]"
- for c in range(server_count):
- primret.append(f"[s[{c}].index, s[{c}].id, s[{c}].name, s[{c}].description, s[{c}].map, s[{c}].playlist, s[{c}].playerCount, s[{c}].maxPlayerCount, s[{c}].requiresPassword, s[{c}].region]")
-
- ret = "[" + ",".join(primret) + "]"
-
- return cmd("execute_squirrel", {
- "code": f"array<ServerInfo> s = NSGetGameServers()\nreturn {ret}"
- })["result"]
+ return cmd("execute_squirrel", {
+ "code": f"array<ServerInfo> s = NSGetGameServers()\nreturn {ret}"
+ })["result"]
- return []
def NSTryAuthWithServer(index: int, password: str = None):
if password is None: