From b837247b8f6190074762d8549d2fc622ee8a98bf Mon Sep 17 00:00:00 2001 From: srl <906239+srliao@users.noreply.github.com> Date: Sat, 9 Sep 2023 17:27:06 -0400 Subject: [PATCH] fix GO traveler import (#1699) --- .../Components/GOOD/parseFromGOOD.ts | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/ui/packages/ui/src/Pages/Simulator/Components/GOOD/parseFromGOOD.ts b/ui/packages/ui/src/Pages/Simulator/Components/GOOD/parseFromGOOD.ts index 0c07d47df..7e3256e16 100644 --- a/ui/packages/ui/src/Pages/Simulator/Components/GOOD/parseFromGOOD.ts +++ b/ui/packages/ui/src/Pages/Simulator/Components/GOOD/parseFromGOOD.ts @@ -60,6 +60,7 @@ export function parseFromGOOD(val: string): IGOODImport { result.characters = buildCharactersFromGOOD(data.characters, weaponBank, artifactBank); + console.log(result) return result; } @@ -98,7 +99,11 @@ function buildCharactersFromGOOD( goodArtifactBank: GOODArtifactBank ) { const result: Character[] = []; - goodChars.forEach((goodChar) => { + let travelerIdx: { [key in string]: number } = {} + goodChars.forEach((goodChar, index) => { + if (goodChar.key.startsWith("Traveler")) { + travelerIdx[goodChar.key] = index + } let char = GOODChartoSrlChar(goodChar, weaponBank[goodChar.key]); if (char === undefined) { @@ -109,5 +114,41 @@ function buildCharactersFromGOOD( result.push(char); }); + + //this code sucks, kids do not do this + for (const [goodkey, idx] of Object.entries(travelerIdx)) { + console.log("parsing ", goodkey) + const g = goodChars[idx] + travelers.forEach(ck => { + let key = goodkey + key = key.toLowerCase() + //split the string between traveler and element; if no element + key = key.replace("traveler", ck) + + console.log("adding: ", key) + + let copy: GOODCharacter = { + ...g, + talent: { + ...g.talent + }, + key: key, + } + + //weapon and artifact bank uses Traveler as key ignoring element + let char = GOODChartoSrlChar(copy, weaponBank["Traveler"]) + if (char === undefined) { + console.log(key, "not found") + //skip char + return; + } + char = equipArtifacts(char, goodArtifactBank["Traveler"]) + + result.push(char) + }) + } + return result; } + +const travelers : string[] = ["lumine", "aether"] \ No newline at end of file