Skip to content

Commit

Permalink
Resolve Source Protocol issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Feb 6, 2024
1 parent 28fbb65 commit d3a55fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions opengsq/protocols/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def __parse_from_info_src(self, br: BinaryReader) -> SourceInfo:
info["players"] = br.read_byte()
info["max_players"] = br.read_byte()
info["bots"] = br.read_byte()
info["server_type"] = ServerType(br.read_byte())
info["environment"] = Environment(br.read_byte())
info["server_type"] = ServerType.parse(br.read_byte())
info["environment"] = Environment.parse(br.read_byte())
info["visibility"] = Visibility(br.read_byte())
info["vac"] = VAC(br.read_byte())

Expand Down Expand Up @@ -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(ord(chr(br.read_byte()).lower()))
info["environment"] = Environment(ord(chr(br.read_byte()).lower()))
info["server_type"] = ServerType.parse(br.read_byte())
info["environment"] = Environment.parse(br.read_byte())
info["visibility"] = Visibility(br.read_byte())
info["mod"] = br.read_byte()

Expand Down
4 changes: 4 additions & 0 deletions opengsq/responses/source/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ class Environment(IntEnum):

Mac = 0x6D
"""Mac"""

@staticmethod
def parse(byte: int):
return Environment(ord(chr(byte).lower()))
4 changes: 4 additions & 0 deletions opengsq/responses/source/server_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ class ServerType(IntEnum):

Proxy = 0x70
"""SourceTV relay (proxy)"""

@staticmethod
def parse(byte: int):
return ServerType(ord(chr(byte).lower()))

0 comments on commit d3a55fa

Please sign in to comment.