Converted lots of document access to V10.
This commit is contained in:
parent
c0dd5b584a
commit
b104480a48
|
|
@ -62,7 +62,7 @@ Hooks.once("init", async () => {
|
|||
Handlebars.registerHelper("actorItemValue", (actorId: any, itemId: string, path: string) => {
|
||||
//console.log("actorItemValue", actorId, itemId, path)
|
||||
const actor = (game as Game).actors.get(actorId)
|
||||
let obj = actor.data.items.get(itemId).data.data
|
||||
let obj = actor.items.get(itemId).system
|
||||
path.split(".").forEach(p => {
|
||||
if (obj)
|
||||
obj = obj[p]
|
||||
|
|
|
|||
|
|
@ -77,11 +77,11 @@ export class M5Character extends Actor {
|
|||
spells: {}
|
||||
} as M5CharacterCalculatedData
|
||||
|
||||
const context = (this as any).data
|
||||
const context = (this as any)
|
||||
if (!context)
|
||||
return null
|
||||
|
||||
const data = context.data
|
||||
const data = (this as any).system
|
||||
if (!data)
|
||||
return null
|
||||
|
||||
|
|
@ -126,12 +126,12 @@ export class M5Character extends Actor {
|
|||
if (!skip.mods) {
|
||||
const aggregate = new M5ModAggregate(data, ret)
|
||||
|
||||
context.items?.filter(item => item.data.type === "item").forEach(item => {
|
||||
const mods = item.data.data.mods
|
||||
context.items?.filter(item => item.type === "item").forEach(item => {
|
||||
const mods = item.system.mods
|
||||
//console.log("Actor item mods", mods)
|
||||
Object.keys(mods).forEach(modIndex => {
|
||||
const mod = mods[modIndex] as M5ItemMod
|
||||
aggregate.push(mod, item.data.name)
|
||||
aggregate.push(mod, item.name)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -139,102 +139,102 @@ export class M5Character extends Actor {
|
|||
}
|
||||
|
||||
if (!skip.items) {
|
||||
context.items?.filter(item => item.data.type === "item").forEach(item => {
|
||||
context.items?.filter(item => item.type === "item").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
|
||||
let label = item.data.name
|
||||
if (item.data.data.magic) {
|
||||
let label = item.name
|
||||
if (item.system.magic) {
|
||||
label += "*"
|
||||
}
|
||||
|
||||
ret.gear.items[item.data._id] = {
|
||||
ret.gear.items[item.id] = {
|
||||
label: label,
|
||||
magic: item.data.data.magic,
|
||||
calc: item.data.data.calc
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!skip.skills) {
|
||||
context.items?.filter(item => item.data.type === "skill").forEach(item => {
|
||||
context.items?.filter(item => item.type === "skill").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
const skillMap = ret.skills[item.data.data.type]
|
||||
skillMap[item.data._id] = {
|
||||
label: item.data.name,
|
||||
fw: item.data.data.fw,
|
||||
attribute: item.data.data.attribute,
|
||||
calc: item.data.data.calc
|
||||
const skillMap = ret.skills[item.system.type]
|
||||
skillMap[item.id] = {
|
||||
label: item.name,
|
||||
fw: item.system.fw,
|
||||
attribute: item.system.attribute,
|
||||
calc: item.system.calc
|
||||
} as M5SkillCalculated
|
||||
})
|
||||
}
|
||||
|
||||
if (!skip.weapons) {
|
||||
context.items?.filter(item => item.data.type === "weapon").forEach(item => {
|
||||
context.items?.filter(item => item.type === "weapon").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
|
||||
let label = item.data.name
|
||||
if (item.data.data.magic) {
|
||||
let label = item.name
|
||||
if (item.system.magic) {
|
||||
label += "*("
|
||||
+ (item.data.data.stats.attackBonus < 0 ? "" : "+")
|
||||
+ item.data.data.stats.attackBonus + "/"
|
||||
+ (item.data.data.stats.damageBonus < 0 ? "" : "+")
|
||||
+ item.data.data.stats.damageBonus + ")"
|
||||
+ (item.system.stats.attackBonus < 0 ? "" : "+")
|
||||
+ item.system.stats.attackBonus + "/"
|
||||
+ (item.system.stats.damageBonus < 0 ? "" : "+")
|
||||
+ item.system.stats.damageBonus + ")"
|
||||
}
|
||||
|
||||
ret.gear.weapons[item.data._id] = {
|
||||
ret.gear.weapons[item.id] = {
|
||||
label: label,
|
||||
skillId: item.data.data.skillId,
|
||||
magic: item.data.data.magic,
|
||||
calc: item.data.data.calc
|
||||
skillId: item.system.skillId,
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!skip.defensiveWeapons) {
|
||||
context.items?.filter(item => item.data.type === "defensiveWeapon").forEach(item => {
|
||||
context.items?.filter(item => item.type === "defensiveWeapon").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
|
||||
let label = item.data.name
|
||||
if (item.data.data.magic) {
|
||||
let label = item.name
|
||||
if (item.system.magic) {
|
||||
label += "*("
|
||||
+ (item.data.data.stats.defenseBonus < 0 ? "" : "+")
|
||||
+ item.data.data.stats.defenseBonus + ")"
|
||||
+ (item.system.stats.defenseBonus < 0 ? "" : "+")
|
||||
+ item.system.stats.defenseBonus + ")"
|
||||
}
|
||||
|
||||
ret.gear.defensiveWeapons[item.data._id] = {
|
||||
ret.gear.defensiveWeapons[item.id] = {
|
||||
label: label,
|
||||
skillId: item.data.data.skillId,
|
||||
magic: item.data.data.magic,
|
||||
calc: item.data.data.calc
|
||||
skillId: item.system.skillId,
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!skip.armor) {
|
||||
context.items?.filter(item => item.data.type === "armor").forEach(item => {
|
||||
context.items?.filter(item => item.type === "armor").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
|
||||
let label = item.data.name
|
||||
if (item.data.data.magic) {
|
||||
let label = item.name
|
||||
if (item.system.magic) {
|
||||
label += "*"
|
||||
}
|
||||
|
||||
ret.gear.armor[item.data._id] = {
|
||||
ret.gear.armor[item.id] = {
|
||||
label: label,
|
||||
magic: item.data.data.magic,
|
||||
calc: item.data.data.calc
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!skip.spells) {
|
||||
context.items?.filter(item => item.data.type === "spell").forEach(item => {
|
||||
context.items?.filter(item => item.type === "spell").forEach(item => {
|
||||
item.prepareDerivedData()
|
||||
|
||||
ret.spells[item.data._id] = {
|
||||
label: item.data.name,
|
||||
process: "midgard5.spell-process-" + item.data.data.process,
|
||||
calc: item.data.data.calc
|
||||
ret.spells[item.id] = {
|
||||
label: item.name,
|
||||
process: "midgard5.spell-process-" + item.system.process,
|
||||
calc: item.system.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -243,13 +243,13 @@ export class M5Character extends Actor {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
const context = (this as any).data
|
||||
context.data.calc = this.derivedData({})
|
||||
const data = (this as any).system
|
||||
data.calc = this.derivedData({})
|
||||
}
|
||||
|
||||
override getRollData(): any {
|
||||
return {
|
||||
c: (this as any).data.data,
|
||||
c: (this as any).system,
|
||||
i: null,
|
||||
iType: null,
|
||||
rolls: {},
|
||||
|
|
@ -305,8 +305,8 @@ export class M5Character extends Actor {
|
|||
}
|
||||
|
||||
attribute(name: string): M5Attribute {
|
||||
const context = (this as any).data
|
||||
return context?.data?.attributes[name]
|
||||
const data = (this as any).system
|
||||
return data?.attributes[name]
|
||||
}
|
||||
|
||||
createSkill(skillName: string): Promise<M5Item> {
|
||||
|
|
@ -322,7 +322,7 @@ export class M5Character extends Actor {
|
|||
}
|
||||
|
||||
getItem(itemId: string): any {
|
||||
if (!(this as any).data?.items)
|
||||
if (!(this as any).items)
|
||||
return null
|
||||
return (this as any).getEmbeddedDocument("Item", itemId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,38 +7,40 @@ export class M5Item extends Item {
|
|||
static readonly SKILL = "skill"
|
||||
|
||||
prepareDerivedData() {
|
||||
const itemId: string = (this as any).id
|
||||
const itemType: string = (this as any).type
|
||||
const actor = (this.actor as any)
|
||||
const character = actor as M5Character
|
||||
const context = (this as any).data
|
||||
const calc = context.data.calc
|
||||
const itemData = (this as any).system
|
||||
const calc = itemData.calc
|
||||
|
||||
if (context.type === "skill") {
|
||||
calc.fw = context.data.fw
|
||||
if (itemType === "skill") {
|
||||
calc.fw = itemData.fw
|
||||
calc.bonus = 0
|
||||
|
||||
let pairs: Array<M5ModPair> = [{
|
||||
source: context.name,
|
||||
source: (this as any).name,
|
||||
mod: {
|
||||
type: M5ModType.SKILL,
|
||||
id: context._id,
|
||||
id: itemId,
|
||||
operation: M5ModOperation.SET,
|
||||
value: context.data.fw
|
||||
value: itemData.fw
|
||||
}
|
||||
}]
|
||||
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
||||
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(context._id) !== -1) {
|
||||
pairs = pairs.concat(actorCalc.skillMods[context._id])
|
||||
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(itemId) !== -1) {
|
||||
pairs = pairs.concat(actorCalc.skillMods[itemId])
|
||||
|
||||
if (context.data?.attribute && context.data?.attribute !== "") {
|
||||
if (itemData?.attribute && itemData.attribute !== "") {
|
||||
pairs.push({
|
||||
source: context.name,
|
||||
source: (this as any).name,
|
||||
mod: {
|
||||
type: M5ModType.SKILL,
|
||||
id: context._id,
|
||||
id: itemId,
|
||||
operation: M5ModOperation.ADD,
|
||||
value: actorCalc.attributes[context.data.attribute].bonus
|
||||
value: actorCalc.attributes[itemData.attribute].bonus
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -55,11 +57,11 @@ export class M5Item extends Item {
|
|||
|
||||
calc.ew = calc.fw + calc.bonus
|
||||
calc.sources = res.mods
|
||||
} else if (context.type === "weapon") {
|
||||
} else if (itemType === "weapon") {
|
||||
calc.fw = 0
|
||||
calc.bonus = 0
|
||||
calc.special = context.data.special ? 2 : 0
|
||||
calc.ew = calc.special + context.data.stats.attackBonus
|
||||
calc.special = itemData.special ? 2 : 0
|
||||
calc.ew = calc.special + itemData.stats.attackBonus
|
||||
calc.combatSkills = null
|
||||
|
||||
if (actor) {
|
||||
|
|
@ -69,21 +71,21 @@ export class M5Item extends Item {
|
|||
calc.combatSkills = actorCalc.skills.combat
|
||||
}
|
||||
|
||||
const skill = character.getItem(context.data.skillId)
|
||||
//console.log("M5Item.prepareDerivedData:weapon", context.data, skill?.data?.data)
|
||||
const skill = character.getItem(itemData.skillId)
|
||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
||||
if (skill) {
|
||||
skill.prepareDerivedData()
|
||||
const skillData = skill.data.data
|
||||
const skillData = skill.system
|
||||
calc.ew += skillData.calc.ew
|
||||
calc.bonus += skillData.calc.bonus
|
||||
calc.fw += skillData.fw
|
||||
}
|
||||
}
|
||||
} else if (context.type === "defensiveWeapon") {
|
||||
} else if (itemType === "defensiveWeapon") {
|
||||
calc.fw = 0
|
||||
calc.bonus = 0
|
||||
calc.special = context.data.special ? 2 : 0
|
||||
calc.ew = calc.special + context.data.stats.defenseBonus
|
||||
calc.special = itemData.special ? 2 : 0
|
||||
calc.ew = calc.special + itemData.stats.defenseBonus
|
||||
calc.combatSkills = null
|
||||
|
||||
if (actor) {
|
||||
|
|
@ -93,28 +95,28 @@ export class M5Item extends Item {
|
|||
calc.combatSkills = actorCalc.skills.combat
|
||||
}
|
||||
|
||||
const skill = character.getItem(context.data.skillId)
|
||||
//console.log("M5Item.prepareDerivedData:weapon", context.data, skill?.data?.data)
|
||||
const skill = character.getItem(itemData.skillId)
|
||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
||||
if (skill) {
|
||||
skill.prepareDerivedData()
|
||||
const skillData = skill.data.data
|
||||
const skillData = skill.system
|
||||
calc.ew += skillData.calc.ew
|
||||
calc.bonus += skillData.calc.bonus
|
||||
calc.fw += skillData.fw
|
||||
}
|
||||
}
|
||||
} else if (context.type === "spell") {
|
||||
calc.ew = context.data.bonus
|
||||
} else if (itemType === "spell") {
|
||||
calc.ew = itemData.bonus
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
||||
if (actorCalc) {
|
||||
calc.ew += actorCalc.stats.spellCasting.value
|
||||
}
|
||||
}
|
||||
} else if (context.type === "item") {
|
||||
} else if (itemType === "item") {
|
||||
calc.mods = {}
|
||||
Object.keys(context.data?.mods).forEach(key => {
|
||||
const mod = context.data.mods[key]
|
||||
Object.keys(itemData?.mods).forEach(key => {
|
||||
const mod = itemData.mods[key]
|
||||
const modCalc = {}
|
||||
switch (mod.type) {
|
||||
case M5ModType.ATTRIBUTE: {
|
||||
|
|
@ -139,28 +141,28 @@ export class M5Item extends Item {
|
|||
Object.keys(actorCalc.skills.general).forEach(skillId => {
|
||||
const skill = character.getItem(skillId)
|
||||
if (skill)
|
||||
modCalc[skillId] = `${category}: ${skill.data.name}`
|
||||
modCalc[skillId] = `${category}: ${skill.name}`
|
||||
})
|
||||
|
||||
category = (game as Game).i18n.localize("midgard5.language")
|
||||
Object.keys(actorCalc.skills.language).forEach(skillId => {
|
||||
const skill = character.getItem(skillId)
|
||||
if (skill)
|
||||
modCalc[skillId] = `${category}: ${skill.data.name}`
|
||||
modCalc[skillId] = `${category}: ${skill.name}`
|
||||
})
|
||||
|
||||
category = (game as Game).i18n.localize("midgard5.weapon-skill")
|
||||
Object.keys(actorCalc.skills.combat).forEach(skillId => {
|
||||
const skill = character.getItem(skillId)
|
||||
if (skill)
|
||||
modCalc[skillId] = `${category}: ${skill.data.name}`
|
||||
modCalc[skillId] = `${category}: ${skill.name}`
|
||||
})
|
||||
|
||||
category = (game as Game).i18n.localize("midgard5.innate-ability")
|
||||
Object.keys(actorCalc.skills.innate).forEach(skillId => {
|
||||
const skill = character.getItem(skillId)
|
||||
if (skill)
|
||||
modCalc[skillId] = `${category}: ${skill.data.name}`
|
||||
modCalc[skillId] = `${category}: ${skill.name}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -175,7 +177,7 @@ export class M5Item extends Item {
|
|||
|
||||
getRollData() {
|
||||
const actor = this.actor as any
|
||||
const context = (this as any).data
|
||||
const item = this as any
|
||||
|
||||
let ret: M5RollData = actor?.getRollData() ?? {
|
||||
c: null,
|
||||
|
|
@ -185,13 +187,13 @@ export class M5Item extends Item {
|
|||
res: {}
|
||||
}
|
||||
|
||||
ret.i = context.data
|
||||
ret.iType = context.type
|
||||
ret.i = item.system
|
||||
ret.iType = item.type
|
||||
return ret
|
||||
}
|
||||
|
||||
async roll() {
|
||||
const item = (this as any).data
|
||||
const item = (this as any)
|
||||
|
||||
// Initialize chat data.
|
||||
const speaker = ChatMessage.getSpeaker({ actor: this.actor })
|
||||
|
|
@ -199,11 +201,11 @@ export class M5Item extends Item {
|
|||
const label = `[${item.type}] ${item.name}`
|
||||
|
||||
// If there's no roll data, send a chat message.
|
||||
const formulaNames = item.data.rolls?.formulas ? Object.keys(item.data.rolls.formulas) : []
|
||||
const formulaNames = item.system.rolls?.formulas ? Object.keys(item.system.rolls.formulas) : []
|
||||
if (formulaNames.length > 0) {
|
||||
const rollData = this.getRollData()
|
||||
formulaNames.forEach(formulaName => {
|
||||
const formula = item.data.rolls.formulas[formulaName]
|
||||
const formula = item.system.rolls.formulas[formulaName]
|
||||
if (formula) {
|
||||
rollData.rolls[formulaName] = {
|
||||
formula: formula.formula,
|
||||
|
|
@ -224,7 +226,7 @@ export class M5Item extends Item {
|
|||
speaker: speaker,
|
||||
rollMode: rollMode,
|
||||
flavor: label,
|
||||
content: item.data.description ?? ''
|
||||
content: item.system.description ?? ''
|
||||
})
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
return Promise.resolve(super.getData(options)).then(context => {
|
||||
actor.prepareDerivedData()
|
||||
|
||||
const actorData = (actor as any).data.toObject(false)
|
||||
context.actor = actorData;
|
||||
context.data = actorData.data;
|
||||
context.actor = (actor as any).toObject(false)
|
||||
context.data = (actor as any).system
|
||||
|
||||
//console.log("Sheet Promise", context.actor, context.data)
|
||||
return context
|
||||
|
|
@ -95,7 +94,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
itemId = row.dataset["item"]
|
||||
}
|
||||
|
||||
const context = this.actor.data
|
||||
const context = this.actor as any
|
||||
const item = context.items.get(itemId)
|
||||
console.log("edit-item", item)
|
||||
item.sheet.render(true)
|
||||
|
|
@ -111,7 +110,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
itemId = row.dataset["item"]
|
||||
}
|
||||
|
||||
const context = this.actor.data
|
||||
const context = this.actor as any
|
||||
const item = context.items.get(itemId)
|
||||
item.delete()
|
||||
this.render(false)
|
||||
|
|
@ -122,10 +121,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
let skillId = row.dataset["item"]
|
||||
|
||||
const actor = this.actor as any
|
||||
const context = this.actor.data
|
||||
const data = context.data
|
||||
|
||||
const item = context.items.get(skillId) as M5Item
|
||||
const item = actor.items.get(skillId) as M5Item
|
||||
await item.roll()
|
||||
})
|
||||
|
||||
|
|
@ -134,8 +130,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
let skillName = row.dataset["skill"]
|
||||
|
||||
const actor = this.actor as M5Character
|
||||
const context = this.actor.data
|
||||
const data = context.data
|
||||
const context = this.actor as any
|
||||
const data = context.system
|
||||
|
||||
const skill = data.skills.general[skillName]
|
||||
const attribute = data.attributes[skill.attribute]
|
||||
|
|
@ -161,7 +157,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
const row = event.target.parentElement.parentElement
|
||||
let skillName = row.dataset["skill"]
|
||||
|
||||
const data = this.actor.data.data
|
||||
const data = this.actor.system
|
||||
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned
|
||||
|
||||
const character = this.actor as M5Character
|
||||
|
|
@ -182,10 +178,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
const row = event.target.parentElement.parentElement
|
||||
let itemId = row.dataset["item"]
|
||||
|
||||
const actor = this.actor as any
|
||||
const context = this.actor.data
|
||||
const data = context.data
|
||||
|
||||
const context = this.actor as any
|
||||
const item = context.items.get(itemId) as M5Item
|
||||
await item.roll()
|
||||
})
|
||||
|
|
@ -219,11 +212,11 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
const item = this.actor.items.get(li.dataset.itemId)
|
||||
|
||||
// limit transfer on personal weapons/armour/gear
|
||||
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell"].includes(item.data.type)) {
|
||||
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell"].includes(item.type)) {
|
||||
const dragData = {
|
||||
type: "Transfer",
|
||||
actorId: this.actor.id,
|
||||
data: item.data,
|
||||
data: item.toObject(false),
|
||||
tokenId: null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
get template() {
|
||||
//console.log("M5ItemSheet", this.item.data.type)
|
||||
const path = "systems/midgard5/templates/sheets/item"
|
||||
return `${path}/${this.item.data.type}.hbs`
|
||||
return `${path}/${this.item.type}.hbs`
|
||||
}
|
||||
|
||||
override getData(options?: Partial<ItemSheet.Options>): ItemSheet.Data<ItemSheet.Options> | Promise<ItemSheet.Data<ItemSheet.Options>> {
|
||||
|
|
@ -24,7 +24,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
const context = value as any
|
||||
|
||||
// Use a safe clone of the item data for further operations.
|
||||
const itemData = context.item.data
|
||||
const itemData = context.item
|
||||
|
||||
// Retrieve the roll data for TinyMCE editors.
|
||||
context.rollData = {}
|
||||
|
|
@ -35,7 +35,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
}
|
||||
|
||||
// Add the actor's data to context.data for easier access, as well as flags.
|
||||
context.data = itemData.data
|
||||
context.system = itemData.system
|
||||
context.flags = itemData.flags
|
||||
|
||||
return context
|
||||
|
|
@ -46,8 +46,8 @@ export class M5ItemSheet extends ItemSheet {
|
|||
super.activateListeners(html)
|
||||
|
||||
html.find(".add-mod").on("click", async (event) => {
|
||||
const context = this.object.data
|
||||
const mods = context.data.mods
|
||||
const context = this.object
|
||||
const mods = context.system.mods
|
||||
const modIndex = Object.keys(mods).length
|
||||
mods[modIndex.toString()] = {
|
||||
type: M5ModType.ATTRIBUTE,
|
||||
|
|
@ -72,7 +72,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
itemId = row.dataset["item"]
|
||||
}
|
||||
|
||||
const context = this.item.data
|
||||
const context = this.item
|
||||
const item = context.items.get(itemId)
|
||||
item.delete()
|
||||
this.render(false)
|
||||
|
|
@ -90,7 +90,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
rollIndex = row.dataset["roll"]
|
||||
}
|
||||
|
||||
const rolls = this.item.data.data.rolls.formulas
|
||||
const rolls = this.item.system.rolls.formulas
|
||||
rolls[rollIndex] = null
|
||||
|
||||
this.item.update({
|
||||
|
|
@ -104,7 +104,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
})
|
||||
|
||||
html.find(".roll-create").on("click", async (event) => {
|
||||
const rolls = this.item.data.data.rolls.formulas
|
||||
const rolls = this.item.system.rolls.formulas
|
||||
|
||||
const indeces = Object.keys(rolls).map(index => parseInt(index)).sort().reverse()
|
||||
const index = (indeces.find(index => !!rolls[index.toString()]) ?? -1) + 1
|
||||
|
|
@ -127,7 +127,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
})
|
||||
|
||||
// Drag & Drop
|
||||
if (["item"].includes(this.object.data?.type)) {
|
||||
if (["item"].includes(this.object.type)) {
|
||||
const itemToItemAssociation = new DragDrop({
|
||||
dragSelector: ".item",
|
||||
dropSelector: null,
|
||||
|
|
@ -177,7 +177,7 @@ export class M5ItemSheet extends ItemSheet {
|
|||
}
|
||||
|
||||
if ((itemObject.type === "mod")) {
|
||||
let mods = obj?.data?.data?.mods
|
||||
let mods = obj?.system?.mods
|
||||
if (!mods)
|
||||
mods = []
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "midgard5",
|
||||
"id": "midgard5",
|
||||
"title": "Midgard 5. Edition",
|
||||
"description": "The German RPG Midgard 5. Edition",
|
||||
"version": "1.0.0",
|
||||
"compatibility": {
|
||||
"minimum": "9",
|
||||
"minimum": "10",
|
||||
"verified": "10"
|
||||
},
|
||||
"templateVersion": 3,
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each actor.data.skills.general as |skill key|}}
|
||||
{{#each actor.system.skills.general as |skill key|}}
|
||||
<tr data-skill="{{key}}">
|
||||
<td><button class="learn-button">{{localize "midgard5.learn"}}</button></td>
|
||||
<td class="padding">{{localizeMidgard key}}</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue