Item ehnance, fixes on acto sheet

This commit is contained in:
2026-03-08 10:42:36 +01:00
parent 8f7f0169e4
commit e9abefd90d
22 changed files with 508 additions and 68 deletions

View File

@@ -95,6 +95,13 @@ export default class OathHammerActorSheet extends HandlebarsApplicationMixin(fou
async _onDropItem(item) {
const itemData = item.toObject()
// Lineage and class are unique: replace any existing item of the same type
if (item.type === "lineage" || item.type === "class") {
const existing = this.document.itemTypes[item.type]
if (existing.length > 0) {
await this.document.deleteEmbeddedDocuments("Item", existing.map(i => i.id))
}
}
await this.document.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
}