mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge branch 'feature/party-sheet' into sidebar-character-sheet-changes
This commit is contained in:
commit
bf8744a88b
7 changed files with 47 additions and 23 deletions
|
|
@ -223,7 +223,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
title: game.i18n.localize('DAGGERHEART.APPLICATIONS.TagTeamSelect.title'),
|
||||
speaker: cls.getSpeaker({ actor: this.party.find(x => x.id === mainRollId) }),
|
||||
system: systemData,
|
||||
rolls: mainRoll.rolls
|
||||
rolls: mainRoll.rolls,
|
||||
sound: null,
|
||||
flags: { core: { RollTable: true } }
|
||||
};
|
||||
|
||||
await cls.create(msgData);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
|
|||
async _prepareContext(options) {
|
||||
const context = await super._prepareContext(options);
|
||||
|
||||
context.partyOnCanvas = this.actor.system.partyMembers.some(member => member.getActiveTokens().length > 0);
|
||||
context.partyOnCanvas =
|
||||
this.actor.type === 'party' &&
|
||||
this.actor.system.partyMembers.some(member => member.getActiveTokens().length > 0);
|
||||
context.icons.toggleParty = 'systems/daggerheart/assets/icons/arrow-dunk.png';
|
||||
context.actorType = this.actor.type;
|
||||
context.usesEffects = this.actor.type !== 'party';
|
||||
|
|
@ -77,7 +79,7 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
|
|||
|
||||
const animationDuration = 500;
|
||||
const activeTokens = this.actor.system.partyMembers.flatMap(member => member.getActiveTokens());
|
||||
const { x: actorX, y: actorY } = this.actor.token;
|
||||
const { x: actorX, y: actorY } = this.document;
|
||||
if (activeTokens.length > 0) {
|
||||
for (let token of activeTokens) {
|
||||
await token.document.update(
|
||||
|
|
@ -88,12 +90,15 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
|
|||
}
|
||||
} else {
|
||||
const activeScene = game.scenes.find(x => x.active);
|
||||
const partyTokenData = [];
|
||||
for (let member of this.actor.system.partyMembers) {
|
||||
const data = await member.getTokenDocument();
|
||||
partyTokenData.push(data.toObject());
|
||||
}
|
||||
const newTokens = await activeScene.createEmbeddedDocuments(
|
||||
'Token',
|
||||
this.actor.system.partyMembers.map(member => ({
|
||||
...member.getTokenDocument(),
|
||||
actorId: member.id,
|
||||
actorLink: true,
|
||||
partyTokenData.map(tokenData => ({
|
||||
...tokenData,
|
||||
alpha: 0,
|
||||
x: actorX,
|
||||
y: actorY
|
||||
|
|
|
|||
|
|
@ -225,8 +225,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
})
|
||||
});
|
||||
|
||||
const renderData = { system: foundry.utils.deepClone(message.system) };
|
||||
foundry.utils.setProperty(renderData.system, `${path}.result`, result.roll);
|
||||
const newMessageData = foundry.utils.deepClone(message.system);
|
||||
foundry.utils.setProperty(newMessageData, `${path}.result`, result.roll);
|
||||
const renderData = { system: new game.system.api.models.chatMessages.config.groupRoll(newMessageData) };
|
||||
|
||||
const updatedContent = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/groupRoll.hbs',
|
||||
|
|
@ -280,8 +281,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
})
|
||||
});
|
||||
|
||||
const renderData = { system: foundry.utils.deepClone(message.system) };
|
||||
foundry.utils.setProperty(renderData.system, `${path}.result`, { ...result.roll, rerolled: true });
|
||||
const newMessageData = foundry.utils.deepClone(message.system);
|
||||
foundry.utils.setProperty(newMessageData, `${path}.result`, { ...result.roll, rerolled: true });
|
||||
const renderData = { system: new game.system.api.models.chatMessages.config.groupRoll(newMessageData) };
|
||||
|
||||
const updatedContent = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/groupRoll.hbs',
|
||||
|
|
@ -312,8 +314,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.noActorOwnership'));
|
||||
}
|
||||
|
||||
const renderData = { system: foundry.utils.deepClone(message.system) };
|
||||
foundry.utils.setProperty(renderData.system, `${path}.manualSuccess`, Boolean(success));
|
||||
const newMessageData = foundry.utils.deepClone(message.system);
|
||||
foundry.utils.setProperty(newMessageData, `${path}.manualSuccess`, Boolean(success));
|
||||
const renderData = { system: new game.system.api.models.chatMessages.config.groupRoll(newMessageData) };
|
||||
|
||||
const updatedContent = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/groupRoll.hbs',
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ export default class DHGroupRoll extends foundry.abstract.TypeDataModel {
|
|||
members: new fields.ArrayField(new fields.EmbeddedDataField(GroupRollMemberField))
|
||||
};
|
||||
}
|
||||
|
||||
get totalModifier() {
|
||||
return this.members.reduce((acc, m) => {
|
||||
if (m.manualSuccess === null) return acc;
|
||||
|
||||
return acc + (m.manualSuccess ? 1 : -1);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
class GroupRollMemberField extends foundry.abstract.DataModel {
|
||||
|
|
|
|||
|
|
@ -70,8 +70,10 @@ export default class DHRoll extends Roll {
|
|||
if (Hooks.call(`${CONFIG.DH.id}.postRoll${hook.capitalize()}`, config, message) === false) return null;
|
||||
}
|
||||
|
||||
if (config.skips?.createMessage && game.modules.get('dice-so-nice')?.active) {
|
||||
await game.dice3d.showForRoll(roll, game.user, true);
|
||||
if (config.skips?.createMessage) {
|
||||
if (game.modules.get('dice-so-nice')?.active) {
|
||||
await game.dice3d.showForRoll(roll, game.user, true);
|
||||
}
|
||||
} else if (!config.source?.message) {
|
||||
config.message = await this.toMessage(roll, config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
const html = await super.renderHTML({ actor: actorData, author: this.author });
|
||||
|
||||
if (this.flags.core?.RollTable) {
|
||||
html.querySelector('.roll-buttons.apply-buttons').remove();
|
||||
html.querySelector('.roll-buttons.apply-buttons')?.remove();
|
||||
}
|
||||
|
||||
this.enrichChatMessage(html);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<h4 class="divider group-roll-header first">
|
||||
<label>{{localize "DAGGERHEART.UI.Chat.groupRoll.leader"}}</label>
|
||||
</h4>
|
||||
<div class="group-roll-content {{#unless (isNullish system.leader.manualSuccess)}}finished{{/unless}}">
|
||||
<div class="group-roll-content {{#if system.leader.result}}finished{{/if}}">
|
||||
<div class="group-roll-member">
|
||||
<div class="group-roll-data">
|
||||
<img src="{{system.leader.actor.img}}" />
|
||||
|
|
@ -22,11 +22,9 @@
|
|||
<a class="group-roll-button" data-path="leader"><img class="dice-icon normal" src="{{concat 'systems/daggerheart/assets/icons/dice/default/d20.svg'}}" alt=""></a>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="roll-results {{#unless (isNullish system.leader.manualSuccess)}}finished{{/unless}}">
|
||||
<div class="roll-results {{#if system.leader.result}}finished{{/if}}">
|
||||
{{#if (isNullish system.leader.manualSuccess)}}
|
||||
<div class="reroll-result-container">
|
||||
<span class="label">{{system.leader.result.total}}</span>
|
||||
|
||||
<a class="group-roll-success success" data-success="true" data-path="leader"><i class="fa-solid fa-check"></i></a>
|
||||
<a class="group-roll-success failure" data-path="leader"><i class="fa-solid fa-xmark"></i></a>
|
||||
</div>
|
||||
|
|
@ -47,17 +45,23 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{#unless (isNullish system.leader.manualSuccess)}}
|
||||
{{#if system.leader.result}}
|
||||
<div class="group-roll-main-roll">
|
||||
<h4 class="divider">
|
||||
{{localize "DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle" ability=(localize (concat "DAGGERHEART.CONFIG.Traits." system.leader.trait ".name"))}}
|
||||
</h4>
|
||||
<span class="main-roll-content">
|
||||
<span class="main-value">{{system.leader.result.total}}</span>
|
||||
<span class="main-value">
|
||||
{{system.leader.result.total}}
|
||||
{{#unless (isNullish system.totalModifier)}}
|
||||
{{#if (gte system.totalModifier 0)}}+{{else}}-{{/if}}
|
||||
{{positive system.totalModifier}} = {{add system.leader.result.total system.totalModifier}}
|
||||
{{/unless}}
|
||||
</span>
|
||||
<span class="main-text">{{localize "DAGGERHEART.GENERAL.withThing" thing=system.leader.result.result.label}}</span>
|
||||
</span>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="group-roll-section">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue