Update wish tally

pull/1/head
Made Baruna 2021-04-29 05:22:40 +08:00
parent d36f862fc0
commit ec18f32990
No known key found for this signature in database
GPG Key ID: 5AA5DA16AA5DCEAD
3 changed files with 29 additions and 1 deletions

View File

@ -310,6 +310,7 @@
"wonFiftyFifty": "won 50:50",
"fromFiveStar": "from all 5★",
"fromFourStar": "from all 4★",
"fromFourStarFeatured": "from featured 4★",
"show": "Show",
"name": "Name",
"total": "Total",

View File

@ -281,6 +281,7 @@
"wonFiftyFifty": "menang 50:50",
"fromFiveStar": "dari semua 5★",
"fromFourStar": "dari semua 4★",
"fromFourStarFeatured": "dari featured 4★",
"show": "Tampilkan",
"name": "Nama",
"total": "Total",

View File

@ -104,6 +104,12 @@
min: 0,
max: 0,
};
const rareInclude = {
300011: ['rosaria'],
300012: ['yanfei', 'noelle', 'diona'],
};
let promotedRarePercentage = 0;
let legendaryList = [];
let legendaryPity = [];
@ -165,6 +171,23 @@
];
}
// only for zhongli banner upward
if (id > 300011 && id < 400000) {
const totalRare = data.list.reduce((prev, current) => {
if (rareInclude[id].includes(current.name)) {
prev.total += current.count;
}
if (featured[1] === current.name) {
prev.featured = current.count;
}
return prev;
}, {
total: 0,
featured: 0,
});
promotedRarePercentage = totalRare.featured / totalRare.total * 100
}
legendary = {
total: data.total.legendary,
percentage: (data.total.legendary / data.total.all) * 100,
@ -310,13 +333,16 @@
<span class="text-gray-400">{$t('wish.tally.summoned')}</span>
</p>
<p class="text-gray-400">
{#if id === 300011 && i === 0}
{#if id >= 300011 && id < 400000 && i === 0}
{numberFormat.format(
((featuredValues[i].total - featuredValues[i].guaranteed) /
(data.total.legendary - featuredValues[i].guaranteed)) *
100,
)}%
{$t('wish.tally.wonFiftyFifty')}
{:else if id > 300011 && id < 400000 && i === 1}
{numberFormat.format(promotedRarePercentage)}%
{$t('wish.tally.fromFourStarFeatured')}
{:else}
{numberFormat.format(featuredValues[i].percentage)}% {$t(
type === 'character' && i === 1 ? 'wish.tally.fromFourStar' : 'wish.tally.fromFiveStar',