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