diff --git a/genshin/models/genshin/character.py b/genshin/models/genshin/character.py index 065cc14b..4720d009 100644 --- a/genshin/models/genshin/character.py +++ b/genshin/models/genshin/character.py @@ -4,6 +4,8 @@ import re import typing +from genshin.utility import deprecation + if typing.TYPE_CHECKING: import pydantic.v1 as pydantic else: @@ -20,7 +22,7 @@ _LOGGER = logging.getLogger(__name__) -ICON_BASE = "https://upload-os-bbs.mihoyo.com/game_record/genshin/" +ICON_BASE = "https://enka.network/ui/" def _parse_icon(icon: typing.Union[str, int]) -> str: @@ -86,7 +88,14 @@ def _get_db_char( constants.CHARACTER_NAMES[lang][char.id] = char return char - return constants.DBChar(id or 0, icon_name, name or icon_name, element or "Anemo", rarity or 5, guessed=True) + return constants.DBChar( + id or 0, + icon_name, + name or icon_name, + element or "Anemo", + rarity or 5, + guessed=True, + ) if name: for char in constants.CHARACTER_NAMES[lang].values(): @@ -115,7 +124,7 @@ def __autocomplete(cls, values: typing.Dict[str, typing.Any]) -> typing.Dict[str id, name, icon, element, rarity = (values.get(x) for x in ("id", "name", "icon", "element", "rarity")) char = _get_db_char(id, name, icon, element, rarity, lang=values["lang"]) - icon = _create_icon(char.icon_name, "character_icon/UI_AvatarIcon_{}") + icon = _create_icon(char.icon_name, "UI_AvatarIcon_{}") values["id"] = char.id values["name"] = char.name @@ -143,16 +152,21 @@ def __autocomplete(cls, values: typing.Dict[str, typing.Any]) -> typing.Dict[str return values @property + @deprecation.deprecated("gacha_art") def image(self) -> str: - return _create_icon(self.icon, "character_image/UI_AvatarIcon_{}@2x") + return _create_icon(self.icon, "UI_Gacha_AvatarImg_{}") + + @property + def gacha_art(self) -> str: + return _create_icon(self.icon, "UI_Gacha_AvatarImg_{}") @property def side_icon(self) -> str: - return _create_icon(self.icon, "character_side_icon/UI_AvatarIcon_Side_{}") + return _create_icon(self.icon, "UI_AvatarIcon_Side_{}") @property def card_icon(self) -> str: - return _create_icon(self.icon, "character_card_icon/UI_AvatarIcon_{}_Card") + return _create_icon(self.icon, "UI_AvatarIcon_{}_Card") @property def traveler_name(self) -> str: