fixed another array problem

pull/13/head
Jendrik 2025-09-25 23:26:05 +02:00
parent 9e7428d589
commit fc83a83de9
1 changed files with 13 additions and 5 deletions

View File

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