Skip to content

Commit

Permalink
feat: Add pfps data to assets
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Feb 2, 2024
1 parent f57f711 commit 6df205b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions enka/assets/file_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
NAMECARD_DATA_PATH = f"{ASSET_PATH}/namecards.json"
CONSTS_DATA_PATH = f"{ASSET_PATH}/consts.json"
TALENTS_DATA_PATH = f"{ASSET_PATH}/talents.json"
PFPS_DATA_PATH = f"{ASSET_PATH}/pfps.json"
10 changes: 10 additions & 0 deletions enka/assets/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
CHARACTER_DATA_PATH,
CONSTS_DATA_PATH,
NAMECARD_DATA_PATH,
PFPS_DATA_PATH,
TALENTS_DATA_PATH,
TEXT_MAP_PATH,
)
Expand All @@ -26,20 +27,23 @@ def __init__(self, lang: "Language") -> None:
self.namecard_data = NamecardData()
self.consts_data = ConstsData()
self.talents_data = TalentsData()
self.pfps_data = PfpsData()

async def load(self) -> bool:
text_map_loaded = await self.text_map.load()
character_data_loaded = await self.character_data.load()
namecard_data_loaded = await self.namecard_data.load()
consts_data_loaded = await self.consts_data.load()
talents_data_loaded = await self.talents_data.load()
pfp_data_loaded = await self.pfps_data.load()

return (
text_map_loaded
and character_data_loaded
and namecard_data_loaded
and consts_data_loaded
and talents_data_loaded
and pfp_data_loaded
)


Expand Down Expand Up @@ -111,3 +115,9 @@ class TalentsData(AssetData):
async def load(self) -> bool:
self._data = await self._open_json(TALENTS_DATA_PATH)
return self._data is not None


class PfpsData(AssetData):
async def load(self) -> bool:
self._data = await self._open_json(PFPS_DATA_PATH)
return self._data is not None
2 changes: 2 additions & 0 deletions enka/assets/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CHARACTER_DATA_PATH,
CONSTS_DATA_PATH,
NAMECARD_DATA_PATH,
PFPS_DATA_PATH,
TALENTS_DATA_PATH,
TEXT_MAP_PATH,
)
Expand All @@ -25,6 +26,7 @@
"https://raw.githubusercontent.com/EnkaNetwork/API-docs/master/store/namecards.json": NAMECARD_DATA_PATH,
"https://raw.githubusercontent.com/seriaati/enka-py-assets/main/data/consts.json": CONSTS_DATA_PATH,
"https://raw.githubusercontent.com/seriaati/enka-py-assets/main/data/talents.json": TALENTS_DATA_PATH,
"https://raw.githubusercontent.com/EnkaNetwork/API-docs/master/store/pfps.json": PFPS_DATA_PATH,
}

LOGGER_ = logging.getLogger("enka.assets.updater")
Expand Down

0 comments on commit 6df205b

Please sign in to comment.