def serverList(self):
data = b'\x04' # packet ID
data += bytes([AUTH_NUMGATEWAYS]) # total num game servers available
data += b'\x01' # last game server used
# the following is repeated for each server:
data += bytes([GATEWAY_ID]) # ID of each server (starting at 1)
# gameserver IP, packed in big-endian order
data += ipaddress.IPv4Address(GATEWAY_IP).packed
# gameserver port, little-endian order
data += struct.pack("<I", GATEWAY_PORT)
data += bytes([GATEWAY_AGELIMIT]) # unsure what this is used for
data += bytes([GATEWAY_PVP]) # 1 if GATEWAY_PVP server, otherwise 0
data += struct.pack("<H", GATEWAY_NUMPLAYERS) # current # of players
data += struct.pack("<H", GATEWAY_MAXPLAYERS) # max # of players
data += bytes([GATEWAY_ONLINE]) # 1 if server should be listed, otherwise 0
if (GATEWAY_ONLINE == 1):
data += b'\x04\x00\x00\x00\x00'
else:
# TODO doesn't list server if it isn't a test server
data += b'\x00\x00\x00\x00\x00'
self.sendPacket(data)
评论列表
文章目录