diff --git a/backend/api/routes/info.py b/backend/api/routes/info.py index 01249dd5..1fb1160c 100644 --- a/backend/api/routes/info.py +++ b/backend/api/routes/info.py @@ -123,7 +123,6 @@ async def get_info_by_dnfhelper(uid: str, state: AltersDep, redis: RedisDep): except Exception as e: if isinstance(e, ResponseException): return response(code=500, message=str(e), data=None) - print(e) return response(code=500, message='Failed to fetch DNFHelper info', data=None) @@ -135,7 +134,6 @@ async def get_skill_by_code(state: AltersDep, code=Body(None)): return response(code=500, message='技能加点代码职业与登录职业不匹配', data=None) return response(data=skills) except Exception as e: - print(f'Error fetching skill tree info: {e}') if isinstance(e, ResponseException): return response(code=500, message=str(e), data=None) return response(code=500, message='解析技能加点失败', data=None) diff --git a/backend/core/basic/character/calc_equip.py b/backend/core/basic/character/calc_equip.py index 3b097376..78ab65a6 100644 --- a/backend/core/basic/character/calc_equip.py +++ b/backend/core/basic/character/calc_equip.py @@ -75,6 +75,7 @@ class CalcEquipMixin(CharacterBase): """套装效果统计""" suitInfo = {} oathSuitInfo = {} + correction = 0 equs = get_equipment(self.equVersion) for item in filter(lambda x: x.equInfo is not None, self.charEquipInfo.values()): partEqu = item.equInfo @@ -101,14 +102,16 @@ class CalcEquipMixin(CharacterBase): max_point_oath_suit = max((suit for suit in oathSuitInfo if oathSuitInfo[suit]['point'] > 0), key=lambda suit: oathSuitInfo[suit]['point'], default=None) zero_point_suits = [suit for suit in suitInfo if suitInfo[suit]['point'] == 0] # 套装没有到太初的时候,优先把誓约套装的点数加到装备套装上,以达到更高的套装等级 - if suitInfo is not None and 0 < suitInfo[max_point_suit]['point'] < 2550 and oathSuitInfo.get('max_point_oath_suit', None) is not None: - suitInfo[max_point_suit]['point'] += min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point']) - oathSuitInfo[max_point_oath_suit]['point'] -= min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point']) + if suitInfo is not None and 0 < suitInfo[max_point_suit]['point'] < 2550 and oathSuitInfo.get(max_point_oath_suit, None) is not None: + correction = min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point']) + suitInfo[max_point_suit]['point'] += correction + oathSuitInfo[max_point_oath_suit]['point'] -= correction pass suits = zero_point_suits + ([max_point_suit] if max_point_suit is not None else []) suitList: list[Suit] = [] oathSuitList: list[OathSuit] = [] - res = [] + res = {'suit': None, 'oath': None, 'correction': correction} + # print(max_point_suit, suitList) for suit in suits: if suitInfo[suit]['point'] == 0: suitList += equs.get_suit_info(suit, 0, suitInfo[suit]['count']) @@ -116,20 +119,20 @@ class CalcEquipMixin(CharacterBase): suitList += equs.get_suit_info(suit, suitInfo[suit]['point'], 0) if len(suitList) == 0: continue - self.suitInfo = suitList - temp = suitList[-1] - res.append( - { - 'id': temp.id, - 'name': temp.name, - 'rarity': temp.rarity, - 'point': suitInfo[suit]['point'], - 'count': suitInfo[suit]['count'], - 'level': temp.level, - 'imageUrl': temp.imageUrl, - 'value': temp.value, - } - ) + if suit == max_point_suit: + self.suitInfo = suitList + temp = suitList[-1] + res['suit'] = { + 'id': temp.id, + 'name': temp.name, + 'rarity': temp.rarity, + 'point': suitInfo[suit]['point'], + 'count': suitInfo[suit]['count'], + 'level': temp.level, + 'suitId': suit, + 'imageUrl': temp.imageUrl, + # 'value': temp.value, + } for suit in oathSuitInfo: if oathSuitInfo[suit]['point'] == 0: oathSuitList += equs.get_oath_suit_info(suit, 0, oathSuitInfo[suit]['count']) @@ -149,19 +152,19 @@ class CalcEquipMixin(CharacterBase): filtered_dict = {k: v for k, v in suit.__dict__.items() if k[0].isupper()} self.SetStatus(**filtered_dict) if func is not None and oathEffect is None: - print(f'套装 {suit.name} 生效') + # print(f'套装 {suit.name} 生效') func(self) - else: - # 当存在套装和誓约不匹配的时候,誓约技能只能是1号位 - self.charOathSkillId = 1 + if max_point_suit != max_point_oath_suit: + self.charOathSkillId = '1' oathSkillEffect = [] - self.max_point = max([i['point'] for i in res], default=0) + self.max_point = 0 if res['suit'] is None else res.get('suit', {}).get('point', 0) self.oathSuitInfo = [] self.oathSkillInfo = [] # 当套装点数达到太初时,誓约技能生效 if self.max_point >= 2550: for oathSuit in oathSuitList: - skill = next((x for x in oathSuit.skills if x.skillId == self.charOathSkillId), None) + skills = list(filter(lambda x: x.suitId == oathSuit.suitId, oathSuit.skills)) + skill = next((x for x in oathSuit.skills if str(x.skillId) == str(self.charOathSkillId)), None) # 誓约套装效果生效 filtered_dict = {k: v for k, v in oathSuit.__dict__.items() if k[0].isupper()} self.SetStatus(**filtered_dict) @@ -172,11 +175,23 @@ class CalcEquipMixin(CharacterBase): self.SetStatus(**filtered_dict) self.oathSkillInfo.append(skill) self.oathSuitInfo.append(oathSuit) - + if oathSuit.suitId == max_point_oath_suit: + res['oath'] = { + 'id': oathSuit.id, + 'name': skill.name, + 'rarity': oathSuit.rarity, + 'point': oathSuitInfo[oathSuit.suitId]['point'], + 'count': oathSuitInfo[oathSuit.suitId]['count'], + 'level': oathSuit.level, + 'imageUrl': oathSuit.imageUrl, + 'suitId': oathSuit.suitId, + 'skills': [{'id': skill.id, 'skillId': i.skillId, 'name': i.name, 'imageUrl': i.imageUrl, 'enable': i.skillId == '1' or max_point_oath_suit == max_point_suit} for i in skills], + # 'value': oathSuit.value, + } for skill in oathSkillEffect: func = equs.funs.execture(f'oath_skill_{skill.id}') if func is not None: - print(f'誓约技能 {skill.id} 生效') + # print(f'誓约技能 {skill.id} 生效') func(self) if self.max_point >= 2550: skillAttack = (self.max_point - 2550) // 70 * 0.01 diff --git a/backend/core/basic/character/info.py b/backend/core/basic/character/info.py index 1ead3c67..fa00572f 100644 --- a/backend/core/basic/character/info.py +++ b/backend/core/basic/character/info.py @@ -98,16 +98,7 @@ class CharacterInfoMixin(CharacterBase): info['options'] = equInfos.funs.options info['sundry'] = equInfos.funs.sundryList for skill in platinum: - info['emblems'].append( - { - 'id': skill, - 'fame': 232, - 'position': ['辅助装备', '魔法石'], - 'detail': skill + ' Lv+1' + ' 四维 + 8', - 'categorize': ['技能'], - 'rarity': '白金', - } - ) + info['emblems'].append({'id': skill, 'fame': 232, 'value': skill + ' Lv+1' + ' 四维 + 8', 'rarity': '白金', 'rarityId': '-1', 'type': '白金', 'typeId': '-1'}) return info def getBasicInos(self): diff --git a/backend/core/basic/equipment.py b/backend/core/basic/equipment.py index 40940518..7b2620b3 100644 --- a/backend/core/basic/equipment.py +++ b/backend/core/basic/equipment.py @@ -234,6 +234,21 @@ class Equipments: with Session(self.engine) as session: db_list = session.query(OathSuitData).all() db_skills_list = session.query(OathSuitSkillData).all() + skill_list = [] + for item in db_skills_list: + lvs = len(item.SkillAttack.split(',')) + skills = {k: v for k, v in item.__dict__.items() if not k.startswith('_')} + for i in range(1, lvs + 1): + skill = {k: v for k, v in skills.items()} + skillAttacks = parse_to_number_list(skill['SkillAttack'], [0]) + skill['SkillAttack'] = 0 if i - 1 >= len(skillAttacks) else skillAttacks[i - 1] + attacks = parse_to_number_list(skill['Attack'], [0]) + skill['Attack'] = 0 if i - 1 >= len(attacks) else attacks[i - 1] + buffers = parse_to_number_list(skill['Buffer'], [0]) + skill['Buffer'] = 0 if i - 1 >= len(buffers) else buffers[i - 1] + skill['level'] = i + skill_obj = OathSuitSkill(**skill) + skill_list.append(skill_obj) for item in db_list: lvs = len(item.point.split(',')) suits = {k: v for k, v in item.__dict__.items() if not k.startswith('_')} @@ -241,7 +256,7 @@ class Equipments: suit = {k: v for k, v in suits.items()} suit['points'] = suit['point'] suit['point'] = int(suit['point'].split(',')[i - 1]) - skills = [x for x in db_skills_list if x.suitId == suit['suitId'] and x.key == suit['key']] + skills = [x for x in skill_list if x.suitId == suit['suitId'] and x.key == suit['key'] and x.level == i] suit['level'] = i skillAttaks = parse_to_number_list(suit['SkillAttack'], [0]) suit['SkillAttack'] = (0 if len(skillAttaks) == 0 else skillAttaks[0]) if i - 1 >= len(skillAttaks) else skillAttaks[i - 1] @@ -371,6 +386,7 @@ class OathSuitSkill: Buffer: float value: str bufferValue: str + level: int def __init__(self, **kwargs): for key in ['SkillAttack', 'Attack', 'Buffer']: diff --git a/backend/core/basic/skill.py b/backend/core/basic/skill.py index 21ed9fe2..3a0e7ebf 100644 --- a/backend/core/basic/skill.py +++ b/backend/core/basic/skill.py @@ -40,7 +40,7 @@ def get_data(prefix: str, key: int | str, func = lambda x: x): data = next((item.get('custom', 1.0) for item in custom_cn if item['job'] == job and item['jobGrow'] == jobGrow and item['skillId'] == skill), 1.0) except Exception as e: - print(f"get skill {prefix}/{key} data error",e) + # print(f"get skill {prefix}/{key} data error",e) data = None return data @@ -215,7 +215,7 @@ class Skill: if skill is not None: self.update_skill_attribute(skill, type, old, new, data, ratio, weapon) except Exception as e: - print(f"Error applying association {type} for skill {self.name}: {e}") + # print(f"Error applying association {type} for skill {self.name}: {e}") raise e def update_skill_attribute(self, skill, type, old, new, data, ratio=100, weapon=[]): diff --git a/backend/dataFiles/dcalc_0.db b/backend/dataFiles/dcalc_0.db index 32cfc0fc..d524aa01 100644 Binary files a/backend/dataFiles/dcalc_0.db and b/backend/dataFiles/dcalc_0.db differ diff --git a/frontend/src/api/calc/type.ts b/frontend/src/api/calc/type.ts index 5b13f368..6a8a673b 100644 --- a/frontend/src/api/calc/type.ts +++ b/frontend/src/api/calc/type.ts @@ -2,7 +2,11 @@ export interface IResult { uuid: string skills: IResultSkill[] info: IResultUserInfo[] - suits: IResultSuit[] + suits: { + suit?: IResultSuit + oath?: IResultSuit + correction?: number + } buffer: boolean } @@ -27,7 +31,7 @@ export interface IResultUserInfo { } export interface IResultSuit { - id: number + id: string count: number imageUrl: string level: number @@ -35,6 +39,14 @@ export interface IResultSuit { point: number rarity: string value: string + suitId: string + skills: { + id: string + skillId: string + name: string + imageUrl: string + enable: boolean + }[] } export interface IResultSkillCount { diff --git a/frontend/src/api/info/type.ts b/frontend/src/api/info/type.ts index 6db332da..73aca316 100644 --- a/frontend/src/api/info/type.ts +++ b/frontend/src/api/info/type.ts @@ -30,7 +30,7 @@ export interface ICharacterInfo { properties: string[] stones: IEquipment[] enchants: IEnchantingInfo[] - emblems: IEnchantingInfo[] + emblems: IEmblemInfo[] oaths: IEquipment[] weapons: string[] subweapons: string[] @@ -137,6 +137,14 @@ export interface IEnchantingInfo { type?: string } +export interface IEmblemInfo { + fame: number + id: string + rarity: string + type: string + value: string +} + export interface IAvatarInfo { id: number options: string[] diff --git a/frontend/src/assets/img/oath/active.png b/frontend/src/assets/img/oath/active.png new file mode 100755 index 00000000..6802c187 Binary files /dev/null and b/frontend/src/assets/img/oath/active.png differ diff --git a/frontend/src/assets/img/oath/disabled.png b/frontend/src/assets/img/oath/disabled.png new file mode 100755 index 00000000..4a44cde1 Binary files /dev/null and b/frontend/src/assets/img/oath/disabled.png differ diff --git a/frontend/src/pages/Character/Forge/components/Emblems.vue b/frontend/src/pages/Character/Forge/components/Emblems.vue index 223a8c9b..f3b678cd 100644 --- a/frontend/src/pages/Character/Forge/components/Emblems.vue +++ b/frontend/src/pages/Character/Forge/components/Emblems.vue @@ -25,8 +25,8 @@ :key="index" > -