diff --git a/package.json b/package.json index adf5b578..12dd0ef6 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@rollup/plugin-replace": "^2.3.4", "@rollup/plugin-url": "^5.0.0", "autoprefixer": "^10.0.1", + "chart.js": "^2.9.4", "dayjs": "^1.9.4", "dotenv": "^8.2.0", "postcss": "^8.1.2", diff --git a/src/components/Header.svelte b/src/components/Header.svelte index 45dfad2f..39f1dc77 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -9,7 +9,7 @@ } -
+
Paimon.moe diff --git a/src/components/Table/TableHeader.svelte b/src/components/Table/TableHeader.svelte index 43f69b48..8bb339c2 100644 --- a/src/components/Table/TableHeader.svelte +++ b/src/components/Table/TableHeader.svelte @@ -4,13 +4,21 @@ import Icon from '../Icon.svelte'; + export let className = ''; + export let styleList = ''; export let sort = false; export let order = false; export let align = 'left'; + export let padding = 'px-4'; - - + + {#if sort}
diff --git a/src/data/banners.js b/src/data/banners.js new file mode 100644 index 00000000..02e7f284 --- /dev/null +++ b/src/data/banners.js @@ -0,0 +1,153 @@ +export const banners = { + beginners: [ + { + name: "Beginners' Wish", + start: '2000-01-01 00:00:00', + end: '2200-01-01 00:00:00', + }, + ], + standard: [ + { + name: 'Wanderlust Invocation', + start: '2000-01-01 00:00:00', + end: '2200-01-01 00:00:00', + }, + ], + characters: [ + { + name: 'Ballad in Goblets', + shortName: 'Venti', + start: '2020-09-28 00:00:00', + end: '2020-10-18 18:00:00', + color: '#55E4B0', + }, + { + name: 'Sparkling Steps', + shortName: 'Klee', + start: '2020-10-20 18:00:00', + end: '2020-11-10 18:00:00', + color: '#CA360E', + }, + { + name: 'Farewell of Snezhnaya', + shortName: 'Tartaglia', + start: '2020-11-11 06:00:00', + end: '2020-12-01 18:00:00', + color: '#50A3C0', + }, + { + name: 'Gentry of Hermitage', + shortName: 'Zhongli', + start: '2020-12-01 18:00:00', + end: '2020-12-22 15:00:00', + color: '#D1A55C', + }, + { + name: 'Secretum Secretorum', + shortName: 'Albedo', + start: '2020-12-23 10:00:00', + end: '2021-01-12 16:00:00', + color: '#FCFE83', + }, + { + name: 'Adrift in the Harbor', + shortName: 'Ganyu', + start: '2021-01-12 18:00:00', + end: '2021-02-02 15:00:00', + color: '#6994DF', + }, + { + name: 'Invitation to Mundane Life', + shortName: 'Xiao', + start: '2021-02-03 06:00:00', + end: '2021-02-17 16:00:00', + color: '#2BE3F8', + }, + { + name: 'Dance of Lanterns', + shortName: 'Keqing', + start: '2021-02-17 18:00:00', + end: '2021-03-02 16:00:00', + color: '#AB6CD7', + }, + { + name: 'Moment of Bloom', + shortName: 'Hu Tao', + start: '2021-03-02 18:00:00', + end: '2021-03-16 15:00:00', + color: '#BF5042', + }, + { + name: 'Ballad in Goblets', + shortName: 'Venti', + start: '2021-03-17 06:00:00', + end: '2021-04-06 16:00:00', + color: '#35C297', + }, + ], + weapons: [ + { + name: 'Epitome Invocation', + start: '2020-09-28 00:00:00', + end: '2020-10-18 18:00:00', + shortName: 'Amos', + color: '#f54e42' + }, + { + name: 'Epitome Invocation', + start: '2020-10-20 18:00:00', + end: '2020-11-10 18:00:00', + shortName: 'WGS', + color: '#f5c242' + }, + { + name: 'Epitome Invocation', + start: '2020-11-11 06:00:00', + end: '2020-12-01 18:00:00', + shortName: 'Skyward', + color: '#f5ef42' + }, + { + name: 'Epitome Invocation', + start: '2020-12-01 18:00:00', + end: '2020-12-22 15:00:00', + shortName: 'Vortex', + color: '#7ef542' + }, + { + name: 'Epitome Invocation', + start: '2020-12-23 10:00:00', + end: '2021-01-12 16:00:00', + shortName: 'Summit', + color: '#42ecf5' + }, + { + name: 'Epitome Invocation', + start: '2021-01-12 18:00:00', + end: '2021-02-02 15:00:00', + shortName: 'Amos', + color: '#424ef5' + }, + { + name: 'Epitome Invocation', + start: '2021-02-03 06:00:00', + end: '2021-02-23 16:00:00', + shortName: 'Primordial', + color: '#b042f5' + }, + { + name: 'Epitome Invocation', + start: '2021-02-23 18:00:00', + end: '2021-03-16 15:00:00', + shortName: 'Homa', + color: '#f542c8' + }, + { + name: 'Epitome Invocation', + start: '2021-03-17 11:00:00', + end: '2021-04-06 16:00:00', + shortName: 'Elegy', + color: '#f54e42' + }, + ], +}; diff --git a/src/data/weaponList.js b/src/data/weaponList.js index 2cc7aa94..09d2952c 100644 --- a/src/data/weaponList.js +++ b/src/data/weaponList.js @@ -1071,7 +1071,7 @@ export const weaponList = { atk: 42, secondary: 'Elemental Mastery', type: weapons.sword, - source: 'forgingnorthlander sword prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -1130,7 +1130,7 @@ export const weaponList = { atk: 44, secondary: 'Physical DMG Bonus', type: weapons.sword, - source: 'adventure rank 10 rewardforging:northlander sword prototype x1crystal chunk x50white iron chunk x50', + source: 'adventure rank 10 reward, forging', ascension: [ { items: [ @@ -1307,7 +1307,7 @@ export const weaponList = { atk: 42, secondary: 'ATK', type: weapons.bow, - source: 'forgingnorthlander bow prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -1602,7 +1602,7 @@ export const weaponList = { atk: 44, secondary: 'Physical DMG Bonus', type: weapons.polearm, - source: 'forgingnorthlander polearm prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -2664,7 +2664,7 @@ export const weaponList = { atk: 42, secondary: 'Energy Recharge', type: weapons.polearm, - source: 'forgingnorthlander polearm prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -2723,7 +2723,7 @@ export const weaponList = { atk: 42, secondary: 'DEF', type: weapons.claymore, - source: 'forgingnorthlander claymore prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -2841,7 +2841,7 @@ export const weaponList = { atk: 41, secondary: 'Physical DMG Bonus', type: weapons.bow, - source: 'forgingnorthlander bow prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -3313,7 +3313,7 @@ export const weaponList = { atk: 44, secondary: 'Elemental Mastery', type: weapons.catalyst, - source: 'forgingnorthlander catalyst prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ @@ -3903,7 +3903,7 @@ export const weaponList = { atk: 44, secondary: 'ATK', type: weapons.claymore, - source: 'forgingnorthlander claymore prototype x1crystal chunk x50white iron chunk x50', + source: 'forging', ascension: [ { items: [ diff --git a/src/locales/en.json b/src/locales/en.json index 40682bc0..1723599c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -127,6 +127,24 @@ "Or you can add or edit the table manually." ] } + }, + "types": { + "beginners": "Beginners' Wish", + "standard": "Standard", + "character-event": "Character Event", + "weapon-event": "Weapon Event" + }, + "detail": { + "weapon": "Weapon", + "character": "Character", + "time": "Time", + "pity": "Pity", + "name": "Name", + "type": "Type", + "banner": "Banner", + "roll": "#Roll", + "totalThisBanner": "Total pull on this banner", + "worth": "Worth" } }, "calculator": { diff --git a/src/locales/id.json b/src/locales/id.json index 342101eb..3f18e990 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -127,6 +127,24 @@ "Atau kamu bisa menambahkan atau mengedit tabel nya secara manual." ] } + }, + "types": { + "beginners": "Beginners' Wish", + "standard": "Standard", + "character-event": "Event Karakter", + "weapon-event": "Event Senjata" + }, + "detail": { + "weapon": "Senjata", + "character": "Karakter", + "time": "Waktu", + "pity": "Pity", + "name": "Nama", + "type": "Tipe", + "banner": "Banner", + "roll": "#Roll", + "totalThisBanner": "Total pull di banner ini", + "worth": "Setara dengan" } }, "calculator": { diff --git a/src/routes/wish/[id].svelte b/src/routes/wish/[id].svelte new file mode 100644 index 00000000..355eacff --- /dev/null +++ b/src/routes/wish/[id].svelte @@ -0,0 +1,654 @@ + + + + +
+
+ + + +

+ Wish Counter + {$t(`wish.types.${id}`)} +

+
+ {#if loading} +
Loading...
+ {:else} +
+
+
+ + + sort('time')} + sort={sortBy === 'time'} + order={sortOrder} + align="left" + > + {$t('wish.detail.time')} +
+ + sort('pity')} + sort={sortBy === 'pity'} + order={sortOrder} + align="center" + padding="px-2" + > + {$t('wish.detail.pity')} + + sort('name')} + sort={sortBy === 'name'} + order={sortOrder} + align="left" + > + {$t('wish.detail.name')} + + sort('rare')} + sort={sortBy === 'rare'} + order={sortOrder} + align="center" + padding="px-2" + > + + + sort('type')} + sort={sortBy === 'type'} + order={sortOrder} + align="left" + > + {$t('wish.detail.type')} + + + {$t('wish.detail.roll')} + + + {$t('wish.detail.banner')} + +
+ {#each sorted as pull} + + + + + + + + {#if sortBy === 'time' && ((pull.end && !sortOrder) || (pull.start && sortOrder))} + + + {/if} + + + {/each} +
+ {pull.formattedTime} + {#if sortBy === 'time' && (sortOrder ? pull.group === 'start' : pull.group === 'end')} +
x10
+ {/if} +
+ + {pull.pity} + + + {pull.name} + {pull.name} + {pull.rarity} + {$t(`wish.detail.${pull.type}`)} + + {pull.at} + + openDetail(pull.banner)} + class="h-8 inline cursor-pointer" + src={pull.banner.image} + alt={pull.banner.name} + /> +
+
+
+
+
+
+

Total

+

{total}

+

5 Pity

+

{legendary}

+

4 Pity

+

{rare}

+
+
+ +
+
+ {#if id === 'character-event' || id === 'weapon-event'} + + {/if} +
+
+ {/if} +
+ + diff --git a/src/routes/wish/_counter.svelte b/src/routes/wish/_counter.svelte index b350c6fb..00ba94ec 100644 --- a/src/routes/wish/_counter.svelte +++ b/src/routes/wish/_counter.svelte @@ -3,7 +3,7 @@ import { onMount, getContext } from 'svelte'; import { slide } from 'svelte/transition'; - import { mdiPencil, mdiStar, mdiChevronDown } from '@mdi/js'; + import { mdiPencil, mdiStar, mdiChevronDown, mdiTableOfContents } from '@mdi/js'; import debounce from 'lodash/debounce'; const { open: openModal, close: closeModal } = getContext('simple-modal'); @@ -245,13 +245,18 @@
-
-

{name}

+
+

{name}

{#if manualInput} {/if} + + +
+ import { t } from 'svelte-i18n'; + + import dayjs from 'dayjs'; + import Icon from '../../components/Icon.svelte'; + import { mdiStar } from '@mdi/js'; + + let numberFormat = Intl.NumberFormat('en', { + maximumFractionDigits: 1, + minimumFractionDigits: 0, + }); + + export let banner; + + function calculateColor(percentage) { + const hue = percentage * 120; + return `color: hsl(${hue}, 100%, 60%);`; + } + + const legendaryPity = banner.legendary.reduce((prev, next) => { + prev += next.pity; + return prev; + }, 0); + + let rarePity = 0; + let rarePityCharacter = 0; + let rarePityWeapon = 0; + let rareTotal = banner.rare.character.length + banner.rare.weapon.length; + + for (let item of banner.rare.character) { + rarePity += item.pity; + rarePityCharacter += item.pity; + } + for (let item of banner.rare.weapon) { + rarePity += item.pity; + rarePityWeapon += item.pity; + } + + +
+ {banner.name} +

{banner.name}

+

+ + {dayjs.unix(banner.start).format('ddd, D MMM YYYY HH:mm')} + - + + {dayjs.unix(banner.end).format('ddd, D MMM YYYY HH:mm')} +

+

+ {$t('wish.detail.totalThisBanner')} + {banner.total} +

+

+ {$t('wish.detail.worth')} + primogem + {banner.total * 160} +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RarityTotalPercentPity AVG
+ 5 + + {numberFormat.format(banner.legendary.length)} + + {numberFormat.format((banner.legendary.length / banner.total) * 100)}% + + {banner.legendary.length ? numberFormat.format(legendaryPity / banner.legendary.length) : 0} +
+ 4 + + {numberFormat.format(rareTotal)} + + {numberFormat.format((rareTotal / banner.total) * 100)}% + + {rareTotal > 0 ? numberFormat.format(rarePity / rareTotal) : 0} +
+ └ Character + + {numberFormat.format(banner.rare.character.length)} + + {numberFormat.format((banner.rare.character.length / banner.total) * 100)}% + + {rareTotal > 0 ? numberFormat.format(rarePityCharacter / rareTotal) : 0} +
+ └ Weapon + + {numberFormat.format(banner.rare.weapon.length)} + + {numberFormat.format((banner.rare.weapon.length / banner.total) * 100)}% + + {rareTotal > 0 ? numberFormat.format(rarePityWeapon / rareTotal) : 0} +
+
+ {#each banner.legendary as pull} + {pull.name} {pull.pity} + {/each} +
+
+ + diff --git a/static/images/banners/Adrift in the Harbor 2021-01-12.png b/static/images/banners/Adrift in the Harbor 2021-01-12.png new file mode 100644 index 00000000..e5513729 Binary files /dev/null and b/static/images/banners/Adrift in the Harbor 2021-01-12.png differ diff --git a/static/images/banners/Ballad in Goblets 2020-09-28.png b/static/images/banners/Ballad in Goblets 2020-09-28.png new file mode 100644 index 00000000..58927f6e Binary files /dev/null and b/static/images/banners/Ballad in Goblets 2020-09-28.png differ diff --git a/static/images/banners/Ballad in Goblets 2021-03-17.png b/static/images/banners/Ballad in Goblets 2021-03-17.png new file mode 100644 index 00000000..22c25751 Binary files /dev/null and b/static/images/banners/Ballad in Goblets 2021-03-17.png differ diff --git a/static/images/banners/Beginners' Wish 2000-01-01.png b/static/images/banners/Beginners' Wish 2000-01-01.png new file mode 100644 index 00000000..041f6b3c Binary files /dev/null and b/static/images/banners/Beginners' Wish 2000-01-01.png differ diff --git a/static/images/banners/Dance of Lanterns 2021-02-17.png b/static/images/banners/Dance of Lanterns 2021-02-17.png new file mode 100644 index 00000000..15d257a0 Binary files /dev/null and b/static/images/banners/Dance of Lanterns 2021-02-17.png differ diff --git a/static/images/banners/Epitome Invocation 2020-09-28.png b/static/images/banners/Epitome Invocation 2020-09-28.png new file mode 100644 index 00000000..23940480 Binary files /dev/null and b/static/images/banners/Epitome Invocation 2020-09-28.png differ diff --git a/static/images/banners/Epitome Invocation 2020-10-20.png b/static/images/banners/Epitome Invocation 2020-10-20.png new file mode 100644 index 00000000..3524a6e5 Binary files /dev/null and b/static/images/banners/Epitome Invocation 2020-10-20.png differ diff --git a/static/images/banners/Epitome Invocation 2020-11-11.png b/static/images/banners/Epitome Invocation 2020-11-11.png new file mode 100644 index 00000000..655e0447 Binary files /dev/null and b/static/images/banners/Epitome Invocation 2020-11-11.png differ diff --git a/static/images/banners/Epitome Invocation 2020-12-01.png b/static/images/banners/Epitome Invocation 2020-12-01.png new file mode 100644 index 00000000..a3daf81c Binary files /dev/null and b/static/images/banners/Epitome Invocation 2020-12-01.png differ diff --git a/static/images/banners/Epitome Invocation 2020-12-23.png b/static/images/banners/Epitome Invocation 2020-12-23.png new file mode 100644 index 00000000..6807c68f Binary files /dev/null and b/static/images/banners/Epitome Invocation 2020-12-23.png differ diff --git a/static/images/banners/Epitome Invocation 2021-01-12.png b/static/images/banners/Epitome Invocation 2021-01-12.png new file mode 100644 index 00000000..9374b76a Binary files /dev/null and b/static/images/banners/Epitome Invocation 2021-01-12.png differ diff --git a/static/images/banners/Epitome Invocation 2021-02-03.png b/static/images/banners/Epitome Invocation 2021-02-03.png new file mode 100644 index 00000000..ba40922f Binary files /dev/null and b/static/images/banners/Epitome Invocation 2021-02-03.png differ diff --git a/static/images/banners/Epitome Invocation 2021-02-23.png b/static/images/banners/Epitome Invocation 2021-02-23.png new file mode 100644 index 00000000..d5363231 Binary files /dev/null and b/static/images/banners/Epitome Invocation 2021-02-23.png differ diff --git a/static/images/banners/Epitome Invocation 2021-03-17.png b/static/images/banners/Epitome Invocation 2021-03-17.png new file mode 100644 index 00000000..e7de80f9 Binary files /dev/null and b/static/images/banners/Epitome Invocation 2021-03-17.png differ diff --git a/static/images/banners/Farewell of Snezhnaya 2020-11-11.png b/static/images/banners/Farewell of Snezhnaya 2020-11-11.png new file mode 100644 index 00000000..1dd97dd0 Binary files /dev/null and b/static/images/banners/Farewell of Snezhnaya 2020-11-11.png differ diff --git a/static/images/banners/Gentry of Hermitage 2020-12-01.png b/static/images/banners/Gentry of Hermitage 2020-12-01.png new file mode 100644 index 00000000..a60b638c Binary files /dev/null and b/static/images/banners/Gentry of Hermitage 2020-12-01.png differ diff --git a/static/images/banners/Invitation to Mundane Life 2021-02-03.png b/static/images/banners/Invitation to Mundane Life 2021-02-03.png new file mode 100644 index 00000000..b0027e83 Binary files /dev/null and b/static/images/banners/Invitation to Mundane Life 2021-02-03.png differ diff --git a/static/images/banners/Moment of Bloom 2021-03-02.png b/static/images/banners/Moment of Bloom 2021-03-02.png new file mode 100644 index 00000000..5ba76a9b Binary files /dev/null and b/static/images/banners/Moment of Bloom 2021-03-02.png differ diff --git a/static/images/banners/Secretum Secretorum 2020-12-23.png b/static/images/banners/Secretum Secretorum 2020-12-23.png new file mode 100644 index 00000000..67fbb10b Binary files /dev/null and b/static/images/banners/Secretum Secretorum 2020-12-23.png differ diff --git a/static/images/banners/Sparkling Steps 2020-10-20.png b/static/images/banners/Sparkling Steps 2020-10-20.png new file mode 100644 index 00000000..6372edae Binary files /dev/null and b/static/images/banners/Sparkling Steps 2020-10-20.png differ diff --git a/static/images/banners/Wanderlust Invocation 2000-01-01.png b/static/images/banners/Wanderlust Invocation 2000-01-01.png new file mode 100644 index 00000000..e333ff05 Binary files /dev/null and b/static/images/banners/Wanderlust Invocation 2000-01-01.png differ diff --git a/yarn.lock b/yarn.lock index 4319cab8..15786df2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1163,6 +1163,29 @@ chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2: ansi-styles "^4.1.0" supports-color "^7.1.0" +chart.js@^2.9.4: + version "2.9.4" + resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.9.4.tgz#0827f9563faffb2dc5c06562f8eb10337d5b9684" + integrity sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A== + dependencies: + chartjs-color "^2.1.0" + moment "^2.10.2" + +chartjs-color-string@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz#1df096621c0e70720a64f4135ea171d051402f71" + integrity sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A== + dependencies: + color-name "^1.0.0" + +chartjs-color@^2.1.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.4.1.tgz#6118bba202fe1ea79dd7f7c0f9da93467296c3b0" + integrity sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w== + dependencies: + chartjs-color-string "^0.6.0" + color-convert "^1.9.3" + clean-css@^4.2.1: version "4.2.3" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78" @@ -1170,7 +1193,7 @@ clean-css@^4.2.1: dependencies: source-map "~0.6.0" -color-convert@^1.9.0, color-convert@^1.9.1: +color-convert@^1.9.0, color-convert@^1.9.1, color-convert@^1.9.3: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== @@ -1874,6 +1897,11 @@ minimist@^1.1.1, minimist@^1.2.5: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +moment@^2.10.2: + version "2.29.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" + integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + mri@^1.1.0: version "1.1.6" resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6"