fixed json array problem

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

View File

@ -114,7 +114,7 @@ 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) { for (let ausbildung in held.basis.ausbildungen.ausbildung) {
if (ausbildung.tarnidentitaet) { if (ausbildung.tarnidentitaet) {
professions = [ausbildung.tarnidentitaet] professions = [ausbildung.tarnidentitaet]
break; break;
@ -146,59 +146,60 @@ function mapRawJson(rawJson) {
] ]
json.titel = held.basis.rasse.aussehen.titel json.titel = held.basis.rasse.aussehen.titel
json.stand = held.basis.rasse.aussehen.stand json.stand = held.basis.rasse.aussehen.stand
let attributes = held.eigenschaften.eigenschaft
json.attribute = {} json.attribute = {}
json.attribute.mu = getAttributeJson(held.eigenschaften, "Mut") json.attribute.mu = getAttributeJson(attributes, "Mut")
json.attribute.kl = getAttributeJson(held.eigenschaften, "Klugheit") json.attribute.kl = getAttributeJson(attributes, "Klugheit")
json.attribute.in = getAttributeJson(held.eigenschaften, "Intuition") json.attribute.in = getAttributeJson(attributes, "Intuition")
json.attribute.ch = getAttributeJson(held.eigenschaften, "Charisma") json.attribute.ch = getAttributeJson(attributes, "Charisma")
json.attribute.ff = getAttributeJson(held.eigenschaften, "Fingerfertigkeit") json.attribute.ff = getAttributeJson(attributes, "Fingerfertigkeit")
json.attribute.ge = getAttributeJson(held.eigenschaften, "Gewandtheit") json.attribute.ge = getAttributeJson(attributes, "Gewandtheit")
json.attribute.ko = getAttributeJson(held.eigenschaften, "Konstitution") json.attribute.ko = getAttributeJson(attributes, "Konstitution")
json.attribute.kk = getAttributeJson(held.eigenschaften, "Körperkraft") json.attribute.kk = getAttributeJson(attributes, "Körperkraft")
json.attribute.mr = { json.attribute.mr = {
mod: filterAttribute(held.eigenschaften ,"Magieresistenz").mod mod: filterAttribute(attributes,"Magieresistenz").mod
} }
json.attribute.lep = { json.attribute.lep = {
mod: filterAttribute(held.eigenschaften ,"Lebensenergie").mod mod: filterAttribute(attributes,"Lebensenergie").mod
} }
json.attribute.aup = { json.attribute.aup = {
mod: filterAttribute(held.eigenschaften ,"Ausdauer").mod mod: filterAttribute(attributes,"Ausdauer").mod
} }
json.attribute.asp = { json.attribute.asp = {
mod: filterAttribute(held.eigenschaften ,"Astralenergie").mod mod: filterAttribute(attributes,"Astralenergie").mod
} }
json.attribute.kap = { json.attribute.kap = {
mod: filterAttribute(held.eigenschaften ,"Karmaenergie").mod mod: filterAttribute(attributes,"Karmaenergie").mod
} }
let attribute = filterAttribute(held.eigenschaften ,"Karmaenergie") let attribute = filterAttribute(attributes,"Karmaenergie")
json.attribute.at = { json.attribute.at = {
mod: attribute.mod, mod: attribute.mod,
aktuell: attribute.value aktuell: attribute.value
} }
attribute = filterAttribute(held.eigenschaften ,"at") attribute = filterAttribute(attributes,"at")
json.attribute.pa = { json.attribute.pa = {
mod: attribute.mod, mod: attribute.mod,
aktuell: attribute.value aktuell: attribute.value
} }
attribute = filterAttribute(held.eigenschaften ,"pa") attribute = filterAttribute(attributes,"pa")
json.attribute.at = { json.attribute.at = {
mod: attribute.mod, mod: attribute.mod,
aktuell: attribute.value aktuell: attribute.value
} }
attribute = filterAttribute(held.eigenschaften ,"fk") attribute = filterAttribute(attributes,"fk")
json.attribute.fk = { json.attribute.fk = {
mod: attribute.mod, mod: attribute.mod,
aktuell: attribute.value aktuell: attribute.value
} }
attribute = filterAttribute(held.eigenschaften ,"ini") attribute = filterAttribute(attributes,"ini")
json.attribute.ini = { json.attribute.ini = {
mod: attribute.mod, mod: attribute.mod,
aktuell: attribute.value aktuell: attribute.value
} }
json.attribute.so = getAttributeJson(held.eigenschaften, "Sozialstatus") json.attribute.so = getAttributeJson(attributes, "Sozialstatus")
let specialAbilities = [] let specialAbilities = []
let liturgies = [] let liturgies = []
for (let specialAbility in held.sf) { for (let specialAbility in held.sf.sonderfertigkeit) {
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(),
@ -216,7 +217,7 @@ function mapRawJson(rawJson) {
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) { for (let choice in choices.wahl) {
specialAbilityJson.auswahlen.push(choice.value) specialAbilityJson.auswahlen.push(choice.value)
} }
} }
@ -229,7 +230,7 @@ function mapRawJson(rawJson) {
json.sonderfertigkeiten = specialAbilities json.sonderfertigkeiten = specialAbilities
json.liturgien = liturgies json.liturgien = liturgies
let talents = [] let talents = []
for (let talent in held.talentliste) { for (let talent in held.talentliste.talent) {
talents.push({ talents.push({
name: talent.name, name: talent.name,
taw: talent.value, taw: talent.value,
@ -240,7 +241,7 @@ function mapRawJson(rawJson) {
} }
json.talente = talents json.talente = talents
let spells = [] let spells = []
for (let spell in held.zauberliste) { for (let spell in held.zauberliste.zauber) {
spells.push({ spells.push({
name: spell.name, name: spell.name,
rep: spell.repraesentation, rep: spell.repraesentation,
@ -252,7 +253,7 @@ function mapRawJson(rawJson) {
} }
json.zauber = spells json.zauber = spells
let combatValues = [] let combatValues = []
for (let combatValue in held.kampfwerte) { for (let combatValue in held.kampf.kampfwerte) {
combatValues.push({ combatValues.push({
name: combatValue.name, name: combatValue.name,
at: combatValue.attacke.value, at: combatValue.attacke.value,