mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
finish party members tab
This commit is contained in:
parent
9a1ed95c9f
commit
5b7272c2c7
10 changed files with 144 additions and 32 deletions
|
|
@ -2368,6 +2368,8 @@
|
|||
"wrongDomain": "The card isn't from one of your class domains.",
|
||||
"cardTooHighLevel": "The card is too high level!",
|
||||
"duplicateCard": "You cannot select the same card more than once.",
|
||||
"duplicateCharacter": "This actor is already registered in the party members list.",
|
||||
"onlyCharactersInPartySheet": "You can drag only characters to a party sheet.",
|
||||
"notPrimary": "The weapon is not a primary weapon!",
|
||||
"notSecondary": "The weapon is not a secondary weapon!",
|
||||
"itemTooHighTier": "The item must be from Tier1",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import DHBaseActorSheet from '../api/base-actor.mjs';
|
||||
import { getDocFromElement } from '../../../helpers/utils.mjs';
|
||||
|
||||
export default class Party extends DHBaseActorSheet {
|
||||
/**@inheritdoc */
|
||||
|
|
@ -10,7 +11,9 @@ export default class Party extends DHBaseActorSheet {
|
|||
window: {
|
||||
resizable: true
|
||||
},
|
||||
actions: {},
|
||||
actions: {
|
||||
deletePartyMember: this.#deletePartyMember
|
||||
},
|
||||
dragDrop: [{ dragSelector: '.actors-section .inventory-item', dropSelector: null }]
|
||||
};
|
||||
|
||||
|
|
@ -103,20 +106,39 @@ export default class Party extends DHBaseActorSheet {
|
|||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
const actor = await foundry.utils.fromUuid(data.uuid);
|
||||
const currentMembers = this.document.system.partyMembers.map(x => x.uuid);
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'adversary' && event.target.closest('.category-container')) {
|
||||
const target = event.target.closest('.category-container');
|
||||
const path = `system.potentialAdversaries.${target.dataset.potentialAdversary}.adversaries`;
|
||||
const current = foundry.utils.getProperty(this.actor, path).map(x => x.uuid);
|
||||
await this.actor.update({
|
||||
[path]: [...current, item.uuid]
|
||||
});
|
||||
this.render();
|
||||
} else if (item.type === 'feature' && event.target.closest('.tab.features')) {
|
||||
await this.actor.createEmbeddedDocuments('Item', [item]);
|
||||
this.render();
|
||||
if (foundry.utils.parseUuid(data.uuid).collection instanceof CompendiumCollection) return;
|
||||
|
||||
if (actor.type !== 'character') {
|
||||
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.onlyCharactersInPartySheet'));
|
||||
}
|
||||
|
||||
if (currentMembers.includes(data.uuid)) {
|
||||
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter'));
|
||||
}
|
||||
|
||||
await this.document.update({ 'system.partyMembers': [...currentMembers, actor.uuid] });
|
||||
}
|
||||
|
||||
static async #deletePartyMember(_event, target) {
|
||||
const doc = await getDocFromElement(target.closest('.inventory-item'));
|
||||
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||
type: game.i18n.localize('TYPES.Actor.adversary'),
|
||||
name: doc.name
|
||||
})
|
||||
},
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: doc.name })
|
||||
});
|
||||
|
||||
if (!confirmed) return;
|
||||
|
||||
const currentMembers = this.document.system.partyMembers.map(x => x.uuid);
|
||||
const newMemberdList = currentMembers.filter(uuid => uuid !== doc.uuid);
|
||||
await this.document.update({ 'system.partyMembers': newMemberdList });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,4 +170,13 @@ export default class DhpAdversary extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
_getTags() {
|
||||
const tags = [
|
||||
game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`),
|
||||
`${game.i18n.localize(`DAGGERHEART.CONFIG.AdversaryType.${this.type}.label`)}`,
|
||||
`${game.i18n.localize('DAGGERHEART.GENERAL.difficulty')}: ${this.difficulty}`
|
||||
];
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -675,4 +675,9 @@ export default class DhCharacter extends BaseDataActor {
|
|||
this.companion.updateLevel(1);
|
||||
}
|
||||
}
|
||||
|
||||
_getTags() {
|
||||
const tags = [this.class.value.name, this.class.subclass.name, this.community.name, this.ancestry.name];
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ export default class DhParty extends BaseDataActor {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
partyMembers: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
label: new fields.StringField(),
|
||||
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' })
|
||||
})
|
||||
),
|
||||
partyMembers: new ForeignDocumentUUIDArrayField({ type: 'Actor' }),
|
||||
notes: new fields.HTMLField()
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -772,4 +772,14 @@ export default class DhpActor extends Actor {
|
|||
this.#scrollTextInterval = setInterval(intervalFunc.bind(this), 600);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an array of localized tag.
|
||||
* @returns {string[]} An array of localized tag strings.
|
||||
*/
|
||||
_getTags() {
|
||||
const tags = [];
|
||||
if (this.system._getTags) tags.push(...this.system._getTags());
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
43
styles/less/sheets/actors/party/party-members.less
Normal file
43
styles/less/sheets/actors/party/party-members.less
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
@import '../../../utils/colors.less';
|
||||
@import '../../../utils/fonts.less';
|
||||
|
||||
.application.sheet.daggerheart.actor.dh-style.party {
|
||||
.tab.partyMembers {
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
|
||||
.actions-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10px;
|
||||
gap: 20px;
|
||||
background-color: light-dark(@dark-blue-10, @golden-10);
|
||||
|
||||
button {
|
||||
span {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.actors-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
.actors-dragger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border: 1px dashed light-dark(@dark-blue-50, @beige-50);
|
||||
border-radius: 3px;
|
||||
color: light-dark(@dark-blue-50, @beige-50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
@import './actors/environment/sheet.less';
|
||||
|
||||
@import './actors/party/header.less';
|
||||
@import './actors/party/party-members.less';
|
||||
@import './actors/party/sheet.less';
|
||||
|
||||
@import './items/beastform.less';
|
||||
|
|
|
|||
|
|
@ -3,17 +3,37 @@
|
|||
data-tab='{{tabs.partyMembers.id}}'
|
||||
data-group='{{tabs.partyMembers.group}}'
|
||||
>
|
||||
<div class="action-section">
|
||||
{{#each document.system.partyMembers as |category categoryId|}}
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title=tabs.partyMembers.label
|
||||
type='character'
|
||||
isGlassy=true
|
||||
isActor=true
|
||||
hideControls=true
|
||||
collection=category.adversaries
|
||||
hideResources=true
|
||||
}}
|
||||
{{/each}}
|
||||
|
||||
<div class="actions-section">
|
||||
<button>
|
||||
<i class="fa-solid fa-user-group"></i>
|
||||
<span>Tag Team Roll</span>
|
||||
</button>
|
||||
<button>
|
||||
<i class="fa-solid fa-users"></i>
|
||||
<span>Group Roll</span>
|
||||
</button>
|
||||
<button>
|
||||
<i class="fa-solid fa-handshake-angle"></i>
|
||||
<span>Help Action</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<fieldset class="actors-section glassy">
|
||||
<legend>{{localize tabs.partyMembers.label}}</legend>
|
||||
<ul class="actors-list">
|
||||
{{#each document.system.partyMembers as |actor id|}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=actor
|
||||
type='character'
|
||||
isActor=true
|
||||
}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{#unless document.system.partyMembers.length}}
|
||||
<div class="actors-dragger">
|
||||
<span>{{localize "DAGGERHEART.GENERAL.dropActorsHere"}}</span>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</fieldset>
|
||||
</section>
|
||||
|
|
@ -83,6 +83,11 @@ Parameters:
|
|||
<i class='fas fa-trash'></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (eq type 'character')}}
|
||||
<a data-action='deletePartyMember' data-tooltip="CONTROLS.CommonDelete">
|
||||
<i class='fas fa-trash'></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#if (eq type 'weapon')}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue