星铁面板初步展示圣遗物评分及词条数

This commit is contained in:
Kokomi 2023-05-30 03:42:13 +08:00
parent 9fef444705
commit 02637ece3f
11 changed files with 148 additions and 78 deletions

View File

@ -1,18 +1,19 @@
# 2.4.0
# 2.4.2
* 星铁面板展示圣遗物评分,评分功能尚未完全完成,分值与样式不为最终版本
* 一些已知问题修复
# 2.4.1
* 初步支持星铁面板数据获取与展示
* 可使用`#星铁更新面板`来获取面板信息,通过`#希儿面板`来进行查看
* 部分角色的伤害计算,以及圣遗物评分功能仍在补全中
* 使用Miao-Yunzai可使用`*`来代填`#星铁`前缀并能区分游戏使用不同UID目前仍在Dev版本请等待后续更新
* 请配合使用Miao-Yunzai 3.1.0可达到最佳效果
* Miao-Yunzai可使用`*`来代填`#星铁`前缀能区分游戏使用不同UID
* 其他Yunzai版本出现原神与星铁UID混淆情况为正常情况请手动切换UID或命令后附加UID查询
* 停用旧面板格式数据非AttrIDs格式的数据不会展示部分角色面板数据不展示是正常情况重新更新面板数据即可
# 2.3.8
* 面板服务增加由**Snap Hutao**提供的Enka转发代理可通过`#喵喵设置面板服务4`进行选择
* 面板详情的圣遗物词条增加词条数展示
* 角色面板使用平均词条值作为词条数计算基础
* 部分角色资源文件结构调整
# 2.3.1~2.3.7
# 2.4.0
* 增加`#角色记录``#抽卡统计`功能,可在`#喵喵设置`中开启
* `#角色记录`、`#武器记录`、`#常驻记录` 可查看对应池子的抽卡记录
@ -35,6 +36,10 @@
* 圣遗物评级的分数上限微调
* 增加3.6新圣遗物数据及资源
* 增加绮良良的角色信息,可通过`#绮良良天赋`、`#绮良良图鉴`等查看
* 面板服务增加由**Snap Hutao**提供的Enka转发代理可通过`#喵喵设置面板服务4`进行选择
* 面板详情的圣遗物词条增加词条数展示
* 角色面板使用平均词条值作为词条数计算基础
* 部分角色资源文件结构调整
# 2.3.0

View File

@ -21,6 +21,7 @@ export async function profileArtis (e) {
return true
}
let char = profile.char
let { game } = char
let charCfg = profile.artis.getCharCfg()
let { attrMap } = Artifact.getMeta()
@ -39,6 +40,7 @@ export async function profileArtis (e) {
artisKeyTitle,
attrMap,
charCfg,
game,
changeProfile: e._profileMsg
}, { e, scale: 1.3 })
}

View File

@ -138,10 +138,13 @@ class Artifact extends Base {
console.log('not found attr', ds, _ds)
return true
}
let value = attrCfg?.base * ds.count + attrCfg.step * ds.step
attrs.push({
...ds,
key: attrCfg?.key,
value: attrCfg?.base * ds.count + attrCfg.step * ds.step
upNum: ds.count,
eff: value / (attrCfg.base + attrCfg.step * 2),
value
})
})
return {

View File

@ -6,7 +6,8 @@ import AvatarArtis from './AvatarArtis.js'
import { Artifact, ArtifactSet, Character } from './index.js'
import { Format } from '../components/index.js'
import ArtisMark from './profile/ArtisMark.js'
import { attrMap } from '../resources/meta/artifact/index.js'
import { attrMap as attrMapGS } from '../resources/meta/artifact/index.js'
import { attrMap as attrMapSR } from '../resources/meta-sr/artifact/index.js'
import CharArtis from './profile/CharArtis.js'
export default class ProfileArtis extends AvatarArtis {
@ -29,9 +30,11 @@ export default class ProfileArtis extends AvatarArtis {
*/
getCharCfg () {
let char = Character.get(this.charid)
let { game, isGs } = char
let { attrWeight, title } = CharArtis.getCharArtisCfg(char, this.profile, this)
let attrs = {}
let baseAttr = char.baseAttr || { hp: 14000, atk: 230, def: 700 }
let attrMap = isGs ? attrMapGS : attrMapSR
lodash.forEach(attrMap, (attr, key) => {
let k = attr.base || ''
let weight = attrWeight[k || key]
@ -53,7 +56,7 @@ export default class ProfileArtis extends AvatarArtis {
}
attrs[key] = ret
})
let posMaxMark = ArtisMark.getMaxMark(attrs)
let posMaxMark = ArtisMark.getMaxMark(attrs, game)
// 返回内容待梳理简化
return {
attrs,
@ -116,10 +119,6 @@ export default class ProfileArtis extends AvatarArtis {
let ret = {
mark: Format.comma(totalMark, 1),
_mark: totalMark,
/* crit: Format.comma(totalCrit, 1),
_crit: totalCrit,
valid: Format.comma(totalVaild, 1),
_valid: totalVaild, */
markClass: ArtisMark.getMarkClass(totalMark / 5),
artis,
sets,

View File

@ -1,8 +1,15 @@
import lodash from 'lodash'
import { Format } from '#miao'
import { attrNameMap, mainAttr, subAttr, attrMap } from '../../resources/meta/artifact/index.js'
import {
attrMap as attrMapSR
attrNameMap,
mainAttr as mainAttrGS,
subAttr as subAttrGS,
attrMap as attrMapGS
} from '../../resources/meta/artifact/index.js'
import {
attrMap as attrMapSR,
mainAttr as mainAttrSR,
subAttr as subAttrSR
} from '../../resources/meta-sr/artifact/meta.js'
let ArtisMark = {
@ -14,12 +21,13 @@ let ArtisMark = {
} else if (title === '物理伤害加成') {
return 'phy'
}
return (game === 'gs' ? attrNameMap : attrMap)[title]
return attrNameMap[title] || attrMapGS[title]
},
getKeyTitleMap (game = 'gs') {
let ret = {}
lodash.forEach(game === 'gs' ? attrMap : attrMapSR, (ds, key) => {
let attrMap = game === 'gs' ? attrMapGS : attrMapSR
lodash.forEach(attrMap, (ds, key) => {
ret[key] = ds.title
})
Format.eachElem((key, name) => {
@ -77,7 +85,7 @@ let ArtisMark = {
if (!key || key === 'undefined') {
return {}
}
let arrCfg = (game === 'gs' ? attrMap : attrMapSR)[isDmg ? 'dmg' : key]
let arrCfg = (game === 'gs' ? attrMapGS : attrMapSR)[isDmg ? 'dmg' : key]
val = Format[arrCfg?.format || 'comma'](val, 1)
let ret = {
key,
@ -95,7 +103,7 @@ let ArtisMark = {
ret.mark = Format.comma(mark || 0)
ret._mark = mark || 0
}
ret.eff = ret.eff ? Format.comma(ret.eff / 0.85, 1) : '-'
ret.eff = ret.eff ? Format.comma(ret.eff / (game === 'gs' ? 0.85 : 0.9), 1) : '-'
return ret
},
@ -112,14 +120,11 @@ let ArtisMark = {
// 获取位置分数
getMark ({ charCfg, idx, arti, elem = '', game = 'gs' }) {
if (game === 'sr') {
return 0
}
let ret = 0
let mainAttr = arti.main
let subAttr = arti.attrs
let mAttr = arti.main
let sAttr = arti.attrs
let { attrs, posMaxMark } = charCfg
let key = mainAttr?.key
let key = mAttr?.key
if (!key) {
return 0
}
@ -128,24 +133,27 @@ let ArtisMark = {
if (idx >= 3) {
let mainKey = key
if (key !== 'recharge') {
if (idx === 4 && Format.isElem(key) && key === elem) {
let dmgIdx = { gs: 4, sr: 5 }
if (idx === dmgIdx[game] && Format.sameElem(elem, key, game)) {
mainKey = 'dmg'
}
fixPct = Math.max(0, Math.min(1, (attrs[mainKey]?.weight || 0) / (posMaxMark['m' + idx])))
}
ret += (attrs[mainKey]?.mark || 0) * (mainAttr.value || 0) / 4
ret += (attrs[mainKey]?.mark || 0) * (mAttr.value || 0) / 4
}
lodash.forEach(subAttr, (ds) => {
lodash.forEach(sAttr, (ds) => {
ret += (attrs[ds.key]?.mark || 0) * (ds.value || 0)
})
return ret * (1 + fixPct) / 2 / posMaxMark[idx] * 66
},
// 获取位置最高分
getMaxMark (attrs) {
getMaxMark (attrs, game = 'gs') {
let ret = {}
for (let idx = 1; idx <= 5; idx++) {
let mainAttr = game === 'gs' ? mainAttrGS : mainAttrSR
let subAttr = game === 'gs' ? subAttrGS : subAttrSR
for (let idx = 1; idx <= (game === 'gs' ? 5 : 6); idx++) {
let totalMark = 0
let mMark = 0
let mAttr = ''
@ -184,7 +192,7 @@ let ArtisMark = {
return ret.slice(0, maxLen)
},
hasAttr (artis) {
hasAttr (artis, game = 'gs') {
for (let idx = 1; idx <= 5; idx++) {
let ds = artis[idx]
if (ds) {

View File

@ -1,10 +1,14 @@
import { usefulAttr } from '../../resources/meta/artifact/artis-mark.js'
import { usefulAttr as usefulAttrGS } from '../../resources/meta/artifact/artis-mark.js'
import { usefulAttr as usefulAttrSR } from '../../resources/meta-sr/artifact/artis-mark.js'
import lodash from 'lodash'
const CharArtis = {
getCharArtisCfg (char, profile, artis) {
let { attr, weapon } = profile
let { isGs } = char
let usefulAttr = isGs ? usefulAttrGS : usefulAttrSR
let rule = function (title, attrWeight) {
return {
title,
@ -14,6 +18,7 @@ const CharArtis = {
let def = function (attrWeight) {
let title = []
let weight = lodash.extend({}, attrWeight || usefulAttr[char.name] || { atk: 75, cpct: 100, cdmg: 100, dmg: 100 })
let check = (key, max = 75, maxPlus = 75, isWeapon = true) => {
let original = weight[key] || 0
@ -24,42 +29,48 @@ const CharArtis = {
}
return false
}
let wn = weapon?.name || ''
// 增加攻击力或直接伤害类武器判定
const weaponCfg = {
磐岩结绿: {
attr: 'hp',
abbr: '绿剑'
},
赤角石溃杵: {
attr: 'def',
abbr: '赤角'
},
猎人之径: {
attr: 'mastery'
},
薙草之稻光: {
attr: 'recharge',
abbr: '薙刀'
}
}
if (weight.atk > 0 && weaponCfg[wn]) {
let wCfg = weaponCfg[wn]
if (check(wCfg.attr, wCfg.max || 75, wCfg.plus || 75)) {
title.push(wCfg.abbr || wn)
}
}
if (isGs) {
// 对原神一些特殊情况做适配与判定
// 不与攻击力挂钩的武器判定
if (wn === '辰砂之纺锤' && check('def')) {
title.push('纺锤')
}
// 增加攻击力或直接伤害类武器判定
const weaponCfg = {
磐岩结绿: {
attr: 'hp',
abbr: '绿剑'
},
赤角石溃杵: {
attr: 'def',
abbr: '赤角'
},
猎人之径: {
attr: 'mastery'
},
薙草之稻光: {
attr: 'recharge',
abbr: '薙刀'
}
}
// 圣遗物判定如果是绝缘4将充能权重拉高至沙漏圣遗物当前最高权重齐平
let maxWeight = Math.max(weight.atk || 0, weight.hp || 0, weight.def || 0, weight.mastery || 0)
if (artis.is('绝缘4') && check('recharge', maxWeight, 75, false)) {
title.push('绝缘4')
if (weight.atk > 0 && weaponCfg[wn]) {
let wCfg = weaponCfg[wn]
if (check(wCfg.attr, wCfg.max || 75, wCfg.plus || 75)) {
title.push(wCfg.abbr || wn)
}
}
// 不与攻击力挂钩的武器判定
if (wn === '辰砂之纺锤' && check('def')) {
title.push('纺锤')
}
// 圣遗物判定如果是绝缘4将充能权重拉高至沙漏圣遗物当前最高权重齐平
let maxWeight = Math.max(weight.atk || 0, weight.hp || 0, weight.def || 0, weight.mastery || 0)
if (artis.is('绝缘4') && check('recharge', maxWeight, 75, false)) {
title.push('绝缘4')
}
}
title = title.length > 0 ? title.join('') : '通用'

View File

@ -17,6 +17,7 @@ let DmgBuffs = {
let mKey2 = {
aggravate: '超激化'
}
buffs = lodash.filter(buffs, (b) => !!b)
lodash.forEach(buffs, (buff, idx) => {
if (lodash.isString(buff)) {
if (mKey[buff]) {

View File

@ -33,10 +33,10 @@
<div class="artis">
<% for(let idx = 1; idx<=5; idx++) {
<% for(let idx = 1; idx<=(game==='gs'?5:6); idx++) {
let ds = ad?.artis[idx]
%>
{{if idx === 1 }}
{{if idx === 1 && game === 'gs'}}
<div class="item no-bg"></div>
{{/if}}
<div class="item arti {{idx}}">
@ -77,16 +77,17 @@
*{{( 66 / (46.6/6/100 * charCfg.posMaxMark[idx]) * 100).toFixed(1)}}%
</span>
</li>
{{if idx>2}}
{{if idx>2 || game==='sr' }}
<li>
<span class="title">最优主词缀</span>
<span class="val">
{{if game==='sr' && idx<=2 }} - {{else}}
{{if ds.main.title === '充能效率'}}
*100%
{{else}}
{{set mainWeight = charCfg?.attrs[ds.main?.key===data.elem?'dmg':ds.main?.key]?.weight || 0}}
*{{(50 + 50 * mainWeight / charCfg.posMaxMark["m"+idx] ).toFixed(0)}}%
{{/if}}
{{/if}}{{/if}}
</span>
</li>
{{/if}}
@ -158,12 +159,22 @@
</div>
<div class="cont-table mark-table">
<div class="tr thead">
<div class="th">位置</div>
{{if game === 'sr'}}
<div>生之花</div>
<div>死之羽</div>
<div>时之沙</div>
<div>空之杯</div>
<div>理之冠</div>
{{else}}
<div>帽子</div>
<div>手套</div>
<div>衣服</div>
<div>靴子</div>
<div></div>
<div></div>
{{/if}}
</div>
<div class="tr">
<div class="th">最高分(对齐前)</div>

View File

@ -202,7 +202,7 @@
{{else}}
<div class="cont">
<div class="cont-footer dmg-desc">
<strong>伤害计算、圣遗物评分及词条数功能尚未完成...</strong>
<strong>圣遗物评分功能尚未完全完,分值可能不准确,请淡定...</strong>
</div>
</div>
{{/if}}

View File

@ -0,0 +1,30 @@
/**
* 角色的默认评分规则
* 如character/${name}/artis.js下有角色自定义规则优先使用自定义
*/
export const usefulAttr = {
景元: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
希儿: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
布洛妮娅: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 0, cdmg: 100, stance: 0, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 },
杰帕德: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 },
姬子: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 50, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
瓦尔特: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
彦卿: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 75, effPct: 100, effDef: 0, dmg: 100 },
白露: { hp: 100, atk: 0, def: 50, speed: 75, cpct: 0, cdmg: 0, stance: 0, heal: 100, recharge: 100, effPct: 0, effDef: 50, dmg: 0 },
克拉拉: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
三月七: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 },
丹恒: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
阿兰: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
艾丝妲: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 0, cdmg: 0, stance: 75, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 },
黑塔: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
希露瓦: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
娜塔莎: { hp: 100, atk: 0, def: 50, speed: 75, cpct: 0, cdmg: 0, stance: 0, heal: 100, recharge: 75, effPct: 0, effDef: 50, dmg: 0 },
佩拉: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 100, effDef: 0, dmg: 100 },
桑博: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 100, effDef: 0, dmg: 100 },
虎克: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
青雀: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
停云: { hp: 50, atk: 100, def: 0, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 0 },
素裳: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 50, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
开拓者火: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 0, effPct: 100, effDef: 50, dmg: 0 },
开拓者物理: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }
}

View File

@ -22,16 +22,16 @@ export const subAttr = 'atk,atkPlus,def,defPlus,hp,hpPlus,speed,cpct,cdmg,effPct
*/
const attrMap = {
atk: { title: '大攻击', format: 'pct', calc: 'pct', value: 4.32 },
atkPlus: { title: '小攻击', format: 'comma', value: 21 },
atkPlus: { title: '小攻击', format: 'comma', value: 127 / 6 },
def: { title: '大防御', format: 'pct', calc: 'pct', value: 5.4 },
defPlus: { title: '小防御', format: 'comma', value: 21 },
defPlus: { title: '小防御', format: 'comma', value: 127 / 6 },
hp: { title: '大生命', format: 'pct', calc: 'pct', value: 4.32 },
hpPlus: { title: '小生命', format: 'comma', value: 42 },
hpPlus: { title: '小生命', format: 'comma', value: 254 / 6 },
speed: { title: '速度', format: 'comma', calc: 'plus', value: 2.6 },
cpct: { title: '暴击率', format: 'pct', calc: 'plus', value: 3.24 },
cdmg: { title: '暴击伤害', format: 'pct', calc: 'plus', value: 6.48 },
recharge: { title: '充能效率', format: 'pct', calc: 'plus' },
dmg: { title: '伤害加成', format: 'pct' },
recharge: { title: '充能效率', format: 'pct', calc: 'plus', value: 3.11 },
dmg: { title: '伤害加成', format: 'pct', value: 6.22 },
heal: { title: '治疗加成', format: 'pct' },
stance: { title: '击破特攻', format: 'pct', value: 6.48 },
effPct: { title: '效果命中', format: 'pct', value: 4.32 },