diff --git a/apps/panel.js b/apps/panel.js index f6b08d2..519381b 100644 --- a/apps/panel.js +++ b/apps/panel.js @@ -19,6 +19,10 @@ export class Panel extends ZZZPlugin { reg: `${rulePrefix}(.*)面板(.*)$`, fnc: 'handleRule', }, + { + reg: `${rulePrefix}练度(统计)?$`, + fnc: 'proficiency', + }, ], }); } @@ -104,4 +108,24 @@ export class Panel extends ZZZPlugin { }; await render(this.e, 'panel/card.html', finalData); } + async proficiency() { + const uid = await this.getUID(); + if (!uid) return false; + const result = getPanelList(uid); + + result.sort((a, b) => { + return b.proficiency_score - a.proficiency_score; + }); + + result.forEach(item => { + logger.debug(item.proficiency_score, item); + }); + + const finalData = { + count: result?.length || 0, + list: result, + }; + + // await render(this.e, 'panel/proficiency.html', finalData); + } } diff --git a/lib/plugin.js b/lib/plugin.js index 7c1f9db..41cd574 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -29,7 +29,9 @@ export class ZZZPlugin extends plugin { const uid = this.User?.getUid('zzz'); // 如果 UID 不存在,说明没有绑定 cookie if (!uid) { - await this.reply('uid为空,米游社查询请先绑定cookie,其他查询请携带uid'); + await this.reply( + 'uid为空,需要CK的功能请先绑定CK或者#扫码登录,需要SK的功能请#扫码登录,若不清楚需要CK或SK,请查看%帮助' + ); return false; } // 返回 UID @@ -47,7 +49,7 @@ export class ZZZPlugin extends plugin { const ck = await getCk(this.e); // 如果 cookie 不存在或者 cookie 为空,说明没有绑定 cookie if (!ck || Object.keys(ck).filter(k => ck[k].ck).length === 0) { - await this.reply('尚未绑定cookie,请先绑定cookie'); + await this.reply('尚未绑定cookie,请先绑定cookie,或者#扫码登录'); return { api: null, uid: null, deviceFp: null }; } try { diff --git a/model/avatar.js b/model/avatar.js index 9945dd5..b3e717a 100644 --- a/model/avatar.js +++ b/model/avatar.js @@ -438,6 +438,29 @@ export class ZZZAvatarInfo { return false; } + /** @type {number} 练度分数 */ + get proficiency_score() { + let score = 0; + if (this.rarity === 'S') { + score += 30; + } else { + score += 10; + } + if (this.equip_score !== false) { + score += this.equip_score * 3; + } + for (const skill of this.skills) { + score += skill.level * 5; + } + score += this.level * 2; + score += this.rank * 10; + if (this.weapon) { + score += this.weapon.level * 2; + score += this.weapon.star * 10; + } + return score; + } + async get_basic_assets() { const result = await getSquareAvatar(this.id); /** @type {string} */