From 830272fd85e6f9343bcbed6543f68823c1de5b7c Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sat, 31 Mar 2018 14:38:53 +0100 Subject: [PATCH] update SteamID.is_valid method --- steam/steamid.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/steam/steamid.py b/steam/steamid.py index 5c7c8ac..42df5a5 100644 --- a/steam/steamid.py +++ b/steam/steamid.py @@ -192,20 +192,27 @@ class SteamID(intBase): :rtype: :py:class:`bool` """ - if self.id == 0: - return False - if self.type == EType.Invalid or self.type >= EType.Max: return False if self.universe == EUniverse.Invalid or self.universe >= EUniverse.Max: return False - if self.type == EType.Individual and self.instance > 4: - return False + if self.type == EType.Individual: + if self.id == 0 or self.instance > 4: + return False - if self.type == EType.Clan and self.instance != 0: - return False + if self.type == EType.Clan: + if self.id == 0 or self.instance != 0: + return False + + if self.type == EType.GameServer: + if self.id == 0: + return False + + if self.type == EType.AnonGameServer: + if self.id == 0 and self.instance == 0: + return False return True