From 03dd85db3a6adbb055e167e5bc2d2f22e5b6f175 Mon Sep 17 00:00:00 2001 From: altNightHawk <84723615+altNightHawk@users.noreply.github.com> Date: Fri, 2 Jan 2026 02:58:34 +0000 Subject: [PATCH] Add Exfil game support with accurate player count Exfil servers return player count in a 'current/max' format (e.g., '1/24') in the Players_s field from A2S_RULES query. This change adds special handling for exfil game type to: - Query A2S_RULES to get the Players_s field - Parse the 'current/max' format to extract current player count - Fallback to standard query if rules query fails - Override the info.players with the accurate count --- discordgsm/protocols/source.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/discordgsm/protocols/source.py b/discordgsm/protocols/source.py index ed88403..921a3b7 100644 --- a/discordgsm/protocols/source.py +++ b/discordgsm/protocols/source.py @@ -34,6 +34,23 @@ async def get_players(): source.get_info(), get_players(), source.get_rules() ) info.name = rules["ServerName_s"] # Override the info server name + # Exfil accurate player count fix + elif self.kv["type"] == "exfil": + try: + info, players, rules = await asyncio.gather( + source.get_info(), get_players(), source.get_rules() + ) + # Override player count with accurate count from A2S_RULES + if "Players_s" in rules: + # Players_s format is "current/max" like "1/24", extract current players + players_str = str(rules["Players_s"]) + if "/" in players_str: + info.players = int(players_str.split("/")[0]) + else: + info.players = int(players_str) + except Exception: + # Fallback to standard query if rules query fails + info, players = await asyncio.gather(source.get_info(), get_players()) else: info, players = await asyncio.gather(source.get_info(), get_players())