From 17447c0e1d0354415d9ead1ba3f240ee5f543a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B6=E5=AE=9E=E9=9B=A8=E5=BE=88=E5=A5=BD?= <2122840028@qq.com> Date: Mon, 6 Jan 2025 13:12:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=B1=B3=E6=B8=B8?= =?UTF-8?q?=E7=A4=BE=E6=9B=B4=E6=96=B0=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=A9=E8=B5=8B=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#857)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复米游社更新面板无法获取天赋的问题 * Update MysPanelData.js --- models/serv/api/MysPanelData.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/models/serv/api/MysPanelData.js b/models/serv/api/MysPanelData.js index af8f5af7..3761664b 100644 --- a/models/serv/api/MysPanelData.js +++ b/models/serv/api/MysPanelData.js @@ -1,4 +1,4 @@ -import { Meta } from '#miao' +import { Format, Meta } from '#miao' import { Character, Artifact, Weapon } from '#miao.models' import { artifactMainIdMapping, propertyType2attrName, fixedAttrNames } from './MysPanelMappings.js' import lodash from 'lodash' @@ -15,10 +15,10 @@ let MysPanelData = { level: ds.base.level, cons: ds.base.actived_constellation_num, fetter: ds.base.fetter, - // ds.costumes 是个数组,暂时不知道怎么用 - elem: ds.base.elem, + costume: ds.costumes?.[0]?.id || 0, + elem: Format.elem(ds.base.element), weapon: MysPanelData.getWeapon(ds.weapon), - talent: MysPanelData.getTalent(char, ds.skills), + talent: MysPanelData.getTalent(ds.skills), artis: MysPanelData.getArtifact(ds.relics) }, 'mysPanel') return avatar @@ -34,29 +34,18 @@ let MysPanelData = { } }, - getTalent (char, ds = {}) { - // 照抄 EnkaData 实现 - let { talentId = {}, talentElem = {} } = char.meta - let elem = '' + getTalent (ds = {}) { let idx = 0 let ret = {} lodash.forEach(ds, (talent_data) => { - const id = talent_data.skill_id const lv = talent_data.level let key - if (talentId[id]) { - let key = talentId[id] - elem = elem || talentElem[id] - ret[key] = lv - } else if (talent_data.skill_type == 1) { // 1 主动技能;2 被动技能 + if (talent_data.skill_type == 1) { // 1 主动技能;2 被动技能 key = ['a', 'e', 'q'][idx++] ret[key] = ret[key] || lv } }) - return { - elem: elem, - talent: ret - } + return ret }, getArtifact (data) {