diff --git a/src/module/xml-import/xml-import.mjs b/src/module/xml-import/xml-import.mjs index f203eb16..b150bcb1 100644 --- a/src/module/xml-import/xml-import.mjs +++ b/src/module/xml-import/xml-import.mjs @@ -114,13 +114,14 @@ function mapRawJson(rawJson) { json.meta.spezies = held.basis.rasse.string json.meta.kultur = held.basis.kultur.string let professions = [] - for (let ausbildung in held.basis.ausbildungen.ausbildung) { - if (ausbildung.tarnidentitaet) { - professions = [ausbildung.tarnidentitaet] + for (let profession in held.basis.ausbildungen.ausbildung) { + profession = held.basis.ausbildungen.ausbildung[profession] + if (profession.tarnidentitaet) { + professions = [profession.tarnidentitaet] break; } - let ausbildungString = ausbildung.string - professions.push(ausbildungString) + let professionString = profession.string + professions.push(professionString) } json.meta.profession = professions json.geschlecht = held.basis.geschlecht.name @@ -200,6 +201,7 @@ function mapRawJson(rawJson) { let specialAbilities = [] let liturgies = [] for (let specialAbility in held.sf.sonderfertigkeit) { + specialAbility = held.sf.sonderfertigkeit[specialAbility] if (specialAbility.name.startsWith("Liturgie:")) { liturgies.push({ name: specialAbility.name.replace("Liturgie:", "").trim(), @@ -212,12 +214,14 @@ function mapRawJson(rawJson) { let fields = Object.keys(specialAbility) if (fields.length > 1) { for (let field in fields) { + field = fields[field] if (field !== "name") { let choices = specialAbility[field] if (choices.hasOwnProperty("name")) { specialAbilityJson.auswahlen.push(choices.name) } else { for (let choice in choices.wahl) { + choice = choices.wahl[choice] specialAbilityJson.auswahlen.push(choice.value) } } @@ -231,6 +235,7 @@ function mapRawJson(rawJson) { json.liturgien = liturgies let talents = [] for (let talent in held.talentliste.talent) { + talent = held.talentliste.talent[talent] talents.push({ name: talent.name, taw: talent.value, @@ -242,6 +247,7 @@ function mapRawJson(rawJson) { json.talente = talents let spells = [] for (let spell in held.zauberliste.zauber) { + spell = held.zauberliste.zauber[spell] spells.push({ name: spell.name, rep: spell.repraesentation, @@ -254,6 +260,7 @@ function mapRawJson(rawJson) { json.zauber = spells let combatValues = [] for (let combatValue in held.kampf.kampfwerte) { + combatValue = held.kampf.kampfwerte[combatValue] combatValues.push({ name: combatValue.name, at: combatValue.attacke.value, @@ -263,6 +270,7 @@ function mapRawJson(rawJson) { json.kampfwerte = combatValues let notes = [] for (let note in held.kommentare) { + note = held.kommentare[note] if (note.hasOwnProperty("key")) { notes.push({ key: note.key,