From f47e902daaba24b02ef5896b413f08a0ba6a4dad Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Wed, 7 Sep 2022 17:25:26 +0700 Subject: [PATCH] Add weapons to reruns timeline --- src/data/banners.js | 33 +++++++++ src/routes/banners/index.svelte | 120 +++++++++++++++++++++++++++++--- src/service-worker.js | 4 +- 3 files changed, 146 insertions(+), 11 deletions(-) diff --git a/src/data/banners.js b/src/data/banners.js index 08167b63..6460f736 100644 --- a/src/data/banners.js +++ b/src/data/banners.js @@ -516,6 +516,7 @@ export const banners = { timezoneDependent: true, featured: ['aquila_favonia', 'amos_bow'], featuredRare: ['the_flute', 'the_bell', 'the_widsith', 'the_stringless', 'favonius_lance'], + version: '1.0', }, { name: 'Epitome Invocation', @@ -532,6 +533,7 @@ export const banners = { 'sacrificial_fragments', 'dragons_bane', ], + version: '1.0', }, { name: 'Epitome Invocation', @@ -543,6 +545,7 @@ export const banners = { timezoneDependent: true, featured: ['skyward_harp', 'memory_of_dust'], featuredRare: ['the_flute', 'rainslasher', 'eye_of_perception', 'rust', 'favonius_lance'], + version: '1.1', }, { name: 'Epitome Invocation', @@ -553,6 +556,7 @@ export const banners = { color: '#eae5e1', featured: ['vortex_vanquisher', 'the_unforged'], featuredRare: ['lions_roar', 'the_bell', 'favonius_codex', 'favonius_warbow', 'dragons_bane'], + version: '1.1', }, { name: 'Epitome Invocation', @@ -570,6 +574,7 @@ export const banners = { 'sacrificial_fragments', 'the_stringless', ], + version: '1.2', }, { name: 'Epitome Invocation', @@ -580,6 +585,7 @@ export const banners = { color: '#eae5e1', featured: ['amos_bow', 'skyward_pride'], featuredRare: ['sacrificial_sword', 'the_bell', 'dragons_bane', 'eye_of_perception', 'favonius_warbow'], + version: '1.2', }, { name: 'Epitome Invocation', @@ -591,6 +597,7 @@ export const banners = { timezoneDependent: true, featured: ['primordial_jade_winged-spear', 'primordial_jade_cutter'], featuredRare: ['the_flute', 'sacrificial_greatsword', 'rust', 'eye_of_perception', 'favonius_lance'], + version: '1.3', }, { name: 'Epitome Invocation', @@ -601,6 +608,7 @@ export const banners = { color: '#eae5e1', featured: ['wolfs_gravestone', 'staff_of_homa'], featuredRare: ['lithic_blade', 'lithic_spear', 'lions_roar', 'sacrificial_bow', 'the_widsith'], + version: '1.3', }, { name: 'Epitome Invocation', @@ -612,6 +620,7 @@ export const banners = { timezoneDependent: true, featured: ['elegy_for_the_end', 'skyward_blade'], featuredRare: ['the_alley_flash', 'wine_and_song', 'favonius_greatsword', 'favonius_warbow', 'dragons_bane'], + version: '1.4', }, { name: 'Epitome Invocation', @@ -622,6 +631,7 @@ export const banners = { color: '#eae5e1', featured: ['skyward_harp', 'lost_prayer_to_the_sacred_winds'], featuredRare: ['alley_hunter', 'favonius_codex', 'favonius_lance', 'sacrificial_greatsword', 'favonius_sword'], + version: '1.4', }, { name: 'Epitome Invocation', @@ -633,6 +643,7 @@ export const banners = { timezoneDependent: true, featured: ['summit_shaper', 'memory_of_dust'], featuredRare: ['lithic_blade', 'lithic_spear', 'sacrificial_bow', 'eye_of_perception', 'the_flute'], + version: '1.5', }, { name: 'Epitome Invocation', @@ -643,6 +654,7 @@ export const banners = { color: '#eae5e1', featured: ['song_of_broken_pines', 'aquila_favonia'], featuredRare: ['rust', 'sacrificial_fragments', 'dragons_bane', 'rainslasher', 'sacrificial_sword'], + version: '1.5', }, { name: 'Epitome Invocation', @@ -654,6 +666,7 @@ export const banners = { featured: ['lost_prayer_to_the_sacred_winds', 'skyward_pride'], featuredRare: ['mitternachts_waltz', 'lions_roar', 'the_bell', 'favonius_lance', 'the_widsith'], timezoneDependent: true, + version: '1.6', }, { name: 'Epitome Invocation', @@ -664,6 +677,7 @@ export const banners = { color: '#eae5e1', featured: ['freedom-sworn', 'skyward_atlas'], featuredRare: ['the_alley_flash', 'wine_and_song', 'alley_hunter', 'favonius_greatsword', 'dragons_bane'], + version: '1.6', }, { name: 'Epitome Invocation', @@ -675,6 +689,7 @@ export const banners = { featured: ['mistsplitter_reforged', 'skyward_spine'], featuredRare: ['favonius_sword', 'sacrificial_greatsword', 'favonius_lance', 'favonius_codex', 'the_stringless'], timezoneDependent: true, + version: '2.0', }, { name: 'Epitome Invocation', @@ -685,6 +700,7 @@ export const banners = { color: '#eae5e1', featured: ['thundering_pulse', 'skyward_blade'], featuredRare: ['sacrificial_sword', 'rainslasher', 'dragons_bane', 'sacrificial_fragments', 'favonius_warbow'], + version: '2.0', }, { name: 'Epitome Invocation', @@ -696,6 +712,7 @@ export const banners = { featured: ['engulfing_lightning', 'the_unforged'], featuredRare: ['lions_roar', 'the_bell', 'favonius_lance', 'the_widsith', 'sacrificial_bow'], timezoneDependent: true, + version: '2.1', }, { name: 'Epitome Invocation', @@ -706,6 +723,7 @@ export const banners = { color: '#eae5e1', featured: ['primordial_jade_cutter', 'everlasting_moonglow'], featuredRare: ['the_flute', 'favonius_greatsword', 'dragons_bane', 'favonius_codex', 'the_stringless'], + version: '2.1', }, { name: 'Epitome Invocation', @@ -717,6 +735,7 @@ export const banners = { featured: ['polar_star', 'memory_of_dust'], featuredRare: ['akuoumaru', 'favonius_sword', 'favonius_lance', 'eye_of_perception', 'rust'], timezoneDependent: true, + version: '2.2', }, { name: 'Epitome Invocation', @@ -727,6 +746,7 @@ export const banners = { color: '#eae5e1', featured: ['staff_of_homa', 'elegy_for_the_end'], featuredRare: ['wavebreakers_fin', 'mouuns_moon', 'sacrificial_sword', 'rainslasher', 'the_widsith'], + version: '2.2', }, { name: 'Epitome Invocation', @@ -738,6 +758,7 @@ export const banners = { featured: ['freedom-sworn', 'song_of_broken_pines'], featuredRare: ['wine_and_song', 'alley_hunter', 'lions_roar', 'sacrificial_greatsword', 'dragons_bane'], timezoneDependent: true, + version: '2.3', }, { name: 'Epitome Invocation', @@ -749,6 +770,7 @@ export const banners = { featured: ['redhorn_stonethresher', 'skyward_harp'], featuredRare: ['the_alley_flash', 'mitternachts_waltz', 'the_bell', 'favonius_lance', 'sacrificial_fragments'], timezoneDependent: true, + version: '2.3', }, { name: 'Epitome Invocation', @@ -760,6 +782,7 @@ export const banners = { featured: ['calamity_queller', 'primordial_jade_winged-spear'], featuredRare: ['lithic_spear', 'the_flute', 'favonius_greatsword', 'the_widsith', 'favonius_warbow'], timezoneDependent: true, + version: '2.4', }, { name: 'Epitome Invocation', @@ -770,6 +793,7 @@ export const banners = { color: '#eae5e1', featured: ['amos_bow', 'vortex_vanquisher'], featuredRare: ['lithic_blade', 'favonius_sword', 'dragons_bane', 'favonius_codex', 'sacrificial_bow'], + version: '2.4', }, { name: 'Epitome Invocation', @@ -781,6 +805,7 @@ export const banners = { featured: ['kaguras_verity', 'primordial_jade_cutter'], featuredRare: ['wavebreakers_fin', 'sacrificial_sword', 'rainslasher', 'eye_of_perception', 'the_stringless'], timezoneDependent: true, + version: '2.5', }, { name: 'Epitome Invocation', @@ -791,6 +816,7 @@ export const banners = { color: '#eae5e1', featured: ['engulfing_lightning', 'everlasting_moonglow'], featuredRare: ['akuoumaru', 'mouuns_moon', 'lions_roar', 'favonius_lance', 'sacrificial_fragments'], + version: '2.5', }, { name: 'Epitome Invocation', @@ -802,6 +828,7 @@ export const banners = { featured: ['haran_geppaku_futsu', 'elegy_for_the_end'], featuredRare: ['the_flute', 'sacrificial_greatsword', 'dragons_bane', 'the_widsith', 'rust'], timezoneDependent: true, + version: '2.6', }, { name: 'Epitome Invocation', @@ -813,6 +840,7 @@ export const banners = { featured: ['mistsplitter_reforged', 'the_unforged'], featuredRare: ['favonius_sword', 'the_bell', 'favonius_lance', 'favonius_codex', 'favonius_warbow'], timezoneDependentEnd: true, + version: '2.6', }, { name: 'Epitome Invocation', @@ -830,6 +858,7 @@ export const banners = { 'sacrificial_bow', ], timezoneDependent: true, + version: '2.7', }, { name: 'Epitome Invocation', @@ -840,6 +869,7 @@ export const banners = { color: '#eae5e1', featured: ['redhorn_stonethresher', 'memory_of_dust'], featuredRare: ['lithic_blade', 'lions_roar', 'dragons_bane', 'sacrificial_fragments', 'the_stringless'], + version: '2.7', }, { name: 'Epitome Invocation', @@ -851,6 +881,7 @@ export const banners = { featured: ['freedom-sworn', 'lost_prayer_to_the_sacred_winds'], featuredRare: ['the_alley_flash', 'mitternachts_waltz', 'rainslasher', 'favonius_lance', 'the_widsith'], timezoneDependent: true, + version: '2.8', }, { name: 'Epitome Invocation', @@ -861,6 +892,7 @@ export const banners = { color: '#eae5e1', featured: ['thundering_pulse', 'summit_shaper'], featuredRare: ['wine_and_song', 'alley_hunter', 'the_flute', 'sacrificial_greatsword', 'dragons_bane'], + version: '2.8', }, { name: 'Epitome Invocation', @@ -872,6 +904,7 @@ export const banners = { featured: ['hunters_path', 'vortex_vanquisher'], featuredRare: ['favonius_sword', 'the_bell', 'favonius_lance', 'favonius_codex', 'the_stringless'], timezoneDependent: true, + version: '3.0', }, ], }; diff --git a/src/routes/banners/index.svelte b/src/routes/banners/index.svelte index b1082d67..68ff5882 100644 --- a/src/routes/banners/index.svelte +++ b/src/routes/banners/index.svelte @@ -4,6 +4,7 @@ import { banners } from '../../data/banners'; import { characters } from '../../data/characters'; + import { weaponList } from '../../data/weaponList'; import Button from '../../components/Button.svelte'; import Icon from '../../components/Icon.svelte'; @@ -15,13 +16,19 @@ let length = 0; let versions = []; let rows = [[]]; + let rowsWep = [[]]; let names = [{ name: '', length: 0 }]; + let namesWep = [{ name: '', length: 0 }]; let hovered = -1; let __rows5; let __rows4; let __names5; let __names4; + let __rowsWep5; + let __rowsWep4; + let __namesWep5; + let __namesWep4; let sort = false; @@ -101,8 +108,81 @@ __names5 = _names5; __names4 = _names4; - rows = [..._rows5, new Array(length).fill({ l: '' }), ..._rows4]; - names = [..._names5, { name: '', length: 0 }, ..._names4]; + rows = [..._rows5, new Array(length).fill({ l: '' }), ..._rows4, new Array(length).fill({ l: '' })]; + names = [..._names5, { name: '', length: 0 }, ..._names4, { name: '', length: 0 }]; + + await processWeapons(); + } + + async function processWeapons() { + const weaponsBanners = [...banners.weapons]; + weaponsBanners.splice(8, 0, banners.weapons[7]); + + let _chars5 = {}; + let _chars4 = {}; + let _rows5 = []; + let _rows4 = []; + let _names5 = []; + let _names4 = []; + + let pos5 = 0; + let pos4 = 0; + let len = 0; + + for (const banner of weaponsBanners) { + for (const ch of Object.keys(_chars5)) { + _chars5[ch].length++; + _names5[_chars5[ch].pos].length++; + _rows5[_chars5[ch].pos][len] = { l: _chars5[ch].length, m: 15 }; + } + for (const ch of Object.keys(_chars4)) { + _chars4[ch].length++; + _names4[_chars4[ch].pos].length++; + _rows4[_chars4[ch].pos][len] = { l: _chars4[ch].length, m: 9 }; + } + + for (const char of banner.featured) { + if (_chars5[char] === undefined) { + _chars5[char] = { + pos: pos5, + length: 0, + }; + _names5[pos5] = { name: weaponList[char].name, length: 0 }; + _rows5[pos5] = [...new Array(len).fill({ l: '' }), { char, l: 0 }]; + pos5++; + } else { + _rows5[_chars5[char].pos][len] = { char, l: 0 }; + _names5[_chars5[char].pos].length = 0; + _chars5[char].length = 0; + } + } + + for (const char of banner.featuredRare) { + if (_chars4[char] === undefined) { + _chars4[char] = { + pos: pos4, + length: 0, + }; + _names4[pos4] = { name: weaponList[char].name, length: 0 }; + _rows4[pos4] = [...new Array(len).fill({ l: '' }), { char, l: 0 }]; + pos4++; + } else { + _rows4[_chars4[char].pos][len] = { char, l: 0 }; + _names4[_chars4[char].pos].length = 0; + _chars4[char].length = 0; + } + } + + len++; + } + + __rowsWep5 = _rows5; + __rowsWep4 = _rows4; + __namesWep5 = _names5; + __namesWep4 = _names4; + + rowsWep = [..._rows5, new Array(length).fill({ l: '' }), ..._rows4]; + namesWep = [..._names5, { name: '', length: 0 }, ..._names4]; await tick(); @@ -126,11 +206,15 @@ const _rows4 = [...__rows4].sort((a, b) => b[length - 1].l - a[length - 1].l); const _names5 = [...__names5].sort((a, b) => b.length - a.length); const _names4 = [...__names4].sort((a, b) => b.length - a.length); + const _rowsWep5 = [...__rowsWep5].sort((a, b) => b[length - 1].l - a[length - 1].l); + const _rowsWep4 = [...__rowsWep4].sort((a, b) => b[length - 1].l - a[length - 1].l); + const _namesWep5 = [...__namesWep5].sort((a, b) => b.length - a.length); + const _namesWep4 = [...__namesWep4].sort((a, b) => b.length - a.length); - console.log(_rows5); - - rows = [..._rows5, new Array(length).fill({ l: '' }), ..._rows4]; - names = [..._names5, { name: '', length: 0 }, ..._names4]; + rows = [..._rows5, new Array(length).fill({ l: '' }), ..._rows4, new Array(length).fill({ l: '' })]; + names = [..._names5, { name: '', length: 0 }, ..._names4, { name: '', length: 0 }]; + rowsWep = [..._rowsWep5, new Array(length).fill({ l: '' }), ..._rowsWep4]; + namesWep = [..._namesWep5, { name: '', length: 0 }, ..._namesWep4]; } function getColor(index, max) { @@ -172,7 +256,7 @@ - {#each versions as v, index} + {#each versions as v} @@ -193,7 +277,27 @@ > {/if} {/each} - + + + {/each} + {#each rowsWep as r, rowIndex} + + {#each r as col, index} + {#if col.char} + + {:else} + + {/if} + {/each} + {/each} diff --git a/src/service-worker.js b/src/service-worker.js index fc86eafb..f80ee088 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -8,11 +8,9 @@ const IMAGE_CACHE = `cacheimg${IMAGE_CACHE_VER}`; const IMAGE_URL = `${self.location.origin}/images/`; const changelog = [ - 'Add character release timeline (Database > Character Reruns)', + 'Add character & weapons release timeline (Database > Character Reruns)', 'Add checklist to achievement', 'Update achievement commission list', - 'Update wish import instruction for pc', - 'Update timeline', ]; const channel = new BroadcastChannel('paimonmoe-sw');
{v.version}{$t(names[rowIndex].name)}{$t(names[rowIndex].name)}
onHover(index)} class="cell {hovered === index ? 'hovered' : ''}"> + {col.char} + onHover(index)} + class="cell {hovered === index ? 'hovered' : ''}" + style="background: {getColor(col.l, col.m)};">{col.l}{$t(namesWep[rowIndex].name)}