Skip to content

Commit

Permalink
fix GO traveler import (#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
srliao authored Sep 9, 2023
1 parent 278c4c2 commit b837247
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function parseFromGOOD(val: string): IGOODImport {

result.characters = buildCharactersFromGOOD(data.characters, weaponBank, artifactBank);

console.log(result)
return result;
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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"]

0 comments on commit b837247

Please sign in to comment.