Factoring

This commit is contained in:
Vlyan
2021-07-02 09:56:16 +02:00
parent de449ab58e
commit 043d7442e9
3 changed files with 115 additions and 129 deletions

View File

@@ -171,7 +171,28 @@ export class BaseSheetL5r5e extends ActorSheet {
// Check item type and subtype
const item = await game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
if (!item || item.documentName !== "Item" || item.data.type === "property") {
if (!item || !["Item", "JournalEntry"].includes(item.documentName) || item.data.type === "property") {
return;
}
// Specific curriculum journal drop
if (item.documentName === "JournalEntry") {
// npc does not have this
if (!this.actor.data.data.identity?.school_curriculum_journal) {
return;
}
this.actor.data.data.identity.school_curriculum_journal = {
id: item.data._id,
name: item.data.name,
pack: item.pack || null,
};
await this.actor.update({
data: {
identity: {
school_curriculum_journal: this.actor.data.data.identity.school_curriculum_journal,
},
},
});
return;
}
@@ -513,6 +534,9 @@ export class BaseSheetL5r5e extends ActorSheet {
* @private
*/
_switchSubItemCurriculum(event) {
event.preventDefault();
event.stopPropagation();
const itemId = $(event.currentTarget).data("item-id");
const item = this.actor.items.get(itemId);
if (item.type !== "item") {