fix:gachalog

This commit is contained in:
bietiaop 2024-07-11 15:05:24 +08:00
parent 25dd6b012a
commit d8ea18a9d5
7 changed files with 27 additions and 13 deletions

View file

@ -13,7 +13,7 @@ export class Card extends ZZZPlugin {
priority: 100, priority: 100,
rule: [ rule: [
{ {
reg: `${rulePrefix}card$`, reg: `${rulePrefix}(card|卡片|个人信息)$`,
fnc: 'card', fnc: 'card',
}, },
], ],

View file

@ -23,7 +23,7 @@ export class GachaLog extends ZZZPlugin {
fnc: 'startGachaLog', fnc: 'startGachaLog',
}, },
{ {
reg: `${rulePrefix}刷新抽卡链接$`, reg: `${rulePrefix}刷新抽卡(链接|记录)$`,
fnc: 'refreshGachaLog', fnc: 'refreshGachaLog',
}, },
{ {

View file

@ -13,7 +13,7 @@ export class Note extends ZZZPlugin {
priority: 100, priority: 100,
rule: [ rule: [
{ {
reg: `${rulePrefix}note$`, reg: `${rulePrefix}(note|每日|体力|便笺|便签)$`,
fnc: 'note', fnc: 'note',
}, },
], ],

View file

@ -136,6 +136,13 @@ const RANK_MAP = {
2: 'B', 2: 'B',
}; };
const HOMO_TAG = ['非到极致', '运气不好', '平稳保底', '小欧一把', '欧狗在此']; const HOMO_TAG = ['非到极致', '运气不好', '平稳保底', '小欧一把', '欧狗在此'];
const EMOJI = [
[4, 8, 13],
[1, 10, 5],
[16, 15, 2],
[12, 3, 9],
[6, 14, 7],
];
const NORMAL_LIST = [ const NORMAL_LIST = [
'「11号」', '「11号」',
'猫又', '猫又',
@ -194,7 +201,6 @@ export async function anaylizeGachaLog(uid) {
const list = []; const list = [];
let lastFive = null; let lastFive = null;
let preIndex = 0; let preIndex = 0;
let luck = 0;
let i = 0; let i = 0;
for (const item of data) { for (const item of data) {
let isUp = true; let isUp = true;
@ -218,7 +224,7 @@ export async function anaylizeGachaLog(uid) {
preIndex = i; preIndex = i;
} }
if (i === data.length - 1 && list.length > 0) { if (i === data.length - 1 && list.length > 0) {
list[list.length - 1]['totalCount'] = i - preIndex; list[list.length - 1]['totalCount'] = i - preIndex + 1;
} }
i++; i++;
} }
@ -239,18 +245,21 @@ export async function anaylizeGachaLog(uid) {
if (totalCount > 0) lastFive = totalCount; if (totalCount > 0) lastFive = totalCount;
else lastFive = '-'; else lastFive = '-';
} }
if (avgUp !== "-") { if (avgUp !== '-') {
if ("音擎频段" === name) { if ('音擎频段' === name) {
level = getLevelFromList(avgUp, [62, 75, 88, 99, 111]); level = getLevelFromList(avgUp, [62, 75, 88, 99, 111]);
} else if ("邦布频段" === name) { } else if ('邦布频段' === name) {
level = getLevelFromList(avgUp, [51, 55, 61, 68, 70]); level = getLevelFromList(avgUp, [51, 55, 61, 68, 70]);
} else if ("独家频段" === name) { } else if ('独家频段' === name) {
level = getLevelFromList(avgUp, [74, 87, 99, 105, 120]); level = getLevelFromList(avgUp, [74, 87, 99, 105, 120]);
} else if ("常驻频段" === name) { } else if ('常驻频段' === name) {
level = getLevelFromList(avgUp, [53, 60, 68, 73, 75]); level = getLevelFromList(avgUp, [53, 60, 68, 73, 75]);
} }
} }
let tag = HOMO_TAG[level]; const tag = HOMO_TAG[level];
const emojis = EMOJI[level];
// 随机选取一个
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
result.push({ result.push({
name, name,
timeRange, timeRange,
@ -263,6 +272,7 @@ export async function anaylizeGachaLog(uid) {
avgUp, avgUp,
level, level,
tag, tag,
emoji,
}); });
} }
return result; return result;

View file

@ -64,6 +64,7 @@ export class SingleGachaLog {
async get_assets() { async get_assets() {
if (this.item_type === '音擎') { if (this.item_type === '音擎') {
const result = await getWeaponImage(this.item_id); const result = await getWeaponImage(this.item_id);
logger.debug('音擎result', result);
this.square_icon = result; this.square_icon = result;
} else if (this.item_type === '邦布') { } else if (this.item_type === '邦布') {
const result = await getSquareBangboo(this.item_id); const result = await getSquareBangboo(this.item_id);

View file

@ -30,11 +30,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="comment e1"> <div class="comment e{{item.emoji}}">
<div class="icon"></div> <div class="icon"></div>
<div class="label">{{item.tag}}</div> <div class="label">{{item.tag}}</div>
</div> </div>
</div> </div>
{{if item.list.length === 0}}
<div style="margin: 1em auto; text-align: center;">暂无数据</div>
{{/if}}
<div class="list"> <div class="list">
{{each item.list inv j}} {{each item.list inv j}}
<div class="item rankS {{inv.isUp && 'up'}}"> <div class="item rankS {{inv.isUp && 'up'}}">

View file

@ -16,7 +16,7 @@ export async function checkLatency(url) {
}); });
}) })
.on('error', err => { .on('error', err => {
logger.mark(`Error checking ${url}:`, err.message); logger.debug(`下载节点 ${url} 连接失败:`, err.message);
resolve({ url, latency: Infinity }); resolve({ url, latency: Infinity });
}); });
}); });