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-11-25 12:47:47 +00:00
|
|
|
from module.exception import ScriptError
|
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-18 12:22:46 +00:00
|
|
|
enhancement: str
|
2023-08-10 09:12:17 +00:00
|
|
|
|
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-10-14 20:20:25 +00:00
|
|
|
def __hash__(self) -> int:
|
|
|
|
return super().__hash__()
|
|
|
|
|
2023-08-10 18:43:06 +00:00
|
|
|
@property
|
|
|
|
def path_name(self):
|
2023-08-20 14:43:07 +00:00
|
|
|
return [self.__getattribute__(f"{server}_parsed").replace("the", '')
|
2023-08-10 18:43:06 +00:00
|
|
|
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
|
|
|
|
|
2023-11-25 12:47:47 +00:00
|
|
|
@classmethod
|
|
|
|
def find_path(cls, name):
|
2023-12-10 18:16:27 +00:00
|
|
|
if isinstance(name, RoguePath):
|
|
|
|
return name
|
2023-11-25 12:47:47 +00:00
|
|
|
for instance in cls.instances.values():
|
|
|
|
if name == instance.name:
|
|
|
|
return instance
|
|
|
|
# Not found
|
|
|
|
raise ScriptError(f'Cannot find a {cls.__name__} instance that matches "{name}"')
|
|
|
|
|
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")]
|
2023-08-12 07:15:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class RogueCurio(Keyword):
|
|
|
|
instances: ClassVar = {}
|
2023-08-12 17:04:54 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def curio_name(self):
|
|
|
|
return [self.__getattribute__(f"{server}_parsed")
|
|
|
|
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
|
2023-08-14 07:12:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class RogueBonus(Keyword):
|
|
|
|
instances: ClassVar = {}
|
2023-08-18 12:22:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class RogueEnhancement(Keyword):
|
|
|
|
instances: ClassVar = {}
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enhancement_keyword(self):
|
|
|
|
return [self.__getattribute__(f"{server}_parsed")
|
|
|
|
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
|
2023-10-06 11:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class RogueEventTitle(Keyword):
|
|
|
|
instances: ClassVar = {}
|
|
|
|
option_ids: list[int]
|
|
|
|
|
2023-10-07 13:52:41 +00:00
|
|
|
def __hash__(self):
|
|
|
|
return super().__hash__()
|
|
|
|
|
2023-10-06 11:39:15 +00:00
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class RogueEventOption(Keyword):
|
|
|
|
instances: ClassVar = {}
|