init
This commit is contained in:
@@ -8,7 +8,12 @@ import redis
|
||||
|
||||
from api.core.Gzip import gzip_zip
|
||||
from api.utils.skill_detail import SKILL_DETAIL_NORMALIZE_VERSION, normalize_skill_detail
|
||||
from api.utils.openapi_data import logical_skill_detail_prefix
|
||||
from api.utils.openapi_data import (
|
||||
OPENAPI_CUSTOM_CN_PATH,
|
||||
OPENAPI_DATA_DIR,
|
||||
OPENAPI_SKILLS_PATH,
|
||||
logical_skill_detail_prefix,
|
||||
)
|
||||
from api.utils.skill_tree import (
|
||||
SKILL_TREE_NAME_MAP_VERSION,
|
||||
SKILL_TREE_WITH_DESC_SPECIAL_VERSION,
|
||||
@@ -18,7 +23,7 @@ from api.utils.skill_tree import (
|
||||
from core.basic.character import createCharacter
|
||||
from core.basic.equipment import get_equipment
|
||||
from core.character.adventure import adv, get_adv_list
|
||||
from database.connect import BACKEND_DIR, RedisPool
|
||||
from database.connect import RedisPool
|
||||
|
||||
|
||||
PreheatLoader = Callable[[], object]
|
||||
@@ -28,12 +33,12 @@ PREHEAT_LOCK_EXPIRE_SECONDS = 15 * 60
|
||||
|
||||
|
||||
def _load_skills():
|
||||
with (BACKEND_DIR / 'openapi' / 'data' / 'skills.json').open(encoding='utf-8') as file:
|
||||
with OPENAPI_SKILLS_PATH.open(encoding='utf-8') as file:
|
||||
return json.load(file)
|
||||
|
||||
|
||||
def _load_custom_cn():
|
||||
with (BACKEND_DIR / 'openapi' / 'custom_cn.json').open(encoding='utf-8') as file:
|
||||
with OPENAPI_CUSTOM_CN_PATH.open(encoding='utf-8') as file:
|
||||
return json.load(file)
|
||||
|
||||
|
||||
@@ -60,8 +65,7 @@ def _build_character_preheat_tasks(equ_version: str = '0') -> list[PreheatTask]:
|
||||
|
||||
|
||||
def _iter_skill_detail_files() -> list[Path]:
|
||||
data_dir = BACKEND_DIR / 'openapi' / 'data'
|
||||
return sorted(data_dir.glob('cn/*/*/skillDetail/*.json'))
|
||||
return sorted(OPENAPI_DATA_DIR.glob('cn/*/*/skillDetail/*.json'))
|
||||
|
||||
|
||||
def _skill_prefix_from_path(path: Path) -> str:
|
||||
@@ -144,9 +148,8 @@ def _build_skill_data_preheat_tasks(custom_cn: list[dict]) -> list[PreheatTask]:
|
||||
|
||||
def _build_skill_tree_preheat_tasks() -> list[PreheatTask]:
|
||||
tasks: list[PreheatTask] = []
|
||||
data_dir = BACKEND_DIR / 'openapi' / 'data'
|
||||
for path in sorted(data_dir.glob('cn/*/*/skill_tree.json')):
|
||||
relative = path.relative_to(data_dir)
|
||||
for path in sorted(OPENAPI_DATA_DIR.glob('cn/*/*/skill_tree.json')):
|
||||
relative = path.relative_to(OPENAPI_DATA_DIR)
|
||||
job_id = relative.parts[1]
|
||||
job_grow_id = relative.parts[2]
|
||||
tasks.append(
|
||||
|
||||
Reference in New Issue
Block a user