StarRailCopilot/tasks/rogue/keywords/classes.py

45 lines
1.1 KiB
Python
Raw Normal View History

2023-08-10 09:12:17 +00:00
from dataclasses import dataclass
from typing import ClassVar
2023-08-10 18:43:06 +00:00
from dev_tools.keyword_extract import UI_LANGUAGES
2023-08-10 09:12:17 +00:00
from module.ocr.keyword import Keyword
@dataclass(repr=False)
class RogueBlessing(Keyword):
instances: ClassVar = {}
path_id: int
rarity: int
2023-08-10 18:43:06 +00:00
@property
def path_name(self):
path = RoguePath.instances[self.path_id]
return path.path_name
@property
def blessing_name(self):
return [self.__getattribute__(f"{server}_parsed")
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
2023-08-10 09:12:17 +00:00
@dataclass(repr=False)
class RoguePath(Keyword):
instances: ClassVar = {}
2023-08-10 18:43:06 +00:00
@property
def path_name(self):
return [self.__getattribute__(f"{server}_parsed")
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
2023-08-10 09:12:17 +00:00
@dataclass(repr=False)
class RogueResonance(Keyword):
instances: ClassVar = {}
path_id: int
rarity: int
2023-08-10 18:43:06 +00:00
@property
def resonance_name(self):
return [self.__getattribute__(f"{server}_parsed")
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]