This commit is contained in:
baiqwerdvd 2024-09-18 15:44:47 +08:00
parent 6838cb94eb
commit 7835cb9791
No known key found for this signature in database
GPG Key ID: 7717E46E1797411A
7 changed files with 923 additions and 894 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "starrail_damage_cal" name = "starrail_damage_cal"
version = "1.9.3" version = "1.9.4"
description = "For StarRail Role Damage Cal" description = "For StarRail Role Damage Cal"
authors = [ authors = [
{name = "qwerdvd", email = "105906879+qwerdvd@users.noreply.github.com"}, {name = "qwerdvd", email = "105906879+qwerdvd@users.noreply.github.com"},

View File

@ -1,6 +1,6 @@
import json import json
from pathlib import Path from pathlib import Path
from typing import List, Union from typing import Dict, List, Union
from msgspec import Struct, convert from msgspec import Struct, convert
@ -67,6 +67,26 @@ class SingleRelicSubAffix(Struct):
StepValue: PromotionAttr StepValue: PromotionAttr
StepNum: int StepNum: int
class SingleAvatarRelicScore(Struct):
role: str
HPDelta: float
HPAddedRatio: float
AttackDelta: float
AttackAddedRatio: float
DefenceDelta: float
DefenceAddedRatio: float
SpeedDelta: float
CriticalChanceBase: float
CriticalDamageBase: float
BreakDamageAddedRatioBase: float
HealRatio: float
SPRatio: float
StatusProbabilityBase: float
StatusResistanceBase: float
AttributeAddedRatio: float
with Path.open(EXCEL / "RelicMainAffixConfig.json", encoding="utf8") as f: with Path.open(EXCEL / "RelicMainAffixConfig.json", encoding="utf8") as f:
RelicMainAffixConfig = convert(json.load(f), List[SingleRelicMainAffix]) RelicMainAffixConfig = convert(json.load(f), List[SingleRelicMainAffix])
@ -78,3 +98,9 @@ with Path.open(EXCEL / "AvatarPromotionConfig.json", encoding="utf8") as f:
with Path.open(EXCEL / "EquipmentPromotionConfig.json", encoding="utf8") as f: with Path.open(EXCEL / "EquipmentPromotionConfig.json", encoding="utf8") as f:
EquipmentPromotionConfig = convert(json.load(f), List[SingleEquipmentPromotion]) EquipmentPromotionConfig = convert(json.load(f), List[SingleEquipmentPromotion])
with Path.open(EXCEL / "AvatarRelicScore.json", encoding="utf8") as f:
AvatarRelicScore = convert(json.load(f), List[SingleAvatarRelicScore])
with Path.open(EXCEL / "char_alias.json", encoding="utf8") as f:
CharAlias = convert(json.load(f), Dict[str, Dict[str, List[str]]])

View File

@ -1,2 +0,0 @@
StarRailUID_version = "0.1.0"
StarRail_version = "2.5.0"

View File

@ -13,6 +13,7 @@ version = StarRail_version
avatarId2Name_fileName = f"avatarId2Name_mapping_{version}.json" avatarId2Name_fileName = f"avatarId2Name_mapping_{version}.json"
avatarId2EnName_fileName = f"avatarId2EnName_mapping_{version}.json" avatarId2EnName_fileName = f"avatarId2EnName_mapping_{version}.json"
EquipmentID2Name_fileName = f"EquipmentID2Name_mapping_{version}.json" EquipmentID2Name_fileName = f"EquipmentID2Name_mapping_{version}.json"
EquipmentID2EnName_fileName = f"EquipmentID2EnName_mapping_{version}.json"
skillId2Name_fileName = f"skillId2Name_mapping_{version}.json" skillId2Name_fileName = f"skillId2Name_mapping_{version}.json"
skillId2Type_fileName = f"skillId2Type_mapping_{version}.json" skillId2Type_fileName = f"skillId2Type_mapping_{version}.json"
Property2Name_fileName = f"Property2Name_mapping_{version}.json" Property2Name_fileName = f"Property2Name_mapping_{version}.json"
@ -28,6 +29,7 @@ EquipmentID2AbilityProperty_fileName = (
RelicSetSkill_fileName = f"RelicSetSkill_mapping_{version}.json" RelicSetSkill_fileName = f"RelicSetSkill_mapping_{version}.json"
skillId2AttackType_fileName = f"skillId2AttackType_mapping_{version}.json" skillId2AttackType_fileName = f"skillId2AttackType_mapping_{version}.json"
EquipmentID2Rarity_fileName = f"EquipmentID2Rarity_mapping_{version}.json" EquipmentID2Rarity_fileName = f"EquipmentID2Rarity_mapping_{version}.json"
RelicId2Rarity_fileName = f"RelicId2Rarity_mapping_{version}.json"
ItemId2Name_fileName = f"ItemId2Name_mapping_{version}.json" ItemId2Name_fileName = f"ItemId2Name_mapping_{version}.json"
RelicId2MainAffixGroup_fileName = f"RelicId2MainAffixGroup_mapping_{version}.json" RelicId2MainAffixGroup_fileName = f"RelicId2MainAffixGroup_mapping_{version}.json"
avatarRankSkillUp_fileName = f"avatarRankSkillUp_mapping_{version}.json" avatarRankSkillUp_fileName = f"avatarRankSkillUp_mapping_{version}.json"
@ -91,6 +93,9 @@ with Path.open(MAP / avatarId2EnName_fileName, encoding="UTF-8") as f:
with Path.open(MAP / EquipmentID2Name_fileName, encoding="UTF-8") as f: with Path.open(MAP / EquipmentID2Name_fileName, encoding="UTF-8") as f:
EquipmentID2Name = msgjson.decode(f.read(), type=Dict[str, str]) EquipmentID2Name = msgjson.decode(f.read(), type=Dict[str, str])
with Path.open(MAP / EquipmentID2EnName_fileName, encoding="UTF-8") as f:
EquipmentID2EnName = msgjson.decode(f.read(), type=Dict[str, str])
with Path.open(MAP / skillId2Name_fileName, encoding="UTF-8") as f: with Path.open(MAP / skillId2Name_fileName, encoding="UTF-8") as f:
skillId2Name = msgjson.decode(f.read(), type=Dict[str, str]) skillId2Name = msgjson.decode(f.read(), type=Dict[str, str])
@ -117,9 +122,6 @@ with Path.open(MAP / characterSkillTree_fileName, encoding="UTF-8") as f:
with Path.open(MAP / avatarId2DamageType_fileName, encoding="UTF-8") as f: with Path.open(MAP / avatarId2DamageType_fileName, encoding="UTF-8") as f:
avatarId2DamageType = msgjson.decode(f.read(), type=Dict[str, str]) avatarId2DamageType = msgjson.decode(f.read(), type=Dict[str, str])
with Path.open(MAP / "char_alias.json", encoding="UTF-8") as f:
alias_data = msgjson.decode(f.read(), type=Dict[str, Dict[str, List[str]]])
with Path.open(MAP / avatarId2Rarity_fileName, encoding="UTF-8") as f: with Path.open(MAP / avatarId2Rarity_fileName, encoding="UTF-8") as f:
avatarId2Rarity = msgjson.decode(f.read(), type=Dict[str, str]) avatarId2Rarity = msgjson.decode(f.read(), type=Dict[str, str])
@ -148,3 +150,6 @@ with Path.open(MAP / RelicId2MainAffixGroup_fileName, encoding="UTF-8") as f:
with Path.open(MAP / avatarRankSkillUp_fileName, encoding="UTF-8") as f: with Path.open(MAP / avatarRankSkillUp_fileName, encoding="UTF-8") as f:
AvatarRankSkillUp = msgjson.decode(f.read(), type=Dict[str, Union[List[LU], None]]) AvatarRankSkillUp = msgjson.decode(f.read(), type=Dict[str, Union[List[LU], None]])
with Path.open(MAP / RelicId2Rarity_fileName, encoding="UTF-8") as f:
RelicId2Rarity = msgjson.decode(f.read(), type=Dict[str, int])

View File

@ -1,5 +1,5 @@
from ..excel.model import CharAlias
from ..map.SR_MAP_PATH import ( from ..map.SR_MAP_PATH import (
alias_data,
avatarId2Name, avatarId2Name,
) )
@ -14,7 +14,7 @@ def name_to_avatar_id(name: str) -> str:
def alias_to_char_name(char_name: str) -> str: def alias_to_char_name(char_name: str) -> str:
for i in alias_data["characters"]: for i in CharAlias["characters"]:
if char_name in alias_data["characters"][i]: if char_name in CharAlias["characters"][i]:
return alias_data["characters"][i][0] return CharAlias["characters"][i][0]
return char_name return char_name