This commit is contained in:
@@ -71,6 +71,9 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
|
||||
const doc = this.document
|
||||
context.trait = doc.itemTypes['species-trait']?.[0]
|
||||
|
||||
return context
|
||||
}
|
||||
|
||||
@@ -106,7 +109,7 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
|
||||
context.tab = context.tabs.biography
|
||||
context.deals = doc.itemTypes.deal
|
||||
context.deals.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.tarot = doc.itemTypes.tarot
|
||||
context.tarot = doc.itemTypes.tarot?.[0]
|
||||
context.enrichedBackstory = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.backstory, { async: true })
|
||||
context.enrichedAppearance = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.appearance, { async: true })
|
||||
context.enrichedScars = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.scars, { async: true })
|
||||
@@ -121,6 +124,7 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
|
||||
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.notes, { async: true })
|
||||
break
|
||||
}
|
||||
console.log("context", context)
|
||||
return context
|
||||
}
|
||||
|
||||
@@ -188,14 +192,32 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
|
||||
|
||||
async _onDrop(event) {
|
||||
if (!this.isEditable || !this.isEditMode) return
|
||||
const data = TextEditor.getDragEventData(event)
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event)
|
||||
|
||||
// Handle different data types
|
||||
switch (data.type) {
|
||||
case "Item":
|
||||
const item = await fromUuid(data.uuid)
|
||||
return super._onDropItem(item)
|
||||
if (data.type === "Item") {
|
||||
const item = await fromUuid(data.uuid)
|
||||
if (item.type === "tarot") {
|
||||
// Delete the existing tarot item
|
||||
const existingTarot = this.document.items.find(i => i.type === "tarot")
|
||||
if (existingTarot) {
|
||||
await existingTarot.delete()
|
||||
// Display info message
|
||||
ui.notifications.info(game.i18n.localize("HELLBORN.Notifications.tarotDeleted") + existingTarot.name)
|
||||
}
|
||||
}
|
||||
if (item.type === "species-trait") {
|
||||
// Check if the item is already in the actor
|
||||
const existingTrait = this.document.items.find(i => i.type === "species-trait" && i.name === item.name)
|
||||
if (existingTrait) {
|
||||
await existingTrait.delete()
|
||||
// Display info message
|
||||
ui.notifications.info(game.i18n.localize("HELLBORN.Notifications.speciesTraitDeleted")+ existingTrait.name)
|
||||
}
|
||||
}
|
||||
return super._onDropItem(item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user