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
72daeac477
commit
f8d3765ded
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,21 +1,19 @@
|
||||
# 2.1.5
|
||||
|
||||
* 角色立绘
|
||||
* 支持`#上传刻晴面板图`上传
|
||||
* 增加角色面板立绘图相关命令 **@cvs**
|
||||
* 支持`#上传刻晴面板图`上传
|
||||
* 新增`#刻晴面板图列表`
|
||||
* 可通过指令查询当前可看的面板立绘
|
||||
* 立绘支持`#原图`指令
|
||||
* 支持删除uid缓存data文件数据 `#删除面板数据`
|
||||
# 2.1.4
|
||||
|
||||
* 增加散兵的伤害计算 **@panganqi**
|
||||
* 角色立绘支持随机,用于面板场景
|
||||
* 图像支持webp及png格式
|
||||
* 普通立绘:**resources/profile/normal-character/**
|
||||
* 彩蛋立绘(满命/ACE/三皇冠):**resources/profile/super-character/**
|
||||
* 彩蛋立绘(满命/ACE/三皇冠):**resources/profile/super-character/**
|
||||
* 单张立绘请放置在普通&彩蛋目录下,以**角色全名**为**文件名**,例如**刻晴.webp**
|
||||
* 如需多张随机,请在普通&彩蛋目录下,以**角色全名**为**目录**名,任意文件名为文件名,例如 **刻晴/1.png**
|
||||
|
||||
# 2.1.1~2.1.3
|
||||
# 2.1.1~2.1.4
|
||||
|
||||
* 增加面板替换功能,可通过命令更换面板的圣遗物、武器、天赋命座等,用于伤害计算
|
||||
* `#雷神面板换稻光换90级满命` / `#刻晴面板换雷神圣遗物` 等命令
|
||||
|
@ -38,7 +38,7 @@ const checkAuth = async function (e) {
|
||||
(*/ω\*)`)
|
||||
return false
|
||||
}
|
||||
return await MysApi.initUser(e)
|
||||
return true
|
||||
}
|
||||
|
||||
async function sysCfg (e) {
|
||||
|
@ -11,8 +11,9 @@ import { Character } from '../../models/index.js'
|
||||
const resPath = process.cwd() + '/plugins/miao-plugin/resources/'
|
||||
let regex = /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:照片|写真|图片|图像)\s*$/
|
||||
let profileRegex = /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:面板图)\s*$/
|
||||
let isProfile = false;
|
||||
export async function uploadCharacterImg(e) {
|
||||
let isProfile = false
|
||||
|
||||
export async function uploadCharacterImg (e) {
|
||||
let promise = await isAllowedToUploadCharacterImage(e)
|
||||
if (!promise) {
|
||||
return false
|
||||
@ -22,7 +23,7 @@ export async function uploadCharacterImg(e) {
|
||||
let msg = e.msg
|
||||
let regRet = regex.exec(msg)
|
||||
if (msg.includes('面板')) {
|
||||
isProfile = true;
|
||||
isProfile = true
|
||||
regRet = profileRegex.exec(msg)
|
||||
}
|
||||
|
||||
@ -40,7 +41,7 @@ export async function uploadCharacterImg(e) {
|
||||
imageMessages.push(val)
|
||||
}
|
||||
}
|
||||
if (imageMessages.length === 0) {
|
||||
if (imageMessages.length === 0 && e.source) {
|
||||
let source
|
||||
if (e.isGroup) {
|
||||
// 支持at图片添加,以及支持后发送
|
||||
@ -52,9 +53,9 @@ export async function uploadCharacterImg(e) {
|
||||
for (let val of source.message) {
|
||||
if (val.type === 'image') {
|
||||
imageMessages.push(val)
|
||||
} else if (val.type === 'xml') { //支持合并转发消息内置的图片批量上传,喵喵 喵喵喵? 喵喵喵喵
|
||||
} else if (val.type === 'xml') { // 支持合并转发消息内置的图片批量上传,喵喵 喵喵喵? 喵喵喵喵
|
||||
let resid = val.data.match(/m_resid="(\d|\w|\/)*"/)[0].replace(/m_resid=|"/g, '')
|
||||
if (!resid) break;
|
||||
if (!resid) break
|
||||
let message = await Bot.getForwardMsg(resid)
|
||||
for (const item of message) {
|
||||
for (const i of item.message) {
|
||||
@ -75,10 +76,10 @@ export async function uploadCharacterImg(e) {
|
||||
return true
|
||||
}
|
||||
|
||||
async function saveImages(e, name, imageMessages) {
|
||||
async function saveImages (e, name, imageMessages) {
|
||||
let imgMaxSize = e?.groupConfig?.imgMaxSize || 5
|
||||
let pathSuffix = `character-img/${name}/upload`
|
||||
if (isProfile) pathSuffix = `profile/normal-character/${name}`;
|
||||
if (isProfile) pathSuffix = `profile/normal-character/${name}`
|
||||
let path = resPath + pathSuffix
|
||||
|
||||
if (!fs.existsSync(path)) {
|
||||
@ -130,8 +131,8 @@ async function saveImages(e, name, imageMessages) {
|
||||
return true
|
||||
}
|
||||
|
||||
async function isAllowedToUploadCharacterImage(e) {
|
||||
let sendMsg = e.msg.includes('上传') ? '添加' : '删除';
|
||||
async function isAllowedToUploadCharacterImage (e) {
|
||||
let sendMsg = e.msg.includes('上传') ? '添加' : '删除'
|
||||
if (!e.message) {
|
||||
return false
|
||||
}
|
||||
@ -162,8 +163,9 @@ async function isAllowedToUploadCharacterImage(e) {
|
||||
}
|
||||
return true
|
||||
}
|
||||
//仅支持面板图删除
|
||||
export async function delProflie(e) {
|
||||
|
||||
// 仅支持面板图删除
|
||||
export async function delProfileImg (e) {
|
||||
let promise = await isAllowedToUploadCharacterImage(e)
|
||||
if (!promise) {
|
||||
return false
|
||||
@ -173,7 +175,7 @@ export async function delProflie(e) {
|
||||
return false
|
||||
}
|
||||
let name = char.name
|
||||
let pathSuffix = `profile/normal-character/${name}`;
|
||||
let pathSuffix = `profile/normal-character/${name}`
|
||||
let path = resPath + pathSuffix
|
||||
let num = e.msg.match(/\d+/)
|
||||
if (!num) {
|
||||
@ -181,8 +183,10 @@ export async function delProflie(e) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
let File = fs.readdirSync(`${path}`)
|
||||
fs.unlinkSync(`${path}/${File[num - 1]}`)
|
||||
let imgs = fs.readdirSync(`${path}`).filter((file) => {
|
||||
return /\.(png|webp)$/.test(file)
|
||||
})
|
||||
fs.unlinkSync(`${path}/${imgs[num - 1]}`)
|
||||
e.reply('删除成功')
|
||||
} catch (err) {
|
||||
e.reply('删除失败,请检查序列号是否正确')
|
||||
@ -190,31 +194,38 @@ export async function delProflie(e) {
|
||||
return true
|
||||
}
|
||||
|
||||
export async function proflieList(e) {
|
||||
export async function profileImgList (e) {
|
||||
let msglist = []
|
||||
let char = Character.get(e.msg.replace(/#|面板图列表/g, ''))
|
||||
if (!char || !char.name) {
|
||||
return false
|
||||
}
|
||||
let nickname = Bot.nickname;
|
||||
let nickname = Bot.nickname
|
||||
if (e.isGroup) {
|
||||
let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin)
|
||||
nickname = info.card || info.nickname
|
||||
}
|
||||
let name = char.name
|
||||
let pathSuffix = `profile/normal-character/${name}`;
|
||||
let pathSuffix = `profile/normal-character/${name}`
|
||||
let path = resPath + pathSuffix
|
||||
if (!fs.existsSync(path)) {
|
||||
e.reply(`暂无${char.name}的角色面板图`)
|
||||
return true
|
||||
}
|
||||
try {
|
||||
|
||||
let File = fs.readdirSync(`${path}`)
|
||||
let imgs = fs.readdirSync(`${path}`).filter((file) => {
|
||||
return /\.(png|webp)$/.test(file)
|
||||
})
|
||||
msglist.push({
|
||||
message: [`当前查看的是${name}面板图,共${File.length}张,可输入【#删除${name}面板图(序列号)】进行删除`],
|
||||
message: [`当前查看的是${name}面板图,共${imgs.length}张,可输入【#删除${name}面板图(序列号)】进行删除`],
|
||||
nickname: nickname,
|
||||
user_id: Bot.uin
|
||||
})
|
||||
for (let i = 0; i < File.length; i++) { //合并转发最多99? 但是我感觉不会有这么多先不做处理
|
||||
for (let i = 0; i < imgs.length; i++) {
|
||||
// 合并转发最多99? 但是我感觉不会有这么多先不做处理
|
||||
console.log(`${path}${imgs[i]}`)
|
||||
msglist.push({
|
||||
message: [`${i + 1}.`, segment.image(`${path}/${File[i]}`)],
|
||||
message: [`${i + 1}.`, segment.image(`${path}/${imgs[i]}`)],
|
||||
nickname: nickname,
|
||||
user_id: Bot.uin
|
||||
})
|
||||
@ -222,6 +233,8 @@ export async function proflieList(e) {
|
||||
let msgRsg = await e.reply(await Bot.makeForwardMsg(msglist))
|
||||
if (!msgRsg) e.reply('风控了,可私聊查看', true)
|
||||
} catch (err) {
|
||||
logger.error(err); e.reply('没有角色面板图')
|
||||
logger.error(err)
|
||||
e.reply(`暂无${char.name}的角色面板图~`)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export async function profileList (e) {
|
||||
await profileList(e)
|
||||
return true
|
||||
} else {
|
||||
e.reply('尚未获取任何角色数据')
|
||||
e.reply(`本地暂无uid${uid}的面板数据...`)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { profileArtis, profileArtisList } from './character/ProfileArtis.js'
|
||||
import { renderProfile } from './character/ProfileDetail.js'
|
||||
import { profileStat } from './character/ProfileStat.js'
|
||||
import { profileList } from './character/ProfileList.js'
|
||||
import { uploadCharacterImg,delProflie,proflieList } from './character/ImgUpload.js'
|
||||
import { uploadCharacterImg, delProfileImg, profileImgList } from './character/ImgUpload.js'
|
||||
import { enemyLv } from './character/ProfileUtils.js'
|
||||
import ProfileChange from './profile/ProfileChange.js'
|
||||
import { groupRank, resetRank, refreshRank } from './character/ProfileRank.js'
|
||||
@ -75,35 +75,39 @@ app.reg('profile-refresh', getProfile, {
|
||||
})
|
||||
|
||||
app.reg('upload-img', uploadCharacterImg, {
|
||||
rule: /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:面板图)\s*$/,
|
||||
rule: /^#?\s*(?:上传|添加)(.+)(?:面板图)\s*$/,
|
||||
describe: '【#上传刻晴面板图】 上传角色面板图'
|
||||
})
|
||||
app.reg('del-profile', delProflie, {
|
||||
rule: /^#?\s*(?:喵喵)?(?:移除|清除|删除)(.+)(?:面板图)(\d){1,}\s*$/,
|
||||
app.reg('del-profile', delProfileImg, {
|
||||
rule: /^#?\s*(?:移除|清除|删除)(.+)(?:面板图)(\d){1,}\s*$/,
|
||||
describe: '【#删除刻晴面板图1】 删除指定角色面板图(序号)'
|
||||
})
|
||||
app.reg('profile-list', proflieList, {
|
||||
rule: /^#?\s*(?:喵喵)?(.+)(?:面板图列表)\s*$/,
|
||||
app.reg('profile-img-list', profileImgList, {
|
||||
rule: /^#?\s*(.+)(?:面板图列表)\s*$/,
|
||||
describe: '【#刻晴面板图列表】 删除指定角色面板图(序号)'
|
||||
})
|
||||
app.reg('del-uidflie', delUidProfile, {
|
||||
rule: /^#?\s*(?:喵喵)?(?:移除|清除|删除)面板数据$/,
|
||||
/**
|
||||
app.reg('del-uidflie', delProfile, {
|
||||
rule: /^#?\s*(?:移除|清除|删除)面板数据$/,
|
||||
describe: '【#删除面板数据】 删除面板数据'
|
||||
})
|
||||
*/
|
||||
|
||||
export default app
|
||||
export async function delUidProfile(e){
|
||||
|
||||
export async function delProfile (e) {
|
||||
let uid = await getTargetUid(e)
|
||||
if (!uid) {
|
||||
return true
|
||||
}
|
||||
if(Data.delfile(`data/UserData/${uid}.json`)){
|
||||
if (Data.delfile(`data/UserData/${uid}.json`)) {
|
||||
e.reply(`uid:${uid}缓存面板数据已删除~`)
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
|
||||
// 查看当前角色
|
||||
export async function profileDetail(e) {
|
||||
export async function profileDetail (e) {
|
||||
let msg = e.original_msg || e.msg
|
||||
if (!msg) {
|
||||
return false
|
||||
|
@ -27,23 +27,32 @@ export default class MysApi {
|
||||
}
|
||||
|
||||
static async initUser (e, auth = 'all') {
|
||||
if (!e.runtime) {
|
||||
let { runtime } = e
|
||||
if (!runtime) {
|
||||
Version.runtime()
|
||||
return false
|
||||
}
|
||||
let uid = e.runtime.uid
|
||||
if (e.at) {
|
||||
// 暂时使用MysApi.init替代
|
||||
let mys = await MysApi.init(e, auth)
|
||||
if (!mys) {
|
||||
return false
|
||||
let uid
|
||||
if (runtime.getUid) {
|
||||
uid = await runtime.getUid()
|
||||
} else {
|
||||
// 兼容处理老版本Yunzai
|
||||
uid = runtime.uid || e.uid
|
||||
if (e.at) {
|
||||
// 暂时使用MysApi.init替代
|
||||
let mys = await MysApi.init(e, auth)
|
||||
if (!mys) {
|
||||
return false
|
||||
}
|
||||
uid = mys.uid || uid
|
||||
}
|
||||
uid = mys.uid || uid
|
||||
}
|
||||
if (uid) {
|
||||
return new User({ id: e.user_id, uid })
|
||||
} else {
|
||||
e.reply('请先#绑定uid')
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
get isSelfCookie () {
|
||||
|
@ -1,22 +1,22 @@
|
||||
export const details = [{
|
||||
title: '开E后首段普攻',
|
||||
params: { pyro: false,cryo:false},
|
||||
params: { pyro: false, cryo: false },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a['一段伤害'], 'a')
|
||||
},{
|
||||
}, {
|
||||
title: '开E后重击',
|
||||
params: { pyro: false,cryo:false},
|
||||
params: { pyro: false, cryo: false },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a['重击伤害'], 'a2')
|
||||
}, {
|
||||
title: '开E满染火首段普攻',
|
||||
params: { pyro: true,cryo:false},
|
||||
params: { pyro: true, cryo: false },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a['一段伤害'], 'a')
|
||||
}, {
|
||||
title: '开E满染火染冰首段普攻',
|
||||
params: { pyro: true,cryo:true},
|
||||
params: { pyro: true, cryo: true },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.a['一段伤害'], 'a')
|
||||
}, {
|
||||
title: '狂言·式乐五番',
|
||||
params: { pyro: true,cryo:true},
|
||||
title: 'Q伤害',
|
||||
params: { pyro: true, cryo: true },
|
||||
dmg: ({ talent }, dmg) => dmg(talent.q['技能伤害'], 'q')
|
||||
}]
|
||||
|
||||
@ -33,7 +33,7 @@ export const buffs = [{
|
||||
title: '天赋拾玉得花:火元素攻击力提升30%,冰元素暴击率提升20%',
|
||||
data: {
|
||||
atkPct: ({ params }) => params.pyro ? 30 : 0,
|
||||
cpct: ({ params }) => params.cryo ? 20 : 0,
|
||||
cpct: ({ params }) => params.cryo ? 20 : 0
|
||||
}
|
||||
}, {
|
||||
title: '二番·箙岛月白浪:至多使狂言·式乐五番造成的伤害提升200%',
|
||||
|
Loading…
Reference in New Issue
Block a user