From e3a2616fd981bddb8f68ea955f22c064d2ebf258 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 26 Dec 2023 19:07:15 +0200 Subject: [PATCH] add request key support by @a1batross --- pymaster.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pymaster.py b/pymaster.py index c9aff84..2583558 100755 --- a/pymaster.py +++ b/pymaster.py @@ -67,20 +67,23 @@ class PyMaster: gamedir = "valve" # halflife, by default clver = None nat = 0 + key = None for i in range(0, len(split), 2): try: - key = split[i + 1] + value = split[i + 1] if split[i] == "gamedir": - gamedir = key.lower() # keep gamedir in lowercase + gamedir = value.lower() # keep gamedir in lowercase elif split[i] == "nat": - nat = int(key) + nat = int(value) elif split[i] == "clver": - clver = key + clver = value + elif split[i] == 'key': + key = int(value, 16) else: logging.debug( "Unhandled info string entry: {0}/{1}. Infostring was: {2}".format( - split[i], key, split + split[i], value, split ) ) except IndexError: @@ -91,6 +94,10 @@ class PyMaster: return packet = MasterProtocol.queryPacketHeader + + if key != None: # Required in latest Xash3D version + packet += b'\x7F' + pack(' i.die: self.serverList.remove(i)