Add 50:50 indicator on wish history

This commit is contained in:
Made Baruna 2022-02-15 19:10:34 +07:00
parent 749bce19fe
commit 0d2c2683f2
5 changed files with 155 additions and 27 deletions

View file

@ -4,6 +4,7 @@
export let color = null;
export let flip = null;
export let rotate = 0;
export let marginBottom = 0;
export let spin = false;
export let title = '';
export let className = '';
@ -35,6 +36,9 @@
styles.push(['transform', transform.join(' ')]);
styles.push(['transform-origin', 'center']);
}
if (marginBottom > 0) {
styles.push(['margin-bottom', `${marginBottom}px`]);
}
return styles.reduce((cur, item) => {
return `${cur} ${item[0]}:${item[1]};`;
}, '');
@ -42,13 +46,6 @@
$: style = getStyles();
</script>
<style>
svg {
vertical-align: middle;
display: inline-block;
}
</style>
<svg viewBox="0 0 24 24" {style} class={className}>
{#if title}
<title>{title}</title>
@ -78,3 +75,10 @@
<path d={path} />
{/if}
</svg>
<style>
svg {
vertical-align: middle;
display: inline-block;
}
</style>

View file

@ -0,0 +1,33 @@
<script>
export let title = '';
let isHovered = false;
let x;
let y;
function mouseOver(event) {
isHovered = true;
x = event.pageX + 5;
y = event.pageY + 5;
}
function mouseMove(event) {
x = event.pageX + 5;
y = event.pageY + 5;
}
function mouseLeave() {
isHovered = false;
}
</script>
<i on:mouseover={mouseOver} on:mouseleave={mouseLeave} on:mousemove={mouseMove}>
<slot />
</i>
{#if isHovered}
<div style="top: {y}px; left: {x}px;" class="tooltip">{title}</div>
{/if}
<style>
.tooltip {
@apply text-background rounded-xl bg-gray-400 border border-gray-800 p-2 absolute text-sm;
}
</style>

View file

@ -29,6 +29,7 @@ export const banners = {
color: '#55E4B0',
timezoneDependent: true,
featured: ['venti'],
featuredRare: ['barbara', 'fischl', 'xiangling'],
},
{
name: 'Sparkling Steps',
@ -38,6 +39,7 @@ export const banners = {
end: '2020-11-10 16:00:00',
color: '#CA360E',
featured: ['klee'],
featuredRare: ['xingqiu', 'sucrose', 'noelle'],
},
{
name: 'Farewell of Snezhnaya',
@ -48,6 +50,7 @@ export const banners = {
color: '#50A3C0',
timezoneDependent: true,
featured: ['tartaglia'],
featuredRare: ['ningguang', 'beidou', 'diona'],
},
{
name: 'Gentry of Hermitage',
@ -57,6 +60,7 @@ export const banners = {
end: '2020-12-22 15:00:00',
color: '#D1A55C',
featured: ['zhongli'],
featuredRare: ['xinyan', 'razor', 'chongyun'],
},
{
name: 'Secretum Secretorum',
@ -67,6 +71,7 @@ export const banners = {
color: '#FCFE83',
timezoneDependent: true,
featured: ['albedo'],
featuredRare: ['fischl', 'bennett', 'sucrose'],
},
{
name: 'Adrift in the Harbor',
@ -76,6 +81,7 @@ export const banners = {
end: '2021-02-02 15:00:00',
color: '#6994DF',
featured: ['ganyu'],
featuredRare: ['xingqiu', 'xiangling', 'noelle'],
},
{
name: 'Invitation to Mundane Life',
@ -86,6 +92,7 @@ export const banners = {
color: '#2BE3F8',
timezoneDependent: true,
featured: ['xiao'],
featuredRare: ['diona', 'xinyan', 'beidou'],
},
{
name: 'Dance of Lanterns',
@ -95,6 +102,7 @@ export const banners = {
end: '2021-03-02 16:00:00',
color: '#AB6CD7',
featured: ['keqing'],
featuredRare: ['barbara', 'bennett', 'ningguang'],
},
{
name: 'Moment of Bloom',
@ -104,6 +112,7 @@ export const banners = {
end: '2021-03-16 15:00:00',
color: '#BF5042',
featured: ['hu_tao'],
featuredRare: ['xingqiu', 'xiangling', 'chongyun'],
},
{
name: 'Ballad in Goblets',
@ -316,6 +325,7 @@ export const banners = {
color: '#f54e42',
timezoneDependent: true,
featured: ['aquila_favonia', 'amos_bow'],
featuredRare: ['the_flute', 'the_bell', 'the_widsith', 'the_stringless', 'favonius_lance'],
},
{
name: 'Epitome Invocation',
@ -325,6 +335,13 @@ export const banners = {
shortName: 'Lost Prayer',
color: '#f5c242',
featured: ['lost_prayer_to_the_sacred_winds', 'wolfs_gravestone'],
featuredRare: [
'sacrificial_sword',
'sacrificial_bow',
'sacrificial_greatsword',
'sacrificial_fragments',
'dragons_bane',
],
},
{
name: 'Epitome Invocation',
@ -335,6 +352,7 @@ export const banners = {
color: '#f5ef42',
timezoneDependent: true,
featured: ['skyward_harp', 'memory_of_dust'],
featuredRare: ['the_flute', 'rainslasher', 'eye_of_perception', 'rust', 'favonius_lance'],
},
{
name: 'Epitome Invocation',
@ -344,6 +362,7 @@ export const banners = {
shortName: 'Vortex',
color: '#7ef542',
featured: ['vortex_vanquisher', 'the_unforged'],
featuredRare: ['lions_roar', 'the_bell', 'favonius_codex', 'favonius_warbow', 'dragons_bane'],
},
{
name: 'Epitome Invocation',
@ -354,6 +373,13 @@ export const banners = {
color: '#42ecf5',
timezoneDependent: true,
featured: ['summit_shaper', 'skyward_atlas'],
featuredRare: [
'favonius_sword',
'favonius_greatsword',
'favonius_lance',
'sacrificial_fragments',
'the_stringless',
],
},
{
name: 'Epitome Invocation',
@ -363,6 +389,7 @@ export const banners = {
shortName: 'Amos',
color: '#424ef5',
featured: ['amos_bow', 'skyward_pride'],
featuredRare: ['sacrificial_sword', 'the_bell', 'dragons_bane', 'eye_of_perception', 'favonius_warbow'],
},
{
name: 'Epitome Invocation',
@ -373,6 +400,7 @@ export const banners = {
color: '#b042f5',
timezoneDependent: true,
featured: ['primordial_jade_winged-spear', 'primordial_jade_cutter'],
featuredRare: ['the_flute', 'sacrificial_greatsword', 'rust', 'eye_of_perception', 'favonius_lance'],
},
{
name: 'Epitome Invocation',
@ -382,6 +410,7 @@ export const banners = {
shortName: 'Homa',
color: '#f542c8',
featured: ['wolfs_gravestone', 'staff_of_homa'],
featuredRare: ['lithic_blade', 'lithic_spear', 'lions_roar', 'sacrificial_bow', 'the_widsith'],
},
{
name: 'Epitome Invocation',

View file

@ -22,7 +22,9 @@
"message": "Your best Genshin Impact companion! Help you plan what to farm with ascension calculator, also track your progress with todo and wish counter.",
"visitor": "{count} visitors in last 7 days",
"banner": {
"featured": ["Eula"],
"featured": [
"Eula"
],
"summoned": "Summoned",
"percentage": "from all {rarity}",
"avg": "Pity average",
@ -134,7 +136,10 @@
"manualButton": "Enable Manual Input",
"errorBanner": "Banner time missmatch! Please adjust your server on settings page. Still not working? please leave a message on Discord 😅",
"globalWishTally": "Global Wish Tally",
"pityTooltip": ["Shows your current {rarity} pity", "{count} pulls to guaranteed {rarity}"],
"pityTooltip": [
"Shows your current {rarity} pity",
"{count} pulls to guaranteed {rarity}"
],
"import": {
"title": "Import Wish History",
"faqsButton": "FAQ - READ FIRST",
@ -170,7 +175,11 @@
"server": "Select your server:",
"wishTallyCheck": "Submit pity for global wish tally",
"wishTally": "We are doing a global wish tally! You can submit your wish tally to participate. All pity data will be aggregated to know what is the average pity of paimon.moe users.",
"wishTallyCollected": ["What will be collected:", "and", "pity from your wish history"],
"wishTallyCollected": [
"What will be collected:",
"and",
"pity from your wish history"
],
"forceUpdateCheck": "Force update wish history (enable only if your wish history is not updating)",
"header": [
"Import and backup your Genshin Impact wish history to keep it more than 6 months. Also automatically track your pity and statistic about your wishes!",
@ -348,7 +357,11 @@
"exportFinish": "Export success, please wait until the browser download the file!",
"wishTallyTitle": "Submit Wish Tally",
"wishTally": "We are doing a global wish tally! You can submit your wish tally to participate. All pity data will be aggregated to know what is the average pity of paimon.moe users.",
"wishTallyCollected": ["What will be collected:", "and", "pity from your wish history"],
"wishTallyCollected": [
"What will be collected:",
"and",
"pity from your wish history"
],
"wishTallySubmit": "Submit Wish Tally",
"wishTallyThankyou": "Thankyou for participating!",
"manualTitle": "Manual Input Setting",
@ -360,13 +373,22 @@
"subtitle": "After a 1x Wish:",
"pressWhenYouGet": "Press {button} when you get {rarity}★",
"p1": "It will automatically add the lifetime pulls, 5★, and 4★ pity",
"p2": ["When the", "pity reaches 10, it will automatically be reset to 0"],
"p3": ["When the", "pity reaches 90, it will automatically be reset to 0"],
"p2": [
"When the",
"pity reaches 10, it will automatically be reset to 0"
],
"p3": [
"When the",
"pity reaches 90, it will automatically be reset to 0"
],
"p4": [
"After a 10x Wish, press",
"but keep in mind that the pity counter might not be accurate, because there is no way to tell when the drop occured (maybe you got it on the 1st or even the 10th pull). To ensure that the counter is still accurate, you need to check the history table and add it one-by-one like you do 1x Wishes."
],
"p5": ["You can also press the", "button to edit the values manually!"],
"p5": [
"You can also press the",
"button to edit the values manually!"
],
"p6": [
"Press the arrow on the bottom to see your pulls' details. A popup will show up when you get a",
"or",
@ -421,7 +443,12 @@
"Wish history is not updated automatically, please import again to update your history!",
"Paimon.moe cannot retrieve wish history older than 6 months because it's already deleted on miHoYo server, so your old wishes might not show.",
"The data are saved on your browser, so it will be deleted if you clear your browser cache! Enable Google Drive sync on setting to backup your data!"
]
],
"rateon": {
"won": "Won 50:50",
"lost": "Lost 50:50",
"guaranteed": "Guaranteed"
}
},
"calculator": {
"titleWeapon": "Weapon Calculator",
@ -467,7 +494,11 @@
"calculateTalent": "Calculate Talent Material?",
"inputTalentLevel": "Input the 1st, 2nd & 3rd current talent level",
"inputTalentNotice": "If it has different color, substract it by 3",
"inputTalent": ["1st talent lvl", "2nd talent lvl", "3rd talent lvl"],
"inputTalent": [
"1st talent lvl",
"2nd talent lvl",
"3rd talent lvl"
],
"talentToLevel": "to level",
"calculate": "Calculate",
"unknownInformation": "There are some unknown information",
@ -476,7 +507,11 @@
"expWasted": "EXP Wasted",
"addToTodo": "Add to Todo List",
"addedToTodo": "Added to Todo List",
"talent": ["Attack", "Skill", "Burst"]
"talent": [
"Attack",
"Skill",
"Burst"
]
},
"expTable": {
"level": "Level",
@ -568,7 +603,10 @@
"todo": {
"title": "Todo List",
"summary": "Summary",
"empty": ["Nothing to do yet 😀", "Add some from the Items page or the Calculator!"],
"empty": [
"Nothing to do yet 😀",
"Add some from the Items page or the Calculator!"
],
"farmableToday": "Farmable Today",
"resin": "Resin needed",
"based": "Based on AR:{ar} and WL:{wl}",
@ -816,4 +854,4 @@
"save": "Save",
"cancel": "Cancel"
}
}
}

View file

@ -8,7 +8,7 @@
<script>
import { t } from 'svelte-i18n';
import { getContext, onMount, tick } from 'svelte';
import { mdiArrowLeft, mdiArrowUpCircle, mdiStar } from '@mdi/js';
import { mdiArrowLeft, mdiArrowUpCircle, mdiStar, mdiStarOff, mdiStarOutline } from '@mdi/js';
import dayjs from 'dayjs';
import Chart from 'chart.js';
@ -16,6 +16,8 @@
import { bannersDual } from '../../data/bannersDual';
import Icon from '../../components/Icon.svelte';
import Tooltip from '../../components/Tooltip.svelte';
import Ad from '../../components/Ad.svelte';
import TableHeader from '../../components/Table/TableHeader.svelte';
import WishDetailModal from './_detail.svelte';
@ -25,7 +27,6 @@
import { fromRemote, readSave } from '../../stores/saveManager';
import { getTimeOffset, server } from '../../stores/server';
import { pushToast } from '../../stores/toast';
import Ad from '../../components/Ad.svelte';
Chart.defaults.global.defaultFontColor = '#cbd5e0';
Chart.defaults.global.defaultFontFamily = 'Poppins';
@ -155,6 +156,7 @@
let striped = false;
let startBanner = false;
let rateUp = false;
let rateUpRare = false;
let lastBanner;
let lastBannerIndex;
@ -206,14 +208,17 @@
};
if (item.rarity === 5) {
if (currentBanner.featured) {
newPull.guaranteed = rateUp;
rateUp = !currentBanner.featured.includes(newPull.id);
}
newPull.guaranteed = rateUp;
rateUp = !currentBanner.featured.includes(newPull.id);
newPull.loseRateOff = rateUp;
selectedBanners[currentBannerIndex].legendary.push(newPull);
allLegendary.push(newPull);
} else if (item.rarity === 4) {
newPull.guaranteed = rateUpRare;
rateUpRare = !currentBanner.featuredRare.includes(newPull.id);
newPull.loseRateOff = rateUpRare;
allRare.push(newPull);
if (pull.type === 'character') {
selectedBanners[currentBannerIndex].rare.character.push(newPull);
@ -454,7 +459,7 @@
function calculateRareColor(percentage) {
const opacity = percentage + 0.3;
return `opacity: ${opacity};`;
return `color: rgba(237, 242, 247, ${opacity});`;
}
function toggleShowRarity(index) {
@ -596,7 +601,22 @@
? calculateLegendaryColor((90 - pull.pity) / 90)
: calculateRareColor((10 - pull.pity) / 10)}
>
{pull.pity}
<span class="w-8 inline-block">{pull.pity}</span>
{#if pull.guaranteed === false}
{#if pull.loseRateOff}
<Tooltip title={$t('wish.rateon.lost')}>
<Icon marginBottom={2} size={0.7} path={mdiStarOff} />
</Tooltip>
{:else}
<Tooltip title={$t('wish.rateon.won')}>
<Icon marginBottom={2} size={0.7} path={mdiStar} />
</Tooltip>
{/if}
{:else if pull.rarity > 3}
<Tooltip title={$t('wish.rateon.guaranteed')}>
<Icon marginBottom={2} size={0.7} path={mdiStarOutline} className="opacity-50" />
</Tooltip>
{/if}
</span>
</td>
<td class="border-t border-gray-700 pl-4 text-gray-200">
@ -750,6 +770,10 @@
}
}
.rate-star {
margin-bottom: 2px !important;
}
.rate-tooltip {
@apply relative;