Browse Source

add request key support by @a1batross

v2
ghost 11 months ago
parent
commit
e3a2616fd9
  1. 17
      pymaster.py

17
pymaster.py

@ -67,20 +67,23 @@ class PyMaster:
gamedir = "valve" # halflife, by default gamedir = "valve" # halflife, by default
clver = None clver = None
nat = 0 nat = 0
key = None
for i in range(0, len(split), 2): for i in range(0, len(split), 2):
try: try:
key = split[i + 1] value = split[i + 1]
if split[i] == "gamedir": if split[i] == "gamedir":
gamedir = key.lower() # keep gamedir in lowercase gamedir = value.lower() # keep gamedir in lowercase
elif split[i] == "nat": elif split[i] == "nat":
nat = int(key) nat = int(value)
elif split[i] == "clver": elif split[i] == "clver":
clver = key clver = value
elif split[i] == 'key':
key = int(value, 16)
else: else:
logging.debug( logging.debug(
"Unhandled info string entry: {0}/{1}. Infostring was: {2}".format( "Unhandled info string entry: {0}/{1}. Infostring was: {2}".format(
split[i], key, split split[i], value, split
) )
) )
except IndexError: except IndexError:
@ -91,6 +94,10 @@ class PyMaster:
return return
packet = MasterProtocol.queryPacketHeader packet = MasterProtocol.queryPacketHeader
if key != None: # Required in latest Xash3D version
packet += b'\x7F' + pack('<I', key) + b'\x00'
for i in self.serverList: for i in self.serverList:
if time() > i.die: if time() > i.die:
self.serverList.remove(i) self.serverList.remove(i)

Loading…
Cancel
Save