mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-03-28 01:00:41 +01:00
Update wish tally
This commit is contained in:
parent
8b749614f9
commit
dbde34de88
11 changed files with 73 additions and 57 deletions
src
components
functions
locales
routes
static/images/home
|
@ -73,11 +73,6 @@
|
|||
let currentBanner = '';
|
||||
let currentPage = 1;
|
||||
|
||||
let lastPull = {
|
||||
id: '0',
|
||||
time: '',
|
||||
};
|
||||
|
||||
function cancel() {
|
||||
fetchController.abort();
|
||||
cancelled = true;
|
||||
|
@ -229,11 +224,6 @@
|
|||
const name = row.name;
|
||||
const type = row.item_type.replace(/ /g, '');
|
||||
|
||||
if (row.id > lastPull.id) {
|
||||
lastPull.id = row.id;
|
||||
lastPull.time = row.time;
|
||||
}
|
||||
|
||||
if (time.unix() <= newestPullTime) {
|
||||
return;
|
||||
}
|
||||
|
@ -409,7 +399,7 @@
|
|||
pushToast($t('wish.import.success'));
|
||||
|
||||
if (wishTallyChecked) {
|
||||
submitWishTally(lastPull);
|
||||
submitWishTally();
|
||||
}
|
||||
|
||||
const prefix = getAccountPrefix();
|
||||
|
|
|
@ -72,6 +72,7 @@ export function process(id) {
|
|||
image,
|
||||
total: 0,
|
||||
legendary: [],
|
||||
pityCount: [],
|
||||
rarePity: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
rare: {
|
||||
character: [],
|
||||
|
@ -97,6 +98,7 @@ export function process(id) {
|
|||
let currentBannerIndex = -1;
|
||||
let hasManualInput = false;
|
||||
|
||||
let pity = 0;
|
||||
for (let i = 0; i < pullData.length; i++) {
|
||||
const pull = pullData[i];
|
||||
const next = pullData[i + 1] || { time: dayjs().year(2000).unix() };
|
||||
|
@ -128,6 +130,9 @@ export function process(id) {
|
|||
|
||||
selectedBanners[currentBannerIndex].total++;
|
||||
|
||||
const currentPity = selectedBanners[currentBannerIndex].pityCount[pity];
|
||||
selectedBanners[currentBannerIndex].pityCount[pity] = (currentPity || 0) + 1;
|
||||
|
||||
const newPull = {
|
||||
...pull,
|
||||
formattedTime: formatTime(pull.time),
|
||||
|
@ -136,6 +141,7 @@ export function process(id) {
|
|||
banner: currentBanner,
|
||||
start: startBanner,
|
||||
at: selectedBanners[currentBannerIndex].total,
|
||||
currentPity: ++pity,
|
||||
};
|
||||
|
||||
if (item.rarity === 5) {
|
||||
|
@ -146,6 +152,7 @@ export function process(id) {
|
|||
|
||||
selectedBanners[currentBannerIndex].legendary.push(newPull);
|
||||
allLegendary.push(newPull);
|
||||
pity = 0;
|
||||
} else if (item.rarity === 4) {
|
||||
allRare.push(newPull);
|
||||
selectedBanners[currentBannerIndex].rarePity[newPull.pity - 1]++;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { process } from './wish';
|
||||
|
||||
const bannerCategories = ['beginners', 'standard', 'character-event', 'weapon-event'];
|
||||
const rareInclude = {
|
||||
300011: ['rosaria'],
|
||||
300012: ['yanfei', 'noelle', 'diona'],
|
||||
};
|
||||
|
||||
async function sendWish(data) {
|
||||
try {
|
||||
|
@ -14,14 +18,14 @@ async function sendWish(data) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function submitWishTally(lastPull) {
|
||||
export async function submitWishTally() {
|
||||
let prefixId = 0;
|
||||
for (const id of bannerCategories) {
|
||||
prefixId += 100000;
|
||||
|
||||
const data = process(id);
|
||||
if (data === null) continue;
|
||||
if (data.hasManualInput) continue;
|
||||
// if (data.hasManualInput) continue;
|
||||
|
||||
console.log('processing wish tally', id);
|
||||
|
||||
|
@ -33,6 +37,7 @@ export async function submitWishTally(lastPull) {
|
|||
const total = banner[i].total;
|
||||
if (total === 0) continue;
|
||||
|
||||
const pityCount = [...banner[i].pityCount].map((e) => e || 0);
|
||||
const rarePity = banner[i].rarePity;
|
||||
const legendaryCount = banner[i].legendary.length;
|
||||
const rareCount = banner[i].rare.character.length + banner[i].rare.weapon.length;
|
||||
|
@ -46,15 +51,17 @@ export async function submitWishTally(lastPull) {
|
|||
5,
|
||||
]);
|
||||
|
||||
// rosaria only
|
||||
const rosariaPulls = banner[i].rare.character
|
||||
.filter((e) => e.id === 'rosaria')
|
||||
.map((e) => [e.time.toString(), e.id, e.type, e.pity, e.group === 'group', true, 4]);
|
||||
legendaryPulls.push(...rosariaPulls);
|
||||
// specific 4star include
|
||||
if (rareInclude[prefixId + i + 1]) {
|
||||
const includedRarePulls = banner[i].rare.character
|
||||
.filter((e) => rareInclude[prefixId + i + 1].includes(e.id))
|
||||
.map((e) => [e.time.toString(), e.id, e.type, e.pity, e.group === 'group', true, 4]);
|
||||
legendaryPulls.push(...includedRarePulls);
|
||||
}
|
||||
|
||||
console.log(legendaryPulls);
|
||||
console.log(rarePity);
|
||||
console.log(legendaryCount, rareCount, total);
|
||||
// console.log(legendaryPulls);
|
||||
// console.log(rarePity);
|
||||
// console.log(legendaryCount, rareCount, total);
|
||||
|
||||
await sendWish({
|
||||
firstPulls: firstFivePulls,
|
||||
|
@ -64,7 +71,7 @@ export async function submitWishTally(lastPull) {
|
|||
total,
|
||||
legendary: legendaryCount,
|
||||
rare: rareCount,
|
||||
lastPull,
|
||||
pityCount,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
"message": "Your best Genshin Impact companion! Help you plan what to farm with ascension calculator, also track your progress with todo and wish counter.",
|
||||
"banner": {
|
||||
"featured": [
|
||||
"Rosaria",
|
||||
"Tartaglia"
|
||||
"Zhongli",
|
||||
"Yanfei"
|
||||
],
|
||||
"summoned": "Summoned",
|
||||
"percentage": "from all {rarity}",
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
"welcome": "Selamat Datang di Paimon.moe! 👋",
|
||||
"message": "Your best Genshin Impact companion! Membantu kamu merencanakan apa yang harus di farm dengan kalkulator ascension, juga catat progress mu dengan todo dan wish counter.",
|
||||
"banner": {
|
||||
"featured": [
|
||||
"Rosaria",
|
||||
"Tartaglia"
|
||||
],
|
||||
"summoned": "Pulang",
|
||||
"percentage": "dari semua {rarity}",
|
||||
"avg": "Pity rata-rata",
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
"welcome": "Paimon.moe에 어서오세요! 👋",
|
||||
"message": "최고의 원신 동반자! 돌파 계산기로 파밍 계획을 도와주고, 할 일 목록과 기원 통계를 통해 진척도를 확인해줍니다.",
|
||||
"banner": {
|
||||
"featured": [
|
||||
"로자리아",
|
||||
"타르탈리아"
|
||||
],
|
||||
"summoned": "획득",
|
||||
"percentage": "(모든 {rarity} 중)",
|
||||
"avg": "평균 천장",
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
"welcome": "Добро пожаловать на Paimon.moe! 👋",
|
||||
"message": "Твой лучший компаньон в Genshin Impact! Поможет тебе распланировать что фармить в калькуляторе возвышения, а также отслеживать свой прогресс с помощью счетчика молитв и cписка дел",
|
||||
"banner": {
|
||||
"featured": [
|
||||
"Rosaria",
|
||||
"Tartaglia"
|
||||
],
|
||||
"summoned": "Призывов",
|
||||
"percentage": "из всех {rarity}",
|
||||
"avg": "Среднее число молитв",
|
||||
|
|
|
@ -13,21 +13,21 @@
|
|||
const dispatch = createEventDispatcher();
|
||||
|
||||
const featured = {
|
||||
rosaria: {
|
||||
rarity: 'rare',
|
||||
count: 0,
|
||||
average: '...',
|
||||
percentage: '...',
|
||||
},
|
||||
tartaglia: {
|
||||
zhongli: {
|
||||
rarity: 'legendary',
|
||||
count: 0,
|
||||
average: '...',
|
||||
percentage: '...',
|
||||
},
|
||||
yanfei: {
|
||||
rarity: 'rare',
|
||||
count: 0,
|
||||
average: '...',
|
||||
percentage: '...',
|
||||
},
|
||||
};
|
||||
const bannerId = 300011;
|
||||
const image = 'childerosaria.png';
|
||||
const bannerId = 300012;
|
||||
const image = 'zhongliyanfei.png';
|
||||
|
||||
let loading = true;
|
||||
let user = '';
|
||||
|
|
|
@ -247,7 +247,7 @@
|
|||
|
||||
<div class="lg:ml-64 pt-20 px-4 md:px-8 lg:pt-8">
|
||||
<div class="bg-item rounded-xl mb-4 p-4">
|
||||
<p class="text-white">{$t('settings.version')} <b>1.4</b></p>
|
||||
<p class="text-white">{$t('settings.version')} <b>1.5</b></p>
|
||||
</div>
|
||||
<div class="bg-item rounded-xl mb-4 p-4 flex flex-col">
|
||||
<p class="text-white">{$t('settings.multiple')}</p>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<script>
|
||||
import { t } from 'svelte-i18n';
|
||||
import Button from '../../../components/Button.svelte';
|
||||
import Button from '../../../components/Button.svelte';
|
||||
import { banners } from '../../../data/banners';
|
||||
import Item from './_item.svelte';
|
||||
|
||||
let showOld = false;
|
||||
let showOld = [false, false];
|
||||
|
||||
function showOldTally() {
|
||||
showOld = true;
|
||||
function showOldTally(index) {
|
||||
showOld[index] = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -30,6 +30,8 @@ import Button from '../../../components/Button.svelte';
|
|||
</p>
|
||||
|
||||
<div class="px-4 md:px-8">
|
||||
<Item type="character" banner={banners.characters[11]} id={300012} featured={['zhongli', 'yanfei']} />
|
||||
<Item type="weapon" banner={banners.weapons[10]} id={400011} featured={['summit_shaper', 'memory_of_dust']} />
|
||||
<Item type="character" banner={banners.characters[10]} id={300011} featured={['tartaglia', 'rosaria']} />
|
||||
<Item
|
||||
type="weapon"
|
||||
|
@ -37,14 +39,36 @@ import Button from '../../../components/Button.svelte';
|
|||
id={400010}
|
||||
featured={['skyward_harp', 'lost_prayer_to_the_sacred_winds']}
|
||||
/>
|
||||
<Item type="character" banner={banners.characters[9]} id={300010} featured={['venti']} />
|
||||
<Item type="weapon" banner={banners.weapons[8]} id={400009} featured={['elegy_for_the_end', 'skyward_blade']} />
|
||||
<Item type="character" banner={banners.standard[0]} id={200001} />
|
||||
{#if showOld}
|
||||
<Item type="character" banner={banners.characters[8]} id={300009} featured={['hu_tao']} />
|
||||
<Item type="weapon" banner={banners.weapons[7]} id={400008} featured={['wolfs_gravestone', 'staff_of_homa']} />
|
||||
<Item type="character" banner={banners.standard[0]} id={200002} />
|
||||
{#if showOld[0]}
|
||||
<Item type="character" banner={banners.characters[9]} id={300010} featured={['venti']} />
|
||||
<Item
|
||||
type="weapon"
|
||||
banner={banners.weapons[8]}
|
||||
id={400009}
|
||||
featured={['skyward_harp', 'lost_prayer_to_the_sacred_winds']}
|
||||
/>
|
||||
{:else}
|
||||
<Button on:click={showOldTally}>{$t('wish.tally.show')} {banners.characters[8].name} & {banners.weapons[7].name}</Button>
|
||||
<Button on:click={() => showOldTally(0)}>
|
||||
{$t('wish.tally.show')}
|
||||
{banners.characters[9].name} & {banners.weapons[8].name}
|
||||
</Button>
|
||||
<div class="mb-2" />
|
||||
{/if}
|
||||
{#if showOld[1]}
|
||||
<Item type="character" banner={banners.characters[8]} id={300009} featured={['hu_tao']} />
|
||||
<Item
|
||||
type="weapon"
|
||||
banner={banners.weapons[7]}
|
||||
id={400008}
|
||||
featured={['wolfs_gravestone', 'staff_of_homa']}
|
||||
/>
|
||||
{:else}
|
||||
<Button on:click={() => showOldTally(1)}>
|
||||
{$t('wish.tally.show')}
|
||||
{banners.characters[8].name} & {banners.weapons[7].name}
|
||||
</Button>
|
||||
<div class="mb-2" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
|
BIN
static/images/home/zhongliyanfei.png
Normal file
BIN
static/images/home/zhongliyanfei.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 128 KiB |
Loading…
Add table
Reference in a new issue