Skip to content

Commit

Permalink
Merge pull request #247 from wyrmisis/fix/226-227-monster-treasure-ta…
Browse files Browse the repository at this point in the history
…ble-read-delete

fix: Read and delete treasure tables on Monster sheets
  • Loading branch information
anthonyronda authored Oct 10, 2022
2 parents 0395f84 + 9885a03 commit 5cf9622
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/module/actor/monster-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ export class OseActorSheetMonster extends OseActorSheet {

// Settings
data.config.morale = game.settings.get(game.system.id, "morale");
monsterData.details.treasure.link = TextEditor.enrichHTML(
monsterData.details.treasure.table
monsterData.details.treasure.link = await TextEditor.enrichHTML(
monsterData.details.treasure.table,
{ async: true }
);
data.isNew = this.actor.isNew();

Expand Down Expand Up @@ -221,7 +222,7 @@ export class OseActorSheetMonster extends OseActorSheet {
.index.filter((el) => el._id === data.id);
link = `@Compendium[${data.pack}.${data.id}]{${tableData[0].name}}`;
} else {
link = `@RollTable[${data.id}]`;
link = `@UUID[${data.uuid}]`;
}
const treasureTableKey = isNewerVersion(game.version, "10.264")
? "system.details.treasure.table"
Expand Down Expand Up @@ -300,6 +301,13 @@ export class OseActorSheetMonster extends OseActorSheet {
actorObject.rollAppearing({ event: ev, check: check });
});

html.find(".treasure-table a").contextmenu((ev) => {
const treasureTableKey = isNewerVersion(game.version, "10.264")
? "system.details.treasure.table"
: "data.details.treasure.table"; //v9-compatibility
this.actor.update({ [treasureTableKey]: null });
});

// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;

Expand Down

0 comments on commit 5cf9622

Please sign in to comment.