@@ -135,7 +135,7 @@ def __parse_as_key_values(self, br: BinaryReader, is_status=False):
135135 return kv
136136
137137 def __parse_as_object (self , br : BinaryReader , is_player = False ):
138- items , keyhashes , filters = [] , [], []
138+ items , keyhashes , filters = {} , [], []
139139
140140 while br .length () > 0 :
141141 # Get the key, for example player_1, frags_1, ping_1, etc...
@@ -163,15 +163,15 @@ def __parse_as_object(self, br: BinaryReader, is_player=False):
163163 else :
164164 keyhashes .append (value )
165165
166- # Append a dict to items if next index appears
167- if len ( items ) <= index :
168- items . append ({})
166+ # Create a dict on items if next index appears
167+ if index not in items :
168+ items [ index ] = {}
169169
170170 # Save
171171 items [index ][name ] = value
172172
173173 # Filter items by filters
174- return [item for i , item in enumerate ( items ) if i not in filters ]
174+ return [v for k , v in items . items ( ) if k not in filters ]
175175
176176
177177if __name__ == '__main__' :
@@ -182,6 +182,7 @@ async def main_async():
182182 gs1 = GameSpy1 (address = '51.81.48.224' , query_port = 23000 , timeout = 5.0 ) # bfield1942
183183 #gs1 = GameSpy1(address='139.162.235.20', query_port=7778, timeout=5.0) # ut
184184 #gs1 = GameSpy1(address='192.223.24.6', query_port=7778, timeout=5.0) # ut
185+ gs1 = GameSpy1 (address = '141.94.205.35' , query_port = 12300 , timeout = 5.0 ) # mohaa
185186 status = await gs1 .get_status ()
186187 print (json .dumps (status , indent = None ) + '\n ' )
187188
0 commit comments