Skip to content

Commit

Permalink
Fix endoftheround item
Browse files Browse the repository at this point in the history
  • Loading branch information
juanferrer committed Jan 11, 2024
1 parent dec0d2b commit 9aab73f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/module/item/sheets/base-item-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class DLBaseItemSheet extends ItemSheet {

data.effects = prepareActiveEffectCategories(this.document.effects, true, true)

if (data.item.type === 'weapon' || data.item.type === 'spell' || data.item.type === 'talent') this._prepareDamageTypes(data)
if (data.item.type === 'weapon' || data.item.type === 'spell' || data.item.type === 'talent' || data.item.type === 'endoftheround') this._prepareDamageTypes(data)

this.sectionStates = this.sectionStates || new Map()

Expand Down
7 changes: 6 additions & 1 deletion src/module/item/sheets/role-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class DLRoleSheet extends DLBaseItemSheet {
if (group === 'talent') roleData.system.talents.push(levelItem)
else if (group === 'weapon') roleData.system.weapons.push(levelItem)
else if (group === 'spell') roleData.system.spells.push(levelItem)
else if (group === 'endoftheround') roleData.system.endOfRound.push(levelItem)
else return
await this.item.update(roleData, {diff: false}).then(_ => this.render)
}
Expand All @@ -124,6 +125,7 @@ export default class DLRoleSheet extends DLBaseItemSheet {
if (itemGroup === 'talent') itemData.system.talents.splice(itemIndex, 1)
else if (itemGroup === 'weapon') itemData.system.weapons.splice(itemIndex, 1)
else if (itemGroup === 'spell') itemData.system.spells.splice(itemIndex, 1)
else if (itemGroup === 'endoftheround') itemData.system.endOfRound.splice(itemIndex, 1)
await Item.updateDocuments([itemData], {parent: this.actor}).then(_ => this.render())
}

Expand Down Expand Up @@ -152,6 +154,8 @@ export default class DLRoleSheet extends DLBaseItemSheet {
nestedItemData = roleData.weapons[itemIndex]
else if (itemGroup === 'spell')
nestedItemData = roleData.spells[itemIndex]
else if (itemGroup === 'endoftheround')
nestedItemData = roleData.endOfRound[itemIndex]
else return

let selected = nestedItemData.selected = !nestedItemData.selected
Expand Down Expand Up @@ -181,7 +185,8 @@ export default class DLRoleSheet extends DLBaseItemSheet {
const nestedData =
roleData.talents.find(i => i._id === itemId) ??
roleData.weapons.find(i => i._id === itemId) ??
roleData.spells.find(i => i._id === itemId)
roleData.spells.find(i => i._id === itemId) ??
roleData.endOfRound.find(i => i._id === itemId)
await getNestedDocument(nestedData).then(d => {
if (d.sheet) d.sheet.render(true)
else ui.notifications.warn('The item is not present in the game and cannot be edited.')
Expand Down

0 comments on commit 9aab73f

Please sign in to comment.