fix: 替换面板时武器数据错误

This commit is contained in:
Aluxes 2024-05-22 00:56:21 +08:00
parent 3d1e602337
commit 909ccf1ede
No known key found for this signature in database
GPG Key ID: 6696152F9C003087
4 changed files with 8 additions and 17 deletions

View File

@ -147,7 +147,7 @@ export default class Avatar extends Base {
this.fetter = ds.fetter || this.fetter || 0 this.fetter = ds.fetter || this.fetter || 0
this._costume = ds.costume || this._costume || 0 this._costume = ds.costume || this._costume || 0
this.elem = ds.elem || this.elem || this.char.elem || '' this.elem = ds.elem || this.elem || this.char.elem || ''
this.promote = Math.max((ds.promote ? ds.promote : this.promote) * 1 || 0, Attr.calcPromote(this.level)) this.promote = Math.max((ds.promote ? ds.promote : this.promote) * 1 || 0, Attr.calcPromote(this.level, this.game))
this.trees = this.trees || [] this.trees = this.trees || []
this._source = ds._source || this._source || '' // 数据源 this._source = ds._source || this._source || '' // 数据源
this._time = ds._time || this._time || now // 面板最后更新时间 this._time = ds._time || this._time || now // 面板最后更新时间
@ -204,7 +204,7 @@ export default class Avatar extends Base {
id: ds.id || w.id, id: ds.id || w.id,
name: ds.name || w.name, name: ds.name || w.name,
level: ds.level || ds.lv || 1, level: ds.level || ds.lv || 1,
promote: lodash.isUndefined(ds.promote) ? Attr.calcPromote(ds.level || ds.lv || 1) : (ds.promote || 0), promote: lodash.isUndefined(ds.promote) ? Attr.calcPromote(ds.level || ds.lv || 1, this.game) : (ds.promote || 0),
affix: ds.affix, affix: ds.affix,
...w.getData('star,abbr,type,img,imgs') ...w.getData('star,abbr,type,img,imgs')
} }

View File

@ -5,7 +5,7 @@ import lodash from 'lodash'
let weaponSet let weaponSet
class Weapon extends Base { class Weapon extends Base {
constructor(meta, game = 'gs') { constructor (meta, game = 'gs') {
if (!meta || !meta.name) { if (!meta || !meta.name) {
return false return false
} }

View File

@ -24,17 +24,10 @@ class Attr extends Base {
return new Attr(profile) return new Attr(profile)
} }
// 只有原神才需要 static calcPromote (lv, game = 'gs') {
static calcPromote (lv) { let lvs = game === 'gs' ? [1, 20, 40, 50, 60, 70, 80, 90] : [1, 20, 30, 40, 50, 60, 70, 80]
if (lv === 20) {
return 1
}
if (lv === 90) {
return 6
}
let lvs = [1, 20, 40, 50, 60, 70, 80, 90]
let promote = 0 let promote = 0
for (let idx = 0; idx < lvs.length - 1; idx++) { for (let idx = 0; idx <= lvs.length - 1; idx++) {
if (lv >= lvs[idx] && lv <= lvs[idx + 1]) { if (lv >= lvs[idx] && lv <= lvs[idx + 1]) {
return promote return promote
} }
@ -59,14 +52,12 @@ class Attr extends Base {
this.setWeaponAttr() this.setWeaponAttr()
this.setArtisAttr() this.setArtisAttr()
return this.attr.getAttr() return this.attr.getAttr()
} }
getBase () { getBase () {
return this.attr.getBase() return this.attr.getBase()
} }
addAttr (key, val, isBase = false) { addAttr (key, val, isBase = false) {
this.attr.addAttr(key, val, isBase) this.attr.addAttr(key, val, isBase)
} }

View File

@ -135,8 +135,8 @@ export const aliasCfg = {
别让世界静下来: '让世界静下来', 别让世界静下来: '让世界静下来',
天才们的休憩: '天才的休憩,天才', 天才们的休憩: '天才的休憩,天才',
早餐的仪式感: '早餐,仪式感', 早餐的仪式感: '早餐,仪式感',
今日亦是和平的一日: '和平的一日,和平一日', 今日亦是和平的一日: '和平的一日,和平一日,今日亦是和平',
银河铁道之夜: '银河铁道,星穹铁道之夜,星穹铁道', 银河铁道之夜: '银河铁道,星穹铁道之夜,星穹铁道,女人看星星',
拂晓之前: '拂晓', 拂晓之前: '拂晓',
'片刻,留在眼底': '片刻留在眼底,留在眼底,眼一直留', '片刻,留在眼底': '片刻留在眼底,留在眼底,眼一直留',
银河沦陷日: '银河沦陷,沦陷日' 银河沦陷日: '银河沦陷,沦陷日'