55 lines
2.1 KiB
JavaScript
55 lines
2.1 KiB
JavaScript
export default {
|
|
_prepareContext: (context) => {
|
|
|
|
const actorData = context.document
|
|
context.spells = []
|
|
context.system = actorData.system
|
|
context.flags = actorData.flags
|
|
context.derived = context.document.system
|
|
context.originalName = actorData.name
|
|
context.name = context.derived.name ?? actorData.name
|
|
context.effects = actorData.effects ?? []
|
|
|
|
const cleanUpMerkmal = (merkmale) => {
|
|
return merkmale.split(",").map((merkmal) => merkmal.trim())
|
|
}
|
|
|
|
|
|
Object.values(actorData.items).forEach((item, index) => {
|
|
if (item.type === "Spell") {
|
|
const eigenschaften = item.system.probe;
|
|
const werte = [
|
|
{name: eigenschaften[0], value: this.prepareEigenschaftRoll(actorData, eigenschaften[0])},
|
|
{name: eigenschaften[1], value: this.prepareEigenschaftRoll(actorData, eigenschaften[1])},
|
|
{name: eigenschaften[2], value: this.prepareEigenschaftRoll(actorData, eigenschaften[2])}
|
|
]
|
|
context.spells.push({
|
|
id: item._id,
|
|
name: item.name,
|
|
zfw: item.system.zfw,
|
|
hauszauber: item.system.hauszauber,
|
|
merkmal: cleanUpMerkmal(item.system.merkmal),
|
|
rollEigenschaft1: werte[0].value,
|
|
rollEigenschaft2: werte[1].value,
|
|
rollEigenschaft3: werte[2].value,
|
|
eigenschaft1: werte[0].name,
|
|
eigenschaft2: werte[1].name,
|
|
eigenschaft3: werte[2].name,
|
|
})
|
|
}
|
|
})
|
|
context.hasSpells = context.spells.length > 0
|
|
|
|
return context
|
|
},
|
|
_onRender: (context, options) => {
|
|
|
|
},
|
|
_getTabConfig: (group, thisObject) => {
|
|
const hasSpells = thisObject.document.items.filter(p => p.type === "Spell").length > 0 ?? false
|
|
if (hasSpells) {
|
|
group.tabs.push({id: "spells", group: "sheet", label: "Zauber"})
|
|
}
|
|
},
|
|
template: `systems/DSA_4-1/templates/actor/character/tab-spells.hbs`
|
|
} |