sc2_datasets.replay_parser.init_data.game_options ================================================= .. py:module:: sc2_datasets.replay_parser.init_data.game_options Classes ------- .. autoapisummary:: sc2_datasets.replay_parser.init_data.game_options.GameOptions Module Contents --------------- .. py:class:: GameOptions(advancedSharedControl: bool, amm: bool, battleNet: bool, clientDebugFlags: int, competitive: bool, cooperative: bool, fog: int, heroDuplicatesAllowed: bool, lockTeams: bool, noVictoryOrDefeat: bool, observers: int, practice: bool, randomRaces: bool, teamsTogether: bool, userDifficulty: bool) Represents game options within the replay. :param advancedSharedControl: Indicates if advanced shared control is enabled. :type advancedSharedControl: bool :param amm: Indicates if AutoMM (Automated Match Making) is enabled. :type amm: bool :param battleNet: Indicates if the game was played on Battle.net. :type battleNet: bool :param clientDebugFlags: Specifies the client debug flag. :type clientDebugFlags: int :param competitive: Indicates whether the game was ranked or unranked. :type competitive: bool :param cooperative: Indicates if the game was cooperative. :type cooperative: bool :param fog: Specifies the fog value in the game. :type fog: int :param heroDuplicatesAllowed: Indicates if heroes can be duplicated. :type heroDuplicatesAllowed: bool :param lockTeams: Indicates if teams are locked. :type lockTeams: bool :param noVictoryOrDefeat: Indicates if there is no victory or defeat. :type noVictoryOrDefeat: bool :param observers: Specifies the count of observers watching the game. :type observers: int :param practice: Indicates if the game was a practice match. :type practice: bool :param randomRaces: Indicates if random races are allowed in the game. :type randomRaces: bool :param teamsTogether: Indicates if teams of players are together in the game. :type teamsTogether: bool :param userDifficulty: Indicates the user's difficulty level in the game. :type userDifficulty: bool .. py:method:: from_dict(d: dict[str, Any]) -> GameOptions :staticmethod: Static method that initializes a GameOptions class from a provided dictionary. :param d: A dictionary containing information about the game, such as observer count, fog status, competitive mode, etc. It holds translations of phrases or sentences. :type d: dict[str, Any] :returns: An initialized instance of the GameOptions class based on the provided dictionary. :rtype: GameOptions .. rubric:: Examples **Correct Usage Examples:** Using from_dict factory method provides ease of use when parsing a replay pre-processed with SC2InfoExtractorGo_ This method requires a dictionary representation of data to be passed as a parameter because of the built in json parser provided by the Python standard library. _SC2InfoExtractorGo: https://github.com/Kaszanas/SC2InfoExtractorGo The use of this method is intended to get game options information from the game's json representation. >>> game_options_dict = { ... "advancedSharedControl": False, ... "amm": False, ... "battleNet": False, ... "clientDebugFlags": 265, ... "competitive": False, ... "cooperative": False, ... "fog": 0, ... "heroDuplicatesAllowed": True, ... "lockTeams": True, ... "noVictoryOrDefeat": False, ... "observers": 0, ... "practice": False, ... "randomRaces": False, ... "teamsTogether": False, ... "userDifficulty": 0} ... >>> game_options_object = GameOptions.from_dict(d=game_options_dict) ... >>> assert isinstance(game_options_object, GameOptions) >>> assert isinstance(game_options_object.advancedSharedControl, bool) >>> assert isinstance(game_options_object.amm, bool) >>> assert isinstance(game_options_object.battleNet, bool) >>> assert isinstance(game_options_object.clientDebugFlags, int) >>> assert isinstance(game_options_object.competitive, bool) >>> assert isinstance(game_options_object.cooperative, bool) >>> assert isinstance(game_options_object.fog, int) >>> assert isinstance(game_options_object.heroDuplicatesAllowed, bool) >>> assert isinstance(game_options_object.lockTeams, bool) >>> assert isinstance(game_options_object.noVictoryOrDefeat, bool) >>> assert isinstance(game_options_object.observers, int) >>> assert isinstance(game_options_object.practice, bool) >>> assert isinstance(game_options_object.randomRaces, bool) >>> assert isinstance(game_options_object.teamsTogether, bool) >>> assert isinstance(game_options_object.userDifficulty, int) ... >>> assert game_options_object.advancedSharedControl == False >>> assert game_options_object.amm == False >>> assert game_options_object.battleNet == False >>> assert game_options_object.clientDebugFlags == 265 >>> assert game_options_object.competitive == False >>> assert game_options_object.cooperative == False >>> assert game_options_object.fog == 0 >>> assert game_options_object.heroDuplicatesAllowed == True >>> assert game_options_object.lockTeams == True >>> assert game_options_object.noVictoryOrDefeat == False >>> assert game_options_object.observers == 0 >>> assert game_options_object.practice == False >>> assert game_options_object.randomRaces == False >>> assert game_options_object.teamsTogether == False >>> assert game_options_object.userDifficulty == 0 ... >>> assert game_options_object.clientDebugFlags >= 0 >>> assert game_options_object.fog >= 0 >>> assert game_options_object.observers >= 0 >>> assert game_options_object.userDifficulty >= 0 **Incorrect Usage Examples:** >>> advancedSharedControl_wrong = "False" >>> amm_wrong = True >>> battleNet_wrong = "wrong type" >>> clientDebugFlags_wrong = int(2) >>> competitive_wrong = str(2) >>> cooperative_wrong = str(2) >>> fog_wrong = str(2) >>> heroDuplicatesAllowed_wrong = str(2) >>> lockTeams_wrong = str(2) >>> noVictoryOrDefeat_wrong = str(2) >>> observers_wrong = str(2) >>> practice_wrong = str(2) >>> randomRaces_wrong = str(2) >>> teamsTogether_wrong = str(2) >>> userDifficulty_wrong = str(2) >>> GameOptions( ... advancedSharedControl=advancedSharedControl_wrong, ... amm=amm_wrong, ... battleNet=battleNet_wrong, ... clientDebugFlags=clientDebugFlags_wrong, ... competitive=competitive_wrong, ... cooperative=cooperative_wrong, ... fog=fog_wrong, ... heroDuplicatesAllowed=heroDuplicatesAllowed_wrong, ... lockTeams=lockTeams_wrong, ... noVictoryOrDefeat=observers_wrong, ... observers=practice_wrong, ... practice=practice_wrong, ... randomRaces=randomRaces_wrong, ... teamsTogether=teamsTogether_wrong, ... userDifficulty=userDifficulty_wrong) Traceback (most recent call last): ... TypeError: unsupported operand type(s) ... .. py:attribute:: advancedSharedControl .. py:attribute:: amm .. py:attribute:: battleNet .. py:attribute:: clientDebugFlags .. py:attribute:: competitive .. py:attribute:: cooperative .. py:attribute:: fog .. py:attribute:: heroDuplicatesAllowed .. py:attribute:: lockTeams .. py:attribute:: noVictoryOrDefeat .. py:attribute:: observers .. py:attribute:: practice .. py:attribute:: randomRaces .. py:attribute:: teamsTogether .. py:attribute:: userDifficulty