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 {
|
const {
|
||||||
SchemaField, NumberField, StringField, ArrayField, BooleanField, ForeignDocumentField
|
SchemaField, NumberField, StringField, ArrayField, ForeignDocumentField
|
||||||
} = foundry.data.fields;
|
} = foundry.data.fields;
|
||||||
|
|
||||||
export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
|
export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
|
||||||
|
|
@ -114,8 +111,15 @@ export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
|
||||||
auswahlen: new ArrayField(new StringField()),
|
auswahlen: new ArrayField(new StringField()),
|
||||||
})),
|
})),
|
||||||
|
|
||||||
talente: new ArrayField ( new ForeignDocumentField(Item) ),
|
talente: new ArrayField(new SchemaField({
|
||||||
zauber: new ArrayField ( new ForeignDocumentField(Item) ),
|
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({
|
liturgien: new ArrayField(new SchemaField({
|
||||||
name: new StringField(),
|
name: new StringField(),
|
||||||
})),
|
})),
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ export async function importCharacter(actorId, file) {
|
||||||
let dom = domParser.parseFromString(xmlString, 'application/xml')
|
let dom = domParser.parseFromString(xmlString, 'application/xml')
|
||||||
|
|
||||||
let rawJson = getJsonFromXML(dom)
|
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)
|
actor.update(characterJson)
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +107,7 @@ function calculateBirthdate(json) {
|
||||||
* @param rawJson the json parsed from the Helden-Software XML
|
* @param rawJson the json parsed from the Helden-Software XML
|
||||||
* @returns {{}} a json representation of the character
|
* @returns {{}} a json representation of the character
|
||||||
*/
|
*/
|
||||||
function mapRawJson(rawJson) {
|
async function mapRawJson(rawJson) {
|
||||||
let json = {}
|
let json = {}
|
||||||
let held = rawJson.helden.held;
|
let held = rawJson.helden.held;
|
||||||
json.name = held.name
|
json.name = held.name
|
||||||
|
|
@ -251,22 +252,18 @@ function mapRawJson(rawJson) {
|
||||||
let talents = []
|
let talents = []
|
||||||
for (let talent in held.talentliste.talent) {
|
for (let talent in held.talentliste.talent) {
|
||||||
talent = held.talentliste.talent[talent]
|
talent = held.talentliste.talent[talent]
|
||||||
let talentJson = {
|
let talentItem = game.items.getName(talent.name)
|
||||||
name: talent.name,
|
if (talentItem) {
|
||||||
taw: talent.value,
|
let talentJson = {
|
||||||
probe: talent.probe.trim(),
|
talent: talentItem,
|
||||||
|
taw: talent.value,
|
||||||
|
}
|
||||||
|
talents.push(talentJson)
|
||||||
}
|
}
|
||||||
if (talent.be !== undefined) {
|
|
||||||
talentJson.be = talent.be
|
|
||||||
}
|
|
||||||
if (talent.k !== undefined) {
|
|
||||||
talentJson.komplexitaet = parseInt(talent.k)
|
|
||||||
}
|
|
||||||
talents.push(talentJson)
|
|
||||||
}
|
}
|
||||||
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]
|
spell = held.zauberliste.zauber[spell]
|
||||||
spells.push({
|
spells.push({
|
||||||
name: spell.name,
|
name: spell.name,
|
||||||
|
|
@ -276,7 +273,7 @@ function mapRawJson(rawJson) {
|
||||||
anmerkungen: spell.zauberkommentar,
|
anmerkungen: spell.zauberkommentar,
|
||||||
komplexitaet: spell.k,
|
komplexitaet: spell.k,
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
json.zauber = spells
|
json.zauber = spells
|
||||||
let combatValues = []
|
let combatValues = []
|
||||||
for (let combatValue in held.kampf.kampfwerte) {
|
for (let combatValue in held.kampf.kampfwerte) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue