Add character_ids variable

This commit is contained in:
M-307 2022-08-02 12:29:35 +07:00
parent abc068c5d6
commit 66c1cb8bf9

View File

@ -2,7 +2,7 @@ import json
import os import os
import logging import logging
from typing import Dict, Union from typing import Dict, Union, List
from io import TextIOWrapper from io import TextIOWrapper
from .enum import Language from .enum import Language
@ -30,6 +30,10 @@ class Assets:
cls.__load_assets_lang() cls.__load_assets_lang()
cls.__load_assets_data() cls.__load_assets_data()
@property
def CHARACTERS_IDS(self) -> List[str]:
return [x for x in self.DATA["characters"]]
@classmethod @classmethod
def character(cls, id: int) -> Union[assets.CharacterAsset, None]: def character(cls, id: int) -> Union[assets.CharacterAsset, None]:
LOGGER.debug(f"Getting character assets with id: {id}") LOGGER.debug(f"Getting character assets with id: {id}")
@ -123,7 +127,7 @@ class Assets:
@classmethod @classmethod
def _set_language(cls, lang: Language) -> None: def _set_language(cls, lang: Language) -> None:
# Check language # Check language
if not lang.split("-")[0].lower() in list(Language): if lang is None or not lang.split("-")[0].lower() in list(Language):
raise ValueError("Language not supported. Please check your language.") # noqa: E501 raise ValueError("Language not supported. Please check your language.") # noqa: E501
LOGGER.debug(f"Set language to {lang}.") LOGGER.debug(f"Set language to {lang}.")