From 6badfb97a78906feddfba320dea3dcd10ad354d2 Mon Sep 17 00:00:00 2001 From: Kokomi <1379177109@qq.com> Date: Sun, 29 Oct 2023 15:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A4=E5=AE=B3=E8=AE=A1=E7=AE=97=E5=B1=95?= =?UTF-8?q?=E7=A4=BAcreatedBy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/ProfileDmg.js | 27 ++++++++++++++++++------ resources/character/profile-detail.css | 10 +++++++-- resources/character/profile-detail.html | 13 ++++++++---- resources/character/profile-detail.less | 20 ++++++++++++++++-- resources/meta-gs/artifact/artis-mark.js | 3 ++- resources/meta-gs/weapon/desc.js | 1 + 6 files changed, 58 insertions(+), 16 deletions(-) diff --git a/models/ProfileDmg.js b/models/ProfileDmg.js index fa755410..6f160b9e 100644 --- a/models/ProfileDmg.js +++ b/models/ProfileDmg.js @@ -5,7 +5,7 @@ import { Character } from './index.js' import DmgBuffs from './dmg/DmgBuffs.js' import DmgAttr from './dmg/DmgAttr.js' import DmgCalc from './dmg/DmgCalc.js' -import { MiaoError, Meta } from '#miao' +import { MiaoError, Meta, Common } from '#miao' export default class ProfileDmg extends Base { constructor (profile = {}, game = 'gs') { @@ -20,10 +20,18 @@ export default class ProfileDmg extends Base { static dmgRulePath (name, game = 'gs') { const _path = process.cwd() - for (let file of ['calc_user', 'calc_auto', 'calc']) { - let path = `${_path}/plugins/miao-plugin/resources/meta-${game}/character/${name}/${file}.js` + let dmgFile = [ + { file: 'calc_user', name: '自定义伤害' }, + { file: 'calc_auto', name: '组团伤害', test: () => Common.cfg('teamCalc') }, + { file: 'calc', name: '喵喵' } + ] + for (let ds of dmgFile) { + let path = `${_path}/plugins/miao-plugin/resources/meta-${game}/character/${name}/${ds.file}.js` + if (ds.test && !ds.test()) { + continue + } if (fs.existsSync(path)) { - return path + return { path, createdBy: ds.name } } } return false @@ -79,8 +87,12 @@ export default class ProfileDmg extends Base { const cfgPath = ProfileDmg.dmgRulePath(this.char?.name, this.char?.game) let cfg = {} if (cfgPath) { - cfg = await import(`file://${cfgPath}`) + cfg = await import(`file://${cfgPath.path}`) + // 文件中定义了createBy的话,优先进行展示 + let createdBy = cfg.createdBy || cfgPath.createdBy || '喵喵' + createdBy = createdBy.slice(0, 15) return { + createdBy, details: cfg.details || false, // 计算详情 buffs: cfg.buffs || [], // 角色buff defParams: cfg.defParams || {}, // 默认参数,一般为空 @@ -105,7 +117,7 @@ export default class ProfileDmg extends Base { if (!charCalcData) { return false } - let { buffs, details, defParams, mainAttr, defDmgIdx, defDmgKey, enemyName } = charCalcData + let { createdBy, buffs, details, defParams, mainAttr, defDmgIdx, defDmgKey, enemyName } = charCalcData let talent = this.talent() @@ -260,7 +272,8 @@ export default class ProfileDmg extends Base { dmgRet, enemyName, dmgCfg: dmgDetail, - enemyLv + enemyLv, + createdBy } } } diff --git a/resources/character/profile-detail.css b/resources/character/profile-detail.css index 911a051f..f73271fb 100644 --- a/resources/character/profile-detail.css +++ b/resources/character/profile-detail.css @@ -19,7 +19,7 @@ body { } .basic { position: relative; - margin: 0 -15px 10px -10px; + margin: 0 -15px 15px -10px; } .basic:after { content: ""; @@ -324,7 +324,11 @@ body { margin: 10px 0; width: 100%; } -.dmg-mode .dmg-list .cont-footer { +.dmg-created-by { + padding-left: 5px; + float: right; +} +.dmg-mode .not-dmg-mode { display: none; } .cont-title { @@ -383,10 +387,12 @@ body { .dmg-cont .tr .th { color: #d3bc8e; padding-right: 15px; + padding-left: 5px; text-align: right; background: rgba(0, 0, 0, 0.4); min-width: 100px; font-size: 15px; + white-space: nowrap; } .profile-mode .dmg-idx { display: none !important; diff --git a/resources/character/profile-detail.html b/resources/character/profile-detail.html index 42920449..5e923edd 100644 --- a/resources/character/profile-detail.html +++ b/resources/character/profile-detail.html @@ -236,7 +236,7 @@ {{/if}} {{each ad.artis ds idx}} -