Skip to content

Commit d3a55fa

Browse files
Resolve Source Protocol issue
1 parent 28fbb65 commit d3a55fa

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

opengsq/protocols/source.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def __parse_from_info_src(self, br: BinaryReader) -> SourceInfo:
8989
info["players"] = br.read_byte()
9090
info["max_players"] = br.read_byte()
9191
info["bots"] = br.read_byte()
92-
info["server_type"] = ServerType(br.read_byte())
93-
info["environment"] = Environment(br.read_byte())
92+
info["server_type"] = ServerType.parse(br.read_byte())
93+
info["environment"] = Environment.parse(br.read_byte())
9494
info["visibility"] = Visibility(br.read_byte())
9595
info["vac"] = VAC(br.read_byte())
9696

@@ -138,8 +138,8 @@ def __parse_from_info_detailed(self, br: BinaryReader) -> GoldSourceInfo:
138138
info["players"] = br.read_byte()
139139
info["max_players"] = br.read_byte()
140140
info["protocol"] = br.read_byte()
141-
info["server_type"] = ServerType(ord(chr(br.read_byte()).lower()))
142-
info["environment"] = Environment(ord(chr(br.read_byte()).lower()))
141+
info["server_type"] = ServerType.parse(br.read_byte())
142+
info["environment"] = Environment.parse(br.read_byte())
143143
info["visibility"] = Visibility(br.read_byte())
144144
info["mod"] = br.read_byte()
145145

opengsq/responses/source/environment.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ class Environment(IntEnum):
1414

1515
Mac = 0x6D
1616
"""Mac"""
17+
18+
@staticmethod
19+
def parse(byte: int):
20+
return Environment(ord(chr(byte).lower()))

opengsq/responses/source/server_type.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ class ServerType(IntEnum):
1414

1515
Proxy = 0x70
1616
"""SourceTV relay (proxy)"""
17+
18+
@staticmethod
19+
def parse(byte: int):
20+
return ServerType(ord(chr(byte).lower()))

0 commit comments

Comments
 (0)