初步支持星铁面板数据获取与展示

This commit is contained in:
Kokomi 2023-05-27 05:37:06 +08:00
parent ea2919d31f
commit 08e66d28be
6 changed files with 31 additions and 17 deletions

View File

@ -1,8 +1,9 @@
# 2.4.0 Dev
# 2.4.0
* 尚未完成不推荐切换至Dev
* 初步支持星铁面板数据获取与展示
* 面板属性计算暂未包含武器及圣遗物Buff面板数据暂不准确
* 可使用`#星铁更新面板`来获取面板信息,通过`#希儿面板`来进行查看
* 部分角色的伤害计算,以及圣遗物评分功能仍在补全中
* 使用Miao-Yunzai可使用`*`来代填`#星铁`前缀并能区分游戏使用不同UID目前仍在Dev版本请等待后续更新
# 2.3.8

View File

@ -55,6 +55,7 @@ const ProfileChange = {
ret.char = char.id
ret.mode = regRet[3] === '换' ? '面板' : regRet[3]
ret.uid = regRet[1] || regRet[4] || ''
ret.game = char.game
msg = regRet[5]
// 更换匹配
@ -147,13 +148,15 @@ const ProfileChange = {
* @param uid
* @param charid
* @param ds
* @param game
* @returns {ProfileData|boolean}
*/
getProfile (uid, charid, ds) {
getProfile (uid, charid, ds, game = 'gs') {
if (!charid) {
return false
}
let player = Player.create(uid)
let player = Player.create(uid, game)
let source = player.getProfile(charid)
let dc = ds.char || {}
@ -180,7 +183,7 @@ const ProfileChange = {
let id = cfg.char || source.id
let key = cuid + ':' + id
if (!profiles[key]) {
let cPlayer = Player.create(cuid)
let cPlayer = Player.create(cuid, game)
profiles[key] = cPlayer.getProfile(id) || {}
}
return profiles[key]?.id ? profiles[key] : source
@ -194,6 +197,7 @@ const ProfileChange = {
fetter: source.fetter || 10,
elem: char.elem,
dataSource: 'change',
_source: 'change',
promote
}, char.game, false)
@ -201,9 +205,12 @@ const ProfileChange = {
let wCfg = ds.weapon || {}
let wSource = getSource(wCfg).weapon || {}
let weapon = Weapon.get(wCfg?.weapon || wSource?.name || defWeapon[char.weaponType], char.game, char.weaponType)
if (char.isGs) {
if (!weapon || weapon.type !== char.weaponType) {
weapon = Weapon.get(defWeapon[char.weaponType], char.game)
}
}
let wDs = {
name: weapon.name,
star: weapon.star,

View File

@ -28,8 +28,12 @@ let ProfileDetail = {
e.reply('面板替换功能已禁用...')
return true
}
if (pc.game === 'sr') {
e.reply('星铁面板暂不支持面板替换,请等待后续升级...')
return true
}
e.uid = pc.uid || e.runtime.uid
profileChange = ProfileChange.getProfile(e.uid, pc.char, pc.change)
profileChange = ProfileChange.getProfile(e.uid, pc.char, pc.change, pc.game)
if (profileChange && profileChange.char) {
msg = `#${profileChange.char?.name}${pc.mode || '面板'}`
e._profile = profileChange

View File

@ -75,9 +75,9 @@ export default class AvatarArtis extends Base {
arti.set = artiObj.setName || arti.set || ''
arti.level = ds.level || arti.level || 1
arti.star = artiObj.getStarById(ds.id) || arti.star || 5
if (ds.mainId && ds.attrs) {
let attr = artiObj.getAttrData(ds.mainId, ds.attrs, arti.level, arti.star, idx)
let attrIds = ds.attrIds || ds.attrs
if (ds.mainId && attrIds) {
let attr = artiObj.getAttrData(ds.mainId, attrIds, arti.level, arti.star, idx)
if (attr) {
arti.mainId = ds.mainId
arti.main = attr.main || arti.main || {}
@ -85,6 +85,8 @@ export default class AvatarArtis extends Base {
} else {
console.log('attr id error', ds.main, ds.mainId, idx, arti.level, arti.star)
}
} else {
arti.attrs = []
}
return
} else {
@ -160,9 +162,9 @@ export default class AvatarArtis extends Base {
if (this.isSr) {
tmp.id = ds.id
tmp.mainId = ds.main?.id
tmp.attrs = []
tmp.attrIds = []
lodash.forEach(ds.attrs, (as) => {
tmp.attrs.push([
tmp.attrIds.push([
as?.id || '',
as?.count || 1,
as?.step || 0

View File

@ -94,13 +94,13 @@ const HomoData = {
id: ds.ID,
level: ds.Level || 1,
mainId: ds.MainAffixID,
attrs: []
attrIds: []
}
lodash.forEach(ds.RelicSubAffix, (s) => {
if (!s.SubAffixID) {
return true
}
tmp.attrs.push([s.SubAffixID, s.Cnt, s.Step || 0].join(','))
tmp.attrIds.push([s.SubAffixID, s.Cnt, s.Step || 0].join(','))
})
ret[ds.Type] = tmp
})

View File

@ -189,7 +189,7 @@ let ArtisMark = {
let ds = artis[idx]
if (ds) {
// 不再支持非id格式的面板
if (!ds.attrs || !ds.mainId) {
if ((!ds.attrIds && !ds.attr) || !ds.mainId) {
return false
}
}