From 05aae5b7f3f25d526deb71a452ab08ba3c27dbac Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 10 May 2023 19:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20support:=20relic=20config=20type=20?= =?UTF-8?q?rarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/enums.py | 15 +++++++++++++++ models/relic_affix.py | 6 +++++- res_func/relic.py | 4 +++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/models/enums.py b/models/enums.py index 6f4e7aa..8b63e97 100644 --- a/models/enums.py +++ b/models/enums.py @@ -127,3 +127,18 @@ class RelicAffix(str, Enum): """ 雷属性伤害提高 百分比 """ WindAddedRatio: str = "WindAddedRatio" """ 风属性伤害提高 百分比 """ + + +class RelicPosition(str, Enum): + HEAD: str = "HEAD" + """ 头 """ + HAND: str = "HAND" + """ 手 """ + BODY: str = "BODY" + """ 躯干 """ + FOOT: str = "FOOT" + """ 脚 """ + NECK: str = "NECK" + """ 位面球 """ + OBJECT: str = "OBJECT" + """ 连结绳 """ diff --git a/models/relic_affix.py b/models/relic_affix.py index d1cfbed..c9b1c98 100644 --- a/models/relic_affix.py +++ b/models/relic_affix.py @@ -3,7 +3,7 @@ from typing import Optional, Dict from pydantic import BaseModel, root_validator -from .enums import RelicAffix +from .enums import RelicAffix, RelicPosition class SingleRelicAffix(BaseModel): @@ -24,6 +24,10 @@ class RelicAffixAll(BaseModel): id: int set_id: int """ 套装ID """ + type: RelicPosition + """ 遗器类型 """ + rarity: int + """ 星级 """ main_affix_group: int sub_affix_group: int max_level: int diff --git a/res_func/relic.py b/res_func/relic.py index 5443d76..26f2b79 100644 --- a/res_func/relic.py +++ b/res_func/relic.py @@ -4,7 +4,7 @@ from typing import List, Dict import aiofiles import ujson -from models.enums import RelicAffix +from models.enums import RelicAffix, RelicPosition from func.fetch_relics import read_relics, dump_relics, all_relics from res_func.client import client from res_func.url import relic_config, relic_main_affix_config, relic_sub_affix_config, relic_set_config @@ -22,6 +22,8 @@ async def fetch_all_relic(): relic_affix_all = RelicAffixAll( id=int(key), set_id=value["SetID"], + type=RelicPosition(value["Type"]), + rarity=int(value["Rarity"].replace("CombatPowerRelicRarity", "")), main_affix_group=value["MainAffixGroup"], sub_affix_group=value["SubAffixGroup"], max_level=value["MaxLevel"],