mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
Fixed up dice
This commit is contained in:
parent
e37fc83c59
commit
132d9ee6c8
20 changed files with 417 additions and 68 deletions
40
lang/en.json
40
lang/en.json
|
|
@ -387,6 +387,10 @@
|
||||||
"OwnershipSelection": {
|
"OwnershipSelection": {
|
||||||
"title": "Ownership Selection - {name}",
|
"title": "Ownership Selection - {name}",
|
||||||
"default": "Default Ownership"
|
"default": "Default Ownership"
|
||||||
|
},
|
||||||
|
"ResourceDice": {
|
||||||
|
"title": "{name} Resource",
|
||||||
|
"rerollDice": "Reroll Dice"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"CONFIG": {
|
"CONFIG": {
|
||||||
|
|
@ -631,6 +635,10 @@
|
||||||
"abbreviation": "AS"
|
"abbreviation": "AS"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ItemResourceType": {
|
||||||
|
"simple": "Simple",
|
||||||
|
"diceValue": "Dice Value"
|
||||||
|
},
|
||||||
"Range": {
|
"Range": {
|
||||||
"self": {
|
"self": {
|
||||||
"name": "Self",
|
"name": "Self",
|
||||||
|
|
@ -1149,10 +1157,13 @@
|
||||||
"ITEMS": {
|
"ITEMS": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"resource": {
|
"resource": {
|
||||||
"value": { "label": "Value" },
|
"amount": { "label": "Amount" },
|
||||||
"max": { "label": "Max" },
|
"dieFaces": { "label": "Die Faces" },
|
||||||
"icon": { "label": "Icon" },
|
"icon": { "label": "Icon" },
|
||||||
"recovery": { "label": "Recovery" }
|
"max": { "label": "Max" },
|
||||||
|
"recovery": { "label": "Recovery" },
|
||||||
|
"type": { "label": "Type" },
|
||||||
|
"value": { "label": "Value" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Armor": {
|
"Armor": {
|
||||||
|
|
@ -1332,8 +1343,8 @@
|
||||||
},
|
},
|
||||||
"UI": {
|
"UI": {
|
||||||
"Chat": {
|
"Chat": {
|
||||||
"dualityRoll": {
|
"applyEffect": {
|
||||||
"abilityCheckTitle": "{ability} Check"
|
"title": "Apply Effects - {name}"
|
||||||
},
|
},
|
||||||
"attackRoll": {
|
"attackRoll": {
|
||||||
"title": "Attack - {attack}",
|
"title": "Attack - {attack}",
|
||||||
|
|
@ -1349,25 +1360,28 @@
|
||||||
"hitTarget": "Hit Targets",
|
"hitTarget": "Hit Targets",
|
||||||
"selectedTarget": "Selected"
|
"selectedTarget": "Selected"
|
||||||
},
|
},
|
||||||
"applyEffect": {
|
|
||||||
"title": "Apply Effects - {name}"
|
|
||||||
},
|
|
||||||
"healingRoll": {
|
|
||||||
"title": "Heal - {healing}",
|
|
||||||
"heal": "Heal"
|
|
||||||
},
|
|
||||||
"deathMove": {
|
"deathMove": {
|
||||||
"title": "Death Move"
|
"title": "Death Move"
|
||||||
},
|
},
|
||||||
"domainCard": {
|
"domainCard": {
|
||||||
"title": "Domain Card"
|
"title": "Domain Card"
|
||||||
},
|
},
|
||||||
|
"dualityRoll": {
|
||||||
|
"abilityCheckTitle": "{ability} Check"
|
||||||
|
},
|
||||||
|
"featureTitle": "Class Feature",
|
||||||
"foundationCard": {
|
"foundationCard": {
|
||||||
"ancestryTitle": "Ancestry Card",
|
"ancestryTitle": "Ancestry Card",
|
||||||
"communityTitle": "Community Card",
|
"communityTitle": "Community Card",
|
||||||
"subclassFeatureTitle": "Subclass Feature"
|
"subclassFeatureTitle": "Subclass Feature"
|
||||||
},
|
},
|
||||||
"featureTitle": "Class Feature"
|
"healingRoll": {
|
||||||
|
"title": "Heal - {healing}",
|
||||||
|
"heal": "Heal"
|
||||||
|
},
|
||||||
|
"resourceRoll": {
|
||||||
|
"playerMessage": "{user} rerolled their {name}"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Notifications": {
|
"Notifications": {
|
||||||
"adversaryMissing": "The linked adversary doesn't exist in the world.",
|
"adversaryMissing": "The linked adversary doesn't exist in the world.",
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,4 @@ export { default as DamageSelectionDialog } from './damageSelectionDialog.mjs';
|
||||||
export { default as DeathMove } from './deathMove.mjs';
|
export { default as DeathMove } from './deathMove.mjs';
|
||||||
export { default as Downtime } from './downtime.mjs';
|
export { default as Downtime } from './downtime.mjs';
|
||||||
export { default as OwnershipSelection } from './ownershipSelection.mjs';
|
export { default as OwnershipSelection } from './ownershipSelection.mjs';
|
||||||
|
export { default as ResourceDiceDialog } from './resourceDiceDialog.mjs';
|
||||||
|
|
|
||||||
76
module/applications/dialogs/resourceDiceDialog.mjs
Normal file
76
module/applications/dialogs/resourceDiceDialog.mjs
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||||
|
|
||||||
|
export default class ResourceDiceDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
constructor(name, actorName, resource, options = {}) {
|
||||||
|
super(options);
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
this.actorName = actorName;
|
||||||
|
this.resource = resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
tag: 'form',
|
||||||
|
classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'resource-dice'],
|
||||||
|
window: {
|
||||||
|
icon: 'fa-solid fa-dice'
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
rerollDice: this.rerollDice
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
handler: this.updateResourceDice,
|
||||||
|
submitOnChange: true,
|
||||||
|
submitOnClose: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
resourceDice: {
|
||||||
|
id: 'resourceDice',
|
||||||
|
template: 'systems/daggerheart/templates/dialogs/dice-roll/resourceDice.hbs'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return game.i18n.format('DAGGERHEART.APPLICATIONS.ResourceDice.title', { name: this.name });
|
||||||
|
}
|
||||||
|
|
||||||
|
async _prepareContext(_options) {
|
||||||
|
const context = await super._prepareContext(_options);
|
||||||
|
context.resource = this.resource;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async rerollDice() {
|
||||||
|
const diceFormula = `${this.resource.max}d${this.resource.dieFaces}`;
|
||||||
|
const roll = await new Roll(diceFormula).evaluate();
|
||||||
|
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
|
||||||
|
this.rollValues = roll.terms[0].results.map(x => x.result);
|
||||||
|
|
||||||
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const msg = new cls({
|
||||||
|
user: game.user.id,
|
||||||
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
|
'systems/daggerheart/templates/ui/chat/resource-roll.hbs',
|
||||||
|
{
|
||||||
|
user: this.actorName,
|
||||||
|
name: this.name
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
cls.create(msg.toObject());
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
static async create(name, actorName, resource, options = {}) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const app = new this(name, actorName, resource, options);
|
||||||
|
app.addEventListener('close', () => resolve(app.rollValues), { once: true });
|
||||||
|
app.render({ force: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
||||||
useItem: this.useItem, //TODO Fix this
|
useItem: this.useItem, //TODO Fix this
|
||||||
useAction: this.useAction,
|
useAction: this.useAction,
|
||||||
|
toggleResourceDice: this.toggleResourceDice,
|
||||||
|
handleResourceDice: this.handleResourceDice,
|
||||||
toChat: this.toChat
|
toChat: this.toChat
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
|
|
@ -668,6 +670,45 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
action.use(event);
|
action.use(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the used state of a resource dice.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async toggleResourceDice(event) {
|
||||||
|
const target = event.target.closest('.item-resource');
|
||||||
|
const item = this.getItem(event);
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
const diceState = item.system.resource.diceStates[target.dataset.dice];
|
||||||
|
await item.update({
|
||||||
|
[`system.resource.diceStates.${target.dataset.dice}.used`]: diceState?.used ? !diceState.used : true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the roll values of resource dice.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async handleResourceDice(event) {
|
||||||
|
const item = this.getItem(event);
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(
|
||||||
|
item.name,
|
||||||
|
this.document.name,
|
||||||
|
item.system.resource
|
||||||
|
);
|
||||||
|
if (!rollValues) return;
|
||||||
|
|
||||||
|
await item.update({
|
||||||
|
'system.resource.diceStates': rollValues.reduce((acc, value, index) => {
|
||||||
|
acc[index] = { value, used: false };
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
});
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send item to Chat
|
* Send item to Chat
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
*/
|
*/
|
||||||
static async #addResource() {
|
static async #addResource() {
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.resource': { value: 0 }
|
'system.resource': { type: 'simple', value: 0 }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,16 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.subclasses': [...this.document.system.subclasses.map(x => x.uuid), item.uuid]
|
'system.subclasses': [...this.document.system.subclasses.map(x => x.uuid), item.uuid]
|
||||||
});
|
});
|
||||||
|
} else if (item.type === 'feature') {
|
||||||
|
if (target.classList.contains('hope-feature')) {
|
||||||
|
await this.document.update({
|
||||||
|
'system.hopeFeatures': [...this.document.system.hopeFeatures.map(x => x.uuid), item.uuid]
|
||||||
|
});
|
||||||
|
} else if (target.classList.contains('class-feature')) {
|
||||||
|
await this.document.update({
|
||||||
|
'system.classFeatures': [...this.document.system.classFeatures.map(x => x.uuid), item.uuid]
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (item.type === 'weapon') {
|
} else if (item.type === 'weapon') {
|
||||||
if (target.classList.contains('primary-weapon-section')) {
|
if (target.classList.contains('primary-weapon-section')) {
|
||||||
if (!this.document.system.characterGuide.suggestedPrimaryWeapon && !item.system.secondary)
|
if (!this.document.system.characterGuide.suggestedPrimaryWeapon && !item.system.secondary)
|
||||||
|
|
@ -144,7 +154,7 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
static async #removeItemFromCollection(_event, element) {
|
static async #removeItemFromCollection(_event, element) {
|
||||||
const { uuid, target } = element.dataset;
|
const { uuid, target } = element.dataset;
|
||||||
const prop = foundry.utils.getProperty(this.document.system, target);
|
const prop = foundry.utils.getProperty(this.document.system, target);
|
||||||
await this.document.update({ [target]: prop.filter(i => i.uuid !== uuid) });
|
await this.document.update({ [`system.${target}`]: prop.filter(i => i.uuid !== uuid) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1334,3 +1334,14 @@ export const actionTypes = {
|
||||||
label: 'DAGGERHEART.CONFIG.ActionType.reaction'
|
label: 'DAGGERHEART.CONFIG.ActionType.reaction'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const itemResourceTypes = {
|
||||||
|
simple: {
|
||||||
|
id: 'simple',
|
||||||
|
label: 'DAGGERHEART.CONFIG.ItemResourceType.simple'
|
||||||
|
},
|
||||||
|
diceValue: {
|
||||||
|
id: 'diceValue',
|
||||||
|
label: 'DAGGERHEART.CONFIG.ItemResourceType.diceValue'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
if (this.metadata.hasResource) {
|
if (this.metadata.hasResource) {
|
||||||
schema.resource = new fields.SchemaField(
|
schema.resource = new fields.SchemaField(
|
||||||
{
|
{
|
||||||
|
type: new fields.StringField({
|
||||||
|
choices: CONFIG.DH.ITEM.itemResourceTypes,
|
||||||
|
initial: CONFIG.DH.ITEM.itemResourceTypes.simple
|
||||||
|
}),
|
||||||
value: new fields.NumberField({ integer: true, min: 0, initial: 0 }),
|
value: new fields.NumberField({ integer: true, min: 0, initial: 0 }),
|
||||||
max: new fields.NumberField({ nullable: true, initial: null }),
|
max: new fields.NumberField({ nullable: true, initial: null }),
|
||||||
icon: new fields.StringField(),
|
icon: new fields.StringField(),
|
||||||
|
|
@ -46,7 +50,14 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
choices: CONFIG.DH.GENERAL.refreshTypes,
|
choices: CONFIG.DH.GENERAL.refreshTypes,
|
||||||
initial: null,
|
initial: null,
|
||||||
nullable: true
|
nullable: true
|
||||||
})
|
}),
|
||||||
|
diceStates: new fields.TypedObjectField(
|
||||||
|
new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({ integer: true, nullable: true, initial: null }),
|
||||||
|
used: new fields.BooleanField({ initial: false })
|
||||||
|
})
|
||||||
|
),
|
||||||
|
dieFaces: new fields.StringField({ initial: '4' })
|
||||||
},
|
},
|
||||||
{ nullable: true, initial: null }
|
{ nullable: true, initial: null }
|
||||||
);
|
);
|
||||||
|
|
@ -81,7 +92,6 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
|
||||||
async _preCreate(data, options, user) {
|
async _preCreate(data, options, user) {
|
||||||
// Skip if no initial action is required or actions already exist
|
// Skip if no initial action is required or actions already exist
|
||||||
if (!this.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
|
if (!this.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
|
||||||
|
|
@ -122,6 +132,23 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _preUpdate(data) {
|
||||||
|
if (data.system?.resource?.max) {
|
||||||
|
const diceStatesKeys = Object.keys(this.resource.diceStates);
|
||||||
|
const resourceDiff = Math.abs(data.system.resource.max - diceStatesKeys.length);
|
||||||
|
if (!resourceDiff) return;
|
||||||
|
|
||||||
|
const diceStates = {};
|
||||||
|
const deleting = data.system.resource.max < diceStatesKeys.length;
|
||||||
|
[...Array(resourceDiff).keys()].forEach(nr => {
|
||||||
|
const key = deleting ? diceStatesKeys.length - 1 - nr : diceStatesKeys.length + nr;
|
||||||
|
diceStates[`${deleting ? '-=' : ''}${key}`] = deleting ? null : { value: null };
|
||||||
|
});
|
||||||
|
|
||||||
|
foundry.utils.setProperty(data, 'system.resource.diceStates', diceStates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async _preDelete() {
|
async _preDelete() {
|
||||||
if (!this.actor || this.actor.type !== 'character') return;
|
if (!this.actor || this.actor.type !== 'character') return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ export const preloadHandlebarsTemplates = async function () {
|
||||||
'systems/daggerheart/templates/sheets/global/partials/action-item.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/action-item.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs',
|
||||||
|
'systems/daggerheart/templates/sheets/global/partials/item-resource.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/resource-section.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/resource-section.hbs',
|
||||||
'systems/daggerheart/templates/components/card-preview.hbs',
|
'systems/daggerheart/templates/components/card-preview.hbs',
|
||||||
'systems/daggerheart/templates/levelup/parts/selectable-card-preview.hbs',
|
'systems/daggerheart/templates/levelup/parts/selectable-card-preview.hbs',
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
@import './level-up/summary-container.less';
|
@import './level-up/summary-container.less';
|
||||||
@import './level-up/tiers-container.less';
|
@import './level-up/tiers-container.less';
|
||||||
|
|
||||||
|
@import './resource-dice/sheet.less';
|
||||||
|
|
||||||
@import './actions/action-list.less';
|
@import './actions/action-list.less';
|
||||||
|
|
||||||
@import './damage-selection/sheet.less';
|
@import './damage-selection/sheet.less';
|
||||||
|
|
|
||||||
39
styles/less/dialog/resource-dice/sheet.less
Normal file
39
styles/less/dialog/resource-dice/sheet.less
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
.daggerheart.dialog.dh-style.views.resource-dice {
|
||||||
|
.item-resources {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.item-resource {
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
label {
|
||||||
|
position: absolute;
|
||||||
|
color: light-dark(white, black);
|
||||||
|
filter: drop-shadow(0 0 1px @golden);
|
||||||
|
font-size: 24px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
|
||||||
|
brightness(96%) contrast(95%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -67,22 +67,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-resource {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: end;
|
|
||||||
gap: 4px;
|
|
||||||
|
|
||||||
i {
|
|
||||||
flex: none;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -109,11 +93,27 @@
|
||||||
&:hover {
|
&:hover {
|
||||||
.card-label {
|
.card-label {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
.controls {
|
.menu {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
max-height: 16px;
|
max-height: 16px;
|
||||||
|
|
||||||
|
&.resource-menu {
|
||||||
|
max-height: 55px;
|
||||||
|
|
||||||
|
&.dice-menu {
|
||||||
|
max-height: 118px;
|
||||||
|
|
||||||
|
.item-resources {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-resource {
|
||||||
|
width: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +122,7 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-label {
|
.card-label {
|
||||||
|
|
@ -148,15 +149,87 @@
|
||||||
color: @beige;
|
color: @beige;
|
||||||
}
|
}
|
||||||
|
|
||||||
.controls {
|
.menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 15px;
|
flex-direction: column;
|
||||||
align-items: center;
|
gap: 8px;
|
||||||
max-height: 0px;
|
max-height: 0px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
visibility: collapse;
|
visibility: collapse;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
color: @beige;
|
color: @beige;
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
gap: 15px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-resources {
|
||||||
|
width: 92px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-resource {
|
||||||
|
width: 92px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.inventory-item,
|
||||||
|
.card-item {
|
||||||
|
.item-resources {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
.resource-edit {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-resource {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: end;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
flex: none;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-dice-resource {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 26px;
|
||||||
|
|
||||||
|
label {
|
||||||
|
position: absolute;
|
||||||
|
color: light-dark(white, black);
|
||||||
|
filter: drop-shadow(0 0 1px @golden);
|
||||||
|
z-index: 2;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
|
||||||
|
brightness(96%) contrast(95%);
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
position: absolute;
|
||||||
|
text-shadow: 0 0 3px white;
|
||||||
|
filter: drop-shadow(0 1px white);
|
||||||
|
color: black;
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.resource-roll {
|
||||||
|
.reroll-message {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.roll {
|
&.roll {
|
||||||
.dice-flavor {
|
.dice-flavor {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
||||||
13
templates/dialogs/dice-roll/resourceDice.hbs
Normal file
13
templates/dialogs/dice-roll/resourceDice.hbs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<div>
|
||||||
|
<div class="item-resources">
|
||||||
|
{{#each resource.diceStates as | state key |}}
|
||||||
|
<div class="item-resource">
|
||||||
|
<label>{{ifThen state.value state.value '?'}}</label>
|
||||||
|
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/d" ../resource.dieFaces ".svg"}}" />
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
<button data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
@ -1,31 +1,35 @@
|
||||||
<li class="card-item" data-item-id="{{item.id}}" data-item-id="{{item.id}}">
|
<li class="card-item" data-item-id="{{item.id}}" data-item-id="{{item.id}}">
|
||||||
<img src="{{item.img}}" data-action="useItem" class="card-img" />
|
<img src="{{item.img}}" data-action="useItem" class="card-img" />
|
||||||
<div class="card-label">
|
<div class="card-label">
|
||||||
<div class="controls">
|
<div class="menu {{#if item.system.resource}}resource-menu{{/if}} {{#if (eq item.system.resource.type 'diceValue')}}dice-menu{{/if}}">
|
||||||
{{#if (eq type 'weapon')}}
|
{{#if item.system.resource}}
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
<i class="fa-solid fa-hands"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq type 'armor')}}
|
<div class="controls">
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
{{#if (eq type 'weapon')}}
|
||||||
<i class="fa-solid fa-shield"></i>
|
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
||||||
</a>
|
<i class="fa-solid fa-hands"></i>
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'domainCard')}}
|
|
||||||
{{#unless item.system.inVault}}
|
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToVault'}}">
|
|
||||||
<i class="fa-solid fa-arrow-down"></i>
|
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{/if}}
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToLoadout'}}">
|
{{#if (eq type 'armor')}}
|
||||||
<i class="fa-solid fa-arrow-up"></i>
|
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
|
{{#if (eq type 'domainCard')}}
|
||||||
{{/if}}
|
{{#unless item.system.inVault}}
|
||||||
<a data-action="toChat" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToChat'}}"><i class="fa-regular fa-message"></i></a>
|
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToVault'}}">
|
||||||
<a data-action="triggerContextMenu" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.moreOptions'}}"><i class="fa-solid fa-ellipsis-vertical"></i></a>
|
<i class="fa-solid fa-arrow-down"></i>
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
|
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToLoadout'}}">
|
||||||
|
<i class="fa-solid fa-arrow-up"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
<a data-action="toChat" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToChat'}}"><i class="fa-regular fa-message"></i></a>
|
||||||
|
<a data-action="triggerContextMenu" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.moreOptions'}}"><i class="fa-solid fa-ellipsis-vertical"></i></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-name">{{item.name}}</div>
|
<div class="card-name">{{item.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{#if (and (not isSidebar) item.system.resource)}}
|
{{#if (and (not isSidebar) item.system.resource)}}
|
||||||
<div class="item-resource">
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
<i class="{{#if item.system.resource.icon}}{{item.system.resource.icon}}{{else}}fa-solid fa-hashtag{{/if}}"></i>
|
|
||||||
<input type="number" class="inventory-item-resource" value="{{item.system.resource.value}}" step="1" />
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (and (not isSidebar) item.system.quantity)}}
|
{{#if (and (not isSidebar) item.system.quantity)}}
|
||||||
<div class="item-resource">
|
<div class="item-resource">
|
||||||
|
|
|
||||||
19
templates/sheets/global/partials/item-resource.hbs
Normal file
19
templates/sheets/global/partials/item-resource.hbs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{#if (eq item.system.resource.type 'simple')}}
|
||||||
|
<div class="item-resource">
|
||||||
|
<i class="{{#if item.system.resource.icon}}{{item.system.resource.icon}}{{else}}fa-solid fa-hashtag{{/if}}"></i>
|
||||||
|
<input type="number" class="inventory-item-resource" value="{{item.system.resource.value}}" step="1" />
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="item-resources">
|
||||||
|
{{#each item.system.resource.diceStates as | state key |}}
|
||||||
|
<a class="item-resource" data-action="toggleResourceDice" data-dice="{{key}}">
|
||||||
|
<div class="item-dice-resource">
|
||||||
|
<label>{{tertiary state.value '?'}}</label>
|
||||||
|
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/d" ../item.system.resource.dieFaces ".svg"}}" />
|
||||||
|
{{#if state.used}}<i class="fa-solid fa-x"></i>{{/if}}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{{/each}}
|
||||||
|
<a data-action="handleResourceDice"><i class="fa-solid fa-gears resource-edit"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
@ -10,10 +10,20 @@
|
||||||
|
|
||||||
{{#if source.system.resource}}
|
{{#if source.system.resource}}
|
||||||
<div class="two-columns even">
|
<div class="two-columns even">
|
||||||
{{formGroup systemFields.resource.fields.value value=source.system.resource.value localize=true}}
|
{{formGroup systemFields.resource.fields.type value=source.system.resource.type localize=true blank=false}}
|
||||||
{{formGroup systemFields.resource.fields.max value=source.system.resource.max localize=true}}
|
|
||||||
{{formGroup systemFields.resource.fields.icon value=source.system.resource.icon localize=true placeholder="fa-solid fa-hashtag"}}
|
|
||||||
{{formGroup systemFields.resource.fields.recovery value=source.system.resource.recovery localize=true}}
|
{{formGroup systemFields.resource.fields.recovery value=source.system.resource.recovery localize=true}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="two-columns even">
|
||||||
|
{{#if (eq source.system.resource.type 'simple')}}
|
||||||
|
{{formGroup systemFields.resource.fields.value value=source.system.resource.value localize=true}}
|
||||||
|
{{formGroup systemFields.resource.fields.max value=source.system.resource.max localize=true}}
|
||||||
|
{{else}}
|
||||||
|
{{formGroup systemFields.resource.fields.dieFaces value=source.system.resource.dieFaces localize=true}}
|
||||||
|
{{formGroup systemFields.resource.fields.max value=source.system.resource.max label="DAGGERHEART.ITEMS.FIELDS.resource.amount.label" localize=true}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{formGroup systemFields.resource.fields.icon value=source.system.resource.icon localize=true placeholder="fa-solid fa-hashtag"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
data-group='{{tabs.features.group}}'
|
data-group='{{tabs.features.group}}'
|
||||||
>
|
>
|
||||||
<div class="two-columns even">
|
<div class="two-columns even">
|
||||||
<fieldset>
|
<fieldset class="drop-section hope-feature">
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.hopeFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="hope" data-action="addFeature"></i></a></legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.hopeFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="hope" data-action="addFeature"></i></a></legend>
|
||||||
<div class="feature-list">
|
<div class="feature-list">
|
||||||
{{#each source.system.hopeFeatures as |feature|}}
|
{{#each source.system.hopeFeatures as |feature|}}
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset class="drop-section class-feature">
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.classFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="class" data-action="addFeature"></i></a></legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.classFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="class" data-action="addFeature"></i></a></legend>
|
||||||
<div class="feature-list">
|
<div class="feature-list">
|
||||||
{{#each source.system.classFeatures as |feature|}}
|
{{#each source.system.classFeatures as |feature|}}
|
||||||
|
|
|
||||||
3
templates/ui/chat/resource-roll.hbs
Normal file
3
templates/ui/chat/resource-roll.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="daggerheart chat resource-roll">
|
||||||
|
<h5 class="reroll-message">{{localize "DAGGERHEART.UI.Chat.resourceRoll.playerMessage" user=user name=name }}</h5>
|
||||||
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue