This commit is contained in:
WBHarry 2025-11-14 08:43:51 +01:00
parent 013085299f
commit cd8e9f5f12
7 changed files with 66 additions and 44 deletions

View file

@ -2623,7 +2623,8 @@
"cardTooHighLevel": "The card is too high level!", "cardTooHighLevel": "The card is too high level!",
"duplicateCard": "You cannot select the same card more than once.", "duplicateCard": "You cannot select the same card more than once.",
"duplicateCharacter": "This actor is already registered in the party members list.", "duplicateCharacter": "This actor is already registered in the party members list.",
"onlyCharactersInPartySheet": "You can drag only characters to a party sheet.", "onlyCharactersInPartySheet": "You can only drag characters, companions and adverasries to the party sheet.",
"onlyLinkedActorsInPartySheet": "Actors in the ",
"notPrimary": "The weapon is not a primary weapon!", "notPrimary": "The weapon is not a primary weapon!",
"notSecondary": "The weapon is not a secondary weapon!", "notSecondary": "The weapon is not a secondary weapon!",
"itemTooHighTier": "The item must be from Tier1", "itemTooHighTier": "The item must be from Tier1",

View file

@ -7,6 +7,7 @@ import { socketEvent } from '../../../systemRegistration/socket.mjs';
import GroupRollDialog from '../../dialogs/group-roll-dialog.mjs'; import GroupRollDialog from '../../dialogs/group-roll-dialog.mjs';
import DhpActor from '../../../documents/actor.mjs'; import DhpActor from '../../../documents/actor.mjs';
import DHItem from '../../../documents/item.mjs'; import DHItem from '../../../documents/item.mjs';
import DhParty from '../../../data/actor/party.mjs';
export default class Party extends DHBaseActorSheet { export default class Party extends DHBaseActorSheet {
constructor(options) { constructor(options) {
@ -79,6 +80,9 @@ export default class Party extends DHBaseActorSheet {
} }
}; };
static ALLOWED_ACTOR_TYPES = ['character', 'companion', 'adversary'];
static DICE_ROLL_ACTOR_TYPES = ['character'];
async _onRender(context, options) { async _onRender(context, options) {
await super._onRender(context, options); await super._onRender(context, options);
this._createFilterMenus(); this._createFilterMenus();
@ -276,14 +280,18 @@ export default class Party extends DHBaseActorSheet {
}); });
} }
get partyMembersForRoll() {
return this.document.system.partyMembers.filter(x => Party.DICE_ROLL_ACTOR_TYPES.includes(x.type));
}
static async #tagTeamRoll() { static async #tagTeamRoll() {
new game.system.api.applications.dialogs.TagTeamDialog(this.document.system.partyMembers).render({ new game.system.api.applications.dialogs.TagTeamDialog(this.partyMembersForRoll).render({
force: true force: true
}); });
} }
static async #groupRoll(params) { static async #groupRoll(params) {
new GroupRollDialog(this.document.system.partyMembers).render({ force: true }); new GroupRollDialog(this.partyMembersForRoll).render({ force: true });
} }
/** /**
@ -455,7 +463,7 @@ export default class Party extends DHBaseActorSheet {
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event); const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
const item = await foundry.utils.fromUuid(data.uuid); const item = await foundry.utils.fromUuid(data.uuid);
if (item instanceof DhpActor) { if (item instanceof DhpActor && Party.ALLOWED_ACTOR_TYPES.includes(item.type)) {
const currentMembers = this.document.system.partyMembers.map(x => x.uuid); const currentMembers = this.document.system.partyMembers.map(x => x.uuid);
if (currentMembers.includes(data.uuid)) { if (currentMembers.includes(data.uuid)) {
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter')); return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter'));

View file

@ -672,14 +672,6 @@ export default class DhCharacter extends BaseDataActor {
if (this.companion) { if (this.companion) {
this.companion.updateLevel(1); this.companion.updateLevel(1);
} }
if (this.parent.parties) {
for (const party of this.parent.parties) {
await party.update({
'system.partyMembers': party.system.partyMembers.filter(x => x.uuid !== this.parent.uuid)
});
}
}
} }
_getTags() { _getTags() {

View file

@ -85,6 +85,17 @@ export default class DhpActor extends Actor {
this.updateSource({ prototypeToken }); this.updateSource({ prototypeToken });
} }
/**@inheritdoc */
async _preDelete() {
if (this.parent.parties) {
for (const party of this.parent.parties) {
await party.update({
'system.partyMembers': party.system.partyMembers.filter(x => x.uuid !== this.parent.uuid)
});
}
}
}
_onUpdate(changes, options, userId) { _onUpdate(changes, options, userId) {
super._onUpdate(changes, options, userId); super._onUpdate(changes, options, userId);
for (const party of this.parties) { for (const party of this.parties) {

View file

@ -32,7 +32,7 @@ body.game:is(.performance-low, .noblur) {
background: light-dark(@dark-blue-40, @dark-golden-40); background: light-dark(@dark-blue-40, @dark-golden-40);
border-radius: 6px; border-radius: 6px;
border: 1px solid light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark-blue, @golden);
max-width: 230px; width: 230px;
height: -webkit-fill-available; height: -webkit-fill-available;
.actor-name { .actor-name {

View file

@ -49,6 +49,7 @@
canCreate=true canCreate=true
hideResources=true hideResources=true
hideContextMenu=true hideContextMenu=true
isActor=true
}} }}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='TYPES.Item.armor' title='TYPES.Item.armor'
@ -59,6 +60,7 @@
canCreate=true canCreate=true
hideResources=true hideResources=true
hideContextMenu=true hideContextMenu=true
isActor=true
}} }}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='TYPES.Item.consumable' title='TYPES.Item.consumable'
@ -68,6 +70,7 @@
isGlassy=true isGlassy=true
canCreate=true canCreate=true
hideContextMenu=true hideContextMenu=true
isActor=true
}} }}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='TYPES.Item.loot' title='TYPES.Item.loot'
@ -77,6 +80,7 @@
isGlassy=true isGlassy=true
canCreate=true canCreate=true
hideContextMenu=true hideContextMenu=true
isActor=true
}} }}
</div> </div>
</section> </section>

View file

@ -22,19 +22,21 @@
<h2 class="actor-name">{{actor.name}}</h2> <h2 class="actor-name">{{actor.name}}</h2>
<img class="actor-img" src="{{actor.img}}"> <img class="actor-img" src="{{actor.img}}">
<div class="resources"> <div class="resources">
<div class="slot-section"> {{#unless (eq actor.type 'companion') }}
<div class="slot-bar"> <div class="slot-section">
{{#times actor.system.resources.hitPoints.max}} <div class="slot-bar">
<span class='slot {{#if (gte actor.system.resources.hitPoints.value (add this 1))}}filled{{/if}}' {{#times actor.system.resources.hitPoints.max}}
data-action='toggleHitPoints' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}"> <span class='slot {{#if (gte actor.system.resources.hitPoints.value (add this 1))}}filled{{/if}}'
</span> data-action='toggleHitPoints' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}">
{{/times}} </span>
{{/times}}
</div>
<div class="slot-label">
<span class="label">{{localize "DAGGERHEART.GENERAL.HitPoints.short"}}</span>
<span class="value">{{actor.system.resources.hitPoints.value}} / {{actor.system.resources.hitPoints.max}}</span>
</div>
</div> </div>
<div class="slot-label"> {{/unless}}
<span class="label">{{localize "DAGGERHEART.GENERAL.HitPoints.short"}}</span>
<span class="value">{{actor.system.resources.hitPoints.value}} / {{actor.system.resources.hitPoints.max}}</span>
</div>
</div>
<div class="slot-section"> <div class="slot-section">
<div class="slot-bar"> <div class="slot-bar">
@ -71,26 +73,30 @@
</div> </div>
{{/if}} {{/if}}
{{#unless (or (eq actor.type 'companion') (eq actor.type 'adversary')) }}
<div class="hope-section">
<h4>{{localize "DAGGERHEART.GENERAL.hope"}}</h4>
{{#times actor.system.resources.hope.max}}
<span class='hope-value' data-action='toggleHope' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}">
{{#if (gte actor.system.resources.hope.value (add this 1))}}
<i class='fa-solid fa-diamond'></i>
{{else}}
<i class='fa-regular fa-circle'></i>
{{/if}}
</span>
{{/times}}
</div>
{{/unless}}
<div class="hope-section"> {{#unless (eq actor.type 'companion')}}
<h4>{{localize "DAGGERHEART.GENERAL.hope"}}</h4> <div class="threshold-section">
{{#times actor.system.resources.hope.max}} <h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.minor"}}</h4>
<span class='hope-value' data-action='toggleHope' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}"> <h4 class="threshold-value">{{actor.system.damageThresholds.major}}</h4>
{{#if (gte actor.system.resources.hope.value (add this 1))}} <h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.major"}}</h4>
<i class='fa-solid fa-diamond'></i> <h4 class="threshold-value">{{actor.system.damageThresholds.severe}}</h4>
{{else}} <h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.severe"}}</h4>
<i class='fa-regular fa-circle'></i> </div>
{{/if}} {{/unless}}
</span>
{{/times}}
</div>
<div class="threshold-section">
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.minor"}}</h4>
<h4 class="threshold-value">{{actor.system.damageThresholds.major}}</h4>
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.major"}}</h4>
<h4 class="threshold-value">{{actor.system.damageThresholds.severe}}</h4>
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.severe"}}</h4>
</div>
</div> </div>
</li> </li>
{{/each}} {{/each}}