mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
星铁角色增加别名处理
This commit is contained in:
parent
31a06ca8e5
commit
601284c288
@ -9,7 +9,7 @@ import Profile from './player/Profile.js'
|
||||
const charKey = 'name,abbr,sName,star,imgs,face,side,gacha,weaponTypeName'.split(',')
|
||||
|
||||
export default class AvatarData extends Base {
|
||||
constructor (ds = {}, source, game = 'gs') {
|
||||
constructor (ds = {}, game = 'gs') {
|
||||
super()
|
||||
let char = Character.get({ id: ds.id, elem: ds.elem })
|
||||
if (!char) {
|
||||
@ -19,7 +19,7 @@ export default class AvatarData extends Base {
|
||||
this.char = char
|
||||
this.game = char.game || game
|
||||
this.initArtis()
|
||||
this.setAvatar(ds, source)
|
||||
this.setAvatar(ds)
|
||||
}
|
||||
|
||||
get hasTalent () {
|
||||
@ -84,8 +84,8 @@ export default class AvatarData extends Base {
|
||||
return ''
|
||||
}
|
||||
|
||||
static create (ds, source = '', game = 'gs') {
|
||||
let avatar = new AvatarData(ds, source, game)
|
||||
static create (ds, game = 'gs') {
|
||||
let avatar = new AvatarData(ds, game)
|
||||
if (!avatar) {
|
||||
return false
|
||||
}
|
||||
@ -125,7 +125,7 @@ export default class AvatarData extends Base {
|
||||
this.elem = ds.elem || this.elem || this.char.elem || ''
|
||||
this.promote = lodash.isUndefined(ds.promote) ? (this.promote || AttrCalc.calcPromote(this.level)) : (ds.promote || 0)
|
||||
this.trees = ds.trees || this.trees || []
|
||||
this._source = ds._source || ds.dataSource || this._source || ''
|
||||
this._source = ds._source || this._source || ''
|
||||
this._time = ds._time || this._time || now
|
||||
this._update = ds._update || this._update || ds._time || now
|
||||
this._talent = ds._talent || this._talent || ds._time || now
|
||||
|
@ -176,7 +176,7 @@ export default class Player extends Base {
|
||||
}
|
||||
}
|
||||
if (!avatars[id] && create) {
|
||||
avatars[id] = AvatarData.create({ id }, '', this.game)
|
||||
avatars[id] = AvatarData.create({ id }, this.game)
|
||||
}
|
||||
return avatars[id] || false
|
||||
}
|
||||
|
@ -183,7 +183,9 @@ class Weapon extends Base {
|
||||
let pct = ret[2]
|
||||
let value = tables?.[idx]?.[affix - 1]
|
||||
if (pct === '%') {
|
||||
value = Format.percent(value)
|
||||
value = Format.pct(value)
|
||||
} else {
|
||||
value = Format.comma(value)
|
||||
}
|
||||
desc = desc.replaceAll(ret[0], value)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
import lodash from 'lodash'
|
||||
import { Data, Format } from '#miao'
|
||||
import { charPosIdx } from './CharMeta.js'
|
||||
import { aliasMap as aliasMapSR } from '../../resources/meta-sr/character/meta.js'
|
||||
|
||||
|
||||
// 别名表
|
||||
@ -33,6 +34,10 @@ async function init () {
|
||||
gameMap[id] = 'sr'
|
||||
})
|
||||
|
||||
// 添加别名
|
||||
lodash.forEach(aliasMapSR, (v, k) => {
|
||||
aliasMap[v] = aliasMap[k]
|
||||
})
|
||||
|
||||
lodash.forEach([diyCfg.customCharacters, sysCfg.characters], (roleIds) => {
|
||||
lodash.forEach(roleIds || {}, (aliases, id) => {
|
||||
|
42
resources/meta-sr/character/meta.js
Normal file
42
resources/meta-sr/character/meta.js
Normal file
@ -0,0 +1,42 @@
|
||||
import lodash from 'lodash'
|
||||
|
||||
let alias = {
|
||||
三月七: '三月,相遇之缘',
|
||||
丹恒: '冷面,小青龙,冷面小青龙,单恒',
|
||||
佩拉: '佩菈',
|
||||
停云: '',
|
||||
克拉拉: '',
|
||||
卡夫卡: '亲妈',
|
||||
姬子: '',
|
||||
娜塔莎: '纳塔莎,纳塔沙,纳塔沙',
|
||||
布洛妮娅: '大鸭鸭,鸭鸭,板鸭,布洛尼亚',
|
||||
希儿: '希尔,云天明,蝴蝶',
|
||||
希露瓦: '希璐瓦',
|
||||
彦卿: '延卿,闫卿,彦清,彦青',
|
||||
景元: '景原,景源,神君发射器',
|
||||
杰帕德: '',
|
||||
桑博: '',
|
||||
瓦尔特: '老杨,瓦尔特杨',
|
||||
白露: '小龙人',
|
||||
素裳: '',
|
||||
罗刹: '罗沙,罗杀',
|
||||
艾丝妲: '宇宙级富婆',
|
||||
虎克: '胡可,虎克大人,漆黑的虎克,漆黑的虎克大人,鼹鼠党,鼹鼠党老大',
|
||||
银狼: '小鸭鸭,小板鸭,黑客,骇客,骇兔',
|
||||
阿兰: '',
|
||||
青雀: '赌神,赌圣,青鹊',
|
||||
黑塔: ''
|
||||
}
|
||||
|
||||
let aliasMap = {}
|
||||
lodash.forEach(alias, (txt, char) => {
|
||||
if (!txt) {
|
||||
return true
|
||||
}
|
||||
lodash.forEach(txt.split(','), (t) => {
|
||||
aliasMap[char] = t
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
export { aliasMap }
|
Loading…
Reference in New Issue
Block a user