Check banner if exists

pull/1/head
Made Baruna 2022-07-01 19:03:33 +07:00
parent b438f5fbaf
commit 3ae3ae995c
1 changed files with 17 additions and 12 deletions

View File

@ -411,7 +411,7 @@
const path = `wish-counter-${type.id}`; const path = `wish-counter-${type.id}`;
const localData = await readSave(`${prefix}${path}`); const localData = await readSave(`${prefix}${path}`);
const withRate = type.id === 'character-event' || type.id === 'weapon-event'; let withRate = type.id === 'character-event' || type.id === 'weapon-event';
let localWishes = []; let localWishes = [];
if (localData !== null) { if (localData !== null) {
@ -465,20 +465,25 @@
rarity = weaponList[combined[i].id].rarity; rarity = weaponList[combined[i].id].rarity;
} }
const unixTime = dayjs(combined[i].time).unix(); try {
if (withRate && (currentSelectedBanner === null || currentSelectedBanner.end < unixTime)) { const unixTime = dayjs(combined[i].time).unix();
lastBannerIndex = currentBannerIndex; if (withRate && (currentSelectedBanner === null || currentSelectedBanner.end < unixTime)) {
lastBannerIndex = currentBannerIndex;
const nextBanner = getNextBanner(unixTime); const nextBanner = getNextBanner(unixTime);
if (nextBanner === undefined) { if (nextBanner === undefined) {
currentBannerIndex = lastBannerIndex; currentBannerIndex = lastBannerIndex;
currentSelectedBanner = lastBanner; currentSelectedBanner = lastBanner;
} else { } else {
currentSelectedBanner = nextBanner.selectedBanner; currentSelectedBanner = nextBanner.selectedBanner;
currentBannerIndex = nextBanner.currentBannerIndex; currentBannerIndex = nextBanner.currentBannerIndex;
lastBanner = currentSelectedBanner; lastBanner = currentSelectedBanner;
}
} }
} catch (err) {
withRate = false;
console.log('ERROR PARSE BANNER', combined[i]);
} }
// guaranteed + winrateoff // guaranteed + winrateoff