mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
feat: 添加练度的计算公式
This commit is contained in:
parent
2c745c256e
commit
8a420e8fe1
3 changed files with 51 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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} */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue