Skip to content

Commit

Permalink
cleanup showJournal function
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-man committed Dec 6, 2023
1 parent 5db505e commit 614de15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
6 changes: 0 additions & 6 deletions scripts/common/overrides.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
export default function() {


JournalEntryPage.prototype.showInJournal = function() {
let journal = this.parent;
journal.sheet.goToPage(this.id)
}


// Convert functions that move data between world and compendium to retain ID
Actors.prototype.fromCompendium = keepID(Actors.prototype.fromCompendium);
Expand Down
19 changes: 8 additions & 11 deletions scripts/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,18 +536,15 @@ export class WrathAndGloryItem extends Item {
return []
}

get Journal() {
return fromUuid(this.journal)
}

async showInJournal() {
let journal = await this.Journal

if (journal instanceof JournalEntry)
return journal.sheet.render(true)
else if (journal instanceof JournalEntryPage)
return journal.showInJournal()

let journal = await fromUuid(this.journal)
let page;
if (journal instanceof JournalEntryPage)
{
page = journal;
journal = journal.parent;
}
journal.sheet.render(true, {pageId : page?.id})
}

get AbilityType() {
Expand Down

0 comments on commit 614de15

Please sign in to comment.