mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-21 22:48:13 +00:00
伤害计算展示createdBy
This commit is contained in:
parent
64b880036b
commit
6badfb97a7
@ -5,7 +5,7 @@ import { Character } from './index.js'
|
|||||||
import DmgBuffs from './dmg/DmgBuffs.js'
|
import DmgBuffs from './dmg/DmgBuffs.js'
|
||||||
import DmgAttr from './dmg/DmgAttr.js'
|
import DmgAttr from './dmg/DmgAttr.js'
|
||||||
import DmgCalc from './dmg/DmgCalc.js'
|
import DmgCalc from './dmg/DmgCalc.js'
|
||||||
import { MiaoError, Meta } from '#miao'
|
import { MiaoError, Meta, Common } from '#miao'
|
||||||
|
|
||||||
export default class ProfileDmg extends Base {
|
export default class ProfileDmg extends Base {
|
||||||
constructor (profile = {}, game = 'gs') {
|
constructor (profile = {}, game = 'gs') {
|
||||||
@ -20,10 +20,18 @@ export default class ProfileDmg extends Base {
|
|||||||
|
|
||||||
static dmgRulePath (name, game = 'gs') {
|
static dmgRulePath (name, game = 'gs') {
|
||||||
const _path = process.cwd()
|
const _path = process.cwd()
|
||||||
for (let file of ['calc_user', 'calc_auto', 'calc']) {
|
let dmgFile = [
|
||||||
let path = `${_path}/plugins/miao-plugin/resources/meta-${game}/character/${name}/${file}.js`
|
{ 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)) {
|
if (fs.existsSync(path)) {
|
||||||
return path
|
return { path, createdBy: ds.name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -79,8 +87,12 @@ export default class ProfileDmg extends Base {
|
|||||||
const cfgPath = ProfileDmg.dmgRulePath(this.char?.name, this.char?.game)
|
const cfgPath = ProfileDmg.dmgRulePath(this.char?.name, this.char?.game)
|
||||||
let cfg = {}
|
let cfg = {}
|
||||||
if (cfgPath) {
|
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 {
|
return {
|
||||||
|
createdBy,
|
||||||
details: cfg.details || false, // 计算详情
|
details: cfg.details || false, // 计算详情
|
||||||
buffs: cfg.buffs || [], // 角色buff
|
buffs: cfg.buffs || [], // 角色buff
|
||||||
defParams: cfg.defParams || {}, // 默认参数,一般为空
|
defParams: cfg.defParams || {}, // 默认参数,一般为空
|
||||||
@ -105,7 +117,7 @@ export default class ProfileDmg extends Base {
|
|||||||
if (!charCalcData) {
|
if (!charCalcData) {
|
||||||
return false
|
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()
|
let talent = this.talent()
|
||||||
|
|
||||||
@ -260,7 +272,8 @@ export default class ProfileDmg extends Base {
|
|||||||
dmgRet,
|
dmgRet,
|
||||||
enemyName,
|
enemyName,
|
||||||
dmgCfg: dmgDetail,
|
dmgCfg: dmgDetail,
|
||||||
enemyLv
|
enemyLv,
|
||||||
|
createdBy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ body {
|
|||||||
}
|
}
|
||||||
.basic {
|
.basic {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0 -15px 10px -10px;
|
margin: 0 -15px 15px -10px;
|
||||||
}
|
}
|
||||||
.basic:after {
|
.basic:after {
|
||||||
content: "";
|
content: "";
|
||||||
@ -324,7 +324,11 @@ body {
|
|||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.dmg-mode .dmg-list .cont-footer {
|
.dmg-created-by {
|
||||||
|
padding-left: 5px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.dmg-mode .not-dmg-mode {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.cont-title {
|
.cont-title {
|
||||||
@ -383,10 +387,12 @@ body {
|
|||||||
.dmg-cont .tr .th {
|
.dmg-cont .tr .th {
|
||||||
color: #d3bc8e;
|
color: #d3bc8e;
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
|
padding-left: 5px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
background: rgba(0, 0, 0, 0.4);
|
background: rgba(0, 0, 0, 0.4);
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.profile-mode .dmg-idx {
|
.profile-mode .dmg-idx {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
|
@ -236,7 +236,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{each ad.artis ds idx}}
|
{{each ad.artis ds idx}}
|
||||||
<div class="item arti">
|
<div class="item arti arti-class-{{ds.markClass}}">
|
||||||
{{if ds && ds.name && ds.main && ds.main.key && ds.main.key!="undefined"}}
|
{{if ds && ds.name && ds.main && ds.main.key && ds.main.key!="undefined"}}
|
||||||
<div class="arti-icon">
|
<div class="arti-icon">
|
||||||
<div class="img" style="background-image:url({{_res_path}}{{ds.img}})"></div>
|
<div class="img" style="background-image:url({{_res_path}}{{ds.img}})"></div>
|
||||||
@ -268,12 +268,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- 【 伤害表格 】 -->
|
<!-- 【 伤害表格 】 -->
|
||||||
{{ set {dmgRet, dmgCfg, enemyLv, enemyName, dmgMsg, dmgData} = dmgCalc }}
|
{{ set {dmgRet, dmgCfg, enemyLv, enemyName, dmgMsg, dmgData, createdBy} = dmgCalc }}
|
||||||
<div>
|
<div>
|
||||||
{{if dmgData?.length > 0}}
|
{{if dmgData?.length > 0}}
|
||||||
<div class="dmg-cont dmg-list cont">
|
<div class="dmg-cont dmg-list cont">
|
||||||
<div class="cont-title">
|
<div class="cont-title">
|
||||||
伤害计算<span>目标为{{enemyLv}}级{{enemyName||'小宝'}}{{if game==='gs'}},如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置{{/if}}</span>
|
伤害计算
|
||||||
|
<span class="not-dmg-mode dmg-desc">使用<strong>{{gameHash}}{{data.abbr}}伤害</strong>命令可以查看伤害详情</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="cont-table">
|
<div class="cont-table">
|
||||||
<div class="tr thead">
|
<div class="tr thead">
|
||||||
@ -297,7 +298,11 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
<div class="cont-footer dmg-desc">
|
<div class="cont-footer dmg-desc">
|
||||||
使用命令<strong>{{gameHash}}{{data.abbr}}伤害</strong>可以查看伤害详情,使用命令<strong>#角色面板帮助</strong>可查看帮助说明
|
<span>目标为{{enemyLv}}级{{enemyName||'小宝'}}{{if game==='gs'}},使用<strong>#敌人等级{{enemyLv}}</strong>命令可指定等级{{/if}}</span>
|
||||||
|
{{if createdBy}}
|
||||||
|
<!-- 优先展示calc.js中 返回的createdBy字段,用于展示伤害计算作者-->
|
||||||
|
<span class="dmg-created-by">伤害计算来源:<strong>{{createdBy}}</strong></span>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -18,7 +18,7 @@ body {
|
|||||||
|
|
||||||
.basic {
|
.basic {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0 -15px 10px -10px;
|
margin: 0 -15px 15px -10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.basic:after {
|
.basic:after {
|
||||||
@ -388,7 +388,12 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dmg-mode .dmg-list .cont-footer {
|
.dmg-created-by {
|
||||||
|
padding-left: 5px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dmg-mode .not-dmg-mode {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,10 +466,12 @@ body {
|
|||||||
.th {
|
.th {
|
||||||
color: #d3bc8e;
|
color: #d3bc8e;
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
|
padding-left: 5px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
background: rgba(0, 0, 0, .4);
|
background: rgba(0, 0, 0, .4);
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,6 +540,15 @@ body {
|
|||||||
box-shadow: 0 0 1px 0 #ccc, 2px 2px 4px 0 rgba(50, 50, 50, .8);
|
box-shadow: 0 0 1px 0 #ccc, 2px 2px 4px 0 rgba(50, 50, 50, .8);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.item {
|
||||||
|
&.arti-class-ACE,
|
||||||
|
&.arti-class-MAX {
|
||||||
|
.head {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.arti-icon {
|
.arti-icon {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
@ -75,5 +75,6 @@ export const usefulAttr = {
|
|||||||
琳妮特: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
琳妮特: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||||
菲米尼: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 0, dmg: 100, phy: 100, recharge: 55, heal: 0 },
|
菲米尼: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 0, dmg: 100, phy: 100, recharge: 55, heal: 0 },
|
||||||
那维莱特: { hp: 100, atk: 0, def: 0, cpct: 100, cdmg: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 0 },
|
那维莱特: { hp: 100, atk: 0, def: 0, cpct: 100, cdmg: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 0 },
|
||||||
莱欧斯利: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 0 }
|
莱欧斯利: { hp: 0, atk: 75, def: 0, cpct: 100, cdmg: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||||
|
芙宁娜: { hp: 100, atk: 0, def: 0, cpct: 100, cdmg: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 100 },
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ export const descFix = {
|
|||||||
贯月矢: '触发草元素反应后,每20秒产生至多存在10秒的种识之叶,后台也能触发。拾取提升攻击力<nobr>32%</nobr>,持续12秒。',
|
贯月矢: '触发草元素反应后,每20秒产生至多存在10秒的种识之叶,后台也能触发。拾取提升攻击力<nobr>32%</nobr>,持续12秒。',
|
||||||
护摩之杖: '生命值提升$[0]。<br />获得$[1]生命值上限的攻击力提升,生命值低于50%时,进一步获得$[2]生命值上限的攻击力提升。',
|
护摩之杖: '生命值提升$[0]。<br />获得$[1]生命值上限的攻击力提升,生命值低于50%时,进一步获得$[2]生命值上限的攻击力提升。',
|
||||||
薙草之稻光: '攻击力获得提升,提升程度相当于充能效率超出100%部分的$[0],至多提升$[1]。<br/>施放爆发后的12秒内,充能效率提升$[2]。',
|
薙草之稻光: '攻击力获得提升,提升程度相当于充能效率超出100%部分的$[0],至多提升$[1]。<br/>施放爆发后的12秒内,充能效率提升$[2]。',
|
||||||
|
"「渔获」":'元素爆发的伤害提升$[0]<br />元素爆发的暴击率提升$[1]',
|
||||||
|
|
||||||
// 弓
|
// 弓
|
||||||
终末嗟叹之诗: '精通提高$[0]点;战技或爆发命中敌人时,获得追思之符,后台也能触发。4枚时消耗所有追思之符:精通提高$[1]点,攻击力提升$[2],持续12秒。',
|
终末嗟叹之诗: '精通提高$[0]点;战技或爆发命中敌人时,获得追思之符,后台也能触发。4枚时消耗所有追思之符:精通提高$[1]点,攻击力提升$[2],持续12秒。',
|
||||||
|
Loading…
Reference in New Issue
Block a user