mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Removed unused templates
This commit is contained in:
parent
f7acb9cd70
commit
b2d3ff7deb
6 changed files with 3 additions and 177 deletions
|
|
@ -1,148 +0,0 @@
|
||||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
|
||||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
|
||||||
|
|
||||||
export default class DhSettingsActionView extends HandlebarsApplicationMixin(ApplicationV2) {
|
|
||||||
constructor(resolve, reject, title, name, icon, img, description, actions) {
|
|
||||||
super({});
|
|
||||||
|
|
||||||
this.resolve = resolve;
|
|
||||||
this.reject = reject;
|
|
||||||
this.viewTitle = title;
|
|
||||||
this.name = name;
|
|
||||||
this.icon = icon;
|
|
||||||
this.img = img;
|
|
||||||
this.description = description;
|
|
||||||
this.actions = actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
get title() {
|
|
||||||
return this.viewTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
|
||||||
tag: 'form',
|
|
||||||
classes: ['daggerheart', 'setting', 'dh-style'],
|
|
||||||
position: { width: 440, height: 'auto' },
|
|
||||||
actions: {
|
|
||||||
editImage: this.onEditImage,
|
|
||||||
addItem: this.addItem,
|
|
||||||
editItem: this.editItem,
|
|
||||||
removeItem: this.removeItem,
|
|
||||||
resetMoves: this.resetMoves,
|
|
||||||
saveForm: this.saveForm
|
|
||||||
},
|
|
||||||
form: { handler: this.updateData, submitOnChange: true, closeOnSubmit: false }
|
|
||||||
};
|
|
||||||
|
|
||||||
static PARTS = {
|
|
||||||
header: { template: 'systems/daggerheart/templates/settings/components/action-view-header.hbs' },
|
|
||||||
main: {
|
|
||||||
template: 'systems/daggerheart/templates/settings/components/action-view.hbs'
|
|
||||||
},
|
|
||||||
footer: { template: 'systems/daggerheart/templates/settings/components/action-view-footer.hbs' }
|
|
||||||
};
|
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
|
||||||
const context = await super._prepareContext(_options);
|
|
||||||
context.name = this.name;
|
|
||||||
context.icon = this.icon;
|
|
||||||
context.img = this.img;
|
|
||||||
context.description = this.description;
|
|
||||||
context.enrichedDescription = await foundry.applications.ux.TextEditor.enrichHTML(context.description);
|
|
||||||
context.actions = this.actions;
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async updateData(event, element, formData) {
|
|
||||||
const { name, icon, description } = foundry.utils.expandObject(formData.object);
|
|
||||||
this.name = name;
|
|
||||||
this.icon = icon;
|
|
||||||
this.description = description;
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async saveForm(event) {
|
|
||||||
this.resolve({
|
|
||||||
name: this.name,
|
|
||||||
icon: this.icon,
|
|
||||||
img: this.img,
|
|
||||||
description: this.description,
|
|
||||||
actions: this.actions
|
|
||||||
});
|
|
||||||
this.close(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static close(fromSave) {
|
|
||||||
if (!fromSave) {
|
|
||||||
this.reject();
|
|
||||||
}
|
|
||||||
|
|
||||||
super.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
static onEditImage() {
|
|
||||||
const fp = new foundry.applications.apps.FilePicker.implementation({
|
|
||||||
current: this.img,
|
|
||||||
type: 'image',
|
|
||||||
callback: async path => {
|
|
||||||
this.img = path;
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
top: this.position.top + 40,
|
|
||||||
left: this.position.left + 10
|
|
||||||
});
|
|
||||||
return fp.browse();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectActionType() {
|
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(
|
|
||||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
|
||||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
|
||||||
),
|
|
||||||
title = 'Select Action Type',
|
|
||||||
type = 'form',
|
|
||||||
data = {};
|
|
||||||
return Dialog.prompt({
|
|
||||||
title,
|
|
||||||
label: title,
|
|
||||||
content,
|
|
||||||
type,
|
|
||||||
callback: html => {
|
|
||||||
const form = html[0].querySelector('form'),
|
|
||||||
fd = new foundry.applications.ux.FormDataExtended(form);
|
|
||||||
foundry.utils.mergeObject(data, fd.object, { inplace: true });
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
rejectClose: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static async addItem() {
|
|
||||||
const actionType = await this.selectActionType();
|
|
||||||
const cls = actionsTypes[actionType?.type] ?? actionsTypes.attack,
|
|
||||||
action = new cls({
|
|
||||||
_id: foundry.utils.randomID(),
|
|
||||||
type: actionType.type,
|
|
||||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
|
||||||
...cls.getSourceConfig(this.document)
|
|
||||||
});
|
|
||||||
|
|
||||||
this.actions.push(action);
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async editItem(_, button) {
|
|
||||||
await new DHActionConfig(this.actions[button.dataset.id]).render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static removeItem(event, button) {
|
|
||||||
this.actions = this.actions.filter((_, index) => index !== Number.parseInt(button.dataset.id));
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
static resetMoves() {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<section class='tab-form-footer'>
|
|
||||||
<button data-action="saveForm"><i class="fa-solid fa-floppy-disk"></i> {{localize "Save"}}</button>
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<header class='settings-item-header'>
|
|
||||||
<img class='profile' src='{{this.img}}' data-action='editImage' data-edit='img' />
|
|
||||||
<div class='item-info'>
|
|
||||||
<h1 class='item-name'><input type='text' name='name' value='{{this.name}}' /></h1>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>{{localize "Icon"}}</label>
|
|
||||||
|
|
||||||
<div class="form-field">
|
|
||||||
<input type="text" name="icon" value="{{icon}}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{{localize "Description"}}</legend>
|
|
||||||
|
|
||||||
<prose-mirror name="description" value="{{description}}">
|
|
||||||
{{{ enrichedDescription }}}
|
|
||||||
</prose-mirror>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="resources-section">
|
<div class="resources-section">
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<div class='status-value'>
|
||||||
<p><input class="bar-input" name="system.resources.hitPoints.value"
|
<p><input class="bar-input" name="system.resources.hitPoints.value" min="0" max='{{source.system.resources.hitPoints.max}}'
|
||||||
value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
||||||
<p>/</p>
|
<p>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<div class='status-value'>
|
||||||
<p><input class="bar-input" name="system.resources.stress.value"
|
<p><input class="bar-input" name="system.resources.stress.value" min="0" max='{{source.system.resources.stress.max}}'
|
||||||
value="{{source.system.resources.stress.value}}" type="number"></p>
|
value="{{source.system.resources.stress.value}}" type="number"></p>
|
||||||
<p>/</p>
|
<p>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<div class='status-value'>
|
||||||
<p><input class="bar-input" name="system.resources.stress.value" value="{{document.system.resources.stress.value}}" type="number"></p>
|
<p><input class="bar-input" name="system.resources.stress.value" value="{{document.system.resources.stress.value}}" min="0" max='{{document.system.resources.stress.max}}' type="number"></p>
|
||||||
<p>/</p>
|
<p>/</p>
|
||||||
<p class="bar-label">{{document.system.resources.stress.max}}</p>
|
<p class="bar-label">{{document.system.resources.stress.max}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue