From 75ef9f1355f92131f1e7d72b35e32a92bebbdb88 Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Wed, 7 Feb 2024 06:01:32 +0800 Subject: [PATCH] Resolve Source Protocol issue --- opengsq/protocols/source.py | 4 ++-- opengsq/responses/source/gold_source_info.py | 15 +++++++++------ opengsq/version.py | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/opengsq/protocols/source.py b/opengsq/protocols/source.py index 3c1c616..d6994ed 100644 --- a/opengsq/protocols/source.py +++ b/opengsq/protocols/source.py @@ -138,8 +138,8 @@ def __parse_from_info_detailed(self, br: BinaryReader) -> GoldSourceInfo: info["players"] = br.read_byte() info["max_players"] = br.read_byte() info["protocol"] = br.read_byte() - info["server_type"] = ServerType(br.read_byte()) - info["environment"] = Environment(br.read_byte()) + info["server_type"] = ServerType(ord(chr(br.read_byte()).lower())) + info["environment"] = Environment(ord(chr(br.read_byte()).lower())) info["visibility"] = Visibility(br.read_byte()) info["mod"] = br.read_byte() diff --git a/opengsq/responses/source/gold_source_info.py b/opengsq/responses/source/gold_source_info.py index a05e6af..b121da7 100644 --- a/opengsq/responses/source/gold_source_info.py +++ b/opengsq/responses/source/gold_source_info.py @@ -1,4 +1,7 @@ +from __future__ import annotations + from dataclasses import dataclass +from typing import Optional from .partial_info import PartialInfo @@ -18,26 +21,26 @@ class GoldSourceInfo(PartialInfo): 1 for Half-Life mod """ - link: str + link: Optional[str] = None """URL to mod website.""" - download_link: str + download_link: Optional[str] = None """URL to download the mod.""" - version: int + version: Optional[int] = None """Version of mod installed on server.""" - size: int + size: Optional[int] = None """Space (in bytes) the mod takes up.""" - type: int + type: Optional[int] = None """ Indicates the type of mod: 0 for single and multiplayer mod 1 for multiplayer only mod """ - dll: int + dll: Optional[int] = None """ Indicates whether mod uses its own DLL: 0 if it uses the Half-Life DLL diff --git a/opengsq/version.py b/opengsq/version.py index f93b2a2..8595381 100644 --- a/opengsq/version.py +++ b/opengsq/version.py @@ -1 +1 @@ -__version__ = '3.0.6' +__version__ = '3.0.7'