From d41b6002a83635c7c99ad914c03db46d3037fa03 Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Tue, 6 Apr 2021 11:00:25 +0800 Subject: [PATCH] Update wish tally --- src/data/banners.js | 21 ++++++++++++++ src/functions/wish.js | 8 ++++- src/functions/wishTally.js | 11 ++++++- src/locales/en.json | 29 +++++++++++++++---- src/locales/id.json | 3 +- src/routes/wish/[id].svelte | 58 ++++++++++++++++++++++++++++++++----- 6 files changed, 114 insertions(+), 16 deletions(-) diff --git a/src/data/banners.js b/src/data/banners.js index c902dd50..fdb290b7 100644 --- a/src/data/banners.js +++ b/src/data/banners.js @@ -28,6 +28,7 @@ export const banners = { end: '2020-10-18 18:00:00', color: '#55E4B0', timezoneDependent: true, + featured: ['venti'], }, { name: 'Sparkling Steps', @@ -36,6 +37,7 @@ export const banners = { start: '2020-10-20 18:00:00', end: '2020-11-10 16:00:00', color: '#CA360E', + featured: ['klee'], }, { name: 'Farewell of Snezhnaya', @@ -45,6 +47,7 @@ export const banners = { end: '2020-12-01 16:00:00', color: '#50A3C0', timezoneDependent: true, + featured: ['tartaglia'], }, { name: 'Gentry of Hermitage', @@ -53,6 +56,7 @@ export const banners = { start: '2020-12-01 18:00:00', end: '2020-12-22 15:00:00', color: '#D1A55C', + featured: ['zhongli'], }, { name: 'Secretum Secretorum', @@ -62,6 +66,7 @@ export const banners = { end: '2021-01-12 16:00:00', color: '#FCFE83', timezoneDependent: true, + featured: ['albedo'], }, { name: 'Adrift in the Harbor', @@ -70,6 +75,7 @@ export const banners = { start: '2021-01-12 18:00:00', end: '2021-02-02 15:00:00', color: '#6994DF', + featured: ['ganyu'], }, { name: 'Invitation to Mundane Life', @@ -79,6 +85,7 @@ export const banners = { end: '2021-02-17 16:00:00', color: '#2BE3F8', timezoneDependent: true, + featured: ['xiao'], }, { name: 'Dance of Lanterns', @@ -87,6 +94,7 @@ export const banners = { start: '2021-02-17 18:00:00', end: '2021-03-02 16:00:00', color: '#AB6CD7', + featured: ['keqing'], }, { name: 'Moment of Bloom', @@ -95,6 +103,7 @@ export const banners = { start: '2021-03-02 18:00:00', end: '2021-03-16 15:00:00', color: '#BF5042', + featured: ['hu_tao'], }, { name: 'Ballad in Goblets', @@ -104,6 +113,7 @@ export const banners = { end: '2021-04-06 16:00:00', color: '#35C297', timezoneDependent: true, + featured: ['venti'], }, { name: 'Farewell of Snezhnaya', @@ -112,6 +122,7 @@ export const banners = { start: '2021-04-06 18:00:00', end: '2021-04-27 15:00:00', color: '#50A3C0', + featured: ['tartaglia'], }, ], weapons: [ @@ -123,6 +134,7 @@ export const banners = { shortName: 'Amos', color: '#f54e42', timezoneDependent: true, + featured: ['aquila_favonia', 'amos_bow'], }, { name: 'Epitome Invocation', @@ -131,6 +143,7 @@ export const banners = { end: '2020-11-10 16:00:00', shortName: 'Lost Prayer', color: '#f5c242', + featured: ['lost_prayer_to_the_sacred_winds', 'wolfs_gravestone'], }, { name: 'Epitome Invocation', @@ -140,6 +153,7 @@ export const banners = { shortName: 'Skyward', color: '#f5ef42', timezoneDependent: true, + featured: ['skyward_harp', 'memory_of_dust'], }, { name: 'Epitome Invocation', @@ -148,6 +162,7 @@ export const banners = { end: '2020-12-22 15:00:00', shortName: 'Vortex', color: '#7ef542', + featured: ['vortex_vanquisher', 'the_unforged'], }, { name: 'Epitome Invocation', @@ -157,6 +172,7 @@ export const banners = { shortName: 'Summit', color: '#42ecf5', timezoneDependent: true, + featured: ['summit_shaper', 'skyward_atlas'], }, { name: 'Epitome Invocation', @@ -165,6 +181,7 @@ export const banners = { end: '2021-02-02 15:00:00', shortName: 'Amos', color: '#424ef5', + featured: ['amos_bow', 'skyward_pride'], }, { name: 'Epitome Invocation', @@ -174,6 +191,7 @@ export const banners = { shortName: 'Primordial', color: '#b042f5', timezoneDependent: true, + featured: ['primordial_jade_winged-spear', 'primordial_jade_cutter'], }, { name: 'Epitome Invocation', @@ -182,6 +200,7 @@ export const banners = { end: '2021-03-16 15:00:00', shortName: 'Homa', color: '#f542c8', + featured: ['wolfs_gravestone', 'staff_of_homa'], }, { name: 'Epitome Invocation', @@ -191,6 +210,7 @@ export const banners = { shortName: 'Elegy', color: '#f54e42', timezoneDependent: true, + featured: ['elegy_for_the_end', 'skyward_blade'], }, { name: 'Epitome Invocation', @@ -199,6 +219,7 @@ export const banners = { end: '2021-04-27 15:00:00', shortName: 'Skyward', color: '#f5c242', + featured: ['skyward_harp', 'lost_prayer_to_the_sacred_winds'], }, ], }; diff --git a/src/functions/wish.js b/src/functions/wish.js index 16b0c703..6be1fb5e 100644 --- a/src/functions/wish.js +++ b/src/functions/wish.js @@ -92,6 +92,7 @@ export function process(id) { let currentBanner = null; let grouped = false; let striped = false; + let rateUp = false; let startBanner = false; let currentBannerIndex = -1; let hasManualInput = false; @@ -137,7 +138,12 @@ export function process(id) { at: selectedBanners[currentBannerIndex].total, }; - if (item.rarity === 5) { + if (item.rarity === 5) { + if (currentBanner.featured) { + newPull.guaranteed = rateUp; + rateUp = !currentBanner.featured.includes(newPull.id); + } + selectedBanners[currentBannerIndex].legendary.push(newPull); allLegendary.push(newPull); } else if (item.rarity === 4) { diff --git a/src/functions/wishTally.js b/src/functions/wishTally.js index 5cd5464e..3d337381 100644 --- a/src/functions/wishTally.js +++ b/src/functions/wishTally.js @@ -29,7 +29,7 @@ export async function submitWishTally() { const firstFivePulls = pulls.slice(0, 5).map((e) => [e.time.toString(), e.id, e.type, e.pity, e.group === 'group']); - for (let i = banner.length - 1; i >= Math.max(banner.length - 2, 0); i--) { + for (let i = banner.length - 1; i >= Math.max(banner.length - 3, 0); i--) { const total = banner[i].total; if (total === 0) continue; @@ -42,11 +42,20 @@ export async function submitWishTally() { e.type, e.pity, e.group === 'group', + e.guaranteed, + 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); + console.log(legendaryPulls); console.log(rarePity); console.log(legendaryCount, rareCount, total); + await sendWish({ firstPulls: firstFivePulls, legendaryPulls, diff --git a/src/locales/en.json b/src/locales/en.json index 54c3aebe..64854a46 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -241,7 +241,8 @@ "roll": "#Roll", "totalThisBanner": "Total pull on this banner", "worth": "Worth", - "loading": "Loading... (If this stuck, change your server on settings page)" + "loading": "Loading... (If this stuck, change your server on settings page)", + "guaranteed": "The next 5★ is guaranteed to be the promotional character or weapon" }, "tally": { "title": "Wish Tally", @@ -426,19 +427,35 @@ "collect": [ { "title": "Visited url at paimon.moe, referer, browser, operating system, device type, visitor country", - "content": ["Paimon.moe use", "plausible.io", "(a privacy-friendly analytics) so we can see how many people use which feature, so we can prioritize what feature to implement or improve."] + "content": [ + "Paimon.moe use", + "plausible.io", + "(a privacy-friendly analytics) so we can see how many people use which feature, so we can prioritize what feature to implement or improve." + ] }, { "title": "Error message and exception from the website", - "content": ["Paimon.moe will send error and exception from the website to", "sentry.io", "so we can track what cause problem and fix it accordingly."] + "content": [ + "Paimon.moe will send error and exception from the website to", + "sentry.io", + "so we can track what cause problem and fix it accordingly." + ] }, { "title": "Wish Pity", - "content": ["Paimon.moe will save 4* pity count, 5* pity count, and 5* wish information (wish time, item name, pity count) if you check 'Submit pity for global wish tally' on Wish Auto Import or manually submit it on Help & Setting menu. Paimon.moe will aggregate the data and use it to calculate the average pity for each banner on paimon.moe users. You can check it here", "wish tally"] + "content": [ + "Paimon.moe will save 4* pity count, 5* pity count, and 5* wish information (wish time, item name, pity count) if you check 'Submit pity for global wish tally' on Wish Auto Import or manually submit it on Help & Setting menu. Paimon.moe will aggregate the data and use it to calculate the average pity for each banner on paimon.moe users. You can check it here", + "wish tally" + ] } ], "subtitleNotCollect": "What paimon.moe NOT collect", - "notCollect": ["Paimon.moe never save any password, uid, username, email, temporary keys, or feedback url. If you are interested, the project is open source and you can check the source code at", "paimon-moe-api Github", "and", "paimon-moe Github"] + "notCollect": [ + "Paimon.moe never save any password, uid, username, email, temporary keys, or feedback url. If you are interested, the project is open source and you can check the source code at", + "paimon-moe-api Github", + "and", + "paimon-moe Github" + ] }, "sync": { "message": "Your local data in this browser is conflicting with the ones stored in the Google Drive!", @@ -490,4 +507,4 @@ "hoyolab": "Hoyolab Daily Check-In Reminder", "comingsoon": "Coming Soon!" } -} +} \ No newline at end of file diff --git a/src/locales/id.json b/src/locales/id.json index ecaa691f..d2cd85d5 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -241,7 +241,8 @@ "roll": "#Roll", "totalThisBanner": "Total pull di banner ini", "worth": "Setara dengan", - "loading": "Loading... (Kalau tidak selesai-selesai, ganti server di halaman settings)" + "loading": "Loading... (Kalau tidak selesai-selesai, ganti server di halaman settings)", + "guaranteed": "5★ selanjutnya pasti karakter atau senjata promotional" }, "tally": { "title": "Perhitungan Pity Wish", diff --git a/src/routes/wish/[id].svelte b/src/routes/wish/[id].svelte index 05789d66..d77c9e26 100644 --- a/src/routes/wish/[id].svelte +++ b/src/routes/wish/[id].svelte @@ -8,7 +8,7 @@