mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-29 09:07:14 +00:00
4250481727
- Fix issue with Daily Reward Client not running - Update Wish Client to support multiple banner retrieval - Fix issue with setting salt for dynamic secret - Improve APIModel to support multiple aliases - Add asyncio.sleep() to Wish paginator to prevent excessive requests Co-authored-by: xtaodada <xtao@xtaolink.cn>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from typing import Optional
|
|
|
|
from simnet.models.base import APIModel
|
|
|
|
__all__ = ("BaseCharacter",)
|
|
|
|
|
|
class BaseCharacter(APIModel):
|
|
"""A base class for all Genshin Impact characters.
|
|
|
|
Attributes:
|
|
id (int): The unique identifier of the character.
|
|
name (str): The name of the character.
|
|
element (str): The elemental affinity of the character.
|
|
rarity (int): The rarity level of the character.
|
|
icon (str): The URL of the icon image for the character.
|
|
|
|
collab (bool, optional): Whether the character is a collaboration character. Defaults to False.
|
|
|
|
Properties:
|
|
traveler_name (str): If the character ID matches the traveler's ID, returns the name of the traveler character.
|
|
"""
|
|
|
|
id: int
|
|
name: Optional[str] = None
|
|
element: Optional[str] = None
|
|
rarity: Optional[str] = None
|
|
icon: Optional[str] = None
|
|
|
|
collab: bool = False
|
|
|
|
@property
|
|
def traveler_name(self) -> str:
|
|
"""If the character ID matches the traveler's ID, returns the name of the traveler character.
|
|
|
|
Returns:
|
|
str: The name of the traveler character if the ID matches, otherwise an empty string.
|
|
"""
|
|
if self.id == 10000005:
|
|
return "Aether"
|
|
if self.id == 10000007:
|
|
return "Lumine"
|
|
return ""
|