mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-21 14:38:30 +00:00
#角色
增加配置开关
This commit is contained in:
parent
f4353fc5ca
commit
036d61d698
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,14 +1,18 @@
|
||||
# 2.2.3 Dev
|
||||
# 2.3.0 Dev
|
||||
|
||||
* 【Dev测试分支,暂未正式公开,预计2.17左右发布】
|
||||
* `【Dev测试分支,开发中】`
|
||||
* 如需体验可切换至miao-plugin仓库dev分支
|
||||
* dev功能可能不稳定,建议具备一定排错能力的勇士体验
|
||||
* 2.3.0正式版预计2.19日发布,当然也有可能继续咕...
|
||||
* 增加`#角色`功能,查询并展示Mys角色信息
|
||||
* Yunzai需要跟随游戏版本升级的功能会在miao-plugin中逐步提供,以保障基础功能相对长期可用
|
||||
* 大部分功能目前默认关闭,可在`#喵喵设置`中启用
|
||||
* 重写底层面板、角色数据获取与保存逻辑
|
||||
* 底层完全兼容面板及Mys数据,对于miao-plugin的大部分场景可做到数据通用
|
||||
* 角色数据及天赋增加缓存逻辑,有缓存数据情况下可在ck失效/验证码等情况下正常使用功能
|
||||
* 面板底层数据结构优化,Enka下使用statsIds存储圣遗物数据
|
||||
* 初步增加`#角色`功能,查询并展示Mys角色信息,尚未完善
|
||||
* Yunzai需要跟随游戏版本升级的功能会逐步在miao-plugin中提供,以保障对应功能相对长期可用
|
||||
* 暂时默认关闭,如需开启可在`#喵喵设置`中启用
|
||||
* 其他功能及界面优化
|
||||
* 角色数据及天赋增加缓存逻辑,有缓存数据情况下可在ck失效/验证码等情况下正常使用大部分功能
|
||||
* 面板底层数据结构及存储逻辑优化,兼容老版本数据
|
||||
* Enka服务下使用statsIds存储圣遗物数据,能够更精确的计算角色属性
|
||||
* 其他功能及界面优化,部分已知问题调整
|
||||
* `#上传深渊` 界面与样式调整
|
||||
* `#刷新排名`、`#禁用排名`、`#启用排名`可由群管理员进行管理
|
||||
|
||||
|
@ -64,7 +64,7 @@ const Wife = {
|
||||
if (!Common.cfg('avatarPoke')) {
|
||||
return false
|
||||
}
|
||||
} else if (!Common.cfg('avatarWife')) {
|
||||
} else if (!Common.cfg('avatarCard')) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { App } from '../components/index.js'
|
||||
import { profileHelp } from './profile/ProfileCommon.js'
|
||||
import { profileArtisList } from './profile/ProfileArtis.js'
|
||||
import { profileDetail } from './profile/ProfileDetail.js'
|
||||
import { profileStat } from './profile/ProfileStat.js'
|
||||
import ProfileStat from './profile/ProfileStat.js'
|
||||
import ProfileList from './profile/ProfileList.js'
|
||||
import { uploadCharacterImg, delProfileImg, profileImgList } from './character/ImgUpload.js'
|
||||
import { enemyLv } from './profile/ProfileUtils.js'
|
||||
@ -71,13 +71,13 @@ app.reg({
|
||||
|
||||
profileStat: {
|
||||
rule: /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)?练度统计$/,
|
||||
fn: profileStat,
|
||||
fn: ProfileStat.stat,
|
||||
name: '面板练度统计'
|
||||
},
|
||||
|
||||
avatarList: {
|
||||
rule: /^(#(角色|查询|查询角色|角色查询|人物)[ |0-9]*$)|(^(#*uid|#*UID)\+*[1|2|5-9][0-9]{8}$)|(^#[\+|+]*[1|2|5-9][0-9]{8})/,
|
||||
fn: profileStat,
|
||||
fn: ProfileStat.avatarList,
|
||||
name: '角色查询'
|
||||
},
|
||||
|
||||
|
@ -1,77 +1,86 @@
|
||||
import { Cfg, Common } from '../../components/index.js'
|
||||
import { MysApi, Player, Character } from '../../models/index.js'
|
||||
|
||||
export async function profileStat (e) {
|
||||
let isMatch = /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)练度统计?$/.test(e.original_msg || e.msg || '')
|
||||
if (!Cfg.get('profileStat', false) && !isMatch) {
|
||||
return false
|
||||
const ProfileStat = {
|
||||
async stat (e) {
|
||||
let isMatch = /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)练度统计?$/.test(e.original_msg || e.msg || '')
|
||||
if (!Cfg.get('profileStat', false) && !isMatch) {
|
||||
return false
|
||||
}
|
||||
return await ProfileStat.render(e)
|
||||
},
|
||||
async avatarList (e) {
|
||||
if (!Cfg.get('avatarList', false)) {
|
||||
return false
|
||||
}
|
||||
return await ProfileStat.render(e, true)
|
||||
},
|
||||
async render (e, isAvatarList = false) {
|
||||
// 缓存时间,单位小时
|
||||
let msg = e.msg.replace('#', '').trim()
|
||||
if (msg === '角色统计' || msg === '武器统计') {
|
||||
// 暂时避让一下抽卡分析的关键词
|
||||
return false
|
||||
}
|
||||
|
||||
let mys = await MysApi.init(e)
|
||||
if (!mys || !mys.uid) return false
|
||||
|
||||
const uid = mys.uid
|
||||
|
||||
let player = Player.create(e)
|
||||
|
||||
await player.refreshMysInfo()
|
||||
|
||||
let avatarRet = await player.refreshAndGetAvatarData({
|
||||
detail: 1,
|
||||
talent: 0,
|
||||
rank: true,
|
||||
retType: 'array',
|
||||
sort: true
|
||||
})
|
||||
|
||||
if (avatarRet.length === 0) {
|
||||
e.reply(`暂未获得#${uid}角色数据,请绑定CK或 #更新面板`)
|
||||
return true
|
||||
}
|
||||
|
||||
let talentNotice = []
|
||||
|
||||
if (!mys.isSelfCookie) {
|
||||
talentNotice.push('未绑定CK,信息可能展示不完全')
|
||||
}
|
||||
|
||||
let faceChar = Character.get(player.face || avatarRet[0]?.id)
|
||||
let face = {
|
||||
banner: faceChar.imgs?.banner,
|
||||
face: faceChar.imgs?.face,
|
||||
name: player.name || `#${uid}`,
|
||||
sign: player.sign,
|
||||
level: player.level
|
||||
}
|
||||
|
||||
let info = player.getInfo()
|
||||
info.stats = info.stats || {}
|
||||
info.statMap = {
|
||||
achievement: '成就',
|
||||
wayPoint: '锚点',
|
||||
avatar: '角色',
|
||||
avatar5: '五星角色',
|
||||
goldCount: '金卡总数'
|
||||
}
|
||||
|
||||
return await Common.render(isAvatarList ? 'character/avatar-list' : 'character/profile-stat', {
|
||||
save_id: uid,
|
||||
uid,
|
||||
info,
|
||||
updateTime: player.getUpdateTime(),
|
||||
isSelfCookie: e.isSelfCookie,
|
||||
talentLvMap: '0,1,1,1,2,2,3,3,3,4,5'.split(','),
|
||||
face,
|
||||
avatars: avatarRet,
|
||||
talentNotice
|
||||
}, { e, scale: 1.4 })
|
||||
}
|
||||
|
||||
// 缓存时间,单位小时
|
||||
let msg = e.msg.replace('#', '').trim()
|
||||
if (msg === '角色统计' || msg === '武器统计') {
|
||||
// 暂时避让一下抽卡分析的关键词
|
||||
return false
|
||||
}
|
||||
|
||||
let isAvatarList = !/练度统计/.test(msg)
|
||||
|
||||
let mys = await MysApi.init(e)
|
||||
if (!mys || !mys.uid) return false
|
||||
|
||||
const uid = mys.uid
|
||||
|
||||
let player = Player.create(e)
|
||||
|
||||
await player.refreshMysInfo()
|
||||
|
||||
let avatarRet = await player.refreshAndGetAvatarData({
|
||||
detail: 1,
|
||||
talent: 0,
|
||||
rank: true,
|
||||
retType: 'array',
|
||||
sort: true
|
||||
})
|
||||
|
||||
if (avatarRet.length === 0) {
|
||||
e.reply(`暂未获得#${uid}角色数据,请绑定CK或 #更新面板`)
|
||||
return true
|
||||
}
|
||||
|
||||
let talentNotice = []
|
||||
|
||||
if (!mys.isSelfCookie) {
|
||||
talentNotice.push('未绑定CK,信息可能展示不完全')
|
||||
}
|
||||
|
||||
let faceChar = Character.get(player.face || avatarRet[0]?.id)
|
||||
let face = {
|
||||
banner: faceChar.imgs?.banner,
|
||||
face: faceChar.imgs?.face,
|
||||
name: player.name || `#${uid}`,
|
||||
sign: player.sign,
|
||||
level: player.level
|
||||
}
|
||||
|
||||
let info = player.getInfo()
|
||||
info.stats = info.stats || {}
|
||||
info.statMap = {
|
||||
achievement: '成就',
|
||||
wayPoint: '锚点',
|
||||
avatar: '角色',
|
||||
avatar5: '五星角色',
|
||||
goldCount: '金卡总数'
|
||||
}
|
||||
|
||||
return await Common.render(isAvatarList ? 'character/avatar-list' : 'character/profile-stat', {
|
||||
save_id: uid,
|
||||
uid,
|
||||
info,
|
||||
updateTime: player.getUpdateTime(),
|
||||
isSelfCookie: e.isSelfCookie,
|
||||
talentLvMap: '0,1,1,1,2,2,3,3,3,4,5'.split(','),
|
||||
face,
|
||||
avatars: avatarRet,
|
||||
talentNotice
|
||||
}, { e, scale: 1.4 })
|
||||
}
|
||||
export default ProfileStat
|
@ -1,5 +1,5 @@
|
||||
import lodash from 'lodash'
|
||||
import plugin from './common-lib/plugin.js'
|
||||
import Plugin from './common/Plugin.js'
|
||||
|
||||
class App {
|
||||
constructor (cfg) {
|
||||
@ -27,7 +27,7 @@ class App {
|
||||
let rules = []
|
||||
let check = []
|
||||
let event = cfg.event
|
||||
let cls = class extends plugin {
|
||||
let cls = class extends Plugin {
|
||||
constructor () {
|
||||
super({
|
||||
name: `喵喵:${cfg.name || cfg.id}`,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import fs from 'fs'
|
||||
import lodash from 'lodash'
|
||||
import cfgData from './cfg-lib/cfg-data.js'
|
||||
import cfgData from './cfg/CfgData.js'
|
||||
|
||||
const _path = process.cwd()
|
||||
const _cfgPath = `${_path}/plugins/miao-plugin/components/`
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Cfg from './Cfg.js'
|
||||
import render from './common-lib/render.js'
|
||||
import render from './common/Render.js'
|
||||
import { Version } from './index.js'
|
||||
import lodash from 'lodash'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import lodash from 'lodash'
|
||||
import Elem from './common-lib/elem.js'
|
||||
import Elem from './common/Elem.js'
|
||||
import { Cfg } from '../components/index.js'
|
||||
|
||||
let Format = {
|
||||
|
@ -1,4 +1,39 @@
|
||||
export const cfgSchema = {
|
||||
apps: {
|
||||
title: 'Yunzai功能(开启使用喵喵版功能)',
|
||||
cfg: {
|
||||
avatarList: {
|
||||
title: '#角色 #UID',
|
||||
key: '角色列表',
|
||||
def: false
|
||||
},
|
||||
avatarCard: {
|
||||
title: '#刻晴 #老婆',
|
||||
key: '角色卡片',
|
||||
def: true
|
||||
},
|
||||
uploadAbyssData: {
|
||||
title: '#深渊',
|
||||
key: '深渊',
|
||||
def: false
|
||||
},
|
||||
profileStat: {
|
||||
title: '#练度统计',
|
||||
key: '练度统计',
|
||||
def: false
|
||||
},
|
||||
help: {
|
||||
title: '#帮助 #菜单',
|
||||
key: '帮助',
|
||||
def: false
|
||||
},
|
||||
avatarPoke: {
|
||||
title: '戳一戳展示角色卡片',
|
||||
key: '戳一戳',
|
||||
def: true
|
||||
}
|
||||
}
|
||||
},
|
||||
profile: {
|
||||
title: '角色面板相关设置',
|
||||
cfg: {
|
||||
@ -12,12 +47,6 @@ export const cfgSchema = {
|
||||
key: '面板替换',
|
||||
def: true
|
||||
},
|
||||
profileStat: {
|
||||
title: '面板练度统计',
|
||||
key: '练度统计',
|
||||
def: false,
|
||||
desc: '使用【#面板练度统计】功能取代【#练度统计】功能,默认关闭'
|
||||
},
|
||||
groupRank: {
|
||||
title: '群面板排名',
|
||||
key: '排名',
|
||||
@ -63,34 +92,6 @@ export const cfgSchema = {
|
||||
}
|
||||
}
|
||||
},
|
||||
char: {
|
||||
title: '玩家&老婆卡片展示',
|
||||
cfg: {
|
||||
avatarCard: {
|
||||
title: '角色查询',
|
||||
key: '角色',
|
||||
def: true,
|
||||
desc: '使用喵喵版角色卡片作为默认角色卡片功能',
|
||||
showDesc: false
|
||||
},
|
||||
uploadAbyssData: {
|
||||
title: '上传深渊',
|
||||
key: '深渊',
|
||||
def: false,
|
||||
desc: '使用【#上传深渊】功能取代【#深渊】功能,默认关闭'
|
||||
},
|
||||
avatarWife: {
|
||||
title: '老婆查询',
|
||||
key: '老婆',
|
||||
def: true
|
||||
},
|
||||
avatarPoke: {
|
||||
title: '戳一戳卡片',
|
||||
key: '戳一戳',
|
||||
def: true
|
||||
}
|
||||
}
|
||||
},
|
||||
wiki: {
|
||||
title: '角色资料与信息查询',
|
||||
cfg: {
|
||||
@ -137,12 +138,6 @@ export const cfgSchema = {
|
||||
input: (n) => Math.min(200, Math.max(50, (n * 1 || 100))),
|
||||
desc: '可选值50~200,建议100。设置高精度会提高图片的精细度,但因图片较大可能会影响渲染与发送速度'
|
||||
},
|
||||
help: {
|
||||
title: '喵喵作为默认帮助',
|
||||
key: '帮助',
|
||||
def: false,
|
||||
desc: '开启后将使用喵喵版帮助作为Yunzai的默认帮助,默认关闭'
|
||||
},
|
||||
commaGroup: {
|
||||
title: '数字逗号分组',
|
||||
key: '逗号',
|
||||
|
@ -19,7 +19,7 @@
|
||||
<div class="cfg-line">
|
||||
{{cfgItem.title}}
|
||||
<span class="cfg-hint"> #喵喵设置{{cfgItem.key}}
|
||||
{{if cfgItem.type==='num'}} {{cfgItem.def}}{{else}} + 开启/关闭{{/if}}
|
||||
{{if cfgItem.type==='num'}} {{cfgItem.def}}{{else}} 开启/关闭{{/if}}
|
||||
</span>
|
||||
{{if cfgItem.type === 'num'}}
|
||||
<div class="cfg-status">{{cfg[cfgKey]}}</div>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 854 KiB After Width: | Height: | Size: 839 KiB |
Binary file not shown.
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 348 KiB |
@ -275,4 +275,4 @@ let eta = {
|
||||
迪希雅: '2023-03-01',
|
||||
米卡: '2023-03-01'
|
||||
}
|
||||
await down('艾尔海森,珐露珊,莱依拉,流浪者,纳西妲,瑶瑶', true)
|
||||
await down('迪希雅,米卡', true)
|
||||
|
Loading…
Reference in New Issue
Block a user