mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 01:29:42 +00:00
🐛 Fix missed proudSkillExtraLevelMap from simnet to enka
This commit is contained in:
parent
71267bb247
commit
05abee352e
@ -178,14 +178,39 @@ def get_skill_depot_id(data: "GenshinDetailCharacter") -> int:
|
||||
return skill_id_pre + skill_id
|
||||
|
||||
|
||||
def get_skill_level_map(data: "GenshinDetailCharacter") -> Dict:
|
||||
return {str(skill.id): skill.level for skill in data.skills if skill.skill_type == 1}
|
||||
def get_skill_level_map(data: "GenshinDetailCharacter", proud_skill_extra_level_map: Dict[str, int]) -> Dict:
|
||||
_data = {}
|
||||
for skill in data.skills:
|
||||
if skill.skill_type != 1:
|
||||
continue
|
||||
|
||||
_skill = Assets.skills(skill.id)
|
||||
if not _skill:
|
||||
continue
|
||||
|
||||
level = skill.level
|
||||
if proud_skill_extra_level_map:
|
||||
boost_level = proud_skill_extra_level_map.get(str(_skill.pround_map), None)
|
||||
if boost_level is not None:
|
||||
level -= boost_level
|
||||
_data[str(skill.id)] = level
|
||||
return _data
|
||||
|
||||
|
||||
def get_talent_id_list(data: "GenshinDetailCharacter") -> List[int]:
|
||||
return [constellation.id for constellation in data.constellations if constellation.activated]
|
||||
|
||||
|
||||
def get_proud_skill_extra_level_map(avatar_id: int, talent_count: int) -> Dict[str, int]:
|
||||
level_map = Assets.DATA["talents"].get(str(avatar_id), {})
|
||||
data = {}
|
||||
for k, v in level_map.items():
|
||||
if talent_count >= int(k):
|
||||
if talent_data := level_map.get(k):
|
||||
data[str(talent_data["proud_skill_group_id"])] = talent_data["extra_level"]
|
||||
return data
|
||||
|
||||
|
||||
def from_simnet_to_enka_single(index: int, data: "GenshinDetailCharacters") -> Dict:
|
||||
character = data.characters[index]
|
||||
avatar_id = character.base.id
|
||||
@ -195,8 +220,9 @@ def from_simnet_to_enka_single(index: int, data: "GenshinDetailCharacters") -> D
|
||||
inherent_proud_skill_list = get_inherent_proud_skill_list(character)
|
||||
prop_map = get_prop_map(character)
|
||||
skill_depot_id = get_skill_depot_id(character)
|
||||
skill_level_map = get_skill_level_map(character)
|
||||
talent_id_list = get_talent_id_list(character)
|
||||
proud_skill_extra_level_map = get_proud_skill_extra_level_map(avatar_id, len(talent_id_list))
|
||||
skill_level_map = get_skill_level_map(character, proud_skill_extra_level_map)
|
||||
return {
|
||||
"avatarId": avatar_id,
|
||||
"equipList": equip_list,
|
||||
@ -207,6 +233,7 @@ def from_simnet_to_enka_single(index: int, data: "GenshinDetailCharacters") -> D
|
||||
"inherentProudSkillList": inherent_proud_skill_list,
|
||||
"fightPropMap": fight_prop_map,
|
||||
"skillLevelMap": skill_level_map,
|
||||
"proudSkillExtraLevelMap": proud_skill_extra_level_map,
|
||||
}
|
||||
|
||||
|
||||
|
8
pdm.lock
8
pdm.lock
@ -704,7 +704,7 @@ name = "enkanetwork-py"
|
||||
version = "1.4.4"
|
||||
requires_python = ">=3.6"
|
||||
git = "https://github.com/PaiGramTeam/EnkaNetwork.py"
|
||||
revision = "77265cfdee0c0767d08791f28b54d9c105868a93"
|
||||
revision = "0924cbce3b8b61cee1db33d7bc7a89f34572a048"
|
||||
summary = "Library for fetching JSON data from site https://enka.network/"
|
||||
groups = ["default"]
|
||||
dependencies = [
|
||||
@ -1038,7 +1038,7 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "httpx"
|
||||
version = "0.27.0"
|
||||
version = "0.27.2"
|
||||
requires_python = ">=3.8"
|
||||
summary = "The next generation HTTP client."
|
||||
groups = ["default"]
|
||||
@ -1050,8 +1050,8 @@ dependencies = [
|
||||
"sniffio",
|
||||
]
|
||||
files = [
|
||||
{file = "httpx-0.27.0-py3-none-any.whl", hash = "sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5"},
|
||||
{file = "httpx-0.27.0.tar.gz", hash = "sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5"},
|
||||
{file = "httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0"},
|
||||
{file = "httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -28,7 +28,7 @@ click==8.1.7
|
||||
colorama==0.4.6; sys_platform == "win32" or platform_system == "Windows"
|
||||
colorlog==6.8.2
|
||||
cryptography==43.0.0
|
||||
enkanetwork-py @ git+https://github.com/PaiGramTeam/EnkaNetwork.py@77265cfdee0c0767d08791f28b54d9c105868a93
|
||||
enkanetwork-py @ git+https://github.com/PaiGramTeam/EnkaNetwork.py@0924cbce3b8b61cee1db33d7bc7a89f34572a048
|
||||
et-xmlfile==1.1.0
|
||||
exceptiongroup==1.2.2; python_version < "3.11"
|
||||
fakeredis==2.24.1
|
||||
@ -42,7 +42,7 @@ greenlet==3.0.3
|
||||
h11==0.14.0
|
||||
httpcore==1.0.5
|
||||
httptools==0.6.1
|
||||
httpx==0.27.0
|
||||
httpx==0.27.2
|
||||
idna==3.7
|
||||
importlib-metadata==8.4.0; python_version < "3.9"
|
||||
importlib-resources==6.4.4; python_version < "3.9"
|
||||
|
Loading…
Reference in New Issue
Block a user