import talents
Pull Request Check / testing (pull_request) Successful in 17s
Details
Pull Request Check / testing (pull_request) Successful in 17s
Details
parent
b21ba191d8
commit
5167d5e042
|
|
@ -1,8 +1,5 @@
|
|||
import {SkillDataModel} from "./skill.mjs";
|
||||
import {SpellDataModel} from "./spell.mjs";
|
||||
|
||||
const {
|
||||
SchemaField, NumberField, StringField, ArrayField, BooleanField, ForeignDocumentField
|
||||
SchemaField, NumberField, StringField, ArrayField, ForeignDocumentField
|
||||
} = foundry.data.fields;
|
||||
|
||||
export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
|
||||
|
|
@ -114,8 +111,15 @@ export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
|
|||
auswahlen: new ArrayField(new StringField()),
|
||||
})),
|
||||
|
||||
talente: new ArrayField ( new ForeignDocumentField(Item) ),
|
||||
zauber: new ArrayField ( new ForeignDocumentField(Item) ),
|
||||
talente: new ArrayField(new SchemaField({
|
||||
talent: new ForeignDocumentField(Item),
|
||||
taw: new NumberField({integer: true, required: true}),
|
||||
})
|
||||
),
|
||||
zauber: new ArrayField(new SchemaField({
|
||||
talent: new ForeignDocumentField(Item),
|
||||
zfw: new NumberField({integer: true, required: true}),
|
||||
})),
|
||||
liturgien: new ArrayField(new SchemaField({
|
||||
name: new StringField(),
|
||||
})),
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ export async function importCharacter(actorId, file) {
|
|||
let dom = domParser.parseFromString(xmlString, 'application/xml')
|
||||
|
||||
let rawJson = getJsonFromXML(dom)
|
||||
let characterJson = mapRawJson(rawJson)
|
||||
//for some reason this await is necessary, even if Webstorm thinks it is obsolete
|
||||
let characterJson = await mapRawJson(rawJson)
|
||||
|
||||
actor.update(characterJson)
|
||||
}
|
||||
|
|
@ -106,7 +107,7 @@ function calculateBirthdate(json) {
|
|||
* @param rawJson the json parsed from the Helden-Software XML
|
||||
* @returns {{}} a json representation of the character
|
||||
*/
|
||||
function mapRawJson(rawJson) {
|
||||
async function mapRawJson(rawJson) {
|
||||
let json = {}
|
||||
let held = rawJson.helden.held;
|
||||
json.name = held.name
|
||||
|
|
@ -251,22 +252,18 @@ function mapRawJson(rawJson) {
|
|||
let talents = []
|
||||
for (let talent in held.talentliste.talent) {
|
||||
talent = held.talentliste.talent[talent]
|
||||
let talentItem = game.items.getName(talent.name)
|
||||
if (talentItem) {
|
||||
let talentJson = {
|
||||
name: talent.name,
|
||||
talent: talentItem,
|
||||
taw: talent.value,
|
||||
probe: talent.probe.trim(),
|
||||
}
|
||||
if (talent.be !== undefined) {
|
||||
talentJson.be = talent.be
|
||||
}
|
||||
if (talent.k !== undefined) {
|
||||
talentJson.komplexitaet = parseInt(talent.k)
|
||||
}
|
||||
talents.push(talentJson)
|
||||
}
|
||||
}
|
||||
json.talente = talents
|
||||
let spells = []
|
||||
for (let spell in held.zauberliste.zauber) {
|
||||
/*for (let spell in held.zauberliste.zauber) {
|
||||
spell = held.zauberliste.zauber[spell]
|
||||
spells.push({
|
||||
name: spell.name,
|
||||
|
|
@ -276,7 +273,7 @@ function mapRawJson(rawJson) {
|
|||
anmerkungen: spell.zauberkommentar,
|
||||
komplexitaet: spell.k,
|
||||
})
|
||||
}
|
||||
}*/
|
||||
json.zauber = spells
|
||||
let combatValues = []
|
||||
for (let combatValue in held.kampf.kampfwerte) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue