|
@@ 112-141 (lines=30) @@
|
| 109 |
|
'ingame': int(slots.popleft().decode('utf-8')) |
| 110 |
|
}) |
| 111 |
|
|
| 112 |
|
@staticmethod |
| 113 |
|
def parse_64_legacy_response(slots: deque, server: GameServer) -> None: |
| 114 |
|
"""Parse the 64 slot legacy response |
| 115 |
|
|
| 116 |
|
:param slots: |
| 117 |
|
:param server: |
| 118 |
|
:return: |
| 119 |
|
""" |
| 120 |
|
server.server_type = '64_legacy' |
| 121 |
|
server.version = slots.popleft().decode('utf-8') |
| 122 |
|
server.name = slots.popleft().decode('utf-8') |
| 123 |
|
server.map_name = slots.popleft().decode('utf-8') |
| 124 |
|
server.game_type = slots.popleft().decode('utf-8') |
| 125 |
|
server.flags = int(slots.popleft().decode('utf-8')) |
| 126 |
|
server.num_players = int(slots.popleft().decode('utf-8')) |
| 127 |
|
server.max_players = int(slots.popleft().decode('utf-8')) |
| 128 |
|
server.num_clients = int(slots.popleft().decode('utf-8')) |
| 129 |
|
server.max_clients = int(slots.popleft().decode('utf-8')) |
| 130 |
|
|
| 131 |
|
if slots[0] == b'': |
| 132 |
|
# no idea what this is, always empty |
| 133 |
|
slots.popleft() |
| 134 |
|
|
| 135 |
|
while len(slots) >= 5: |
| 136 |
|
server.players.append({ |
| 137 |
|
'name': slots.popleft(), |
| 138 |
|
'clan': slots.popleft(), |
| 139 |
|
'country': int(slots.popleft().decode('utf-8')), |
| 140 |
|
'score': int(slots.popleft().decode('utf-8')), |
| 141 |
|
'ingame': int(slots.popleft().decode('utf-8')) |
| 142 |
|
}) |
| 143 |
|
|
| 144 |
|
@staticmethod |
|
@@ 83-109 (lines=27) @@
|
| 80 |
|
elif data[6:6 + 8] == Network.PACKETS['SERVERBROWSE_INFO_EXTENDED_MORE']: |
| 81 |
|
logging.log(logging.DEBUG, 'no idea what to expect here, never got useful data') |
| 82 |
|
|
| 83 |
|
@staticmethod |
| 84 |
|
def parse_vanilla_response(slots: deque, server: GameServer) -> None: |
| 85 |
|
"""Parse the default response of the vanilla client |
| 86 |
|
|
| 87 |
|
:param slots: |
| 88 |
|
:param server: |
| 89 |
|
:return: |
| 90 |
|
""" |
| 91 |
|
server.server_type = 'vanilla' |
| 92 |
|
server.version = slots.popleft().decode('utf-8') |
| 93 |
|
server.name = slots.popleft().decode('utf-8') |
| 94 |
|
server.map_name = slots.popleft().decode('utf-8') |
| 95 |
|
server.game_type = slots.popleft().decode('utf-8') |
| 96 |
|
server.flags = int(slots.popleft().decode('utf-8')) |
| 97 |
|
server.num_players = int(slots.popleft().decode('utf-8')) |
| 98 |
|
server.max_players = int(slots.popleft().decode('utf-8')) |
| 99 |
|
server.num_clients = int(slots.popleft().decode('utf-8')) |
| 100 |
|
server.max_clients = int(slots.popleft().decode('utf-8')) |
| 101 |
|
|
| 102 |
|
while len(slots) >= 5: |
| 103 |
|
# no idea what this is, always empty |
| 104 |
|
server.players.append({ |
| 105 |
|
'name': slots.popleft(), |
| 106 |
|
'clan': slots.popleft(), |
| 107 |
|
'country': int(slots.popleft().decode('utf-8')), |
| 108 |
|
'score': int(slots.popleft().decode('utf-8')), |
| 109 |
|
'ingame': int(slots.popleft().decode('utf-8')) |
| 110 |
|
}) |
| 111 |
|
|
| 112 |
|
@staticmethod |