From d3e68c22f378247e26db1b6fe03436293a1c332f Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Wed, 13 Mar 2024 15:46:18 +0800 Subject: [PATCH] Add chronicled wish --- src/data/bannerTypes.js | 4 ++ src/data/banners.js | 67 +++++++++++++++++++++ src/functions/wish.js | 1 + src/functions/wishTally.js | 2 +- src/locales/en.json | 54 ++++------------- src/routes/settings/index.svelte | 8 +-- src/routes/wish/[id].svelte | 9 +-- src/routes/wish/_counter.svelte | 13 ++-- src/routes/wish/_monthlyGraph.svelte | 2 +- src/routes/wish/_rank.svelte | 18 +++--- src/routes/wish/_summary.svelte | 8 ++- src/routes/wish/import.svelte | 4 ++ src/routes/wish/index.svelte | 33 +++++++---- src/routes/wish/tally/index.svelte | 88 +++++++++++++++------------- src/service-worker.js | 2 +- 15 files changed, 189 insertions(+), 124 deletions(-) diff --git a/src/data/bannerTypes.js b/src/data/bannerTypes.js index 478dc8cf..b929618d 100644 --- a/src/data/bannerTypes.js +++ b/src/data/bannerTypes.js @@ -15,4 +15,8 @@ export const bannerTypes = [ name: "Beginners' Wish", id: 'beginners', }, + { + name: 'Chronicled Wish', + id: 'chronicled', + }, ]; diff --git a/src/data/banners.js b/src/data/banners.js index ca5db659..520e3722 100644 --- a/src/data/banners.js +++ b/src/data/banners.js @@ -1904,4 +1904,71 @@ export const banners = { timezoneDependent: true, }, ], + chronicled: [ + { + name: 'Ode to the Dawn Breeze', + image: 1, + shortName: 'Mondstadt', + start: '2024-03-13 06:00:00', + end: '2024-04-02 17:59:00', + color: '#eee8e1', + featured: [ + 'eula', + 'mona', + 'albedo', + 'klee', + 'diluc', + 'jean', + 'skyward_blade', + 'aquila_favonia', + 'beacon_of_the_reed_sea', + 'song_of_broken_pines', + 'wolfs_gravestone', + 'skyward_pride', + 'skyward_spine', + 'lost_prayer_to_the_sacred_winds', + 'skyward_atlas', + 'hunters_path', + 'skyward_harp', + ], + featuredRare: [ + 'mika', + 'rosaria', + 'sucrose', + 'diona', + 'noelle', + 'bennett', + 'fischl', + 'amber', + 'razor', + 'kaeya', + 'barbara', + 'lisa', + 'the_alley_flash', + 'lions_roar', + 'sacrificial_sword', + 'the_flute', + 'favonius_sword', + 'rainslasher', + 'sacrificial_greatsword', + 'the_bell', + 'favonius_greatsword', + 'favonius_lance', + 'dragons_bane', + 'wine_and_song', + 'eye_of_perception', + 'sacrificial_fragments', + 'the_widsith', + 'favonius_codex', + 'mitternachts_waltz', + 'alley_hunter', + 'rust', + 'sacrificial_bow', + 'the_stringless', + 'favonius_warbow', + ], + version: '4.5', + timezoneDependent: true, + }, + ], }; diff --git a/src/functions/wish.js b/src/functions/wish.js index f8e81ad3..ba950a54 100644 --- a/src/functions/wish.js +++ b/src/functions/wish.js @@ -17,6 +17,7 @@ const bannerTypes = { 'weapon-event': 'weapons', standard: 'standard', beginners: 'beginners', + chronicled: 'chronicled', }; async function readLocalData(path) { diff --git a/src/functions/wishTally.js b/src/functions/wishTally.js index 1057a243..39c2b9fa 100644 --- a/src/functions/wishTally.js +++ b/src/functions/wishTally.js @@ -3,7 +3,7 @@ import { getAccountPrefix } from '../stores/account'; import { readSave } from '../stores/saveManager'; import { process } from './wish'; -const bannerCategories = ['beginners', 'standard', 'character-event', 'weapon-event']; +const bannerCategories = ['beginners', 'standard', 'character-event', 'weapon-event', 'chronicled']; async function sendWish(data) { try { diff --git a/src/locales/en.json b/src/locales/en.json index e2c5b6b7..16c45186 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -143,10 +143,7 @@ "manualButton": "Enable Manual Input", "errorBanner": "Banner time mismatch! Please adjust your server on the settings page. Still not working? Please leave a message on Discord 😅", "globalWishTally": "Global Wish Stats", - "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", @@ -182,11 +179,7 @@ "server": "Select your server:", "wishTallyCheck": "Submit pity for global wish stats", "wishTally": "We are doing a global wish stats! You can submit your wish stats 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 for more than 6 months. It also automatically tracks your pity and statistics about your wishes!", @@ -396,11 +389,7 @@ "exportFinish": "Export success, please wait until your browser downloads the file!", "wishTallyTitle": "Submit Wish Stats", "wishTally": "We are doing a global wish stats! You can submit your wish stats 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 Stats", "wishTallyThankyou": "Thank you for participating!", "manualTitle": "Manual Input Settings", @@ -412,22 +401,13 @@ "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 5★ or 4★. You can also add or edit the table manually." } }, @@ -435,7 +415,8 @@ "beginners": "Beginners' Wish", "standard": "Standard", "character-event": "Character Event", - "weapon-event": "Weapon Event" + "weapon-event": "Weapon Event", + "chronicled": "Chronicled Wish" }, "detail": { "weapon": "Weapon", @@ -567,11 +548,7 @@ "calculateTalent": "Calculate Talent Material?", "inputTalentLevel": "Input the 1st, 2nd & 3rd current talent level", "inputTalentNotice": "If it has a different color, subtract 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", @@ -580,11 +557,7 @@ "expWasted": "EXP Wasted", "addToTodo": "Add to Todo List", "addedToTodo": "Added to Todo List", - "talent": [ - "Attack", - "Skill", - "Burst" - ] + "talent": ["Attack", "Skill", "Burst"] }, "expTable": { "level": "Level", @@ -676,10 +649,7 @@ "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}", @@ -1053,4 +1023,4 @@ "characterCard": "Character Card", "actionCard": "Action Card" } -} \ No newline at end of file +} diff --git a/src/routes/settings/index.svelte b/src/routes/settings/index.svelte index 510fce30..482c9d42 100644 --- a/src/routes/settings/index.svelte +++ b/src/routes/settings/index.svelte @@ -375,14 +375,14 @@
-
+

{$t('settings.multiple')}

@@ -450,8 +450,8 @@ {isSynced ? $t('settings.synced') : $localModified && $synced - ? $t('settings.waiting') - : $t('settings.syncing')} + ? $t('settings.waiting') + : $t('settings.syncing')} {#if isSynced} {:else if $localModified && !$synced} diff --git a/src/routes/wish/[id].svelte b/src/routes/wish/[id].svelte index d66ae55a..3cd183ad 100644 --- a/src/routes/wish/[id].svelte +++ b/src/routes/wish/[id].svelte @@ -39,6 +39,7 @@ 'weapon-event': 'weapons', standard: 'standard', beginners: 'beginners', + chronicled: 'chronicled', }; let errorProcessingPull = null; @@ -193,8 +194,8 @@ pull.type === 'character' ? characters[pull.id] : pull.type === 'weapon' - ? weaponList[pull.id] - : { name: 'Unknown', rarity: 3 }; + ? weaponList[pull.id] + : { name: 'Unknown', rarity: 3 }; selectedBanners[currentBannerIndex].total++; @@ -638,8 +639,8 @@ src={pull.type === 'character' ? `/images/characters/${pull.id}.png` : pull.type === 'weapon' - ? `/images/weapons/${pull.id}.png` - : '/images/wish.png'} + ? `/images/weapons/${pull.id}.png` + : '/images/wish.png'} alt={pull.name} loading="lazy" /> diff --git a/src/routes/wish/_counter.svelte b/src/routes/wish/_counter.svelte index 1534d6ae..633c521e 100644 --- a/src/routes/wish/_counter.svelte +++ b/src/routes/wish/_counter.svelte @@ -296,10 +296,7 @@ $: hidden = id === 'beginners' && total === 0 && !manualInput; -
+

{name}

{#if manualInput} @@ -459,8 +456,8 @@ characters[pull.id].rarity === 5 ? 'text-legendary-from' : characters[pull.id].rarity === 4 - ? 'text-rare-from' - : 'text-primary' + ? 'text-rare-from' + : 'text-primary' }`}>{$t(characters[pull.id].name)} {:else if pull.type === 'weapon'} @@ -469,8 +466,8 @@ weaponList[pull.id].rarity === 5 ? 'text-legendary-from' : weaponList[pull.id].rarity === 4 - ? 'text-rare-from' - : 'text-primary' + ? 'text-rare-from' + : 'text-primary' }`}>{$t(weaponList[pull.id].name)} {:else if pull.type === 'unknown_3_star'} diff --git a/src/routes/wish/_monthlyGraph.svelte b/src/routes/wish/_monthlyGraph.svelte index 473a9312..4ce7c7dc 100644 --- a/src/routes/wish/_monthlyGraph.svelte +++ b/src/routes/wish/_monthlyGraph.svelte @@ -83,6 +83,6 @@ $: data, createGraph(); -
+
diff --git a/src/routes/wish/_rank.svelte b/src/routes/wish/_rank.svelte index 73751ef7..2ef31e2d 100644 --- a/src/routes/wish/_rank.svelte +++ b/src/routes/wish/_rank.svelte @@ -214,7 +214,7 @@ $: fixedPointWinRateOff = percentageWinRateOff < 0.1 ? 2 : percentageWinRateOff < 2 ? 1 : 0; -
+

{$t('wish.rank.title')}

{$t('wish.rank.based')}

@@ -246,8 +246,8 @@ {loading.total ? '...' : percentage < 50 - ? percentage.toFixed(fixedPoint) - : (100 - percentage).toFixed(fixedPoint)}% + ? percentage.toFixed(fixedPoint) + : (100 - percentage).toFixed(fixedPoint)}%
@@ -283,8 +283,8 @@ {loading.winRateOff.legendary ? '...' : percentageWinRateOff.legendary < 50 - ? percentageWinRateOff.legendary.toFixed(fixedPointWinRateOff) - : (100 - percentageWinRateOff.legendary).toFixed(fixedPointWinRateOff)}% + ? percentageWinRateOff.legendary.toFixed(fixedPointWinRateOff) + : (100 - percentageWinRateOff.legendary).toFixed(fixedPointWinRateOff)}%
@@ -318,8 +318,8 @@ {loading.legendary ? '...' : percentageLuck.legendary < 50 - ? percentageLuck.legendary.toFixed(fixedPointLegendary) - : (100 - percentageLuck.legendary).toFixed(fixedPointLegendary)}% + ? percentageLuck.legendary.toFixed(fixedPointLegendary) + : (100 - percentageLuck.legendary).toFixed(fixedPointLegendary)}%
@@ -350,8 +350,8 @@ {loading.rare ? '...' : percentageLuck.rare < 50 - ? percentageLuck.rare.toFixed(fixedPointRare) - : (100 - percentageLuck.rare).toFixed(fixedPointRare)}% + ? percentageLuck.rare.toFixed(fixedPointRare) + : (100 - percentageLuck.rare).toFixed(fixedPointRare)}%
diff --git a/src/routes/wish/_summary.svelte b/src/routes/wish/_summary.svelte index 541747e0..f36a176b 100644 --- a/src/routes/wish/_summary.svelte +++ b/src/routes/wish/_summary.svelte @@ -25,7 +25,7 @@ let loading = true; let wishCount = 0; - let box = [0, 1, 2, 3]; + let box = [0, 1, 2, 4, 3]; const avg = {}; const percentages = {}; @@ -276,7 +276,7 @@ avg['standard'] !== undefined && avg['weapon-event'].legendary.total > avg['standard'].legendary.total ) { - box = [0, 2, 1, 3]; + box = [0, 2, 1, 4, 3]; } if (updateCollectedCharacters && totalWish > 0) { @@ -309,6 +309,10 @@
{/if} + {#if avg[types[box[4]].id]} + +
+ {/if}
{$t('wish.wishesWorth')} primogem diff --git a/src/routes/wish/import.svelte b/src/routes/wish/import.svelte index d703b353..863fcd93 100644 --- a/src/routes/wish/import.svelte +++ b/src/routes/wish/import.svelte @@ -92,6 +92,10 @@ name: 'Weapon Event', id: 'weapon-event', }, + 500: { + name: 'Chronicled Wish', + id: 'chronicled', + }, }; let powershellScript = `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex "&{$((New-Object System.Net.WebClient).DownloadString('https://gist.github.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/getlink.ps1'))} global"`; diff --git a/src/routes/wish/index.svelte b/src/routes/wish/index.svelte index 91235a1c..98c69539 100644 --- a/src/routes/wish/index.svelte +++ b/src/routes/wish/index.svelte @@ -25,6 +25,7 @@ let counter2; let counter3; let counter4; + let counter5; let rank; let wishTotal = { @@ -129,6 +130,7 @@ counter2.readLocalData(); counter3.readLocalData(); counter4.readLocalData(); + counter5.readLocalData(); } @@ -218,22 +220,31 @@ id="standard" name={$t('wish.types.standard')} /> -
- + setRankWishTotal('chronicled', val)} + bind:this={counter5} + manualInput={settings.manualInput} + id="chronicled" + name={$t('wish.types.chronicled')} + /> + + + +
+ +
setRankWishPercentage(val)} />
diff --git a/src/routes/wish/tally/index.svelte b/src/routes/wish/tally/index.svelte index 628b899f..e6340d56 100644 --- a/src/routes/wish/tally/index.svelte +++ b/src/routes/wish/tally/index.svelte @@ -28,12 +28,14 @@ { label: 'Character Event', value: 'characters' }, { label: 'Weapon Event', value: 'weapons' }, { label: 'Standard', value: 'standard' }, + { label: 'Chronicled Wish', value: 'chronicled' }, ]; const typeNumber = { characters: 300000, weapons: 400000, standard: 200000, + chronicled: 500000, }; const spliceCount = { @@ -252,14 +254,17 @@ const rareTotalPull = data.pityCount.rare; loading = false; + if (data.pullByDay.length === 0) hidePullByDay = true; await tick(); + if (Object.keys(data).length > 0) { consData = data.constellation; - showDataCons(); + await showDataCons(); } Chart.defaults.global.defaultFontColor = '#ffffff'; Chart.defaults.global.defaultFontFamily = 'Poppins'; + if (!chart) return; new Chart(chart, { type: 'bar', data: { @@ -327,46 +332,48 @@ }, }); - new Chart(chartPullByDay, { - type: 'line', - data: { - labels: data.pullByDay.map((e) => dayjs(e.day).format('MM/DD')), - datasets: [ - { - label: 'Pull By Day %', - data: data.pullByDay.map((e) => e.percentage * 100), - borderColor: '#4E7CFF', - backgroundColor: '#4E7CFF', - borderWidth: 3, - pointRadius: 2, - fill: false, - type: 'line', - }, - ], - }, - options: { - responsive: true, - maintainAspectRatio: false, - interaction: { - mode: 'index', - intersect: false, - }, - tooltips: { - mode: 'index', - intersect: false, - callbacks: { - title: (tooltipItem) => { - return dayjs(data.pullByDay[tooltipItem[0].index].day).format('dddd, MMM DD YYYY'); + if (!hidePullByDay) { + new Chart(chartPullByDay, { + type: 'line', + data: { + labels: data.pullByDay.map((e) => dayjs(e.day).format('MM/DD')), + datasets: [ + { + label: 'Pull By Day %', + data: data.pullByDay.map((e) => e.percentage * 100), + borderColor: '#4E7CFF', + backgroundColor: '#4E7CFF', + borderWidth: 3, + pointRadius: 2, + fill: false, + type: 'line', }, - label: (tooltipItem) => { - return `Pull by day: ${numberFormatSecondary.format( - data.pullByDay[tooltipItem.index].percentage * totalWish, - )} (${numberFormat.format(tooltipItem.value)}%)`; + ], + }, + options: { + responsive: true, + maintainAspectRatio: false, + interaction: { + mode: 'index', + intersect: false, + }, + tooltips: { + mode: 'index', + intersect: false, + callbacks: { + title: (tooltipItem) => { + return dayjs(data.pullByDay[tooltipItem[0].index].day).format('dddd, MMM DD YYYY'); + }, + label: (tooltipItem) => { + return `Pull by day: ${numberFormatSecondary.format( + data.pullByDay[tooltipItem.index].percentage * totalWish, + )} (${numberFormat.format(tooltipItem.value)}%)`; + }, }, }, }, - }, - }); + }); + } new Chart(chart2, { type: 'bar', @@ -400,8 +407,6 @@ }, }, }); - - if (data.pullByDay.length === 0) hidePullByDay = true; } catch (err) { console.error(err); error = err; @@ -448,6 +453,7 @@ await tick(); if (constChart) constChart.destroy(); + if (!chart3) return; constChart = new Chart(chart3, { type: 'bar', data: { @@ -697,12 +703,12 @@
{/if}
- +
{#if !loadingCons}
- +
diff --git a/src/service-worker.js b/src/service-worker.js index 4d0e25ac..a8a92ced 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -7,7 +7,7 @@ const IMAGE_CACHE = `cacheimg${IMAGE_CACHE_VER}`; const IMAGE_URL = `${self.location.origin}/images/`; -const changelog = ['Add Chiori & weapons', 'Update banners', 'Update timelines', 'Update achievements']; +const changelog = ['Add chronicled wish banner', 'Add Chiori & weapons', 'Update timelines', 'Update achievements']; const channel = new BroadcastChannel('paimonmoe-sw');