mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Merged with main
This commit is contained in:
commit
9b9632cf94
150 changed files with 1077 additions and 930 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { abilities } from '../../config/actorConfig.mjs';
|
||||
import { burden } from '../../config/generalConfig.mjs';
|
||||
import { createEmbeddedItemWithEffects } from '../../helpers/utils.mjs';
|
||||
import { ItemBrowser } from '../ui/itemBrowser.mjs';
|
||||
import { createEmbeddedItemsWithEffects, createEmbeddedItemWithEffects } from '../../helpers/utils.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
|
|
@ -21,8 +21,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
class: this.character.system.class?.value ?? {},
|
||||
subclass: this.character.system.class?.subclass ?? {},
|
||||
experiences: {
|
||||
[foundry.utils.randomID()]: { name: '', value: 2 },
|
||||
[foundry.utils.randomID()]: { name: '', value: 2 }
|
||||
[foundry.utils.randomID()]: { name: '', value: 2, core: true },
|
||||
[foundry.utils.randomID()]: { name: '', value: 2, core: true }
|
||||
},
|
||||
domainCards: {
|
||||
[foundry.utils.randomID()]: {},
|
||||
|
|
@ -373,13 +373,18 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
);
|
||||
context.armor = {
|
||||
...this.equipment.armor,
|
||||
suggestion: { ...suggestions.armor, taken: suggestions.armor?.uuid === this.equipment.armor?.uuid },
|
||||
suggestion: {
|
||||
...suggestions.armor,
|
||||
uuid: suggestions.armor?.uuid,
|
||||
taken: suggestions.armor?.uuid === this.equipment.armor?.uuid
|
||||
},
|
||||
compendium: 'armors'
|
||||
};
|
||||
context.primaryWeapon = {
|
||||
...this.equipment.primaryWeapon,
|
||||
suggestion: {
|
||||
...suggestions.primaryWeapon,
|
||||
uuid: suggestions.primaryWeapon?.uuid,
|
||||
taken: suggestions.primaryWeapon?.uuid === this.equipment.primaryWeapon?.uuid
|
||||
},
|
||||
compendium: 'weapons'
|
||||
|
|
@ -388,6 +393,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
...this.equipment.secondaryWeapon,
|
||||
suggestion: {
|
||||
...suggestions.secondaryWeapon,
|
||||
uuid: suggestions.secondaryWeapon?.uuid,
|
||||
taken: suggestions.secondaryWeapon?.uuid === this.equipment.secondaryWeapon?.uuid
|
||||
},
|
||||
disabled: this.equipment.primaryWeapon?.system?.burden === burden.twoHanded.value,
|
||||
|
|
@ -490,22 +496,22 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
|
||||
static async viewCompendium(event, target) {
|
||||
const type = target.dataset.compendium ?? target.dataset.type;
|
||||
|
||||
|
||||
const presets = {
|
||||
compendium: "daggerheart",
|
||||
compendium: 'daggerheart',
|
||||
folder: type,
|
||||
render: {
|
||||
noFolder: true
|
||||
}
|
||||
};
|
||||
|
||||
if(type == "domains")
|
||||
if (type == 'domains')
|
||||
presets.filter = {
|
||||
'level.max': { key: 'level.max', value: 1 },
|
||||
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null },
|
||||
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
|
||||
};
|
||||
|
||||
return this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true });
|
||||
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
|
||||
}
|
||||
|
||||
static async viewItem(_, target) {
|
||||
|
|
@ -574,13 +580,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
await createEmbeddedItemWithEffects(this.character, this.setup.community);
|
||||
await createEmbeddedItemWithEffects(this.character, this.setup.class);
|
||||
await createEmbeddedItemWithEffects(this.character, this.setup.subclass);
|
||||
await this.character.createEmbeddedDocuments(
|
||||
'Item',
|
||||
Object.values(this.setup.domainCards).map(x => ({
|
||||
...x,
|
||||
effects: x.effects?.map(effect => effect.toObject())
|
||||
}))
|
||||
);
|
||||
await createEmbeddedItemsWithEffects(this.character, Object.values(this.setup.domainCards));
|
||||
|
||||
if (this.equipment.armor.uuid)
|
||||
await createEmbeddedItemWithEffects(this.character, this.equipment.armor, {
|
||||
|
|
@ -602,24 +602,28 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
if (this.equipment.inventory.choiceB.uuid)
|
||||
await createEmbeddedItemWithEffects(this.character, this.equipment.inventory.choiceB);
|
||||
|
||||
await this.character.createEmbeddedDocuments(
|
||||
'Item',
|
||||
this.setup.class.system.inventory.take
|
||||
.filter(x => x)
|
||||
.map(x => ({
|
||||
...x,
|
||||
effects: x.effects?.map(effect => effect.toObject())
|
||||
}))
|
||||
await createEmbeddedItemsWithEffects(
|
||||
this.character,
|
||||
this.setup.class.system.inventory.take.filter(x => x)
|
||||
);
|
||||
|
||||
await this.character.update({
|
||||
system: {
|
||||
traits: this.setup.traits,
|
||||
experiences: this.setup.experiences
|
||||
}
|
||||
});
|
||||
await this.character.update(
|
||||
{
|
||||
system: {
|
||||
traits: this.setup.traits,
|
||||
experiences: {
|
||||
...this.setup.experiences,
|
||||
...Object.keys(this.character.system.experiences).reduce((acc, key) => {
|
||||
acc[`-=${key}`] = null;
|
||||
return acc;
|
||||
}, {})
|
||||
}
|
||||
}
|
||||
},
|
||||
{ overwrite: true }
|
||||
);
|
||||
|
||||
if(this.itemBrowser) this.itemBrowser.close();
|
||||
if (this.itemBrowser) this.itemBrowser.close();
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
|
@ -710,6 +714,10 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
return;
|
||||
}
|
||||
|
||||
if (item.system.burden === CONFIG.DH.GENERAL.burden.twoHanded.value) {
|
||||
this.equipment.secondaryWeapon = {};
|
||||
}
|
||||
|
||||
this.equipment.primaryWeapon = { ...item, uuid: item.uuid };
|
||||
} else if (item.type === 'weapon' && event.target.closest('.secondary-weapon-card')) {
|
||||
if (this.equipment.primaryWeapon?.system?.burden === burden.twoHanded.value) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ export { default as BeastformDialog } from './beastformDialog.mjs';
|
|||
export { default as d20RollDialog } from './d20RollDialog.mjs';
|
||||
export { default as DamageDialog } from './damageDialog.mjs';
|
||||
export { default as DamageReductionDialog } from './damageReductionDialog.mjs';
|
||||
export { default as DamageSelectionDialog } from './damageSelectionDialog.mjs';
|
||||
export { default as DeathMove } from './deathMove.mjs';
|
||||
export { default as Downtime } from './downtime.mjs';
|
||||
export { default as MulticlassChoiceDialog } from './multiclassChoiceDialog.mjs';
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
};
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize(`DAGGERHEART.EFFECTS.ApplyLocations.${this.config.isHealing ? 'healing' : 'damage'}Roll.name`);
|
||||
return game.i18n.localize(
|
||||
`DAGGERHEART.EFFECTS.ApplyLocations.${this.config.hasHealing ? 'healing' : 'damage'}Roll.name`
|
||||
);
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
|
|
@ -46,7 +48,7 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
context.config = CONFIG.DH;
|
||||
context.title = this.config.title ?? this.title;
|
||||
context.formula = this.roll.constructFormula(this.config);
|
||||
context.isHealing = this.config.isHealing;
|
||||
context.hasHealing = this.config.hasHealing;
|
||||
context.directDamage = this.config.directDamage;
|
||||
context.selectedRollMode = this.config.selectedRollMode;
|
||||
context.rollModes = Object.entries(CONFIG.Dice.rollModes).map(([action, { label, icon }]) => ({
|
||||
|
|
|
|||
|
|
@ -1,128 +0,0 @@
|
|||
// TO DELETE ?
|
||||
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class DamageSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(rollString, bonusDamage, resolve, hope = 0) {
|
||||
super({});
|
||||
|
||||
this.data = {
|
||||
rollString,
|
||||
bonusDamage: bonusDamage.reduce((acc, x) => {
|
||||
if (x.appliesOn === CONFIG.DH.EFFECTS.applyLocations.damageRoll.id) {
|
||||
acc.push({
|
||||
...x,
|
||||
hopeUses: 0
|
||||
});
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []),
|
||||
hope
|
||||
};
|
||||
this.resolve = resolve;
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'damage-selection'],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
decreaseHopeUse: this.decreaseHopeUse,
|
||||
increaseHopeUse: this.increaseHopeUse,
|
||||
rollDamage: this.rollDamage
|
||||
},
|
||||
form: {
|
||||
handler: this.updateSelection,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/damageSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @inheritDoc */
|
||||
get title() {
|
||||
return `Damage Options`;
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
return {
|
||||
rollString: this.getRollString(),
|
||||
bonusDamage: this.data.bonusDamage,
|
||||
hope: this.data.hope + 1,
|
||||
hopeUsed: this.getHopeUsed()
|
||||
};
|
||||
}
|
||||
|
||||
static updateSelection(event, _, formData) {
|
||||
const { bonusDamage, ...rest } = foundry.utils.expandObject(formData.object);
|
||||
|
||||
for (var index in bonusDamage) {
|
||||
this.data.bonusDamage[index].initiallySelected = bonusDamage[index].initiallySelected;
|
||||
if (bonusDamage[index].hopeUses) {
|
||||
const value = Number.parseInt(bonusDamage[index].hopeUses);
|
||||
if (!Number.isNaN(value)) this.data.bonusDamage[index].hopeUses = value;
|
||||
}
|
||||
}
|
||||
|
||||
this.data = foundry.utils.mergeObject(this.data, rest);
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
getRollString() {
|
||||
return this.data.rollString.concat(
|
||||
this.data.bonusDamage.reduce((acc, x) => {
|
||||
if (x.initiallySelected) {
|
||||
const nr = 1 + x.hopeUses;
|
||||
const baseDamage = x.value;
|
||||
return acc.concat(` + ${nr}${baseDamage}`);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, '')
|
||||
);
|
||||
}
|
||||
|
||||
getHopeUsed() {
|
||||
return this.data.bonusDamage.reduce((acc, x) => acc + x.hopeUses, 0);
|
||||
}
|
||||
|
||||
static decreaseHopeUse(_, button) {
|
||||
const index = Number.parseInt(button.dataset.index);
|
||||
if (this.data.bonusDamage[index].hopeUses - 1 >= 0) {
|
||||
this.data.bonusDamage[index].hopeUses -= 1;
|
||||
this.render(true);
|
||||
}
|
||||
}
|
||||
|
||||
static increaseHopeUse(_, button) {
|
||||
const index = Number.parseInt(button.dataset.index);
|
||||
if (this.data.bonusDamage[index].hopeUses <= this.data.hope + 1) {
|
||||
this.data.bonusDamage[index].hopeUses += 1;
|
||||
this.render(true);
|
||||
}
|
||||
}
|
||||
|
||||
static rollDamage(event) {
|
||||
event.preventDefault();
|
||||
|
||||
this.resolve({
|
||||
rollString: this.getRollString(),
|
||||
bonusDamage: this.data.bonusDamage,
|
||||
hopeUsed: this.getHopeUsed()
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +94,10 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
const actionItems = this.actor.items.reduce((acc, x) => {
|
||||
if (x.system.actions) {
|
||||
const recoverable = x.system.actions.reduce((acc, action) => {
|
||||
if (action.uses.recovery && (action.uses.recovery === 'shortRest') === this.shortrest) {
|
||||
if (
|
||||
(action.uses.recovery && (action.uses.recovery === 'longRest') === !this.shortrest) ||
|
||||
action.uses.recovery === 'shortRest'
|
||||
) {
|
||||
acc.push({
|
||||
title: x.name,
|
||||
name: action.name,
|
||||
|
|
@ -116,7 +119,8 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
if (
|
||||
x.system.resource &&
|
||||
x.system.resource.type &&
|
||||
(x.system.resource.recovery === 'shortRest') === this.shortrest
|
||||
((x.system.resource.recovery === 'longRest') === !this.shortrest ||
|
||||
x.system.resource.recovery === 'shortRest')
|
||||
) {
|
||||
acc.push({
|
||||
title: game.i18n.localize(`TYPES.Item.${x.type}`),
|
||||
|
|
@ -226,14 +230,18 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
) {
|
||||
for (var data of this.refreshables.actionItems) {
|
||||
const action = await foundry.utils.fromUuid(data.uuid);
|
||||
await action.parent.parent.update({ [`system.actions.${action.id}.uses.value`]: action.uses.max ?? 1 });
|
||||
await action.parent.parent.update({ [`system.actions.${action.id}.uses.value`]: 0 });
|
||||
}
|
||||
|
||||
for (var data of this.refreshables.resourceItems) {
|
||||
const feature = await foundry.utils.fromUuid(data.uuid);
|
||||
const increasing =
|
||||
feature.system.resource.progression === CONFIG.DH.ITEM.itemResourceProgression.increasing.id;
|
||||
const resetValue = increasing ? 0 : (feature.system.resource.max ?? 0);
|
||||
const resetValue = increasing
|
||||
? 0
|
||||
: feature.system.resource.max
|
||||
? Roll.replaceFormulaData(feature.system.resource.max, this.actor)
|
||||
: 0;
|
||||
await feature.update({ 'system.resource.value': resetValue });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
|||
const experience = Object.keys(this.actor.system.experiences).find(
|
||||
x => x === data
|
||||
);
|
||||
return this.actor.system.experiences[experience]?.description ?? '';
|
||||
return this.actor.system.experiences[experience]?.name ?? '';
|
||||
});
|
||||
advancement[choiceKey].push({ data: data, value: checkbox.value });
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -47,10 +47,12 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
static PARTS = {
|
||||
tabs: { template: 'systems/daggerheart/templates/levelup/tabs/tab-navigation.hbs' },
|
||||
advancements: { template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs' },
|
||||
advancements: {
|
||||
template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs'
|
||||
},
|
||||
selections: {
|
||||
template: 'systems/daggerheart/templates/levelup/tabs/selections.hbs',
|
||||
scrollable: ['.selections']
|
||||
scrollable: ['.levelup-selections-container']
|
||||
},
|
||||
summary: { template: 'systems/daggerheart/templates/levelup/tabs/summary.hbs' },
|
||||
footer: { template: 'systems/daggerheart/templates/levelup/tabs/footer.hbs' }
|
||||
|
|
@ -536,29 +538,28 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
static async viewCompendium(event, target) {
|
||||
const type = target.dataset.compendium ?? target.dataset.type;
|
||||
|
||||
|
||||
const presets = {
|
||||
compendium: "daggerheart",
|
||||
compendium: 'daggerheart',
|
||||
folder: type,
|
||||
render: {
|
||||
noFolder: true
|
||||
}
|
||||
};
|
||||
|
||||
if(type == "domains") {
|
||||
if (type == 'domains') {
|
||||
const domains = this.actor.system.domains,
|
||||
multiclassDomain = this.levelup.classUpgradeChoices?.multiclass?.domain;
|
||||
if (multiclassDomain) {
|
||||
if (!domains.includes(x => x === multiclassDomain))
|
||||
domains.push(multiclassDomain);
|
||||
if (!domains.includes(x => x === multiclassDomain)) domains.push(multiclassDomain);
|
||||
}
|
||||
presets.filter = {
|
||||
'level.max': { key: 'level.max', value: this.levelup.currentLevel },
|
||||
'system.domain': { key: 'system.domain', value: domains },
|
||||
'system.domain': { key: 'system.domain', value: domains }
|
||||
};
|
||||
}
|
||||
|
||||
return this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true });
|
||||
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
|
||||
}
|
||||
|
||||
static async selectPreview(_, button) {
|
||||
|
|
@ -659,7 +660,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
}, {});
|
||||
|
||||
await this.actor.levelUp(levelupData);
|
||||
if(this.itemBrowser) this.itemBrowser.close();
|
||||
if (this.itemBrowser) this.itemBrowser.close();
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export { default as DhAppearanceSettings } from './appearanceSettings.mjs';
|
||||
export { default as DhAutomationSettings } from './automationSettings.mjs';
|
||||
export { default as DhHomebrewSettings } from './homebrewSettings.mjs';
|
||||
export { default as DhRangeMeasurementSettings } from './rangeMeasurementSettings.mjs';
|
||||
export { default as DhVariantRuleSettings } from './variantRuleSettings.mjs';
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
import { DhRangeMeasurement } from '../../data/settings/_module.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class DhRangeMeasurementSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor() {
|
||||
super({});
|
||||
|
||||
this.settings = new DhRangeMeasurement(
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.RangeMeasurement).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.SETTINGS.Menu.title');
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'daggerheart-automation-settings',
|
||||
classes: ['daggerheart', 'dialog', 'dh-style', 'setting'],
|
||||
position: { width: '600', height: 'auto' },
|
||||
window: {
|
||||
icon: 'fa-solid fa-gears'
|
||||
},
|
||||
actions: {
|
||||
reset: this.reset,
|
||||
save: this.save
|
||||
},
|
||||
form: { handler: this.updateData, submitOnChange: true }
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: 'systems/daggerheart/templates/settings/range-measurement-settings.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.settingFields = this.settings;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateData(event, element, formData) {
|
||||
const updatedSettings = foundry.utils.expandObject(formData.object);
|
||||
|
||||
await this.settings.updateSource(updatedSettings);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async reset() {
|
||||
this.settings = new DhRangeMeasurement();
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.RangeMeasurement,
|
||||
this.settings.toObject()
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
toggleResourceDice: CharacterSheet.#toggleResourceDice,
|
||||
handleResourceDice: CharacterSheet.#handleResourceDice,
|
||||
useDowntime: this.useDowntime,
|
||||
tempBrowser: CharacterSheet.#tempBrowser,
|
||||
tempBrowser: CharacterSheet.#tempBrowser
|
||||
},
|
||||
window: {
|
||||
resizable: true
|
||||
|
|
@ -158,7 +158,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
currency: {
|
||||
title: game.i18n.localize('DAGGERHEART.CONFIG.Gold.title'),
|
||||
coins: game.i18n.localize('DAGGERHEART.CONFIG.Gold.coins'),
|
||||
handfulls: game.i18n.localize('DAGGERHEART.CONFIG.Gold.handfulls'),
|
||||
handfuls: game.i18n.localize('DAGGERHEART.CONFIG.Gold.handfuls'),
|
||||
bags: game.i18n.localize('DAGGERHEART.CONFIG.Gold.bags'),
|
||||
chests: game.i18n.localize('DAGGERHEART.CONFIG.Gold.chests')
|
||||
}
|
||||
|
|
@ -180,6 +180,13 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
async _preparePartContext(partId, context, options) {
|
||||
context = await super._preparePartContext(partId, context, options);
|
||||
switch (partId) {
|
||||
case 'header':
|
||||
const { playerCanEditSheet, levelupAuto } = game.settings.get(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.Automation
|
||||
);
|
||||
context.showSettings = game.user.isGM || !levelupAuto || (levelupAuto && playerCanEditSheet);
|
||||
break;
|
||||
case 'loadout':
|
||||
await this._prepareLoadoutContext(context, options);
|
||||
break;
|
||||
|
|
@ -190,6 +197,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
await this._prepareBiographyContext(context, options);
|
||||
break;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
|
@ -596,7 +604,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const { key } = button.dataset;
|
||||
|
||||
const presets = {
|
||||
compendium: "daggerheart",
|
||||
compendium: 'daggerheart',
|
||||
folder: key,
|
||||
render: {
|
||||
noFolder: true
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
static DEFAULT_OPTIONS = {
|
||||
classes: ['environment'],
|
||||
position: {
|
||||
width: 500
|
||||
width: 500,
|
||||
height: 725
|
||||
},
|
||||
window: {
|
||||
resizable: true
|
||||
},
|
||||
actions: {},
|
||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default function DHApplicationMixin(Base) {
|
|||
toggleEffect: DHSheetV2.#toggleEffect,
|
||||
toggleExtended: DHSheetV2.#toggleExtended,
|
||||
addNewItem: DHSheetV2.#addNewItem,
|
||||
browseItem: DHSheetV2.#browseItem,
|
||||
browseItem: DHSheetV2.#browseItem
|
||||
},
|
||||
contextMenus: [
|
||||
{
|
||||
|
|
@ -327,17 +327,31 @@ export default function DHApplicationMixin(Base) {
|
|||
|
||||
if (usable)
|
||||
options.unshift({
|
||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||
icon: 'fa-solid fa-burst',
|
||||
name: 'DAGGERHEART.GENERAL.damage',
|
||||
icon: 'fa-solid fa-explosion',
|
||||
condition: target => {
|
||||
const doc = getDocFromElementSync(target);
|
||||
return doc && !(doc.type === 'domainCard' && doc.system.inVault);
|
||||
return doc?.system?.attack?.damage.parts.length || doc?.damage?.parts.length;
|
||||
},
|
||||
callback: async (target, event) => (await getDocFromElement(target)).use(event)
|
||||
callback: async (target, event) => {
|
||||
const doc = await getDocFromElement(target),
|
||||
action = doc?.system?.attack ?? doc;
|
||||
return action && action.use(event, { byPassRoll: true });
|
||||
}
|
||||
});
|
||||
|
||||
options.unshift({
|
||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||
icon: 'fa-solid fa-burst',
|
||||
condition: target => {
|
||||
const doc = getDocFromElementSync(target);
|
||||
return doc && !(doc.type === 'domainCard' && doc.system.inVault);
|
||||
},
|
||||
callback: async (target, event) => (await getDocFromElement(target)).use(event)
|
||||
});
|
||||
|
||||
if (toChat)
|
||||
options.unshift({
|
||||
options.push({
|
||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
|
||||
icon: 'fa-solid fa-message',
|
||||
callback: async target => (await getDocFromElement(target)).toChat(this.document.id)
|
||||
|
|
@ -419,25 +433,22 @@ export default function DHApplicationMixin(Base) {
|
|||
classes: ['dh-style', 'two-big-buttons'],
|
||||
buttons: [
|
||||
{
|
||||
action: "create",
|
||||
label: "Create Item",
|
||||
icon: "fa-solid fa-plus"
|
||||
action: 'create',
|
||||
label: 'Create Item',
|
||||
icon: 'fa-solid fa-plus'
|
||||
},
|
||||
{
|
||||
action: "browse",
|
||||
label: "Browse Compendium",
|
||||
icon: "fa-solid fa-book"
|
||||
action: 'browse',
|
||||
label: 'Browse Compendium',
|
||||
icon: 'fa-solid fa-book'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
if(!createChoice) return;
|
||||
|
||||
if(createChoice === "browse")
|
||||
return DHSheetV2.#browseItem.call(this, event, target);
|
||||
else
|
||||
return DHSheetV2.#createDoc.call(this, event, target);
|
||||
if (!createChoice) return;
|
||||
|
||||
if (createChoice === 'browse') return DHSheetV2.#browseItem.call(this, event, target);
|
||||
else return DHSheetV2.#createDoc.call(this, event, target);
|
||||
}
|
||||
|
||||
static async #browseItem(event, target) {
|
||||
|
|
@ -450,8 +461,8 @@ export default function DHApplicationMixin(Base) {
|
|||
case 'consumable':
|
||||
case 'armor':
|
||||
case 'weapon':
|
||||
presets.compendium = "daggerheart";
|
||||
presets.folder = "equipments";
|
||||
presets.compendium = 'daggerheart';
|
||||
presets.folder = 'equipments';
|
||||
presets.render = {
|
||||
noFolder: true
|
||||
};
|
||||
|
|
@ -460,14 +471,14 @@ export default function DHApplicationMixin(Base) {
|
|||
};
|
||||
break;
|
||||
case 'domainCard':
|
||||
presets.compendium = "daggerheart";
|
||||
presets.folder = "domains";
|
||||
presets.compendium = 'daggerheart';
|
||||
presets.folder = 'domains';
|
||||
presets.render = {
|
||||
noFolder: true
|
||||
};
|
||||
presets.filter = {
|
||||
'level.max': { key: 'level.max', value: this.document.system.levelData.level.current },
|
||||
'system.domain': { key: 'system.domain', value: this.document.system.domains },
|
||||
'system.domain': { key: 'system.domain', value: this.document.system.domains }
|
||||
};
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
},
|
||||
actions: {
|
||||
openSettings: DHBaseActorSheet.#openSettings,
|
||||
sendExpToChat: DHBaseActorSheet.#sendExpToChat
|
||||
sendExpToChat: DHBaseActorSheet.#sendExpToChat,
|
||||
increaseActionUses: event => DHBaseActorSheet.#modifyActionUses(event, true)
|
||||
},
|
||||
contextMenus: [
|
||||
{
|
||||
|
|
@ -70,6 +71,15 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
htmlElement.querySelectorAll('.item-button .action-uses-button').forEach(element => {
|
||||
element.addEventListener('contextmenu', DHBaseActorSheet.#modifyActionUses);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare render context for the Effect part.
|
||||
* @param {ApplicationRenderContext} context
|
||||
|
|
@ -154,6 +164,19 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
cls.create(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static async #modifyActionUses(event, increase) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
const actionId = event.target.dataset.itemUuid;
|
||||
const action = await foundry.utils.fromUuid(actionId);
|
||||
|
||||
const newValue = (action.uses.value ?? 0) + (increase ? 1 : -1);
|
||||
await action.update({ 'uses.value': Math.min(Math.max(newValue, 0), action.uses.max ?? 0) });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Drag/Drop */
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import DHBaseItemSheet from '../api/base-item.mjs';
|
|||
export default class FeatureSheet extends DHBaseItemSheet {
|
||||
/** @inheritDoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
id: 'daggerheart-feature',
|
||||
classes: ['feature'],
|
||||
actions: {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
|||
static DEFAULT_OPTIONS = {
|
||||
classes: ['subclass'],
|
||||
position: { width: 600 },
|
||||
window: { resizable: false }
|
||||
window: { resizable: true }
|
||||
};
|
||||
|
||||
/**@override */
|
||||
|
|
|
|||
|
|
@ -194,8 +194,12 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
event.stopPropagation();
|
||||
|
||||
const item = await foundry.utils.fromUuid(message.system.origin);
|
||||
const action = item.system.actions.get(event.currentTarget.id);
|
||||
await item.use(action);
|
||||
const action =
|
||||
item.system.attack?.id === event.currentTarget.id
|
||||
? item.system.attack
|
||||
: item.system.actions.get(event.currentTarget.id);
|
||||
if (event.currentTarget.dataset.directDamage) action.use(event, { byPassRoll: true });
|
||||
else action.use(event);
|
||||
}
|
||||
|
||||
async actionUseButton(event, message) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
|||
}
|
||||
}
|
||||
|
||||
await this.viewed.update({ turn: this.viewed.turn === toggleTurn ? null : toggleTurn });
|
||||
await this.viewed.update({
|
||||
turn: this.viewed.turn === toggleTurn ? null : toggleTurn,
|
||||
round: this.viewed.round + 1
|
||||
});
|
||||
await combatant.update(update);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue