2023-05-22 12:20:31 +00:00
|
|
|
from dataclasses import dataclass
|
2023-07-06 14:41:16 +00:00
|
|
|
from functools import cached_property
|
2023-05-30 18:20:45 +00:00
|
|
|
from typing import ClassVar
|
2023-05-22 12:20:31 +00:00
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
from module.exception import ScriptError
|
2023-05-22 12:20:31 +00:00
|
|
|
from module.ocr.keyword import Keyword
|
|
|
|
|
|
|
|
|
2023-06-16 20:24:13 +00:00
|
|
|
@dataclass(repr=False)
|
2023-05-22 12:20:31 +00:00
|
|
|
class DungeonNav(Keyword):
|
2023-05-30 18:20:45 +00:00
|
|
|
instances: ClassVar = {}
|
2023-05-22 12:20:31 +00:00
|
|
|
|
|
|
|
|
2023-06-16 20:24:13 +00:00
|
|
|
@dataclass(repr=False)
|
2023-05-22 12:20:31 +00:00
|
|
|
class DungeonTab(Keyword):
|
2023-05-30 18:20:45 +00:00
|
|
|
instances: ClassVar = {}
|
2023-06-12 16:43:57 +00:00
|
|
|
|
|
|
|
|
2023-06-16 20:24:13 +00:00
|
|
|
@dataclass(repr=False)
|
2023-06-12 16:43:57 +00:00
|
|
|
class DungeonList(Keyword):
|
|
|
|
instances: ClassVar = {}
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Calyx_Golden(self):
|
|
|
|
return 'Calyx_Golden' in self.name
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Calyx_Crimson(self):
|
|
|
|
return 'Calyx_Crimson' in self.name
|
|
|
|
|
2023-08-27 09:13:05 +00:00
|
|
|
@cached_property
|
|
|
|
def is_Calyx(self):
|
|
|
|
return self.is_Calyx_Golden or self.is_Calyx_Crimson
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Stagnant_Shadow(self):
|
|
|
|
return 'Stagnant_Shadow' in self.name
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Cavern_of_Corrosion(self):
|
|
|
|
return 'Cavern_of_Corrosion' in self.name
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Echo_of_War(self):
|
|
|
|
return 'Echo_of_War' in self.name
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-12 16:43:57 +00:00
|
|
|
def is_Simulated_Universe(self):
|
|
|
|
return 'Simulated_Universe' in self.name
|
2023-06-14 16:15:14 +00:00
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-29 04:56:05 +00:00
|
|
|
def is_Forgotten_Hall(self):
|
2023-09-22 17:29:42 +00:00
|
|
|
for word in [
|
|
|
|
'Forgotten_Hall',
|
|
|
|
'Memory_of_Chaos',
|
|
|
|
'Last_Vestiges',
|
|
|
|
'Navis_Astriger',
|
|
|
|
]:
|
|
|
|
if word in self.name:
|
|
|
|
return True
|
|
|
|
return False
|
2023-06-29 16:32:33 +00:00
|
|
|
|
2023-12-27 12:41:57 +00:00
|
|
|
@cached_property
|
|
|
|
def is_Pure_Fiction(self):
|
|
|
|
for word in [
|
|
|
|
'Pure_Fiction',
|
|
|
|
]:
|
|
|
|
if word in self.name:
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-17 16:13:21 +00:00
|
|
|
def is_daily_dungeon(self):
|
|
|
|
return self.is_Calyx_Golden or self.is_Calyx_Crimson or self.is_Stagnant_Shadow or self.is_Cavern_of_Corrosion
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
2023-06-17 16:13:21 +00:00
|
|
|
def is_weekly_dungeon(self):
|
|
|
|
return self.is_Echo_of_War
|
|
|
|
|
2023-07-06 14:41:16 +00:00
|
|
|
@cached_property
|
|
|
|
def dungeon_nav(self) -> DungeonNav:
|
|
|
|
import tasks.dungeon.keywords.nav as KEYWORDS_DUNGEON_NAV
|
|
|
|
if self.is_Simulated_Universe:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Simulated_Universe
|
|
|
|
if self.is_Calyx_Golden:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Calyx_Golden
|
|
|
|
if self.is_Calyx_Crimson:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Calyx_Crimson
|
|
|
|
if self.is_Stagnant_Shadow:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Stagnant_Shadow
|
|
|
|
if self.is_Cavern_of_Corrosion:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Cavern_of_Corrosion
|
|
|
|
if self.is_Echo_of_War:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Echo_of_War
|
|
|
|
if self.is_Forgotten_Hall:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Forgotten_Hall
|
2023-12-27 12:41:57 +00:00
|
|
|
if self.is_Pure_Fiction:
|
|
|
|
return KEYWORDS_DUNGEON_NAV.Pure_Fiction
|
2023-07-06 14:41:16 +00:00
|
|
|
|
|
|
|
raise ScriptError(f'Cannot convert {self} to DungeonNav, please check keyword extractions')
|
|
|
|
|
2023-12-27 16:50:31 +00:00
|
|
|
@cached_property
|
|
|
|
def rogue_theme(self) -> str:
|
|
|
|
"""
|
|
|
|
Returns:
|
|
|
|
'rogue' for normal simulated universe farmed every week
|
|
|
|
'dlc' for special rogue theme
|
|
|
|
'' for non-rogue
|
|
|
|
"""
|
|
|
|
if self.is_Simulated_Universe:
|
|
|
|
if self.name.startswith('Simulated_Universe_World'):
|
|
|
|
return 'rogue'
|
|
|
|
else:
|
|
|
|
return 'dlc'
|
|
|
|
else:
|
|
|
|
return ''
|
|
|
|
|
2023-06-14 16:15:14 +00:00
|
|
|
|
2023-06-16 20:24:13 +00:00
|
|
|
@dataclass(repr=False)
|
2023-06-14 16:15:14 +00:00
|
|
|
class DungeonEntrance(Keyword):
|
|
|
|
instances: ClassVar = {}
|
2023-10-09 03:36:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
|
|
class DungeonDetailed(Keyword):
|
|
|
|
instances: ClassVar = {}
|