diff --git a/opengsq/binary_reader.py b/opengsq/binary_reader.py index 11c441c..ca26efc 100644 --- a/opengsq/binary_reader.py +++ b/opengsq/binary_reader.py @@ -9,7 +9,7 @@ def __init__(self, data: bytes): def remaining_bytes(self) -> int: return len(self.__data) - self.stream_position - def is_end(self) -> int: + def is_end(self) -> bool: return self.stream_position >= len(self.__data) def prepend_bytes(self, data): diff --git a/opengsq/protocols/killingfloor.py b/opengsq/protocols/killingfloor.py index 9b79ea3..d8f93fa 100644 --- a/opengsq/protocols/killingfloor.py +++ b/opengsq/protocols/killingfloor.py @@ -46,7 +46,7 @@ async def get_details(self): async def main_async(): # killingfloor - killingFloor = KillingFloor(host='104.234.65.235', port=7708, timeout=10.0) + killingFloor = KillingFloor(host='185.80.128.168', port=7708, timeout=10.0) details = await killingFloor.get_details() print(json.dumps(details, indent=None) + '\n') rules = await killingFloor.get_rules() diff --git a/opengsq/protocols/unreal2.py b/opengsq/protocols/unreal2.py index 0d7a0ec..33daf38 100644 --- a/opengsq/protocols/unreal2.py +++ b/opengsq/protocols/unreal2.py @@ -103,16 +103,8 @@ def strip_colors(text: bytes): def _read_string(self, br: BinaryReader): length = br.read_byte() - string = br.read_string() - - if length == len(string) + 1: - b = bytes(string, encoding='utf-8') - else: - b = bytes(string, encoding='utf-16') - - b = Unreal2.strip_colors(b) - - return b.decode('utf-8', 'ignore') + b = br.read_bytes(length) + return Unreal2.strip_colors(b).decode('utf-8', 'ignore') if __name__ == '__main__':