Skip to content

Commit

Permalink
fix: 🐛 Party sheet character and reference links
Browse files Browse the repository at this point in the history
Fixes #427
  • Loading branch information
aMediocreDad committed Jul 22, 2024
1 parent 8b4fe2b commit f697495
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-walls-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"forbidden-lands": patch
---

Solved a regression in initial v12 update where party sheets would not link to character and reference sheets.
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"FLPS.PARTY.HINT_ASSIGN": "Drag & drop characters to assign them to the desired travel activities.",
"FLPS.PARTY.MEMBERS": "Party Members",
"FLPS.PARTY.NAME": "Party Name",
"FLPS.PARTY.OPEN_CHARACTER_SHEET": "Open character sheet",
"FLPS.PARTY.RANDOM_ENCOUNTERS": "Random Encounters",
"FLPS.SETTINGS.ALLOW_PUSH": "Allow Unlimited Pushed Rolls",
"FLPS.SETTINGS.ALLOW_PUSH_HINT": "If your character is a Dwarf, or maybe your GM allows an unlimited number of pushed rolls. Or perhaps you are a GM who wants to be able to push this monster's rolls; check this setting to display a push button on almost any roll.",
Expand Down
9 changes: 6 additions & 3 deletions src/actor/party/party-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ export class ForbiddenLandsPartySheet extends ActorSheet {

getTravelActions() {
const travelActions = TravelActionsConfig;
// TODO: This should be moved to content modules to register
const journal = game.journal.getName("Journey Reference");
for (const action of Object.values(travelActions)) {
action.displayJournalEntry =
!!action.journalEntryName &&
!!game.journal.getName(action.journalEntryName);
if (journal)
action.journalLink = journal.pages.getName(
action.journalEntryName,
)?.uuid;
action.participants = this.document.system.travel[action.key].map((id) =>
game.actors.get(id),
);
Expand Down
8 changes: 7 additions & 1 deletion src/legacy-styles/sheets/_party-sheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
height: 100%;
max-height: calc(100vh - 10%);

.content-link:not([data-type="JournalEntryPage"]) {
align-items: center;
display: flex;
gap: 8px;
}

.main {
padding: 1rem;
gap: 2rem;
Expand Down Expand Up @@ -153,7 +159,7 @@
justify-content: center;

.content-link {
background-color: var(--color-theme-gray-200);
background-color: transparent;
border: none;
}
}
Expand Down
11 changes: 8 additions & 3 deletions templates/actor/party/components/action-component.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<div class="travel-action travel-action-{{action.key}}"
data-travel-action="{{action.key}}">
<div class="travel-action-header">
{{ localize action.name }}
{{#if action.journalLink}}
<a class="content-link" draggable="true" data-link=""
data-uuid="{{action.journalLink}}" data-type="JournalEntryPage"
data-tooltip="{{localize 'JOURNALENTRYPAGE.TypeText'}} {{localize 'JOURNALENTRYPAGE.Page'}}"><i
class="fas fa-file-lines"></i>{{localize action.name}}</a>
{{else}}
{{localize action.name}}
{{/if}}
</div>
<div class="travel-rolls">
{{#each action.buttons as |button|}}
Expand All @@ -12,8 +19,6 @@
<div>
<ol>
{{#each assignedCharacters as |partyMember|}}
<!-- prettier-ignore -->
{{! prettier-ignore }}
{{> systems/forbidden-lands/templates/actor/party/components/member-component.hbs partyMember=partyMember}}
{{/each}}
</ol>
Expand Down
12 changes: 8 additions & 4 deletions templates/actor/party/components/member-component.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
draggable="true">
{{#if deleteButton }}
<div class="button">
<a class="item-control item-delete" title="{{localize "FLPS.PARTY.BUTTON.REMOVE_FROM_PARTY"}}">
<a class="item-control item-delete"
title="{{localize "FLPS.PARTY.BUTTON.REMOVE_FROM_PARTY"}}">
<i class="fas fa-trash"></i></a>
</div>
{{/if}}
<img class="party-member-avatar" title="{{partyMember.name}}"
src="{{partyMember.img}}" />
<span class="plain-name">{{partyMember.name}}</span>
<a class="content-link" draggable="true" data-link=""
data-uuid="Actor.{{partyMember._id}}" data-id="{{partyMember._id}}"
data-type="Actor"
data-tooltip="{{localize 'FLPS.PARTY.OPEN_CHARACTER_SHEET'}}"><img
class="party-member-avatar"
src="{{partyMember.img}}" />{{partyMember.name}}</a>
</li>

0 comments on commit f697495

Please sign in to comment.