2023-03-04 14:30:13 +08:00
|
|
|
|
import plugin from '../../../lib/plugins/plugin.js'
|
|
|
|
|
import Calculator from '../model/calculator.js'
|
|
|
|
|
import Blueprint from '../model/blueprint.js'
|
|
|
|
|
import puppeteer from '../../../lib/puppeteer/puppeteer.js'
|
|
|
|
|
import gsCfg from '../model/gsCfg.js'
|
|
|
|
|
|
|
|
|
|
export class calculator extends plugin {
|
2023-11-08 03:03:36 +08:00
|
|
|
|
constructor () {
|
2023-03-04 14:30:13 +08:00
|
|
|
|
super({
|
|
|
|
|
name: '养成计算',
|
|
|
|
|
dsc: '角色养成材料计算器',
|
|
|
|
|
event: 'message',
|
|
|
|
|
priority: 700,
|
|
|
|
|
rule: [
|
|
|
|
|
{
|
2023-07-26 05:08:48 +08:00
|
|
|
|
reg: '^#*(星铁)?(.*)(养成|计算)([0-9]|,|,| )*$',
|
2023-03-04 14:30:13 +08:00
|
|
|
|
fnc: 'Calculator'
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-07-26 05:08:48 +08:00
|
|
|
|
reg: '^#*(星铁)?角色(养成|计算|养成计算)$',
|
2023-03-04 14:30:13 +08:00
|
|
|
|
fnc: 'calculatorHelp'
|
|
|
|
|
},
|
2023-07-26 05:08:48 +08:00
|
|
|
|
{
|
|
|
|
|
reg: '^#*尘歌壶模数(养成|计算|养成计算)$',
|
|
|
|
|
fnc: 'blueprintHelp'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
reg: '^#*尘歌壶(模数|养成|养成计算)(\\d{10,15})$',
|
|
|
|
|
fnc: 'Blueprint'
|
|
|
|
|
},
|
2023-03-04 14:30:13 +08:00
|
|
|
|
]
|
|
|
|
|
})
|
2023-07-26 05:08:48 +08:00
|
|
|
|
this._path = process.cwd().replace(/\\/g, '/')
|
2023-03-04 14:30:13 +08:00
|
|
|
|
}
|
2023-11-08 03:03:36 +08:00
|
|
|
|
|
|
|
|
|
async blueprintHelp (e) {
|
2023-03-04 14:30:13 +08:00
|
|
|
|
let msg = '#尘歌壶模数\n指令:#尘歌壶模数\n示例:#尘歌壶模数123456\n参数为模数id(10-15位数字)'
|
|
|
|
|
await e.reply(msg)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2023-07-26 05:08:48 +08:00
|
|
|
|
|
2023-11-08 03:03:36 +08:00
|
|
|
|
async calculatorHelp (e) {
|
2023-07-26 05:08:48 +08:00
|
|
|
|
let msg = `角色养成计算\n指令:${e.isSr ? '*克拉拉养成\n示例:*克拉拉养成75 80 6 9 9 9\n参数为角色、武器、普攻、战技、终结技、天赋' : '#刻晴养成\n示例:#刻晴养成81 90 9 9 9\n参数为角色、武器、技能等级'}`
|
2023-03-04 14:30:13 +08:00
|
|
|
|
await e.reply(msg)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2023-11-08 03:03:36 +08:00
|
|
|
|
|
|
|
|
|
async Blueprint () {
|
|
|
|
|
let role = this.e.msg.replace(/#/, '').match(/\d+/g)
|
2023-07-26 05:08:48 +08:00
|
|
|
|
let data = await new Blueprint(this.e).get(role)
|
|
|
|
|
if (!data) return
|
|
|
|
|
|
|
|
|
|
/** 生成图片 */
|
|
|
|
|
let img = await puppeteer.screenshot('Blueprint', data)
|
|
|
|
|
if (img) await this.reply(img)
|
2023-03-04 14:30:13 +08:00
|
|
|
|
}
|
2023-11-08 03:03:36 +08:00
|
|
|
|
|
2023-03-04 14:30:13 +08:00
|
|
|
|
/** #刻晴养成 */
|
2023-11-08 03:03:36 +08:00
|
|
|
|
async Calculator () {
|
2023-07-26 05:08:48 +08:00
|
|
|
|
let role = gsCfg.getRole(this.e.msg, '#|#|星铁|养成|计算|[0-9]|,|,| ', this.e.isSr)
|
2023-03-04 14:30:13 +08:00
|
|
|
|
if (!role) return false
|
|
|
|
|
|
|
|
|
|
if ([10000005, 10000007, 20000000].includes(Number(role.roleId))) {
|
|
|
|
|
await this.e.reply('暂不支持旅行者养成计算')
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let data = await new Calculator(this.e).get(role)
|
|
|
|
|
if (!data) return
|
|
|
|
|
|
2023-11-08 03:03:36 +08:00
|
|
|
|
this.renderImg('genshin', `html/calculator/calculator-${data.game}`, data)
|
2023-03-04 14:30:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|