Skip to content

Commit

Permalink
Resolve Source Engine Protocol issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Feb 7, 2024
1 parent 35a0598 commit 5eb929c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
28 changes: 15 additions & 13 deletions opengsq/protocols/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,26 @@ def __parse_from_info_src(self, br: BinaryReader) -> SourceInfo:
info["duration"] = br.read_byte()

info["version"] = br.read_string()
edf = ExtraDataFlag(br.read_byte())
info["edf"] = edf

if edf.has_flag(ExtraDataFlag.Port):
info["port"] = br.read_short()
if not br.is_end():
edf = ExtraDataFlag(br.read_byte())
info["edf"] = edf

if edf.has_flag(ExtraDataFlag.SteamID):
info["steam_id"] = br.read_long_long()
if edf.has_flag(ExtraDataFlag.Port):
info["port"] = br.read_short()

if edf.has_flag(ExtraDataFlag.Spectator):
info["spectator_port"] = br.read_short()
info["spectator_name"] = br.read_string()
if edf.has_flag(ExtraDataFlag.SteamID):
info["steam_id"] = br.read_long_long()

if edf.has_flag(ExtraDataFlag.Keywords):
info["keywords"] = br.read_string()
if edf.has_flag(ExtraDataFlag.Spectator):
info["spectator_port"] = br.read_short()
info["spectator_name"] = br.read_string()

if edf.has_flag(ExtraDataFlag.GameID):
info["game_id"] = br.read_long_long()
if edf.has_flag(ExtraDataFlag.Keywords):
info["keywords"] = br.read_string()

if edf.has_flag(ExtraDataFlag.GameID):
info["game_id"] = br.read_long_long()

return SourceInfo(**info)

Expand Down
2 changes: 1 addition & 1 deletion opengsq/responses/source/source_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SourceInfo(PartialInfo):
version: str
"""Version of the game installed on the server."""

edf: ExtraDataFlag
edf: Optional[ExtraDataFlag] = None
"""If present, this specifies which additional data fields will be included."""

port: Optional[int] = None
Expand Down
2 changes: 1 addition & 1 deletion opengsq/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.8'
__version__ = '3.0.9'

0 comments on commit 5eb929c

Please sign in to comment.