!142 云崽名从package读取&计算宝箱总数&add:星琼预估

Merge pull request !142 from 小花花花儿/master
This commit is contained in:
Kokomi 2024-01-30 20:06:59 +00:00 committed by Gitee
commit 4cc582cc40
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 86 additions and 64 deletions

View File

@ -27,8 +27,8 @@ export class mysNews extends plugin {
fnc: 'mysUrl' fnc: 'mysUrl'
}, },
{ {
reg: '^#*原(石|神)(预估|盘点)$', reg: '^#*原(石|神)|星(琼|铁)(预估|盘点)$',
fnc: 'ysEstimate' fnc: 'mysEstimate'
}, },
{ {
reg: '^#*(星铁|原神|崩坏三|崩三|绝区零|崩坏二|崩二|崩坏学园二|未定|未定事件簿)?(开启|关闭)(公告|资讯)推送$', reg: '^#*(星铁|原神|崩坏三|崩三|绝区零|崩坏二|崩二|崩坏学园二|未定|未定事件簿)?(开启|关闭)(公告|资讯)推送$',
@ -84,8 +84,11 @@ export class mysNews extends plugin {
await this.reply(data) await this.reply(data)
} }
async ysEstimate() { async mysEstimate() {
let data = await new MysNews(this.e).ysEstimate() let args = ['版本原石', 218945821]
if (/星(琼|铁)/.test(this.e.msg))
args = ['可获取星琼', 73779489]
let data = await new MysNews(this.e).mysEstimate(...args)
if (!data) return if (!data) return
await this.reply(data) await this.reply(data)
} }

View File

@ -7,9 +7,6 @@ avatar: 79
# 等级 # 等级
level: 60 level: 60
# 总宝箱
all_chest: 6044
# 奇馈宝箱 # 奇馈宝箱
magic_chest: 221 magic_chest: 221

View File

@ -1,5 +1,6 @@
import fs from 'node:fs' import fs from 'node:fs'
import _ from 'lodash' import _ from 'lodash'
import cfg from '../../../lib/config/config.js'
import { Common, Version } from '#miao' import { Common, Version } from '#miao'
import { Character } from '#miao.models' import { Character } from '#miao.models'
@ -31,10 +32,21 @@ export default class base {
*/ */
get screenData() { get screenData() {
const layoutPath = process.cwd() + '/plugins/genshin/resources/html/layout/' const layoutPath = process.cwd() + '/plugins/genshin/resources/html/layout/'
let yunzaiName = cfg.package.name
if (yunzaiName == 'miao-yunzai') {
yunzaiName = 'Miao-Yunzai'
} else if (yunzaiName == 'yunzai') {
yunzaiName = 'Yunzai-Bot'
} else if (yunzaiName == 'trss-yunzai') {
yunzaiName = 'TRSS-Yunzai'
} else {
yunzaiName = _.capitalize(yunzaiName)
}
let data = { let data = {
saveId: this.userId, saveId: this.userId,
cwd: this._path, cwd: this._path,
yzVersion: `v${Version.yunzai}`, yzVersion: `v${Version.yunzai}`,
yzName: yunzaiName,
genshinLayout: layoutPath + 'genshin.html', genshinLayout: layoutPath + 'genshin.html',
defaultLayout: layoutPath + 'default.html' defaultLayout: layoutPath + 'default.html'
} }

View File

@ -63,14 +63,23 @@ export default class ExportLog extends base {
if (!this.uid) return false if (!this.uid) return false
let list = this.getAllList().list let list = this.getAllList().list
let yunzaiName = cfg.package.name
if (yunzaiName == 'miao-yunzai') {
yunzaiName = 'Miao-Yunzai'
} else if (yunzaiName == 'yunzai') {
yunzaiName = 'Yunzai-Bot'
} else if (yunzaiName == 'trss-yunzai') {
yunzaiName = 'TRSS-Yunzai'
} else {
yunzaiName = _.capitalize(yunzaiName)
}
let data = { let data = {
info: { info: {
uid: this.uid, uid: this.uid,
lang: list[0].lang, lang: list[0].lang,
export_time: moment().format('YYYY-MM-DD HH:mm:ss'), export_time: moment().format('YYYY-MM-DD HH:mm:ss'),
export_timestamp: moment().format('X'), export_timestamp: moment().format('X'),
export_app: 'Miao-Yunzai', export_app: yunzaiName,
export_app_version: cfg.package.version, export_app_version: cfg.package.version,
}, },
list list

View File

@ -93,6 +93,9 @@ export default class MysNews extends base {
case 'searchPosts': case 'searchPosts':
host = 'https://bbs-api.miyoushe.com/post/wapi/searchPosts?' host = 'https://bbs-api.miyoushe.com/post/wapi/searchPosts?'
break break
case 'userInstantSearchPosts':
host = 'https://bbs-api.miyoushe.com/painter/api/user_instant/search/list?'
break
// 帖子详情 // 帖子详情
case 'getPostFull': case 'getPostFull':
host += 'post/wapi/getPostFull?' host += 'post/wapi/getPostFull?'
@ -243,21 +246,14 @@ export default class MysNews extends base {
return this.replyMsg(img, `${param.data.post.subject}`) return this.replyMsg(img, `${param.data.post.subject}`)
} }
async ysEstimate() { async mysEstimate(keyword, uid) {
let msg = '版本原石盘点' let res = await this.postData('userInstantSearchPosts', { keyword, uid, size: 20, offset: 0, sort_type: 2 })
let res = await this.postData('searchPosts', { gids: 2, size: 20, keyword: msg }) let postList = res?.data?.list
if (res?.data?.posts.length <= 0) { if (postList.length <= 0) {
await this.e.reply('暂无数据') await this.e.reply('暂无数据')
return false return false
} }
let postId = '' let postId = postList[0].post.post.post_id
for (let post of res.data.posts) {
if (post.user.uid == '218945821') {
postId = post.post.post_id
break
}
}
if (!postId) { if (!postId) {
await this.e.reply('暂无数据') await this.e.reply('暂无数据')
return false return false

View File

@ -29,6 +29,11 @@ export default class RoleIndex extends base {
枫丹: 9 枫丹: 9
} }
this.all_chest = 0
lodash.forEach(this.lable, (v, i) => {
if (i.includes('_chest')) this.all_chest += v
})
this.areaName = lodash.invert(this.area) this.areaName = lodash.invert(this.area)
this.headIndexStyle = `<style> .head_box { background: url(${this.screenData.pluResPath}img/roleIndex/namecard/${lodash.random(1, 8)}.png) #f5f5f5; background-position-x: 30px; background-repeat: no-repeat; border-radius: 15px; font-family: tttgbnumber; padding: 10px 20px; position: relative; background-size: auto 101%; }</style>` this.headIndexStyle = `<style> .head_box { background: url(${this.screenData.pluResPath}img/roleIndex/namecard/${lodash.random(1, 8)}.png) #f5f5f5; background-position-x: 30px; background-repeat: no-repeat; border-radius: 15px; font-family: tttgbnumber; padding: 10px 20px; position: relative; background-size: auto 101%; }</style>`
@ -121,7 +126,7 @@ export default class RoleIndex extends base {
stats.exquisite_chest_number + stats.exquisite_chest_number +
stats.common_chest_number + stats.common_chest_number +
stats.magic_chest_number) / stats.magic_chest_number) /
this.lable.all_chest) * this.all_chest) *
100, 100,
1 1
) )
@ -150,7 +155,7 @@ export default class RoleIndex extends base {
stats.exquisite_chest_number + stats.exquisite_chest_number +
stats.common_chest_number + stats.common_chest_number +
stats.magic_chest_number, stats.magic_chest_number,
extra: this.lable.all_chest extra: this.all_chest
}, },
{ {
@ -457,7 +462,7 @@ export default class RoleIndex extends base {
stats.common_chest_number + stats.common_chest_number +
stats.magic_chest_number) * stats.magic_chest_number) *
100) / 100) /
this.lable.all_chest, this.all_chest,
2 2
) )
@ -492,7 +497,7 @@ export default class RoleIndex extends base {
stats.exquisite_chest_number + stats.exquisite_chest_number +
stats.common_chest_number + stats.common_chest_number +
stats.magic_chest_number, stats.magic_chest_number,
extra: this.lable.all_chest extra: this.all_chest
}, },
{ {
lable: '宝箱获取率', lable: '宝箱获取率',

View File

@ -42,7 +42,7 @@
</div> </div>
</div> </div>
<div class="logo">详情内容使用【#{{game}}{{typeName}}】加上序号查看,如【#{{game}}{{typeName}}2】</div> <div class="logo">详情内容使用【#{{game}}{{typeName}}】加上序号查看,如【#{{game}}{{typeName}}2】</div>
<div class="logo">Created By Miao-Yunzai</div> <div class="logo">Created By {{yzName}}</div>
</div> </div>
</div> </div>
</body> </body>

View File

@ -120,7 +120,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="logo">Created By Miao-Yunzai</div> --> <!-- <div class="logo">Created By {{yzName}}</div> -->
</div> </div>
</body> </body>
<script type="text/javascript" src="{{pluResPath.replace('StarRail/', '')}}script/qrcode.min.js"></script> <script type="text/javascript" src="{{pluResPath.replace('StarRail/', '')}}script/qrcode.min.js"></script>

View File

@ -77,7 +77,7 @@
<li><span>#删除无效用户</span>: 删除当前所有请求失效的用户的CK数据暂不会删除公共CK</li> <li><span>#删除无效用户</span>: 删除当前所有请求失效的用户的CK数据暂不会删除公共CK</li>
</ul> </ul>
</div> </div>
<div class="copyright">Created By Miao-Yunzai</div> <div class="copyright">Created By {{yzName}}</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -77,7 +77,7 @@
</div> </div>
</div> </div>
<div class="logo">Created By Miao-Yunzai</div> <div class="logo">Created By {{yzName}}</div>
</div> </div>
</body> </body>

View File

@ -115,7 +115,7 @@
<div class="logo">左下角为使用次数,仅展示已有行动牌</div> <div class="logo">左下角为使用次数,仅展示已有行动牌</div>
</div> </div>
{{/if}} {{/if}}
<div class="logo">Created By Miao-Yunzai</div> <div class="logo">Created By {{yzName}}</div>
</div> </div>
</body> </body>

View File

@ -50,7 +50,7 @@
</div> </div>
</div> </div>
{{/each}} {{/each}}
<div class="logo">Created By Miao-Yunzai</div> <div class="logo">Created By {{yzName}}</div>
</div> </div>
</body> </body>

View File

@ -18,7 +18,7 @@
<body class="body_box"> <body class="body_box">
<div class="container" id="container"> <div class="container" id="container">
{{block 'main'}}{{/block}} {{block 'main'}}{{/block}}
<div class="logo">Created By Miao-Yunzai {{yzVersion}}</div> <div class="logo">Created By {{yzName}} {{yzVersion}}</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -42,7 +42,7 @@
</div> </div>
</div> </div>
<div class="logo">详情内容使用【#{{game}}{{typeName}}】加上序号查看,如【#{{game}}{{typeName}}2】</div> <div class="logo">详情内容使用【#{{game}}{{typeName}}】加上序号查看,如【#{{game}}{{typeName}}2】</div>
<div class="logo">Created By Miao-Yunzai</div> <div class="logo">Created By {{yzName}}</div>
</div> </div>
</div> </div>
</body> </body>

View File

@ -120,7 +120,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="logo">Created By Miao-Yunzai</div> --> <!-- <div class="logo">Created By {{yzName}}</div> -->
</div> </div>
</body> </body>
<script type="text/javascript" src="{{pluResPath}}script/qrcode.min.js"></script> <script type="text/javascript" src="{{pluResPath}}script/qrcode.min.js"></script>

View File

@ -52,7 +52,7 @@
<div class="tab_lable">详细统计</div> <div class="tab_lable">详细统计</div>
<div id="chartContainer2"></div> <div id="chartContainer2"></div>
</div> </div>
<div class="logo">Created By Miao-Yunzai & seven-plugin</div> <div class="logo">Created By {{yzName}} & seven-plugin</div>
</div> </div>
</body> </body>