mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-05 19:23:45 +08:00
🐛 修复一些bug
This commit is contained in:
parent
ac3f219db8
commit
d853d60aca
@ -1,5 +1,6 @@
|
|||||||
"""Mihomo.me api 包装
|
"""Mihomo.me api 包装
|
||||||
"""
|
"""
|
||||||
from .models import MihomoData as MihomoData
|
from .models import MihomoData as MihomoData
|
||||||
|
from .requests import get_char_card_info as requests
|
||||||
|
|
||||||
__all__ = ["requests", "MihomoData"]
|
__all__ = ["requests", "MihomoData"]
|
||||||
|
@ -1,35 +1,19 @@
|
|||||||
import re
|
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
from mpmath import mp, nstr
|
from mpmath import mp, nstr
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
from gsuid_core.utils.image.convert import convert_img
|
from gsuid_core.utils.image.convert import convert_img
|
||||||
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
||||||
|
|
||||||
from .to_data import api_to_dict
|
|
||||||
from .effect.Role import RoleInstance
|
|
||||||
from .mono.Character import Character
|
|
||||||
from ..utils.error_reply import CHAR_HINT
|
from ..utils.error_reply import CHAR_HINT
|
||||||
from ..utils.fonts.first_world import fw_font_28
|
|
||||||
from ..utils.excel.read_excel import light_cone_ranks
|
from ..utils.excel.read_excel import light_cone_ranks
|
||||||
from ..utils.map.name_covert import name_to_avatar_id, alias_to_char_name
|
from ..utils.fonts.first_world import fw_font_28
|
||||||
from ..utils.map.SR_MAP_PATH import (
|
|
||||||
RelicId2Rarity,
|
|
||||||
AvatarRelicScore,
|
|
||||||
avatarId2Name,
|
|
||||||
avatarId2DamageType,
|
|
||||||
)
|
|
||||||
from ..utils.resource.RESOURCE_PATH import (
|
|
||||||
RELIC_PATH,
|
|
||||||
SKILL_PATH,
|
|
||||||
PLAYER_PATH,
|
|
||||||
WEAPON_PATH,
|
|
||||||
CHAR_PORTRAIT_PATH,
|
|
||||||
)
|
|
||||||
from ..utils.fonts.starrail_fonts import (
|
from ..utils.fonts.starrail_fonts import (
|
||||||
sr_font_20,
|
sr_font_20,
|
||||||
sr_font_23,
|
sr_font_23,
|
||||||
@ -39,6 +23,23 @@ from ..utils.fonts.starrail_fonts import (
|
|||||||
sr_font_34,
|
sr_font_34,
|
||||||
sr_font_38,
|
sr_font_38,
|
||||||
)
|
)
|
||||||
|
from ..utils.map.name_covert import alias_to_char_name, name_to_avatar_id
|
||||||
|
from ..utils.map.SR_MAP_PATH import (
|
||||||
|
AvatarRelicScore,
|
||||||
|
RelicId2Rarity,
|
||||||
|
avatarId2DamageType,
|
||||||
|
avatarId2Name,
|
||||||
|
)
|
||||||
|
from ..utils.resource.RESOURCE_PATH import (
|
||||||
|
CHAR_PORTRAIT_PATH,
|
||||||
|
PLAYER_PATH,
|
||||||
|
RELIC_PATH,
|
||||||
|
SKILL_PATH,
|
||||||
|
WEAPON_PATH,
|
||||||
|
)
|
||||||
|
from .effect.Role import RoleInstance
|
||||||
|
from .mono.Character import Character
|
||||||
|
from .to_data import api_to_dict
|
||||||
|
|
||||||
Excel_path = Path(__file__).parent / 'effect'
|
Excel_path = Path(__file__).parent / 'effect'
|
||||||
with Path.open(Excel_path / 'Excel' / 'seele.json', encoding='utf-8') as f:
|
with Path.open(Excel_path / 'Excel' / 'seele.json', encoding='utf-8') as f:
|
||||||
@ -744,7 +745,7 @@ async def cal(char_data: Dict):
|
|||||||
role = RoleInstance(char)
|
role = RoleInstance(char)
|
||||||
im_tmp = await role.cal_damage(skill_type)
|
im_tmp = await role.cal_damage(skill_type)
|
||||||
skill_info_list.append(im_tmp)
|
skill_info_list.append(im_tmp)
|
||||||
if char.char_id == 1205:
|
elif char.char_id == 1205:
|
||||||
for skill_type in ['Normal', 'Normal1', 'Ultra']:
|
for skill_type in ['Normal', 'Normal1', 'Ultra']:
|
||||||
role = RoleInstance(char)
|
role = RoleInstance(char)
|
||||||
im_tmp = await role.cal_damage(skill_type)
|
im_tmp = await role.cal_damage(skill_type)
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
from mpmath import mp
|
from mpmath import mp
|
||||||
|
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
|
|
||||||
from .Avatar.Avatar import Avatar
|
|
||||||
from .Weapon.Weapon import Weapon
|
|
||||||
from .utils import merge_attribute
|
|
||||||
from ..mono.Character import Character
|
from ..mono.Character import Character
|
||||||
|
from .Avatar.Avatar import Avatar
|
||||||
from .Base.model import DamageInstance
|
from .Base.model import DamageInstance
|
||||||
from .Relic.Relic import RelicSet, SingleRelic
|
from .Relic.Relic import RelicSet, SingleRelic
|
||||||
|
from .utils import merge_attribute
|
||||||
|
from .Weapon.Weapon import Weapon
|
||||||
|
|
||||||
mp.dps = 14
|
mp.dps = 14
|
||||||
|
|
||||||
@ -176,6 +177,8 @@ class RoleInstance:
|
|||||||
|
|
||||||
# 检查是否有对某一个技能的属性加成
|
# 检查是否有对某一个技能的属性加成
|
||||||
logger.info('检查是否有对某一个技能的属性加成')
|
logger.info('检查是否有对某一个技能的属性加成')
|
||||||
|
if self.attribute_bonus is None:
|
||||||
|
raise Exception('attribute_bonus is None')
|
||||||
for attr in self.attribute_bonus:
|
for attr in self.attribute_bonus:
|
||||||
# 攻击加成
|
# 攻击加成
|
||||||
if attr.__contains__('AttackAddedRatio'):
|
if attr.__contains__('AttackAddedRatio'):
|
||||||
@ -209,6 +212,7 @@ class RoleInstance:
|
|||||||
self.base_attr, self.attribute_bonus
|
self.base_attr, self.attribute_bonus
|
||||||
)
|
)
|
||||||
logger.info(f'{merged_attr}')
|
logger.info(f'{merged_attr}')
|
||||||
|
skill_info_list = []
|
||||||
# 技能类型为攻击
|
# 技能类型为攻击
|
||||||
if skill_info[0] == 'attack':
|
if skill_info[0] == 'attack':
|
||||||
skill_multiplier = skill_multiplier / skill_info[2]
|
skill_multiplier = skill_multiplier / skill_info[2]
|
||||||
@ -216,6 +220,8 @@ class RoleInstance:
|
|||||||
attack = merged_attr['attack']
|
attack = merged_attr['attack']
|
||||||
logger.info(f'攻击力: {attack}')
|
logger.info(f'攻击力: {attack}')
|
||||||
damage_add = 0
|
damage_add = 0
|
||||||
|
hp_multiplier = 0
|
||||||
|
hp_num = 0
|
||||||
if self.raw_data.avatar.id_ == 1205:
|
if self.raw_data.avatar.id_ == 1205:
|
||||||
hp_num = merged_attr['hp']
|
hp_num = merged_attr['hp']
|
||||||
if skill_type == 'Normal1':
|
if skill_type == 'Normal1':
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Union, Optional
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from mpmath import mp
|
|
||||||
from httpx import ReadTimeout
|
from httpx import ReadTimeout
|
||||||
|
from mpmath import mp
|
||||||
|
|
||||||
from ..utils.error_reply import UID_HINT
|
|
||||||
from ..sruid_utils.api.mihomo import MihomoData
|
from ..sruid_utils.api.mihomo import MihomoData
|
||||||
from ..sruid_utils.api.mihomo.models import Avatar
|
from ..sruid_utils.api.mihomo.models import Avatar
|
||||||
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
|
||||||
from ..sruid_utils.api.mihomo.requests import get_char_card_info
|
from ..sruid_utils.api.mihomo.requests import get_char_card_info
|
||||||
|
from ..utils.error_reply import UID_HINT
|
||||||
# from gsuid_core.utils.api.minigg.request import get_weapon_info
|
|
||||||
from .cal_value import cal_relic_sub_affix, cal_relic_main_affix
|
|
||||||
from ..utils.excel.read_excel import AvatarPromotion, EquipmentPromotion
|
from ..utils.excel.read_excel import AvatarPromotion, EquipmentPromotion
|
||||||
from ..utils.map.SR_MAP_PATH import (
|
from ..utils.map.SR_MAP_PATH import (
|
||||||
SetId2Name,
|
EquipmentID2Name,
|
||||||
|
EquipmentID2Rarity,
|
||||||
ItemId2Name,
|
ItemId2Name,
|
||||||
Property2Name,
|
Property2Name,
|
||||||
RelicId2SetId,
|
RelicId2SetId,
|
||||||
EquipmentID2Name,
|
SetId2Name,
|
||||||
EquipmentID2Rarity,
|
avatarId2DamageType,
|
||||||
rankId2Name,
|
|
||||||
skillId2Name,
|
|
||||||
avatarId2Name,
|
|
||||||
skillId2Effect,
|
|
||||||
avatarId2EnName,
|
avatarId2EnName,
|
||||||
|
avatarId2Name,
|
||||||
avatarId2Rarity,
|
avatarId2Rarity,
|
||||||
characterSkillTree,
|
characterSkillTree,
|
||||||
|
rankId2Name,
|
||||||
skillId2AttackType,
|
skillId2AttackType,
|
||||||
avatarId2DamageType,
|
skillId2Effect,
|
||||||
|
skillId2Name,
|
||||||
)
|
)
|
||||||
|
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
||||||
|
|
||||||
|
# from gsuid_core.utils.api.minigg.request import get_weapon_info
|
||||||
|
from .cal_value import cal_relic_main_affix, cal_relic_sub_affix
|
||||||
|
|
||||||
mp.dps = 14
|
mp.dps = 14
|
||||||
|
|
||||||
@ -148,22 +148,7 @@ async def get_data(char: Avatar, sr_data: MihomoData, sr_uid: str):
|
|||||||
extra_ability_temp = {}
|
extra_ability_temp = {}
|
||||||
extra_ability_temp['extraAbilityId'] = behavior['pointId']
|
extra_ability_temp['extraAbilityId'] = behavior['pointId']
|
||||||
extra_ability_temp['extraAbilityLevel'] = behavior['level']
|
extra_ability_temp['extraAbilityLevel'] = behavior['level']
|
||||||
status_add = characterSkillTree[str(char['avatarId'])][
|
char_data['avatarExtraAbility'].append(extra_ability_temp)
|
||||||
str(behavior['pointId'])
|
|
||||||
]['levels'][behavior['level'] - 1]['properties']
|
|
||||||
extra_ability_temp['statusAdd'] = {}
|
|
||||||
if status_add:
|
|
||||||
for property_ in status_add:
|
|
||||||
extra_ability_temp['statusAdd']['property'] = property_[
|
|
||||||
'type'
|
|
||||||
]
|
|
||||||
extra_ability_temp['statusAdd']['name'] = Property2Name[
|
|
||||||
property_['type']
|
|
||||||
]
|
|
||||||
extra_ability_temp['statusAdd']['value'] = property_[
|
|
||||||
'value'
|
|
||||||
]
|
|
||||||
char_data['avatarExtraAbility'].append(extra_ability_temp)
|
|
||||||
|
|
||||||
# 处理技能树中的属性加成
|
# 处理技能树中的属性加成
|
||||||
if f'{char["avatarId"]}2' == str(behavior['pointId'])[0:5]:
|
if f'{char["avatarId"]}2' == str(behavior['pointId'])[0:5]:
|
||||||
@ -245,6 +230,25 @@ async def get_data(char: Avatar, sr_data: MihomoData, sr_uid: str):
|
|||||||
rankTemp['rankName'] = rankId2Name[str(rank_id)]
|
rankTemp['rankName'] = rankId2Name[str(rank_id)]
|
||||||
rank_temp.append(rankTemp)
|
rank_temp.append(rankTemp)
|
||||||
char_data['rankList'] = rank_temp
|
char_data['rankList'] = rank_temp
|
||||||
|
|
||||||
|
# 处理命座中的 level_up_skills
|
||||||
|
level_up_skills = []
|
||||||
|
for rank_item in char_data['rankList']:
|
||||||
|
rank_id = rank_item['rankId']
|
||||||
|
# 121303 -> 1213003
|
||||||
|
behavior_id = str(rank_id)[0:5] + '0' + str(rank_id)[-1]
|
||||||
|
char_skill_tree_data = characterSkillTree[str(char['avatarId'])][behavior_id]
|
||||||
|
if char_skill_tree_data['level_up_skills'] != []:
|
||||||
|
for skill in char_skill_tree_data['level_up_skills']:
|
||||||
|
skill_id = char_skill_tree_data['level_up_skills']['id']
|
||||||
|
skill_up_num = char_skill_tree_data['level_up_skills']['num']
|
||||||
|
# 查找skill_id在不在avatarSkill中
|
||||||
|
for skill_item in char_data['avatarSkill']:
|
||||||
|
if skill_id == skill_item['skillId']:
|
||||||
|
skill_item['skillLevel'] += skill_up_num
|
||||||
|
level_up_skills.append(skill_item)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
# 处理基础属性
|
# 处理基础属性
|
||||||
base_attributes = {}
|
base_attributes = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user