2022-10-15 08:14:32 +00:00
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
2023-06-14 10:59:04 +00:00
|
|
|
from modules.gacha.banner import GenshinBannerType, GachaBanner
|
2022-10-15 08:14:32 +00:00
|
|
|
from modules.gacha.player.banner import PlayerGachaBannerInfo
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerGachaInfo(BaseModel):
|
|
|
|
"""玩家抽卡全部信息"""
|
|
|
|
|
|
|
|
standard_banner: Optional[PlayerGachaBannerInfo] = None
|
|
|
|
event_weapon_banner: Optional[PlayerGachaBannerInfo] = None
|
|
|
|
event_character_banner: Optional[PlayerGachaBannerInfo] = None
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
if self.standard_banner is None:
|
|
|
|
self.standard_banner = PlayerGachaBannerInfo()
|
|
|
|
if self.event_weapon_banner is None:
|
|
|
|
self.event_weapon_banner = PlayerGachaBannerInfo()
|
|
|
|
if self.event_character_banner is None:
|
|
|
|
self.event_character_banner = PlayerGachaBannerInfo()
|
|
|
|
|
|
|
|
def get_banner_info(self, banner: GachaBanner) -> PlayerGachaBannerInfo:
|
2023-06-14 10:59:04 +00:00
|
|
|
if banner.banner_type == GenshinBannerType.EVENT:
|
2022-10-15 08:14:32 +00:00
|
|
|
return self.event_character_banner
|
2023-06-14 10:59:04 +00:00
|
|
|
if banner.banner_type == GenshinBannerType.WEAPON:
|
2022-10-15 08:14:32 +00:00
|
|
|
return self.event_weapon_banner
|
|
|
|
return self.standard_banner
|