mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Cleanup
This commit is contained in:
parent
27d49d35fa
commit
ae211cda30
6 changed files with 8 additions and 121 deletions
11
lang/en.json
11
lang/en.json
|
|
@ -124,12 +124,7 @@
|
|||
"stepTooltip": "+{step} per step"
|
||||
},
|
||||
"summon": {
|
||||
"addSummonEntry": "Add Summon Entry",
|
||||
"actorUUID": "Actor to Summon",
|
||||
"actor": "Actor",
|
||||
"count": "Count",
|
||||
"dropSummonsHere": "Drop Summons Here",
|
||||
"hint": "Add Actor(s) and the quantity to summon under this action."
|
||||
"dropSummonsHere": "Drop Summons Here"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -611,10 +606,6 @@
|
|||
"title": "{name} Resource",
|
||||
"rerollDice": "Reroll Dice"
|
||||
},
|
||||
"Summon": {
|
||||
"title": "Summon Tokens",
|
||||
"hint": "Drag tokens from the list below into the scene to summon them."
|
||||
},
|
||||
"TagTeamSelect": {
|
||||
"title": "Tag Team Roll",
|
||||
"leaderTitle": "Initiating Character",
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class DHSummonDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(summonData) {
|
||||
super(summonData);
|
||||
// Initialize summons and index
|
||||
this.summons = summonData.summons || [];
|
||||
}
|
||||
|
||||
static PARTS = {
|
||||
main: { template: 'systems/daggerheart/templates/dialogs/summon/summonDialog.hbs' }
|
||||
};
|
||||
|
||||
|
||||
static DEFAULT_OPTIONS= {
|
||||
tag: 'form',
|
||||
window: {
|
||||
title: "DAGGERHEART.APPLICATIONS.Summon.title",
|
||||
resizable: false
|
||||
},
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
},
|
||||
classes: ['daggerheart', 'dialog', 'summon-dialog'],
|
||||
dragDrop: [{dragSelector: '.summon-token'}],
|
||||
};
|
||||
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext();
|
||||
context.summons=await Promise.all(this.summons.map(async(entry)=>{
|
||||
const actor = await fromUuid(entry.actorUUID);
|
||||
return {
|
||||
...entry,
|
||||
name: actor?.name || game.i18n.localize("DAGGERHEART.GENERAL.Unknown"),
|
||||
img: actor?.img || 'icons/svg/mystery-man.svg',
|
||||
};
|
||||
}));
|
||||
return context;
|
||||
}
|
||||
|
||||
_onDragStart(event) {
|
||||
const uuid = event.currentTarget.dataset.uuid;
|
||||
if(!uuid) return;
|
||||
const dragData = { type: 'Actor', uuid: uuid };
|
||||
event.dataTransfer.effectAllowed = 'all';
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(dragData));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options, 'action');
|
||||
context.source = this.action.toObject(true);
|
||||
// Resolving summon entries so actions can read entry.name / entry.img / entry.uuid
|
||||
|
||||
context.summons = [];
|
||||
for (const summon of context.source.summon) {
|
||||
const actor = await foundry.utils.fromUuid(summon.actorUUID);
|
||||
|
|
@ -233,17 +233,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
}
|
||||
|
||||
static async editDoc(event, button) {
|
||||
event.stopPropagation();
|
||||
const uuid = button?.dataset.itemUuid ?? button?.dataset.uuid; // Obtain uuid from dataset
|
||||
if (!uuid) return;
|
||||
//Try catching errors
|
||||
try {
|
||||
const doc = await foundry.utils.fromUuid(uuid);
|
||||
if (doc?.sheet) return doc.sheet.render({ force: true });
|
||||
} catch (err) {
|
||||
console.warn('editDoc action failed for', uuid, err);
|
||||
}
|
||||
static async editDoc(_event, target) {
|
||||
const element = target.closest('[data-item-uuid]');
|
||||
const doc = (await foundry.utils.fromUuid(element.dataset.itemUuid)) ?? null;
|
||||
if (doc) return doc.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static addDamage(_event) {
|
||||
|
|
@ -264,6 +257,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
}
|
||||
|
||||
updateSummonCount(event) {
|
||||
event.stopPropagation();
|
||||
const wrapper = event.target.closest('.summon-count-wrapper');
|
||||
const index = wrapper.dataset.index;
|
||||
const data = this.action.toObject();
|
||||
|
|
|
|||
|
|
@ -9,26 +9,6 @@
|
|||
border-radius: 3px;
|
||||
color: light-dark(@dark-blue-50, @beige-50);
|
||||
font-family: @font-body;
|
||||
&.summon-actor-drop {
|
||||
height: fit-content;
|
||||
min-height: inherit;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
.actors-list.summon-entry .actor-summon-item .actor-summon-line {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
.image{
|
||||
max-width: 10%;
|
||||
}
|
||||
.h4{
|
||||
width: --webkit-fill-available;
|
||||
}
|
||||
.controls.effect-control{
|
||||
padding:3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.daggerheart.dh-style {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="actor-summon-controls">
|
||||
<div class="form-group summon-count-wrapper" data-index="{{index}}">
|
||||
<div class="form-fields">
|
||||
<input type="text" data-dtype="Number" value="{{summon.count}}" />
|
||||
<input type="text" value="{{summon.count}}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
<fieldset class="one-column" data-key="summon">
|
||||
<legend>
|
||||
{{localize "DAGGERHEART.APPLICATIONS.Summon.title"}}
|
||||
</legend>
|
||||
<p class="hint">{{localize "DAGGERHEART.APPLICATIONS.Summon.hint"}}</p>
|
||||
|
||||
<div class="summons-list">
|
||||
|
||||
<ul class="actor-summon-item">
|
||||
{{#each summons as |entry index|}}
|
||||
<li class="summon-token" draggable="true" data-uuid="{{entry.actorUUID}}">
|
||||
<div class="actor-summon-line">
|
||||
<img class="image" src="{{entry.img}}" />
|
||||
{{#if (gte entry.count 1)}}
|
||||
<h4 class="h4">
|
||||
{{entry.name}}
|
||||
</h4>
|
||||
<span>Count: {{entry.count}}</span>
|
||||
{{else}}
|
||||
<h4 class="h4 disabled">
|
||||
{{entry.name}}
|
||||
</h4>
|
||||
{{/if}}
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue