1
0
Fork 0
mirror of https://github.com/de2tla2f/pymaster.git synced 2024-11-27 13:21:28 +00:00

add request key support by @a1batross

This commit is contained in:
ghost 2023-12-26 19:07:15 +02:00
parent d76fb9a8fb
commit e3a2616fd9

View file

@ -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', key) + b'\x00'
for i in self.serverList:
if time() > i.die:
self.serverList.remove(i)