mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
[Fix] console noise when starting a tag team dialog or group roll (#1842)
Some checks failed
Project CI / build (24.x) (push) Has been cancelled
Some checks failed
Project CI / build (24.x) (push) Has been cancelled
This commit is contained in:
parent
ca32aa5d35
commit
118c52a996
5 changed files with 68 additions and 73 deletions
|
|
@ -342,7 +342,8 @@ Hooks.on(CONFIG.DH.HOOKS.hooksConfig.tagTeamStart, async data => {
|
||||||
const party = game.actors.get(data.partyId);
|
const party = game.actors.get(data.partyId);
|
||||||
if (!party) return;
|
if (!party) return;
|
||||||
|
|
||||||
const dialog = new game.system.api.applications.dialogs.TagTeamDialog(party);
|
const TagTeamDialog = game.system.api.applications.dialogs.TagTeamDialog;
|
||||||
|
const dialog = foundry.applications.instances.get(`TagTeamDialog-${party.id}`) ?? new TagTeamDialog(party);
|
||||||
dialog.tabGroups.application = 'tagTeamRoll';
|
dialog.tabGroups.application = 'tagTeamRoll';
|
||||||
await dialog.render({ force: true });
|
await dialog.render({ force: true });
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +354,8 @@ Hooks.on(CONFIG.DH.HOOKS.hooksConfig.groupRollStart, async data => {
|
||||||
const party = game.actors.get(data.partyId);
|
const party = game.actors.get(data.partyId);
|
||||||
if (!party) return;
|
if (!party) return;
|
||||||
|
|
||||||
const dialog = new game.system.api.applications.dialogs.GroupRollDialog(party);
|
const GroupRollDialog = game.system.api.applications.dialogs.GroupRollDialog;
|
||||||
|
const dialog = foundry.applications.instances.get(`GroupRollDialog-${party.id}`) ?? new GroupRollDialog(party);
|
||||||
dialog.tabGroups.application = 'groupRoll';
|
dialog.tabGroups.application = 'groupRoll';
|
||||||
await dialog.render({ force: true });
|
await dialog.render({ force: true });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
export default class GroupRollDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
export default class GroupRollDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
constructor(party) {
|
constructor(party) {
|
||||||
super();
|
super({ id: `GroupRollDialog-${party.id}` });
|
||||||
|
|
||||||
this.party = party;
|
this.party = party;
|
||||||
this.partyMembers = party.system.partyMembers
|
this.partyMembers = party.system.partyMembers
|
||||||
|
|
@ -35,7 +35,6 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
tag: 'form',
|
tag: 'form',
|
||||||
id: 'GroupRollDialog',
|
|
||||||
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'group-roll-dialog'],
|
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'group-roll-dialog'],
|
||||||
position: { width: 390, height: 'auto' },
|
position: { width: 390, height: 'auto' },
|
||||||
window: {
|
window: {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
export default class TagTeamDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
export default class TagTeamDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
constructor(party) {
|
constructor(party) {
|
||||||
super();
|
super({ id: `TagTeamDialog-${party.id}` });
|
||||||
|
|
||||||
this.party = party;
|
this.party = party;
|
||||||
this.partyMembers = party.system.partyMembers
|
this.partyMembers = party.system.partyMembers
|
||||||
|
|
@ -36,7 +36,6 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
tag: 'form',
|
tag: 'form',
|
||||||
id: 'TagTeamDialog',
|
|
||||||
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'tag-team-dialog'],
|
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'tag-team-dialog'],
|
||||||
position: { width: 550, height: 'auto' },
|
position: { width: 550, height: 'auto' },
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -60,13 +59,17 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
id: 'initialization',
|
id: 'initialization',
|
||||||
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/initialization.hbs'
|
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/initialization.hbs'
|
||||||
},
|
},
|
||||||
|
tagTeamRoll: {
|
||||||
|
id: 'tagTeamRoll',
|
||||||
|
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs'
|
||||||
|
},
|
||||||
rollSelection: {
|
rollSelection: {
|
||||||
id: 'rollSelection',
|
id: 'rollSelection',
|
||||||
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/rollSelection.hbs'
|
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/rollSelection.hbs'
|
||||||
},
|
},
|
||||||
tagTeamRoll: {
|
result: {
|
||||||
id: 'tagTeamRoll',
|
id: 'result',
|
||||||
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs'
|
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/result.hbs'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -97,36 +100,15 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
_configureRenderParts(options) {
|
_configureRenderParts(options) {
|
||||||
const { initialization, rollSelection, tagTeamRoll } = super._configureRenderParts(options);
|
const parts = super._configureRenderParts(options);
|
||||||
const augmentedParts = { initialization };
|
|
||||||
for (const memberKey of Object.keys(this.party.system.tagTeam.members)) {
|
for (const memberKey of Object.keys(this.party.system.tagTeam.members)) {
|
||||||
augmentedParts[memberKey] = {
|
parts[memberKey] = {
|
||||||
id: memberKey,
|
id: memberKey,
|
||||||
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamMember.hbs'
|
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamMember.hbs'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
augmentedParts.rollSelection = rollSelection;
|
|
||||||
augmentedParts.tagTeamRoll = tagTeamRoll;
|
|
||||||
|
|
||||||
return augmentedParts;
|
return parts;
|
||||||
}
|
|
||||||
|
|
||||||
/**@inheritdoc */
|
|
||||||
async _onRender(context, options) {
|
|
||||||
await super._onRender(context, options);
|
|
||||||
|
|
||||||
// if (this.element.querySelector('.roll-selection')) {
|
|
||||||
// for (const element of this.element.querySelectorAll('.team-member-container')) {
|
|
||||||
// element.classList.add('select-padding');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.element.querySelector('.team-container')) return;
|
|
||||||
const initializationPart = this.element.querySelector('.initialization-container');
|
|
||||||
initializationPart.insertAdjacentHTML('afterend', '<div class="team-container"></div>');
|
|
||||||
const teamContainer = this.element.querySelector('.team-container');
|
|
||||||
for (const memberContainer of this.element.querySelectorAll('.team-member-container'))
|
|
||||||
teamContainer.appendChild(memberContainer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
|
|
@ -167,6 +149,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
partContext.initiatorDisabled = !selectedMembers.length;
|
partContext.initiatorDisabled = !selectedMembers.length;
|
||||||
partContext.openForAllPlayers = this.openForAllPlayers;
|
partContext.openForAllPlayers = this.openForAllPlayers;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'tagTeamRoll':
|
||||||
|
partContext.memberKeys = Object.keys(this.party.system.tagTeam.members);
|
||||||
break;
|
break;
|
||||||
case 'rollSelection':
|
case 'rollSelection':
|
||||||
partContext.members = Object.keys(this.party.system.tagTeam.members).reduce((acc, key) => {
|
partContext.members = Object.keys(this.party.system.tagTeam.members).reduce((acc, key) => {
|
||||||
|
|
@ -175,7 +160,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
break;
|
break;
|
||||||
case 'tagTeamRoll':
|
case 'result':
|
||||||
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
||||||
const critSelected = !selectedRoll
|
const critSelected = !selectedRoll
|
||||||
? undefined
|
? undefined
|
||||||
|
|
@ -243,7 +228,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
getUpdatingParts(target) {
|
getUpdatingParts(target) {
|
||||||
const { initialization, rollSelection, tagTeamRoll } = this.constructor.PARTS;
|
const { initialization, rollSelection, result } = this.constructor.PARTS;
|
||||||
const isInitialization = this.tabGroups.application === initialization.id;
|
const isInitialization = this.tabGroups.application === initialization.id;
|
||||||
const updatingMember = target.closest('.team-member-container')?.dataset?.memberKey;
|
const updatingMember = target.closest('.team-member-container')?.dataset?.memberKey;
|
||||||
|
|
||||||
|
|
@ -251,7 +236,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
...(isInitialization ? [initialization.id] : []),
|
...(isInitialization ? [initialization.id] : []),
|
||||||
...(updatingMember ? [updatingMember] : []),
|
...(updatingMember ? [updatingMember] : []),
|
||||||
...(!isInitialization ? [rollSelection.id] : []),
|
...(!isInitialization ? [rollSelection.id] : []),
|
||||||
...(!isInitialization ? [tagTeamRoll.id] : [])
|
...(!isInitialization ? [result.id] : [])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
38
templates/dialogs/tagTeamDialog/result.hbs
Normal file
38
templates/dialogs/tagTeamDialog/result.hbs
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<section class="tag-team-roll tab {{#if tabs.tagTeamRoll.active}} active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
|
||||||
|
<div class="tag-team-roll-container {{#unless isEditable}}inactive{{/unless}}">
|
||||||
|
<div class="results-container">
|
||||||
|
<span class="result-container-label">{{localize "DAGGERHEART.GENERAL.result.plural"}}</span>
|
||||||
|
<div class="results-inner-container">
|
||||||
|
{{#if hintText}}
|
||||||
|
<div class="hint">{{localize hintText}}</div>
|
||||||
|
{{else}}
|
||||||
|
{{#if joinedRoll.roll}}
|
||||||
|
<div class="result-container">
|
||||||
|
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.dualityRoll"}}</span>
|
||||||
|
<div class="result-info">
|
||||||
|
<div class="damage-info">{{joinedRoll.roll.total}}</div>
|
||||||
|
<div>{{localize "DAGGERHEART.GENERAL.withThing" thing=joinedRoll.roll.totalLabel}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if joinedRoll.rollData.options.hasDamage}}
|
||||||
|
<div class="result-container">
|
||||||
|
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.damage"}}</span>
|
||||||
|
{{#each joinedRoll.rollData.options.damage as |damage key|}}
|
||||||
|
<div class="result-info">
|
||||||
|
<div>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}</div>
|
||||||
|
<div class="damage-info">{{damage.total}}</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="finish-container">
|
||||||
|
<button type="button" data-action="cancelRoll">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.cancelTagTeamRoll"}}</button>
|
||||||
|
<button type="button" data-action="finishRoll" {{#if hintText}}disabled{{/if}} class="finish-button">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.finishTagTeamRoll"}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -1,38 +1,9 @@
|
||||||
<section class="tag-team-roll tab {{#if tabs.tagTeamRoll.active}} active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
|
<div class="tab {{#if tabs.tagTeamRoll.active}}active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
|
||||||
<div class="tag-team-roll-container {{#unless isEditable}}inactive{{/unless}}">
|
<div class="team-container">
|
||||||
<div class="results-container">
|
{{#each memberKeys as |key|}}
|
||||||
<span class="result-container-label">{{localize "DAGGERHEART.GENERAL.result.plural"}}</span>
|
<div data-application-part="{{key}}"></div>
|
||||||
<div class="results-inner-container">
|
{{/each}}
|
||||||
{{#if hintText}}
|
|
||||||
<div class="hint">{{localize hintText}}</div>
|
|
||||||
{{else}}
|
|
||||||
{{#if joinedRoll.roll}}
|
|
||||||
<div class="result-container">
|
|
||||||
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.dualityRoll"}}</span>
|
|
||||||
<div class="result-info">
|
|
||||||
<div class="damage-info">{{joinedRoll.roll.total}}</div>
|
|
||||||
<div>{{localize "DAGGERHEART.GENERAL.withThing" thing=joinedRoll.roll.totalLabel}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if joinedRoll.rollData.options.hasDamage}}
|
|
||||||
<div class="result-container">
|
|
||||||
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.damage"}}</span>
|
|
||||||
{{#each joinedRoll.rollData.options.damage as |damage key|}}
|
|
||||||
<div class="result-info">
|
|
||||||
<div>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}</div>
|
|
||||||
<div class="damage-info">{{damage.total}}</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="finish-container">
|
|
||||||
<button type="button" data-action="cancelRoll">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.cancelTagTeamRoll"}}</button>
|
|
||||||
<button type="button" data-action="finishRoll" {{#if hintText}}disabled{{/if}} class="finish-button">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.finishTagTeamRoll"}}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
<div data-application-part="rollSelection"></div>
|
||||||
|
<div data-application-part="result"></div>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue