Fix bugs
- delay constellation check - unchecked string after convert - wish tally eulapull/1/head
parent
084fa3e37c
commit
d21df64719
|
@ -11,6 +11,8 @@ localforage.config({
|
||||||
description: 'paimonmoe local storage',
|
description: 'paimonmoe local storage',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.localforage = localforage;
|
||||||
|
|
||||||
startClient();
|
startClient();
|
||||||
|
|
||||||
sapper.start({
|
sapper.start({
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
|
|
||||||
async function useRemoteData() {
|
async function useRemoteData() {
|
||||||
// check if old local storage version
|
// check if old local storage version
|
||||||
if (remoteSave['converted'] === undefined) {
|
if (!remoteSave['converted'] === undefined) {
|
||||||
for (const key in remoteSave) {
|
for (const key in remoteSave) {
|
||||||
if (key.endsWith('ar') || key.endsWith('wl')) {
|
if (key.endsWith('ar') || key.endsWith('wl')) {
|
||||||
await updateSave(key, Number(remoteSave[key]), true);
|
await updateSave(key, Number(remoteSave[key]), true);
|
||||||
|
@ -109,7 +109,8 @@
|
||||||
key.endsWith('accounts') ||
|
key.endsWith('accounts') ||
|
||||||
key.endsWith('locale') ||
|
key.endsWith('locale') ||
|
||||||
key.endsWith('server') ||
|
key.endsWith('server') ||
|
||||||
key.endsWith('update-time')
|
key.endsWith('update-time') ||
|
||||||
|
key.endsWith('converted')
|
||||||
) {
|
) {
|
||||||
await updateSave(key, remoteSave[key], true);
|
await updateSave(key, remoteSave[key], true);
|
||||||
} else if (
|
} else if (
|
||||||
|
@ -126,8 +127,35 @@
|
||||||
}
|
}
|
||||||
console.log('finished convert from google drive');
|
console.log('finished convert from google drive');
|
||||||
} else {
|
} else {
|
||||||
for (const k in remoteSave) {
|
for (const key in remoteSave) {
|
||||||
await updateSave(k, remoteSave[k], true);
|
if (typeof remoteSave[key] === 'string') {
|
||||||
|
console.log('converting', key);
|
||||||
|
if (key.endsWith('ar') || key.endsWith('wl')) {
|
||||||
|
await updateSave(key, Number(remoteSave[key]), true);
|
||||||
|
} else if (key.endsWith('collectables-updated')) {
|
||||||
|
await updateSave(key, remoteSave[key] === 'true', true);
|
||||||
|
} else if (
|
||||||
|
key.endsWith('accounts') ||
|
||||||
|
key.endsWith('locale') ||
|
||||||
|
key.endsWith('server') ||
|
||||||
|
key.endsWith('update-time') ||
|
||||||
|
key.endsWith('converted')
|
||||||
|
) {
|
||||||
|
await updateSave(key, remoteSave[key], true);
|
||||||
|
} else if (
|
||||||
|
key.endsWith('wish-counter-character-event') ||
|
||||||
|
key.endsWith('wish-counter-weapon-event') ||
|
||||||
|
key.endsWith('wish-counter-standard') ||
|
||||||
|
key.endsWith('wish-counter-beginners')
|
||||||
|
) {
|
||||||
|
const converted = convertTime(JSON.parse(remoteSave[key]));
|
||||||
|
await updateSave(key, converted, true);
|
||||||
|
} else {
|
||||||
|
await updateSave(key, JSON.parse(remoteSave[key]), true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await updateSave(key, remoteSave[key], true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
let unsubscribeWl = null;
|
let unsubscribeWl = null;
|
||||||
let firstLoad = true;
|
let firstLoad = true;
|
||||||
|
|
||||||
$: if ($fromRemote) {
|
// $: if ($fromRemote) {
|
||||||
readLocalData();
|
// readLocalData();
|
||||||
}
|
// }
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await readLocalData();
|
await readLocalData();
|
||||||
|
|
|
@ -142,6 +142,7 @@ export const banners = {
|
||||||
start: '2021-05-18 18:00:00',
|
start: '2021-05-18 18:00:00',
|
||||||
end: '2021-06-08 15:00:00',
|
end: '2021-06-08 15:00:00',
|
||||||
color: '#A6D6E0',
|
color: '#A6D6E0',
|
||||||
|
featuredRare: ['xingqiu', 'beidou', 'xinyan'],
|
||||||
featured: ['eula'],
|
featured: ['eula'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
await tick();
|
await tick();
|
||||||
dispatch('done');
|
dispatch('done');
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="bg-item rounded-xl p-4 flex flex-col">
|
<div class="bg-item rounded-xl p-4 flex flex-col">
|
||||||
|
@ -68,20 +69,20 @@
|
||||||
{#each Object.entries(featured) as [_, item], i}
|
{#each Object.entries(featured) as [_, item], i}
|
||||||
<div
|
<div
|
||||||
class="flex flex-col pt-2"
|
class="flex flex-col pt-2"
|
||||||
style="background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.75) 27%, rgba(0,0,0,0.75) 70%, rgba(0,0,0,0) 100%);
|
style="background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.75) 17%, rgba(0,0,0,0.75) 70%, rgba(0,0,0,0) 100%);
|
||||||
{i ===
|
{i === 0 ? 'margin-right: 20%;' : ''}"
|
||||||
0
|
|
||||||
? 'margin-right: 20%;'
|
|
||||||
: ''}"
|
|
||||||
>
|
>
|
||||||
<h3 class="text-3xl ml-4 font-black leading-6">
|
<h3 class="text-3xl ml-6 font-black leading-6">
|
||||||
{#if loading}
|
{#if loading}
|
||||||
<Icon path={mdiLoading} spin size={0.8} />
|
<Icon path={mdiLoading} spin size={0.8} />
|
||||||
{:else}
|
{:else}
|
||||||
{item.count}
|
{item.count}
|
||||||
{/if}
|
{/if}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="ml-4 font-sm leading-2">{$t(`home.banner.featured.${i}`)}</p>
|
<p class="ml-6 font-sm leading-2">
|
||||||
|
<span class="font-semibold">{$t(`home.banner.featured.${i}`)}</span>
|
||||||
|
{$t('home.banner.summoned')}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,7 +97,7 @@
|
||||||
<p class="text-white leading-4">{$t('home.banner.avg')} <span class="font-semibold">{item.average}</span></p>
|
<p class="text-white leading-4">{$t('home.banner.avg')} <span class="font-semibold">{item.average}</span></p>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<p class="text-gray-400 pl-2 mt-1">※ {$t('home.banner.subtitle', { values: { user }})}</p>
|
<p class="text-gray-400 pl-2 mt-1">※ {$t('home.banner.subtitle', { values: { user } })}</p>
|
||||||
<a
|
<a
|
||||||
href="/wish/tally"
|
href="/wish/tally"
|
||||||
class="flex justify-end items-center self-end lg:self-start text-white mt-4 bg-background-secondary rounded-xl py-2 px-4
|
class="flex justify-end items-center self-end lg:self-start text-white mt-4 bg-background-secondary rounded-xl py-2 px-4
|
||||||
|
|
|
@ -179,9 +179,14 @@
|
||||||
console.log('wish read local');
|
console.log('wish read local');
|
||||||
const prefix = getAccountPrefix();
|
const prefix = getAccountPrefix();
|
||||||
const data = await readSave(`${prefix}${path}`);
|
const data = await readSave(`${prefix}${path}`);
|
||||||
console.log(data);
|
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
const counterData = data;
|
let counterData = data;
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
counterData = JSON.parse(data);
|
||||||
|
await updateSave(`${prefix}${path}`, JSON.parse(data), true);
|
||||||
|
}
|
||||||
|
|
||||||
total = counterData.total;
|
total = counterData.total;
|
||||||
legendary = counterData.legendary;
|
legendary = counterData.legendary;
|
||||||
rare = counterData.rare;
|
rare = counterData.rare;
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if ($updateTime) {
|
$: if ($updateTime) {
|
||||||
|
setTimeout(() => {
|
||||||
readLocalData();
|
readLocalData();
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
const rareInclude = {
|
const rareInclude = {
|
||||||
300011: ['rosaria'],
|
300011: ['rosaria'],
|
||||||
300012: ['yanfei', 'noelle', 'diona'],
|
300012: ['yanfei', 'noelle', 'diona'],
|
||||||
|
300013: ['xingqiu', 'beidou', 'xinyan'],
|
||||||
};
|
};
|
||||||
let promotedRarePercentage = 0;
|
let promotedRarePercentage = 0;
|
||||||
|
|
||||||
|
@ -175,7 +176,7 @@
|
||||||
if (id > 300011 && id < 400000) {
|
if (id > 300011 && id < 400000) {
|
||||||
const totalRare = data.list.reduce(
|
const totalRare = data.list.reduce(
|
||||||
(prev, current) => {
|
(prev, current) => {
|
||||||
if (rareInclude[id].includes(current.name)) {
|
if (banner.featuredRare.includes(current.name)) {
|
||||||
prev.total += current.count;
|
prev.total += current.count;
|
||||||
}
|
}
|
||||||
if (featured[1] === current.name) {
|
if (featured[1] === current.name) {
|
||||||
|
@ -289,11 +290,11 @@
|
||||||
|
|
||||||
<div class="flex flex-col bg-item rounded-xl px-4 pt-4 pb-2 mb-4 space-y-4">
|
<div class="flex flex-col bg-item rounded-xl px-4 pt-4 pb-2 mb-4 space-y-4">
|
||||||
<div class="flex flex-col xl:flex-row">
|
<div class="flex flex-col xl:flex-row">
|
||||||
<a href="/wish/tally/{id}">
|
<a href="/wish/tally/{id}" class="xl:mr-4">
|
||||||
<img
|
<img
|
||||||
src="/images/banners/{banner.name} {banner.image}.png"
|
src="/images/banners/{banner.name} {banner.image}.png"
|
||||||
alt={banner.name}
|
alt={banner.name}
|
||||||
class="rounded-xl xl:h-64 xl:mr-4"
|
class="rounded-xl xl:h-64 w-auto"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div class="h-4 xl:h-0" />
|
<div class="h-4 xl:h-0" />
|
||||||
|
|
|
@ -129,6 +129,7 @@ export const getLocalSaveJson = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateSave = async (key, data, isFromRemote) => {
|
export const updateSave = async (key, data, isFromRemote) => {
|
||||||
|
console.log('updateSave', key, isFromRemote);
|
||||||
if (!isFromRemote) {
|
if (!isFromRemote) {
|
||||||
localModified.set(true);
|
localModified.set(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue