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