mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-08 13:48:11 +02:00
Restructured all the files
This commit is contained in:
parent
099a4576da
commit
ba3157a2fc
180 changed files with 722 additions and 1730 deletions
|
|
@ -11,12 +11,12 @@ export { default as DhpMiscellaneous } from './sheets/items/miscellaneous.mjs';
|
|||
export { default as DhpConsumable } from './sheets/items/consumable.mjs';
|
||||
export { default as DhpWeapon } from './sheets/items/weapon.mjs';
|
||||
export { default as DhpArmor } from './sheets/items/armor.mjs';
|
||||
export { default as DhpChatMessage } from './chatMessage.mjs';
|
||||
export { default as DhpEnvironment } from './sheets/actors/environment.mjs';
|
||||
export { default as DhActiveEffectConfig } from './sheets/activeEffectConfig.mjs';
|
||||
export { default as DhContextMenu } from './contextMenu.mjs';
|
||||
export { default as DhContextMenu } from './ux/contextMenu.mjs';
|
||||
export { default as DhBeastform } from './sheets/items/beastform.mjs';
|
||||
export { default as DhTooltipManager } from './tooltipManager.mjs';
|
||||
|
||||
export * as config from './config/_module.mjs';
|
||||
export * as api from './sheets/api/_modules.mjs';
|
||||
export * as ui from './ui/_module.mjs';
|
||||
export * as ux from './ux/_module.mjs';
|
||||
|
|
|
|||
|
|
@ -1,250 +0,0 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class AncestrySelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(resolve) {
|
||||
super({});
|
||||
|
||||
this.resolve = resolve;
|
||||
this.data = {
|
||||
ancestries: [],
|
||||
features: [],
|
||||
ancestryInfo: {
|
||||
name: '',
|
||||
img: null,
|
||||
customImg: 'icons/svg/mystery-man.svg',
|
||||
description: ''
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'views', 'ancestry-selection'],
|
||||
position: {
|
||||
width: 800,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
selectAncestry: this.selectAncestry,
|
||||
selectFeature: this.selectFeature,
|
||||
viewItem: this.viewItem,
|
||||
selectImage: this.selectImage,
|
||||
editImage: this._onEditImage,
|
||||
saveAncestry: this.saveAncestry
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'ancestrySelection',
|
||||
template: 'systems/daggerheart/templates/views/ancestrySelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @inheritDoc */
|
||||
get title() {
|
||||
return `Ancestry Selection`;
|
||||
}
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
const ancestryNameInput = $(htmlElement).find('.ancestry-name');
|
||||
if (ancestryNameInput.length > 0) {
|
||||
ancestryNameInput.on('change', this.setName.bind(this));
|
||||
$(htmlElement).find('.ancestry-description').on('change', this.setDescription.bind(this));
|
||||
}
|
||||
// $(htmlElement).find(".ancestry-image").on("change", this.selectImage.bind(this));
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const systemAncestries = Array.from((await game.packs.get('daggerheart.ancestries')).index).map(x => ({
|
||||
...x,
|
||||
selected: this.data.ancestries.some(selected => selected.uuid === x.uuid)
|
||||
}));
|
||||
|
||||
const customAncestries = game.items.reduce((acc, x) => {
|
||||
if (x.type === 'ancestry') {
|
||||
acc.push({
|
||||
...x,
|
||||
uuid: x.uuid,
|
||||
selected: this.data.ancestries.some(selected => selected.uuid === x.uuid)
|
||||
});
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const ancestryFeatures = this.data.ancestries.flatMap(x =>
|
||||
x.system.abilities.map(x => ({
|
||||
...x,
|
||||
selected: this.data.features.some(selected => selected.uuid === x.uuid)
|
||||
}))
|
||||
);
|
||||
|
||||
return {
|
||||
systemAncestries,
|
||||
customAncestries,
|
||||
ancestryFeatures,
|
||||
selectedAncestries: this.data.ancestries,
|
||||
selectedFeatures: this.data.features,
|
||||
ancestryInfo: this.data.ancestryInfo
|
||||
};
|
||||
}
|
||||
|
||||
static async selectAncestry(_, button) {
|
||||
const newAncestries = [...this.data.ancestries];
|
||||
if (!newAncestries.findSplice(x => x.uuid === button.dataset.uuid) && this.data.ancestries.length < 2) {
|
||||
const ancestry = await fromUuid(button.dataset.uuid);
|
||||
newAncestries.push(ancestry);
|
||||
}
|
||||
|
||||
this.data.ancestries = newAncestries;
|
||||
this.data.features = newAncestries.length === 1 ? newAncestries[0].system.abilities : [];
|
||||
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
static async selectFeature(_, button) {
|
||||
const newFeatures = [...this.data.features];
|
||||
if (!newFeatures.findSplice(x => x.uuid === button.dataset.uuid) && this.data.features.length < 2) {
|
||||
const feature = await fromUuid(button.dataset.uuid);
|
||||
newFeatures.push(feature);
|
||||
}
|
||||
|
||||
this.data.features = newFeatures;
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
static async viewItem(_, button) {
|
||||
(await fromUuid(button.dataset.uuid)).sheet.render(true);
|
||||
}
|
||||
|
||||
setName(event) {
|
||||
this.data.ancestryInfo.name = event.currentTarget.value;
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
setDescription(event) {
|
||||
this.data.ancestryInfo.description = event.currentTarget.value;
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
static selectImage(_, button) {
|
||||
this.data.ancestryInfo.img = button.dataset.img;
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
static _onEditImage() {
|
||||
const fp = new foundry.applications.apps.FilePicker.implementation({
|
||||
current: this.data.ancestryInfo.img,
|
||||
type: 'image',
|
||||
redirectToRoot: ['icons/svg/mystery-man.svg'],
|
||||
callback: async path => this._updateImage.bind(this)(path),
|
||||
top: this.position.top + 40,
|
||||
left: this.position.left + 10
|
||||
});
|
||||
return fp.browse();
|
||||
}
|
||||
|
||||
_updateImage(path) {
|
||||
this.data.ancestryInfo.customImg = path;
|
||||
this.data.ancestryInfo.img = path;
|
||||
this.render(true);
|
||||
}
|
||||
|
||||
static async saveAncestry(_, button) {
|
||||
if (this.data.ancestries.length === 2) {
|
||||
const { name, img, description } = this.data.ancestryInfo;
|
||||
|
||||
this.resolve({
|
||||
data: {
|
||||
name: name,
|
||||
img: img,
|
||||
type: 'ancestry',
|
||||
system: {
|
||||
description: description,
|
||||
abilities: this.data.features.map(x => ({
|
||||
name: x.name,
|
||||
img: x.img,
|
||||
uuid: x.uuid,
|
||||
subclassLevel: ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.resolve({ data: this.data.ancestries[0].toObject() });
|
||||
}
|
||||
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
// export default class DamageSelectionDialog extends FormApplication {
|
||||
// constructor(rollString, bonusDamage, resolve){
|
||||
// super({}, {});
|
||||
|
||||
// this.data = {
|
||||
// rollString,
|
||||
// bonusDamage: bonusDamage.map(x => ({
|
||||
// ...x,
|
||||
// hopeUses: 0
|
||||
// })),
|
||||
// }
|
||||
// this.resolve = resolve;
|
||||
// }
|
||||
|
||||
// get title (){
|
||||
// return 'Damage Options';
|
||||
// }
|
||||
|
||||
// static get defaultOptions() {
|
||||
// const defaults = super.defaultOptions;
|
||||
// const overrides = {
|
||||
// height: 'auto',
|
||||
// width: 400,
|
||||
// id: 'damage-selection',
|
||||
// template: 'systems/daggerheart/templates/views/damageSelection.hbs',
|
||||
// closeOnSubmit: false,
|
||||
// classes: ["daggerheart", "views", "damage-selection"],
|
||||
// };
|
||||
|
||||
// const mergedOptions = foundry.utils.mergeObject(defaults, overrides);
|
||||
|
||||
// return mergedOptions;
|
||||
// }
|
||||
|
||||
// async getData(){
|
||||
// const context = super.getData();
|
||||
// context.rollString = this.data.rollString;
|
||||
// context.bonusDamage = this.data.bonusDamage;
|
||||
|
||||
// return context;
|
||||
// }
|
||||
|
||||
// activateListeners(html) {
|
||||
// super.activateListeners(html);
|
||||
|
||||
// html.find('.roll-button').click(this.finish.bind(this));
|
||||
// html.find('.').change();
|
||||
// }
|
||||
|
||||
// // async _updateObject(_, formData) {
|
||||
// // const data = foundry.utils.expandObject(formData);
|
||||
// // this.data = foundry.utils.mergeObject(this.data, data);
|
||||
// // this.render(true);
|
||||
// // }
|
||||
|
||||
// finish(){
|
||||
// this.resolve(this.data);
|
||||
// this.close();
|
||||
// }
|
||||
// }
|
||||
|
|
@ -74,11 +74,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
};
|
||||
|
||||
static PARTS = {
|
||||
tabs: { template: 'systems/daggerheart/templates/views/characterCreation/tabs.hbs' },
|
||||
setup: { template: 'systems/daggerheart/templates/views/characterCreation/tabs/setup.hbs' },
|
||||
equipment: { template: 'systems/daggerheart/templates/views/characterCreation/tabs/equipment.hbs' },
|
||||
// story: { template: 'systems/daggerheart/templates/views/characterCreation/tabs/story.hbs' },
|
||||
footer: { template: 'systems/daggerheart/templates/views/characterCreation/footer.hbs' }
|
||||
tabs: { template: 'systems/daggerheart/templates/characterCreation/tabs.hbs' },
|
||||
setup: { template: 'systems/daggerheart/templates/characterCreation/tabs/setup.hbs' },
|
||||
equipment: { template: 'systems/daggerheart/templates/characterCreation/tabs/equipment.hbs' },
|
||||
// story: { template: 'systems/daggerheart/templates/characterCreation/tabs/story.hbs' },
|
||||
footer: { template: 'systems/daggerheart/templates/characterCreation/footer.hbs' }
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
|
|
@ -176,7 +176,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
switch (partId) {
|
||||
case 'setup':
|
||||
const availableTraitModifiers = game.settings
|
||||
.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew)
|
||||
.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew)
|
||||
.traitArray.map(trait => ({ key: trait, name: trait }));
|
||||
for (let trait of Object.values(this.setup.traits).filter(x => x.value !== null)) {
|
||||
const index = availableTraitModifiers.findIndex(x => x.key === trait.value);
|
||||
|
|
@ -396,7 +396,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = TextEditor.getDragEventData(event);
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = await foundry.utils.fromUuid(data.uuid);
|
||||
if (item.type === 'ancestry' && event.target.closest('.ancestry-card')) {
|
||||
this.setup.ancestry = {
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||
async renderHTML() {
|
||||
if (this.system.messageTemplate)
|
||||
this.content = await foundry.applications.handlebars.renderTemplate(
|
||||
this.system.messageTemplate,
|
||||
this.system
|
||||
);
|
||||
|
||||
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
||||
const html = await super.renderHTML();
|
||||
this.applyPermission(html);
|
||||
|
||||
if (this.type === 'dualityRoll') {
|
||||
html.classList.add('duality');
|
||||
switch (this.system.roll.result.duality) {
|
||||
case 1:
|
||||
html.classList.add('hope');
|
||||
break;
|
||||
case -1:
|
||||
html.classList.add('fear');
|
||||
break;
|
||||
default:
|
||||
html.classList.add('critical');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
applyPermission(html) {
|
||||
const elements = html.querySelectorAll('[data-perm-id]');
|
||||
elements.forEach(e => {
|
||||
const uuid = e.dataset.permId,
|
||||
document = fromUuidSync(uuid);
|
||||
e.setAttribute('data-view-perm', document.testUserPermission(game.user, 'OBSERVER'));
|
||||
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
|||
static PARTS = {
|
||||
form: {
|
||||
id: 'action',
|
||||
template: 'systems/daggerheart/templates/views/action.hbs'
|
||||
template: 'systems/daggerheart/templates/config/action.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
|||
context.source = this.action.toObject(false);
|
||||
context.openSection = this.openSection;
|
||||
context.tabs = this._getTabs();
|
||||
context.config = SYSTEM;
|
||||
context.config = CONFIG.DH;
|
||||
if (!!this.action.effects) context.effects = this.action.effects.map(e => this.action.item.effects.get(e._id));
|
||||
if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
context.hasBaseDamage = !!this.action.parent.damage;
|
||||
|
|
@ -70,7 +70,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
|||
context.isNPC = this.action.actor && this.action.actor.type !== 'character';
|
||||
context.hasRoll = this.action.hasRoll;
|
||||
|
||||
const settingsTiers = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||
context.tierOptions = [
|
||||
{ key: 1, label: game.i18n.localize('DAGGERHEART.Tiers.tier1') },
|
||||
...Object.values(settingsTiers).map(x => ({ key: x.tier, label: x.name }))
|
||||
|
|
|
|||
25
module/applications/config/_module.mjs
Normal file
25
module/applications/config/_module.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import * as action from './Action.mjs';
|
||||
import * as actionConfig from './actionConfig.mjs';
|
||||
import * as actorConfig from './actorConfig.mjs';
|
||||
import * as domainConfig from './domainConfig.mjs';
|
||||
import * as effectConfig from './effectConfig.mjs';
|
||||
import * as flagsConfig from './flagsConfig.mjs';
|
||||
import * as generalConfig from './generalConfig.mjs';
|
||||
import * as hooksConfig from './hooksConfig.mjs';
|
||||
import * as itemConfig from './itemConfig.mjs';
|
||||
import * as settingsConfig from './settingsConfig.mjs';
|
||||
import * as systemConfig from './system.mjs';
|
||||
|
||||
export {
|
||||
action,
|
||||
actionConfig,
|
||||
actorConfig,
|
||||
domainConfig,
|
||||
effectConfig,
|
||||
flagsConfig,
|
||||
generalConfig,
|
||||
hooksConfig,
|
||||
itemConfig,
|
||||
settingsConfig,
|
||||
systemConfig
|
||||
};
|
||||
127
module/applications/config/actionConfig.mjs
Normal file
127
module/applications/config/actionConfig.mjs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
export const actionTypes = {
|
||||
attack: {
|
||||
id: 'attack',
|
||||
name: 'DAGGERHEART.Actions.Types.attack.name',
|
||||
icon: 'fa-swords'
|
||||
},
|
||||
// spellcast: {
|
||||
// id: 'spellcast',
|
||||
// name: 'DAGGERHEART.Actions.Types.spellcast.name',
|
||||
// icon: 'fa-book-sparkles'
|
||||
// },
|
||||
healing: {
|
||||
id: 'healing',
|
||||
name: 'DAGGERHEART.Actions.Types.healing.name',
|
||||
icon: 'fa-kit-medical'
|
||||
},
|
||||
// resource: {
|
||||
// id: 'resource',
|
||||
// name: 'DAGGERHEART.Actions.Types.resource.name',
|
||||
// icon: 'fa-honey-pot'
|
||||
// },
|
||||
damage: {
|
||||
id: 'damage',
|
||||
name: 'DAGGERHEART.Actions.Types.damage.name',
|
||||
icon: 'fa-bone-break'
|
||||
},
|
||||
summon: {
|
||||
id: 'summon',
|
||||
name: 'DAGGERHEART.Actions.Types.summon.name',
|
||||
icon: 'fa-ghost'
|
||||
},
|
||||
effect: {
|
||||
id: 'effect',
|
||||
name: 'DAGGERHEART.Actions.Types.effect.name',
|
||||
icon: 'fa-person-rays'
|
||||
},
|
||||
macro: {
|
||||
id: 'macro',
|
||||
name: 'DAGGERHEART.Actions.Types.macro.name',
|
||||
icon: 'fa-scroll'
|
||||
},
|
||||
beastform: {
|
||||
id: 'beastform',
|
||||
name: 'DAGGERHEART.Actions.Types.beastform.name',
|
||||
icon: 'fa-paw'
|
||||
}
|
||||
};
|
||||
|
||||
export const targetTypes = {
|
||||
self: {
|
||||
id: 'self',
|
||||
label: 'Self'
|
||||
},
|
||||
friendly: {
|
||||
id: 'friendly',
|
||||
label: 'Friendly'
|
||||
},
|
||||
hostile: {
|
||||
id: 'hostile',
|
||||
label: 'Hostile'
|
||||
},
|
||||
any: {
|
||||
id: 'any',
|
||||
label: 'Any'
|
||||
}
|
||||
};
|
||||
|
||||
export const damageOnSave = {
|
||||
none: {
|
||||
id: 'none',
|
||||
label: 'None',
|
||||
mod: 0
|
||||
},
|
||||
half: {
|
||||
id: 'half',
|
||||
label: 'Half Damage',
|
||||
mod: 0.5
|
||||
},
|
||||
full: {
|
||||
id: 'full',
|
||||
label: 'Full damage',
|
||||
mod: 1
|
||||
}
|
||||
};
|
||||
|
||||
export const diceCompare = {
|
||||
below: {
|
||||
id: 'below',
|
||||
label: 'Below',
|
||||
operator: '<'
|
||||
},
|
||||
belowEqual: {
|
||||
id: 'belowEqual',
|
||||
label: 'Below or Equal',
|
||||
operator: '<='
|
||||
},
|
||||
equal: {
|
||||
id: 'equal',
|
||||
label: 'Equal',
|
||||
operator: '='
|
||||
},
|
||||
aboveEqual: {
|
||||
id: 'aboveEqual',
|
||||
label: 'Above or Equal',
|
||||
operator: '>='
|
||||
},
|
||||
above: {
|
||||
id: 'above',
|
||||
label: 'Above',
|
||||
operator: '>'
|
||||
}
|
||||
};
|
||||
|
||||
export const advandtageState = {
|
||||
disadvantage: {
|
||||
label: 'DAGGERHEART.General.Disadvantage.Full',
|
||||
value: -1
|
||||
},
|
||||
neutral: {
|
||||
label: 'DAGGERHEART.General.Neutral.Full',
|
||||
value: 0
|
||||
},
|
||||
advantage: {
|
||||
label: 'DAGGERHEART.General.Advantage.Full',
|
||||
value: 1
|
||||
}
|
||||
};
|
||||
417
module/applications/config/actorConfig.mjs
Normal file
417
module/applications/config/actorConfig.mjs
Normal file
|
|
@ -0,0 +1,417 @@
|
|||
export const abilities = {
|
||||
agility: {
|
||||
label: 'DAGGERHEART.Abilities.agility.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.agility.verb.sprint',
|
||||
'DAGGERHEART.Abilities.agility.verb.leap',
|
||||
'DAGGERHEART.Abilities.agility.verb.maneuver'
|
||||
]
|
||||
},
|
||||
strength: {
|
||||
label: 'DAGGERHEART.Abilities.strength.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.strength.verb.lift',
|
||||
'DAGGERHEART.Abilities.strength.verb.smash',
|
||||
'DAGGERHEART.Abilities.strength.verb.grapple'
|
||||
]
|
||||
},
|
||||
finesse: {
|
||||
label: 'DAGGERHEART.Abilities.finesse.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.finesse.verb.control',
|
||||
'DAGGERHEART.Abilities.finesse.verb.hide',
|
||||
'DAGGERHEART.Abilities.finesse.verb.tinker'
|
||||
]
|
||||
},
|
||||
instinct: {
|
||||
label: 'DAGGERHEART.Abilities.instinct.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.instinct.verb.perceive',
|
||||
'DAGGERHEART.Abilities.instinct.verb.sense',
|
||||
'DAGGERHEART.Abilities.instinct.verb.navigate'
|
||||
]
|
||||
},
|
||||
presence: {
|
||||
label: 'DAGGERHEART.Abilities.presence.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.presence.verb.charm',
|
||||
'DAGGERHEART.Abilities.presence.verb.perform',
|
||||
'DAGGERHEART.Abilities.presence.verb.deceive'
|
||||
]
|
||||
},
|
||||
knowledge: {
|
||||
label: 'DAGGERHEART.Abilities.knowledge.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.knowledge.verb.recall',
|
||||
'DAGGERHEART.Abilities.knowledge.verb.analyze',
|
||||
'DAGGERHEART.Abilities.knowledge.verb.comprehend'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
export const featureProperties = {
|
||||
agility: {
|
||||
name: 'DAGGERHEART.Abilities.agility.name',
|
||||
path: actor => actor.system.traits.agility.data.value
|
||||
},
|
||||
strength: {
|
||||
name: 'DAGGERHEART.Abilities.strength.name',
|
||||
path: actor => actor.system.traits.strength.data.value
|
||||
},
|
||||
finesse: {
|
||||
name: 'DAGGERHEART.Abilities.finesse.name',
|
||||
path: actor => actor.system.traits.finesse.data.value
|
||||
},
|
||||
instinct: {
|
||||
name: 'DAGGERHEART.Abilities.instinct.name',
|
||||
path: actor => actor.system.traits.instinct.data.value
|
||||
},
|
||||
presence: {
|
||||
name: 'DAGGERHEART.Abilities.presence.name',
|
||||
path: actor => actor.system.traits.presence.data.value
|
||||
},
|
||||
knowledge: {
|
||||
name: 'DAGGERHEART.Abilities.knowledge.name',
|
||||
path: actor => actor.system.traits.knowledge.data.value
|
||||
},
|
||||
spellcastingTrait: {
|
||||
name: 'DAGGERHEART.FeatureProperty.SpellcastingTrait',
|
||||
path: actor => actor.system.traits[actor.system.class.subclass.system.spellcastingTrait].data.value
|
||||
}
|
||||
};
|
||||
|
||||
export const adversaryTypes = {
|
||||
bruiser: {
|
||||
id: 'bruiser',
|
||||
label: 'DAGGERHEART.Adversary.Type.bruiser.label',
|
||||
description: 'DAGGERHEART.Adversary.bruiser.description'
|
||||
},
|
||||
horde: {
|
||||
id: 'horde',
|
||||
label: 'DAGGERHEART.Adversary.Type.horde.label',
|
||||
description: 'DAGGERHEART.Adversary.horde.description'
|
||||
},
|
||||
leader: {
|
||||
id: 'leader',
|
||||
label: 'DAGGERHEART.Adversary.Type.leader.label',
|
||||
description: 'DAGGERHEART.Adversary.leader.description'
|
||||
},
|
||||
minion: {
|
||||
id: 'minion',
|
||||
label: 'DAGGERHEART.Adversary.Type.minion.label',
|
||||
description: 'DAGGERHEART.Adversary.minion.description'
|
||||
},
|
||||
ranged: {
|
||||
id: 'ranged',
|
||||
label: 'DAGGERHEART.Adversary.Type.ranged.label',
|
||||
description: 'DAGGERHEART.Adversary.ranged.description'
|
||||
},
|
||||
skulk: {
|
||||
id: 'skulk',
|
||||
label: 'DAGGERHEART.Adversary.Type.skulk.label',
|
||||
description: 'DAGGERHEART.Adversary.skulk.description'
|
||||
},
|
||||
social: {
|
||||
id: 'social',
|
||||
label: 'DAGGERHEART.Adversary.Type.social.label',
|
||||
description: 'DAGGERHEART.Adversary.social.description'
|
||||
},
|
||||
solo: {
|
||||
id: 'solo',
|
||||
label: 'DAGGERHEART.Adversary.Type.solo.label',
|
||||
description: 'DAGGERHEART.Adversary.solo.description'
|
||||
},
|
||||
standard: {
|
||||
id: 'standard',
|
||||
label: 'DAGGERHEART.Adversary.Type.standard.label',
|
||||
description: 'DAGGERHEART.Adversary.standard.description'
|
||||
},
|
||||
support: {
|
||||
id: 'support',
|
||||
label: 'DAGGERHEART.Adversary.Type.support.label',
|
||||
description: 'DAGGERHEART.Adversary.support.description'
|
||||
}
|
||||
};
|
||||
|
||||
export const environmentTypes = {
|
||||
exploration: {
|
||||
label: 'DAGGERHEART.Environment.Type.exploration.label',
|
||||
description: 'DAGGERHEART.Environment.Type.exploration.description'
|
||||
},
|
||||
social: {
|
||||
label: 'DAGGERHEART.Environment.Type.social.label',
|
||||
description: 'DAGGERHEART.Environment.Type.social.description'
|
||||
},
|
||||
traversal: {
|
||||
label: 'DAGGERHEART.Environment.Type.traversal.label',
|
||||
description: 'DAGGERHEART.Environment.Type.traversal.description'
|
||||
},
|
||||
event: {
|
||||
label: 'DAGGERHEART.Environment.Type.event.label',
|
||||
description: 'DAGGERHEART.Environment.Type.event.description'
|
||||
}
|
||||
};
|
||||
|
||||
export const adversaryTraits = {
|
||||
relentless: {
|
||||
name: 'DAGGERHEART.Adversary.Trait..Name',
|
||||
description: 'DAGGERHEART.Adversary.Trait..Description',
|
||||
tip: 'DAGGERHEART.Adversary.Trait..Tip'
|
||||
},
|
||||
slow: {
|
||||
name: 'DAGGERHEART.Adversary.Trait..Name',
|
||||
description: 'DAGGERHEART.Adversary.Trait..Description',
|
||||
tip: 'DAGGERHEART.Adversary.Trait..Tip'
|
||||
},
|
||||
minion: {
|
||||
name: 'DAGGERHEART.Adversary.Trait..Name',
|
||||
description: 'DAGGERHEART.Adversary.Trait..Description',
|
||||
tip: 'DAGGERHEART.Adversary.Trait..Tip'
|
||||
}
|
||||
};
|
||||
|
||||
export const levelChoices = {
|
||||
attributes: {
|
||||
name: 'attributes',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
hitPointSlots: {
|
||||
name: 'hitPointSlots',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
stressSlots: {
|
||||
name: 'stressSlots',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
experiences: {
|
||||
name: 'experiences',
|
||||
title: '',
|
||||
choices: 'system.experiences',
|
||||
nrChoices: 2
|
||||
},
|
||||
proficiency: {
|
||||
name: 'proficiency',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
armorOrEvasionSlot: {
|
||||
name: 'armorOrEvasionSlot',
|
||||
title: 'Permanently add one Armor Slot or take +1 to your Evasion',
|
||||
choices: [
|
||||
{ name: 'Armor Marks +1', path: 'armor' },
|
||||
{ name: 'Evasion +1', path: 'evasion' }
|
||||
],
|
||||
nrChoices: 1
|
||||
},
|
||||
majorDamageThreshold2: {
|
||||
name: 'majorDamageThreshold2',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
severeDamageThreshold2: {
|
||||
name: 'severeDamageThreshold2',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
// minorDamageThreshold2: {
|
||||
// name: 'minorDamageThreshold2',
|
||||
// title: '',
|
||||
// choices: [],
|
||||
// },
|
||||
severeDamageThreshold3: {
|
||||
name: 'severeDamageThreshold3',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
// major2OrSevere4DamageThreshold: {
|
||||
// name: 'major2OrSevere4DamageThreshold',
|
||||
// title: 'Increase your Major Damage Threshold by +2 or Severe Damage Threshold by +4',
|
||||
// choices: [{ name: 'Major Damage Threshold +2', path: 'major' }, { name: 'Severe Damage Threshold +4', path: 'severe' }],
|
||||
// nrChoices: 1,
|
||||
// },
|
||||
// minor1OrMajor1DamageThreshold: {
|
||||
// name: 'minor1OrMajor1DamageThreshold',
|
||||
// title: 'Increase your Minor or Major Damage Threshold by +1',
|
||||
// choices: [{ name: 'Minor Damage Threshold +1', path: 'minor' }, { name: 'Major Damage Threshold +1', path: 'major' }],
|
||||
// nrChoices: 1,
|
||||
// },
|
||||
severeDamageThreshold4: {
|
||||
name: 'severeDamageThreshold4',
|
||||
title: '',
|
||||
choices: []
|
||||
},
|
||||
// majorDamageThreshold1: {
|
||||
// name: 'majorDamageThreshold2',
|
||||
// title: '',
|
||||
// choices: [],
|
||||
// },
|
||||
subclass: {
|
||||
name: 'subclass',
|
||||
title: 'Select subclass to upgrade',
|
||||
choices: []
|
||||
},
|
||||
multiclass: {
|
||||
name: 'multiclass',
|
||||
title: '',
|
||||
choices: [{}]
|
||||
}
|
||||
};
|
||||
|
||||
export const levelupData = {
|
||||
tier1: {
|
||||
id: '2_4',
|
||||
tier: 1,
|
||||
levels: [2, 3, 4],
|
||||
label: 'DAGGERHEART.LevelUp.Tier1.Label',
|
||||
info: 'DAGGERHEART.LevelUp.Tier1.InfoLabel',
|
||||
pretext: 'DAGGERHEART.LevelUp.Tier1.Pretext',
|
||||
posttext: 'DAGGERHEART.LevelUp.Tier1.Posttext',
|
||||
choices: {
|
||||
[levelChoices.attributes.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Attributes',
|
||||
maxChoices: 3
|
||||
},
|
||||
[levelChoices.hitPointSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.HitPointSlots',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.stressSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.StressSlots',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.experiences.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Experiences',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.proficiency.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Proficiency',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.armorOrEvasionSlot.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.ArmorOrEvasionSlot',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.majorDamageThreshold2.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.MajorDamageThreshold2',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.severeDamageThreshold2.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.SevereDamageThreshold2',
|
||||
maxChoices: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
tier2: {
|
||||
id: '5_7',
|
||||
tier: 2,
|
||||
levels: [5, 6, 7],
|
||||
label: 'DAGGERHEART.LevelUp.Tier2.Label',
|
||||
info: 'DAGGERHEART.LevelUp.Tier2.InfoLabel',
|
||||
pretext: 'DAGGERHEART.LevelUp.Tier2.Pretext',
|
||||
posttext: 'DAGGERHEART.LevelUp.Tier2.Posttext',
|
||||
choices: {
|
||||
[levelChoices.attributes.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Attributes',
|
||||
maxChoices: 3
|
||||
},
|
||||
[levelChoices.hitPointSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.HitPointSlots',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.stressSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.StressSlots',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.experiences.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Experiences',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.proficiency.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Proficiency',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.armorOrEvasionSlot.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.ArmorOrEvasionSlot',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.majorDamageThreshold2.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.MajorDamageThreshold2',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.severeDamageThreshold3.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.SevereDamageThreshold3',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.subclass.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Subclass',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.multiclass.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Multiclass',
|
||||
maxChoices: 1,
|
||||
cost: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
tier3: {
|
||||
id: '8_10',
|
||||
tier: 3,
|
||||
levels: [8, 9, 10],
|
||||
label: 'DAGGERHEART.LevelUp.Tier3.Label',
|
||||
info: 'DAGGERHEART.LevelUp.Tier3.InfoLabel',
|
||||
pretext: 'DAGGERHEART.LevelUp.Tier3.Pretext',
|
||||
posttext: 'DAGGERHEART.LevelUp.Tier3.Posttext',
|
||||
choices: {
|
||||
[levelChoices.attributes.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Attributes',
|
||||
maxChoices: 3
|
||||
},
|
||||
[levelChoices.hitPointSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.HitPointSlots',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.stressSlots.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.StressSlots',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.experiences.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Experiences',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.proficiency.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Proficiency',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.armorOrEvasionSlot.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.ArmorOrEvasionSlot',
|
||||
maxChoices: 2
|
||||
},
|
||||
[levelChoices.majorDamageThreshold2.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.MajorDamageThreshold2',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.severeDamageThreshold4.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.SevereDamageThreshold4',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.subclass.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Subclass',
|
||||
maxChoices: 1
|
||||
},
|
||||
[levelChoices.multiclass.name]: {
|
||||
description: 'DAGGERHEART.LevelUp.ChoiceDescriptions.Multiclass',
|
||||
maxChoices: 1,
|
||||
cost: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const subclassFeatureLabels = {
|
||||
1: 'DAGGERHEART.Sheets.PC.DomainCard.FoundationTitle',
|
||||
2: 'DAGGERHEART.Sheets.PC.DomainCard.SpecializationTitle',
|
||||
3: 'DAGGERHEART.Sheets.PC.DomainCard.MasteryTitle'
|
||||
};
|
||||
100
module/applications/config/domainConfig.mjs
Normal file
100
module/applications/config/domainConfig.mjs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
export const domains = {
|
||||
arcana: {
|
||||
id: 'arcana',
|
||||
label: 'DAGGERHEART.Domains.arcana.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/arcana.svg',
|
||||
description: 'DAGGERHEART.Domains.Arcana'
|
||||
},
|
||||
blade: {
|
||||
id: 'blade',
|
||||
label: 'DAGGERHEART.Domains.blade.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/blade.svg',
|
||||
description: 'DAGGERHEART.Domains.Blade'
|
||||
},
|
||||
bone: {
|
||||
id: 'bone',
|
||||
label: 'DAGGERHEART.Domains.bone.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/bone.svg',
|
||||
description: 'DAGGERHEART.Domains.Bone'
|
||||
},
|
||||
codex: {
|
||||
id: 'codex',
|
||||
label: 'DAGGERHEART.Domains.codex.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/codex.svg',
|
||||
description: 'DAGGERHEART.Domains.Codex'
|
||||
},
|
||||
grace: {
|
||||
id: 'grace',
|
||||
label: 'DAGGERHEART.Domains.grace.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/grace.svg',
|
||||
description: 'DAGGERHEART.Domains.Grace'
|
||||
},
|
||||
midnight: {
|
||||
id: 'midnight',
|
||||
label: 'DAGGERHEART.Domains.midnight.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/midnight.svg',
|
||||
description: 'DAGGERHEART.Domains.Midnight'
|
||||
},
|
||||
sage: {
|
||||
id: 'sage',
|
||||
label: 'DAGGERHEART.Domains.sage.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/sage.svg',
|
||||
description: 'DAGGERHEART.Domains.Sage'
|
||||
},
|
||||
splendor: {
|
||||
id: 'splendor',
|
||||
label: 'DAGGERHEART.Domains.splendor.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/splendor.svg',
|
||||
description: 'DAGGERHEART.Domains.Splendor'
|
||||
},
|
||||
valor: {
|
||||
id: 'valor',
|
||||
label: 'DAGGERHEART.Domains.valor.label',
|
||||
src: 'systems/daggerheart/assets/icons/domains/valor.svg',
|
||||
description: 'DAGGERHEART.Domains.Valor'
|
||||
}
|
||||
};
|
||||
|
||||
export const classDomainMap = {
|
||||
rogue: [domains.midnight, domains.grace]
|
||||
};
|
||||
|
||||
export const subclassMap = {
|
||||
syndicate: {
|
||||
id: 'syndicate',
|
||||
label: 'Syndicate'
|
||||
},
|
||||
nightwalker: {
|
||||
id: 'nightwalker',
|
||||
label: 'Nightwalker'
|
||||
}
|
||||
};
|
||||
|
||||
export const classMap = {
|
||||
rogue: {
|
||||
label: 'Rogue',
|
||||
subclasses: [subclassMap.syndicate.id, subclassMap.nightwalker.id]
|
||||
},
|
||||
seraph: {
|
||||
label: 'Seraph',
|
||||
subclasses: []
|
||||
}
|
||||
};
|
||||
|
||||
export const cardTypes = {
|
||||
ability: {
|
||||
id: 'ability',
|
||||
label: 'DAGGERHEART.Domain.CardTypes.ability',
|
||||
img: ''
|
||||
},
|
||||
spell: {
|
||||
id: 'spell',
|
||||
label: 'DAGGERHEART.Domain.CardTypes.spell',
|
||||
img: ''
|
||||
},
|
||||
grimoire: {
|
||||
id: 'grimoire',
|
||||
label: 'DAGGERHEART.Domain.CardTypes.grimoire',
|
||||
img: ''
|
||||
}
|
||||
};
|
||||
64
module/applications/config/effectConfig.mjs
Normal file
64
module/applications/config/effectConfig.mjs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { range } from '../config/generalConfig.mjs';
|
||||
|
||||
export const valueTypes = {
|
||||
numberString: {
|
||||
id: 'numberString'
|
||||
},
|
||||
select: {
|
||||
id: 'select'
|
||||
}
|
||||
};
|
||||
|
||||
export const parseTypes = {
|
||||
string: {
|
||||
id: 'string'
|
||||
},
|
||||
number: {
|
||||
id: 'number'
|
||||
}
|
||||
};
|
||||
|
||||
export const applyLocations = {
|
||||
attackRoll: {
|
||||
id: 'attackRoll',
|
||||
name: 'DAGGERHEART.Effects.ApplyLocations.AttackRoll.Name'
|
||||
},
|
||||
damageRoll: {
|
||||
id: 'damageRoll',
|
||||
name: 'DAGGERHEART.Effects.ApplyLocations.DamageRoll.Name'
|
||||
}
|
||||
};
|
||||
|
||||
export const effectTypes = {
|
||||
health: {
|
||||
id: 'health',
|
||||
name: 'DAGGERHEART.Effects.Types.Health.Name',
|
||||
values: [],
|
||||
valueType: valueTypes.numberString.id,
|
||||
parseType: parseTypes.number.id
|
||||
},
|
||||
stress: {
|
||||
id: 'stress',
|
||||
name: 'DAGGERHEART.Effects.Types.Stress.Name',
|
||||
valueType: valueTypes.numberString.id,
|
||||
parseType: parseTypes.number.id
|
||||
},
|
||||
reach: {
|
||||
id: 'reach',
|
||||
name: 'DAGGERHEART.Effects.Types.Reach.Name',
|
||||
valueType: valueTypes.select.id,
|
||||
parseType: parseTypes.string.id,
|
||||
options: Object.keys(range).map(x => ({ name: range[x].name, value: x }))
|
||||
},
|
||||
damage: {
|
||||
id: 'damage',
|
||||
name: 'DAGGERHEART.Effects.Types.Damage.Name',
|
||||
valueType: valueTypes.numberString.id,
|
||||
parseType: parseTypes.string.id,
|
||||
appliesOn: applyLocations.damageRoll.id,
|
||||
applyLocationChoices: {
|
||||
[applyLocations.damageRoll.id]: applyLocations.damageRoll.name,
|
||||
[applyLocations.attackRoll.id]: applyLocations.attackRoll.name
|
||||
}
|
||||
}
|
||||
};
|
||||
9
module/applications/config/flagsConfig.mjs
Normal file
9
module/applications/config/flagsConfig.mjs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export const displayDomainCardsAsList = 'displayDomainCardsAsList';
|
||||
export const narrativeCountdown = {
|
||||
simple: 'countdown-narrative-simple',
|
||||
position: 'countdown-narrative-position'
|
||||
};
|
||||
export const encounterCountdown = {
|
||||
simple: 'countdown-encounter-simple',
|
||||
position: 'countdown-encounter-position'
|
||||
};
|
||||
436
module/applications/config/generalConfig.mjs
Normal file
436
module/applications/config/generalConfig.mjs
Normal file
|
|
@ -0,0 +1,436 @@
|
|||
export const range = {
|
||||
self: {
|
||||
id: 'self',
|
||||
short: 's',
|
||||
label: 'DAGGERHEART.Range.self.name',
|
||||
description: 'DAGGERHEART.Range.self.description',
|
||||
distance: 0
|
||||
},
|
||||
melee: {
|
||||
id: 'melee',
|
||||
short: 'm',
|
||||
label: 'DAGGERHEART.Range.melee.name',
|
||||
description: 'DAGGERHEART.Range.melee.description',
|
||||
distance: 1
|
||||
},
|
||||
veryClose: {
|
||||
id: 'veryClose',
|
||||
short: 'vc',
|
||||
label: 'DAGGERHEART.Range.veryClose.name',
|
||||
description: 'DAGGERHEART.Range.veryClose.description',
|
||||
distance: 3
|
||||
},
|
||||
close: {
|
||||
id: 'close',
|
||||
short: 'c',
|
||||
label: 'DAGGERHEART.Range.close.name',
|
||||
description: 'DAGGERHEART.Range.close.description',
|
||||
distance: 10
|
||||
},
|
||||
far: {
|
||||
id: 'far',
|
||||
short: 'f',
|
||||
label: 'DAGGERHEART.Range.far.name',
|
||||
description: 'DAGGERHEART.Range.far.description',
|
||||
distance: 20
|
||||
},
|
||||
veryFar: {
|
||||
id: 'veryFar',
|
||||
short: 'vf',
|
||||
label: 'DAGGERHEART.Range.veryFar.name',
|
||||
description: 'DAGGERHEART.Range.veryFar.description',
|
||||
distance: 30
|
||||
}
|
||||
};
|
||||
|
||||
export const burden = {
|
||||
oneHanded: {
|
||||
value: 'oneHanded',
|
||||
label: 'DAGGERHEART.Burden.oneHanded'
|
||||
},
|
||||
twoHanded: {
|
||||
value: 'twoHanded',
|
||||
label: 'DAGGERHEART.Burden.twoHanded'
|
||||
}
|
||||
};
|
||||
|
||||
export const damageTypes = {
|
||||
physical: {
|
||||
id: 'physical',
|
||||
label: 'DAGGERHEART.DamageType.physical.name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.physical.abbreviation'
|
||||
},
|
||||
magical: {
|
||||
id: 'magical',
|
||||
label: 'DAGGERHEART.DamageType.magical.name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.magical.abbreviation'
|
||||
}
|
||||
};
|
||||
|
||||
export const healingTypes = {
|
||||
hitPoints: {
|
||||
id: 'hitPoints',
|
||||
label: 'DAGGERHEART.HealingType.HitPoints.Name',
|
||||
abbreviation: 'DAGGERHEART.HealingType.HitPoints.Abbreviation'
|
||||
},
|
||||
stress: {
|
||||
id: 'stress',
|
||||
label: 'DAGGERHEART.HealingType.Stress.Name',
|
||||
abbreviation: 'DAGGERHEART.HealingType.Stress.Abbreviation'
|
||||
},
|
||||
hope: {
|
||||
id: 'hope',
|
||||
label: 'DAGGERHEART.HealingType.Hope.Name',
|
||||
abbreviation: 'DAGGERHEART.HealingType.Hope.Abbreviation'
|
||||
},
|
||||
armorStack: {
|
||||
id: 'armorStack',
|
||||
label: 'DAGGERHEART.HealingType.ArmorStack.Name',
|
||||
abbreviation: 'DAGGERHEART.HealingType.ArmorStack.Abbreviation'
|
||||
}
|
||||
};
|
||||
|
||||
export const conditions = {
|
||||
vulnerable: {
|
||||
id: 'vulnerable',
|
||||
name: 'DAGGERHEART.Condition.vulnerable.name',
|
||||
icon: 'icons/magic/control/silhouette-fall-slip-prone.webp',
|
||||
description: 'DAGGERHEART.Condition.vulnerable.description'
|
||||
},
|
||||
hidden: {
|
||||
id: 'hidden',
|
||||
name: 'DAGGERHEART.Condition.hidden.name',
|
||||
icon: 'icons/magic/perception/silhouette-stealth-shadow.webp',
|
||||
description: 'DAGGERHEART.Condition.hidden.description'
|
||||
},
|
||||
restrained: {
|
||||
id: 'restrained',
|
||||
name: 'DAGGERHEART.Condition.restrained.name',
|
||||
icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
|
||||
description: 'DAGGERHEART.Condition.restrained.description'
|
||||
}
|
||||
};
|
||||
|
||||
export const defaultRestOptions = {
|
||||
shortRest: () => ({
|
||||
tendToWounds: {
|
||||
id: 'tendToWounds',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.TendToWounds.Name'),
|
||||
img: 'icons/magic/life/cross-worn-green.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.TendToWounds.Description'),
|
||||
actions: [
|
||||
{
|
||||
type: 'healing',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.TendToWounds.Name'),
|
||||
img: 'icons/magic/life/cross-worn-green.webp',
|
||||
actionType: 'action',
|
||||
healing: {
|
||||
type: 'health',
|
||||
value: {
|
||||
custom: {
|
||||
enabled: true,
|
||||
formula: '1d4 + 1' // should be 1d4 + {tier}. How to use the roll param?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
clearStress: {
|
||||
id: 'clearStress',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.ClearStress.Name'),
|
||||
img: 'icons/magic/perception/eye-ringed-green.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.ClearStress.Description'),
|
||||
actions: [
|
||||
{
|
||||
type: 'healing',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.ClearStress.Name'),
|
||||
img: 'icons/magic/perception/eye-ringed-green.webp',
|
||||
actionType: 'action',
|
||||
healing: {
|
||||
type: 'stress',
|
||||
value: {
|
||||
custom: {
|
||||
enabled: true,
|
||||
formula: '1d4 + 1' // should be 1d4 + {tier}. How to use the roll param?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
repairArmor: {
|
||||
id: 'repairArmor',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.RepairArmor.Name'),
|
||||
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.RepairArmor.Description'),
|
||||
actions: []
|
||||
},
|
||||
prepare: {
|
||||
id: 'prepare',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.Prepare.Name'),
|
||||
img: 'icons/skills/trades/academics-merchant-scribe.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.ShortRest.Prepare.Description'),
|
||||
actions: []
|
||||
}
|
||||
}),
|
||||
longRest: () => ({
|
||||
tendToWounds: {
|
||||
id: 'tendToWounds',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.LongRest.TendToWounds.Name'),
|
||||
img: 'icons/magic/life/cross-worn-green.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.LongRest.TendToWounds.Description'),
|
||||
actions: []
|
||||
},
|
||||
clearStress: {
|
||||
id: 'clearStress',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.LongRest.ClearStress.Name'),
|
||||
img: 'icons/magic/perception/eye-ringed-green.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.LongRest.ClearStress.Description'),
|
||||
actions: []
|
||||
},
|
||||
repairArmor: {
|
||||
id: 'repairArmor',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.LongRest.RepairArmor.Name'),
|
||||
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.LongRest.RepairArmor.Description'),
|
||||
actions: []
|
||||
},
|
||||
prepare: {
|
||||
id: 'prepare',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.LongRest.Prepare.Name'),
|
||||
img: 'icons/skills/trades/academics-merchant-scribe.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.LongRest.Prepare.Description'),
|
||||
actions: []
|
||||
},
|
||||
workOnAProject: {
|
||||
id: 'workOnAProject',
|
||||
name: game.i18n.localize('DAGGERHEART.Downtime.LongRest.WorkOnAProject.Name'),
|
||||
img: 'icons/skills/social/thumbsup-approval-like.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.Downtime.LongRest.WorkOnAProject.Description'),
|
||||
actions: []
|
||||
}
|
||||
}),
|
||||
custom: {
|
||||
id: 'customActivity',
|
||||
name: '',
|
||||
img: 'icons/skills/trades/academics-investigation-puzzles.webp',
|
||||
description: '',
|
||||
namePlaceholder: 'DAGGERHEART.Downtime.Custom.NamePlaceholder',
|
||||
placeholder: 'DAGGERHEART.Downtime.Custom.Placeholder'
|
||||
}
|
||||
};
|
||||
|
||||
export const deathMoves = {
|
||||
avoidDeath: {
|
||||
id: 'avoidDeath',
|
||||
name: 'DAGGERHEART.DeathMoves.AvoidDeath.Name',
|
||||
img: 'icons/magic/time/hourglass-yellow-green.webp',
|
||||
description: 'DAGGERHEART.DeathMoves.AvoidDeath.Description'
|
||||
},
|
||||
riskItAll: {
|
||||
id: 'riskItAll',
|
||||
name: 'DAGGERHEART.DeathMoves.RiskItAll.Name',
|
||||
img: 'icons/sundries/gaming/dice-pair-white-green.webp',
|
||||
description: 'DAGGERHEART.DeathMoves.RiskItAll.Description'
|
||||
},
|
||||
blazeOfGlory: {
|
||||
id: 'blazeOfGlory',
|
||||
name: 'DAGGERHEART.DeathMoves.BlazeOfGlory.Name',
|
||||
img: 'icons/magic/life/heart-cross-strong-flame-purple-orange.webp',
|
||||
description: 'DAGGERHEART.DeathMoves.BlazeOfGlory.Description'
|
||||
}
|
||||
};
|
||||
|
||||
export const tiers = {
|
||||
tier1: {
|
||||
id: 'tier1',
|
||||
label: 'DAGGERHEART.Tiers.tier1',
|
||||
value: 1
|
||||
},
|
||||
tier2: {
|
||||
id: 'tier2',
|
||||
label: 'DAGGERHEART.Tiers.tier2',
|
||||
value: 2
|
||||
},
|
||||
tier3: {
|
||||
id: 'tier3',
|
||||
label: 'DAGGERHEART.Tiers.tier3',
|
||||
value: 3
|
||||
},
|
||||
tier4: {
|
||||
id: 'tier4',
|
||||
label: 'DAGGERHEART.Tiers.tier4',
|
||||
value: 4
|
||||
}
|
||||
};
|
||||
|
||||
export const diceTypes = {
|
||||
d4: 'd4',
|
||||
d6: 'd6',
|
||||
d8: 'd8',
|
||||
d10: 'd10',
|
||||
d12: 'd12',
|
||||
d20: 'd20'
|
||||
};
|
||||
|
||||
export const multiplierTypes = {
|
||||
prof: 'Proficiency',
|
||||
cast: 'Spellcast',
|
||||
scale: 'Cost Scaling',
|
||||
result: 'Roll Result',
|
||||
flat: 'Flat'
|
||||
};
|
||||
|
||||
export const diceSetNumbers = {
|
||||
prof: 'Proficiency',
|
||||
cast: 'Spellcast',
|
||||
scale: 'Cost Scaling',
|
||||
flat: 'Flat'
|
||||
};
|
||||
|
||||
export const getDiceSoNicePresets = () => {
|
||||
const { diceSoNice } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
||||
|
||||
return {
|
||||
hope: {
|
||||
...diceSoNice.hope,
|
||||
colorset: 'inspired',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
fear: {
|
||||
...diceSoNice.fear,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
advantage: {
|
||||
...diceSoNice.advantage,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
disadvantage: {
|
||||
...diceSoNice.disadvantage,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const refreshTypes = {
|
||||
session: {
|
||||
id: 'session',
|
||||
label: 'DAGGERHEART.General.RefreshType.Session'
|
||||
},
|
||||
shortRest: {
|
||||
id: 'shortRest',
|
||||
label: 'DAGGERHEART.General.RefreshType.Shortrest'
|
||||
},
|
||||
longRest: {
|
||||
id: 'longRest',
|
||||
label: 'DAGGERHEART.General.RefreshType.Longrest'
|
||||
}
|
||||
};
|
||||
|
||||
export const abilityCosts = {
|
||||
hope: {
|
||||
id: 'hope',
|
||||
label: 'Hope',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
stress: {
|
||||
id: 'stress',
|
||||
label: 'DAGGERHEART.HealingType.Stress.Name',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
armor: {
|
||||
id: 'armor',
|
||||
label: 'Armor Stack',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
hp: {
|
||||
id: 'hp',
|
||||
label: 'DAGGERHEART.HealingType.HitPoints.Name',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
prayer: {
|
||||
id: 'prayer',
|
||||
label: 'Prayer Dice',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
favor: {
|
||||
id: 'favor',
|
||||
label: 'Favor Points',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
slayer: {
|
||||
id: 'slayer',
|
||||
label: 'Slayer Dice',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
tide: {
|
||||
id: 'tide',
|
||||
label: 'Tide',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
chaos: {
|
||||
id: 'chaos',
|
||||
label: 'Chaos',
|
||||
group: 'TYPES.Actor.character'
|
||||
},
|
||||
fear: {
|
||||
id: 'fear',
|
||||
label: 'Fear',
|
||||
group: 'TYPES.Actor.adversary'
|
||||
}
|
||||
};
|
||||
|
||||
export const countdownTypes = {
|
||||
spotlight: {
|
||||
id: 'spotlight',
|
||||
label: 'DAGGERHEART.Countdown.Type.Spotlight'
|
||||
},
|
||||
characterAttack: {
|
||||
id: 'characterAttack',
|
||||
label: 'DAGGERHEART.Countdown.Type.CharacterAttack'
|
||||
},
|
||||
custom: {
|
||||
id: 'custom',
|
||||
label: 'DAGGERHEART.Countdown.Type.Custom'
|
||||
}
|
||||
};
|
||||
export const rollTypes = {
|
||||
weapon: {
|
||||
id: 'weapon',
|
||||
label: 'DAGGERHEART.RollTypes.weapon.name'
|
||||
},
|
||||
spellcast: {
|
||||
id: 'spellcast',
|
||||
label: 'DAGGERHEART.RollTypes.spellcast.name'
|
||||
},
|
||||
ability: {
|
||||
id: 'ability',
|
||||
label: 'DAGGERHEART.RollTypes.ability.name'
|
||||
},
|
||||
diceSet: {
|
||||
id: 'diceSet',
|
||||
label: 'DAGGERHEART.RollTypes.diceSet.name'
|
||||
}
|
||||
};
|
||||
|
||||
export const fearDisplay = {
|
||||
token: { value: 'token', label: 'DAGGERHEART.Settings.Appearance.FearDisplay.Token' },
|
||||
bar: { value: 'bar', label: 'DAGGERHEART.Settings.Appearance.FearDisplay.Bar' },
|
||||
hide: { value: 'hide', label: 'DAGGERHEART.Settings.Appearance.FearDisplay.Hide' }
|
||||
};
|
||||
4
module/applications/config/hooksConfig.mjs
Normal file
4
module/applications/config/hooksConfig.mjs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export const hooks = {
|
||||
characterAttack: 'characterAttackHook',
|
||||
spotlight: 'spotlightHook'
|
||||
};
|
||||
725
module/applications/config/itemConfig.mjs
Normal file
725
module/applications/config/itemConfig.mjs
Normal file
|
|
@ -0,0 +1,725 @@
|
|||
export const armorFeatures = {
|
||||
burning: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Burning.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Burning.Description'
|
||||
},
|
||||
channeling: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Channeling.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Channeling.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.spellcast',
|
||||
mode: 2,
|
||||
value: '1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
difficult: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Difficult.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Difficult.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.traits.agility.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.strength.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.finesse.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.instinct.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.presence.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.knowledge.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
},
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
flexible: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Flexible.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Flexible.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
fortified: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Fortified.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Fortified.Description'
|
||||
},
|
||||
gilded: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Gilded.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Gilded.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.traits.presence.bonus',
|
||||
mode: 2,
|
||||
value: '1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
heavy: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Heavy.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Heavy.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
hopeful: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Hopeful.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Hopeful.Description'
|
||||
},
|
||||
impenetrable: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Impenetrable.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Impenetrable.Description'
|
||||
},
|
||||
magic: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Magic.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Magic.Description'
|
||||
},
|
||||
painful: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Painful.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Painful.Description'
|
||||
},
|
||||
physical: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Physical.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Physical.Description'
|
||||
},
|
||||
quiet: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Quiet.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Quiet.Description'
|
||||
},
|
||||
reinforced: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Reinforced.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Reinforced.Description'
|
||||
},
|
||||
resilient: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Resilient.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Resilient.Description'
|
||||
},
|
||||
sharp: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Sharp.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Sharp.Description'
|
||||
},
|
||||
shifting: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Shifting.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Shifting.Description'
|
||||
},
|
||||
timeslowing: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Timeslowing.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Timeslowing.Description'
|
||||
},
|
||||
truthseeking: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Truthseeking.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Truthseeking.Description'
|
||||
},
|
||||
veryheavy: {
|
||||
label: 'DAGGERHEART.ArmorFeature.VeryHeavy.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.VeryHeavy.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-2'
|
||||
},
|
||||
{
|
||||
key: 'system.traits.agility.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
warded: {
|
||||
label: 'DAGGERHEART.ArmorFeature.Warded.Name',
|
||||
description: 'DAGGERHEART.ArmorFeature.Warded.Description'
|
||||
}
|
||||
};
|
||||
|
||||
export const weaponFeatures = {
|
||||
barrier: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Barrier.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Barrier.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.armorScore',
|
||||
mode: 2,
|
||||
value: '@system.tier + 1'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
bonded: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Bonded.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Bonded.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.damage',
|
||||
mode: 2,
|
||||
value: 'system.levelData.levels.current'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
bouncing: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Bouncing.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Bouncing.Description'
|
||||
},
|
||||
brave: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Brave.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Brave.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.damageThresholds.severe',
|
||||
mode: 2,
|
||||
value: '3'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
brutal: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Brutal.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Brutal.Description'
|
||||
},
|
||||
charged: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Charged.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Charged.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'effect',
|
||||
name: 'DAGGERHEART.WeaponFeature.Concussive.Name',
|
||||
img: 'icons/skills/melee/shield-damaged-broken-brown.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
// Should add an effect with path system.proficiency.bonus +1
|
||||
}
|
||||
]
|
||||
},
|
||||
concussive: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Concussive.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Concussive.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Concussive.Name',
|
||||
img: 'icons/skills/melee/shield-damaged-broken-brown.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'hope',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
cumbersome: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Cumbersome.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Cumbersome.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.traits.finesse.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
deadly: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Deadly.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Deadly.Description'
|
||||
},
|
||||
deflecting: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Deflecting.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Deflecting.Description'
|
||||
// actions: [{
|
||||
// type: 'effect',
|
||||
// name: 'DAGGERHEART.WeaponFeature.Deflecting.Name',
|
||||
// img: 'icons/skills/melee/strike-flail-destructive-yellow.webp',
|
||||
// actionType: 'reaction',
|
||||
// cost: [{
|
||||
// type: 'armorSlot', // Needs armorSlot as type
|
||||
// value: 1
|
||||
// }],
|
||||
// }],
|
||||
},
|
||||
destructive: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Destructive.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Destructive.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.traits.agility.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
devastating: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Devastating.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Devastating.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Devastating.Name',
|
||||
img: 'icons/skills/melee/strike-flail-destructive-yellow.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
doubleduty: {
|
||||
label: 'DAGGERHEART.WeaponFeature.DoubleDuty.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.DoubleDuty.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.armorScore',
|
||||
mode: 2,
|
||||
value: '1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
doubledup: {
|
||||
label: 'DAGGERHEART.WeaponFeature.DoubledUp.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.DoubledUp.Description'
|
||||
},
|
||||
dueling: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Dueling.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Dueling.Description'
|
||||
},
|
||||
eruptive: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Eruptive.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Eruptive.Description'
|
||||
},
|
||||
grappling: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Grappling.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Grappling.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Grappling.Name',
|
||||
img: 'icons/magic/control/debuff-chains-ropes-net-white.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
greedy: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Greedy.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Greedy.Description'
|
||||
},
|
||||
healing: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Healing.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Healing.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'healing',
|
||||
name: 'DAGGERHEART.WeaponFeature.Healing.Name',
|
||||
img: 'icons/magic/life/cross-beam-green.webp',
|
||||
actionType: 'action',
|
||||
healing: {
|
||||
type: 'health',
|
||||
value: {
|
||||
custom: {
|
||||
enabled: true,
|
||||
formula: '1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
heavy: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Heavy.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Heavy.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
hooked: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Hooked.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Hooked.Description'
|
||||
},
|
||||
hot: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Hot.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Hot.Description'
|
||||
},
|
||||
invigorating: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Invigorating.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Invigorating.Description'
|
||||
},
|
||||
lifestealing: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Lifestealing.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Lifestealing.Description'
|
||||
},
|
||||
lockedon: {
|
||||
label: 'DAGGERHEART.WeaponFeature.LockedOn.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.LockedOn.Description'
|
||||
},
|
||||
long: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Long.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Long.Description'
|
||||
},
|
||||
lucky: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Lucky.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Lucky.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Lucky.Name',
|
||||
img: 'icons/magic/control/buff-luck-fortune-green.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
massive: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Massive.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Massive.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.evasion.bonus',
|
||||
mode: 2,
|
||||
value: '-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
painful: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Painful.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Painful.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Painful.Name',
|
||||
img: 'icons/skills/wounds/injury-face-impact-orange.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
paired: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Paired.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Paired.Description',
|
||||
override: {
|
||||
bonusDamage: 1
|
||||
}
|
||||
},
|
||||
parry: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Parry.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Parry.Description'
|
||||
},
|
||||
persuasive: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Persuasive.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Persuasive.Description'
|
||||
},
|
||||
pompous: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Pompous.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Pompous.Description'
|
||||
},
|
||||
powerful: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Powerful.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Powerful.Description'
|
||||
},
|
||||
protective: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Protective.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Protective.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.armorScore',
|
||||
mode: 2,
|
||||
value: '@system.tier'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
quick: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Quick.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Quick.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Quick.Name',
|
||||
img: 'icons/skills/movement/arrow-upward-yellow.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
reliable: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Reliable.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Reliable.Description',
|
||||
effects: [
|
||||
{
|
||||
changes: [
|
||||
{
|
||||
key: 'system.bonuses.attack',
|
||||
mode: 2,
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
reloading: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Reloading.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Reloading.Description'
|
||||
},
|
||||
retractable: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Retractable.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Retractable.Description'
|
||||
},
|
||||
returning: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Returning.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Returning.Description'
|
||||
},
|
||||
scary: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Scary.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Scary.Description'
|
||||
},
|
||||
serrated: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Serrated.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Serrated.Description'
|
||||
},
|
||||
sharpwing: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Sharpwing.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Sharpwing.Description'
|
||||
},
|
||||
sheltering: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Sheltering.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Sheltering.Description'
|
||||
},
|
||||
startling: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Startling.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Startling.Description',
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
name: 'DAGGERHEART.WeaponFeature.Startling.Name',
|
||||
img: 'icons/magic/control/fear-fright-mask-orange.webp',
|
||||
actionType: 'action',
|
||||
cost: [
|
||||
{
|
||||
type: 'stress',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
timebending: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Timebending.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Timebending.Description'
|
||||
},
|
||||
versatile: {
|
||||
label: 'DAGGERHEART.WeaponFeature.Versatile.Name',
|
||||
description: 'DAGGERHEART.WeaponFeature.Versatile.Description',
|
||||
versatile: {
|
||||
characterTrait: '',
|
||||
range: '',
|
||||
damage: ''
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const featureTypes = {
|
||||
ancestry: {
|
||||
id: 'ancestry',
|
||||
label: 'DAGGERHEART.Feature.Type.ancestry'
|
||||
},
|
||||
community: {
|
||||
id: 'community',
|
||||
label: 'DAGGERHEART.Feature.Type.community'
|
||||
},
|
||||
class: {
|
||||
id: 'class',
|
||||
label: 'DAGGERHEART.Feature.Type.class'
|
||||
},
|
||||
subclass: {
|
||||
id: 'subclass',
|
||||
label: 'DAGGERHEART.Feature.Type.subclass'
|
||||
},
|
||||
classHope: {
|
||||
id: 'classHope',
|
||||
label: 'DAGGERHEART.Feature.Type.classHope'
|
||||
},
|
||||
domainCard: {
|
||||
id: 'domainCard',
|
||||
label: 'DAGGERHEART.Feature.Type.domainCard'
|
||||
},
|
||||
equipment: {
|
||||
id: 'equipment',
|
||||
label: 'DAGGERHEART.Feature.Type.equipment'
|
||||
}
|
||||
};
|
||||
|
||||
export const valueTypes = {
|
||||
normal: {
|
||||
id: 'normal',
|
||||
name: 'DAGGERHEART.Feature.ValueType.Normal',
|
||||
data: {
|
||||
value: 0,
|
||||
max: 0
|
||||
}
|
||||
},
|
||||
input: {
|
||||
id: 'input',
|
||||
name: 'DAGGERHEART.Feature.ValueType.Input',
|
||||
data: {
|
||||
value: null
|
||||
}
|
||||
},
|
||||
dice: {
|
||||
id: 'dice',
|
||||
name: 'DAGGERHEART.Feature.ValueType.Dice',
|
||||
data: {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const actionTypes = {
|
||||
passive: {
|
||||
id: 'passive',
|
||||
label: 'DAGGERHEART.ActionType.passive'
|
||||
},
|
||||
action: {
|
||||
id: 'action',
|
||||
label: 'DAGGERHEART.ActionType.action'
|
||||
},
|
||||
reaction: {
|
||||
id: 'reaction',
|
||||
label: 'DAGGERHEART.ActionType.reaction'
|
||||
}
|
||||
};
|
||||
42
module/applications/config/settingsConfig.mjs
Normal file
42
module/applications/config/settingsConfig.mjs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
export const menu = {
|
||||
Automation: {
|
||||
Name: 'GameSettingsAutomation',
|
||||
Icon: 'fa-solid fa-robot'
|
||||
},
|
||||
Homebrew: {
|
||||
Name: 'GameSettingsHomebrew',
|
||||
Icon: 'fa-solid fa-flask-vial'
|
||||
},
|
||||
Range: {
|
||||
Name: 'GameSettingsRange',
|
||||
Icon: 'fa-solid fa-ruler'
|
||||
},
|
||||
VariantRules: {
|
||||
Name: 'GameSettingsVariantrules',
|
||||
Icon: 'fa-solid fa-scale-balanced'
|
||||
}
|
||||
};
|
||||
|
||||
export const gameSettings = {
|
||||
Automation: 'Automation',
|
||||
Homebrew: 'Homebrew',
|
||||
RangeMeasurement: 'RangeMeasurement',
|
||||
appearance: 'Appearance',
|
||||
variantRules: 'VariantRules',
|
||||
Resources: {
|
||||
Fear: 'ResourcesFear'
|
||||
},
|
||||
LevelTiers: 'LevelTiers',
|
||||
Countdowns: 'Countdowns'
|
||||
};
|
||||
|
||||
export const DualityRollColor = {
|
||||
colorful: {
|
||||
value: 0,
|
||||
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Colorful'
|
||||
},
|
||||
normal: {
|
||||
value: 1,
|
||||
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Normal'
|
||||
}
|
||||
};
|
||||
24
module/applications/config/system.mjs
Normal file
24
module/applications/config/system.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as GENERAL from './generalConfig.mjs';
|
||||
import * as DOMAIN from './domainConfig.mjs';
|
||||
import * as ACTOR from './actorConfig.mjs';
|
||||
import * as ITEM from './itemConfig.mjs';
|
||||
import * as SETTINGS from './settingsConfig.mjs';
|
||||
import { hooks as HOOKS } from './hooksConfig.mjs';
|
||||
import * as EFFECTS from './effectConfig.mjs';
|
||||
import * as ACTIONS from './actionConfig.mjs';
|
||||
import * as FLAGS from './flagsConfig.mjs';
|
||||
|
||||
export const SYSTEM_ID = 'daggerheart';
|
||||
|
||||
export const SYSTEM = {
|
||||
id: SYSTEM_ID,
|
||||
GENERAL,
|
||||
DOMAIN,
|
||||
ACTOR,
|
||||
ITEM,
|
||||
SETTINGS,
|
||||
HOOKS,
|
||||
EFFECTS,
|
||||
ACTIONS,
|
||||
FLAGS
|
||||
};
|
||||
86
module/applications/dialogs/beastformDialog.mjs
Normal file
86
module/applications/dialogs/beastformDialog.mjs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import { tiers } from '../config/generalConfig.mjs';
|
||||
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class BeastformDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(configData) {
|
||||
super();
|
||||
|
||||
this.configData = configData;
|
||||
this.selected = null;
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'views', 'dh-style', 'beastform-selection'],
|
||||
position: {
|
||||
width: 600,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
selectBeastform: this.selectBeastform,
|
||||
submitBeastform: this.submitBeastform
|
||||
},
|
||||
form: {
|
||||
handler: this.updateBeastform,
|
||||
submitOnChange: true,
|
||||
submitOnClose: false
|
||||
}
|
||||
};
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.Sheets.Beastform.dialogTitle');
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
beastform: {
|
||||
template: 'systems/daggerheart/templates/dialogs/beastformDialog.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
|
||||
context.beastformTiers = game.items.reduce((acc, x) => {
|
||||
const tier = tiers[x.system.tier];
|
||||
if (x.type !== 'beastform' || tier.value > this.configData.tierLimit) return acc;
|
||||
|
||||
if (!acc[tier.value]) acc[tier.value] = { label: game.i18n.localize(tier.label), values: {} };
|
||||
acc[tier.value].values[x.uuid] = { selected: this.selected == x.uuid, value: x };
|
||||
|
||||
return acc;
|
||||
}, {}); // Also get from compendium when added
|
||||
context.canSubmit = this.selected;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static updateBeastform(event, _, formData) {
|
||||
this.selected = foundry.utils.mergeObject(this.selected, formData.object);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
static selectBeastform(_, target) {
|
||||
this.selected = this.selected === target.dataset.uuid ? null : target.dataset.uuid;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async submitBeastform() {
|
||||
await this.close({ submitted: true });
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onClose(options = {}) {
|
||||
if (!options.submitted) this.config = false;
|
||||
}
|
||||
|
||||
static async configure(configData) {
|
||||
return new Promise(resolve => {
|
||||
const app = new this(configData);
|
||||
app.addEventListener('close', () => resolve(app.selected), { once: true });
|
||||
app.render({ force: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ export default class CostSelectionDialog extends HandlebarsApplicationMixin(Appl
|
|||
static PARTS = {
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/views/costSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/costSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
132
module/applications/dialogs/d20RollDialog.mjs
Normal file
132
module/applications/dialogs/d20RollDialog.mjs
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class D20RollDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(roll, config = {}, options = {}) {
|
||||
super(options);
|
||||
|
||||
this.roll = roll;
|
||||
this.config = config;
|
||||
this.config.experiences = [];
|
||||
|
||||
if (config.source?.action) {
|
||||
this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent;
|
||||
this.action =
|
||||
config.data.attack?._id == config.source.action
|
||||
? config.data.attack
|
||||
: this.item.system.actions.find(a => a._id === config.source.action);
|
||||
}
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'roll-selection',
|
||||
classes: ['daggerheart', 'views', 'roll-selection'],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
updateIsAdvantage: this.updateIsAdvantage,
|
||||
selectExperience: this.selectExperience,
|
||||
submitRoll: this.submitRoll
|
||||
},
|
||||
form: {
|
||||
handler: this.updateRollConfiguration,
|
||||
submitOnChange: true,
|
||||
submitOnClose: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/costSelection.hbs'
|
||||
},
|
||||
rollSelection: {
|
||||
id: 'rollSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/rollSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.hasRoll = !!this.config.roll;
|
||||
context.roll = this.roll;
|
||||
context.rollType = this.roll?.constructor.name;
|
||||
context.experiences = Object.keys(this.config.data.experiences).map(id => ({
|
||||
id,
|
||||
...this.config.data.experiences[id]
|
||||
}));
|
||||
context.selectedExperiences = this.config.experiences;
|
||||
context.advantage = this.config.roll?.advantage;
|
||||
context.diceOptions = CONFIG.DH.GENERAL.diceTypes;
|
||||
context.canRoll = true;
|
||||
context.isLite = this.config.roll?.lite;
|
||||
if (this.config.costs?.length) {
|
||||
const updatedCosts = this.action.calcCosts(this.config.costs);
|
||||
context.costs = updatedCosts;
|
||||
context.canRoll = this.action.hasCost(updatedCosts);
|
||||
this.config.data.scale = this.config.costs[0].total;
|
||||
}
|
||||
if (this.config.uses?.max) {
|
||||
context.uses = this.action.calcUses(this.config.uses);
|
||||
context.canRoll = context.canRoll && this.action.hasUses(context.uses);
|
||||
}
|
||||
context.extraFormula = this.config.extraFormula;
|
||||
context.formula = this.roll.constructFormula(this.config);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static updateRollConfiguration(event, _, formData) {
|
||||
const { ...rest } = foundry.utils.expandObject(formData.object);
|
||||
if (this.config.costs) {
|
||||
this.config.costs = foundry.utils.mergeObject(this.config.costs, rest.costs);
|
||||
}
|
||||
if (this.config.uses) this.config.uses = foundry.utils.mergeObject(this.config.uses, rest.uses);
|
||||
if (rest.roll?.dice) {
|
||||
Object.entries(rest.roll.dice).forEach(([key, value]) => {
|
||||
this.roll[key] = value;
|
||||
});
|
||||
}
|
||||
this.config.extraFormula = rest.extraFormula;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static updateIsAdvantage(_, button) {
|
||||
const advantage = Number(button.dataset.advantage);
|
||||
this.config.roll.advantage = this.config.roll.advantage === advantage ? 0 : advantage;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static selectExperience(_, button) {
|
||||
/* if (this.config.experiences.find(x => x === button.dataset.key)) {
|
||||
this.config.experiences = this.config.experiences.filter(x => x !== button.dataset.key);
|
||||
} else {
|
||||
this.config.experiences = [...this.config.experiences, button.dataset.key];
|
||||
} */
|
||||
this.config.experiences =
|
||||
this.config.experiences.indexOf(button.dataset.key) > -1
|
||||
? this.config.experiences.filter(x => x !== button.dataset.key)
|
||||
: [...this.config.experiences, button.dataset.key];
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async submitRoll() {
|
||||
await this.close({ submitted: true });
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onClose(options = {}) {
|
||||
if (!options.submitted) this.config = false;
|
||||
}
|
||||
|
||||
static async configure(roll, config = {}, options = {}) {
|
||||
return new Promise(resolve => {
|
||||
const app = new this(roll, config, options);
|
||||
app.addEventListener('close', () => resolve(app.config), { once: true });
|
||||
app.render({ force: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
67
module/applications/dialogs/damageDialog.mjs
Normal file
67
module/applications/dialogs/damageDialog.mjs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class DamageDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(roll, config = {}, options = {}) {
|
||||
super(options);
|
||||
|
||||
this.roll = roll;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'roll-selection',
|
||||
classes: ['daggerheart', 'views', 'damage-selection'],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
submitRoll: this.submitRoll
|
||||
},
|
||||
form: {
|
||||
handler: this.updateRollConfiguration,
|
||||
submitOnChange: true,
|
||||
submitOnClose: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/damageSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.title = this.config.title;
|
||||
context.extraFormula = this.config.extraFormula;
|
||||
context.formula = this.roll.constructFormula(this.config);
|
||||
return context;
|
||||
}
|
||||
|
||||
static updateRollConfiguration(event, _, formData) {
|
||||
const { ...rest } = foundry.utils.expandObject(formData.object);
|
||||
this.config.extraFormula = rest.extraFormula;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async submitRoll() {
|
||||
await this.close({ submitted: true });
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onClose(options = {}) {
|
||||
if (!options.submitted) this.config = false;
|
||||
}
|
||||
|
||||
static async configure(roll, config = {}) {
|
||||
return new Promise(resolve => {
|
||||
const app = new this(roll, config);
|
||||
app.addEventListener('close', () => resolve(app.config), { once: true });
|
||||
app.render({ force: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { damageKeyToNumber, getDamageLabel } from '../helpers/utils.mjs';
|
||||
import { damageKeyToNumber, getDamageLabel } from '../../helpers/utils.mjs';
|
||||
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
|||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageReduction',
|
||||
template: 'systems/daggerheart/templates/views/damageReduction.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/damageReduction.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ export default class DamageSelectionDialog extends HandlebarsApplicationMixin(Ap
|
|||
this.data = {
|
||||
rollString,
|
||||
bonusDamage: bonusDamage.reduce((acc, x) => {
|
||||
if (x.appliesOn === SYSTEM.EFFECTS.applyLocations.damageRoll.id) {
|
||||
if (x.appliesOn === CONFIG.DH.EFFECTS.applyLocations.damageRoll.id) {
|
||||
acc.push({
|
||||
...x,
|
||||
hopeUses: 0
|
||||
|
|
@ -44,7 +44,7 @@ export default class DamageSelectionDialog extends HandlebarsApplicationMixin(Ap
|
|||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/views/damageSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/damageSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -24,21 +24,21 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application
|
|||
static PARTS = {
|
||||
application: {
|
||||
id: 'death-move',
|
||||
template: 'systems/daggerheart/templates/views/deathMove.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/deathMove.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.selectedMove = this.selectedMove;
|
||||
context.options = SYSTEM.GENERAL.deathMoves;
|
||||
context.options = CONFIG.DH.GENERAL.deathMoves;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static selectMove(_, button) {
|
||||
const move = button.dataset.move;
|
||||
this.selectedMove = SYSTEM.GENERAL.deathMoves[move];
|
||||
this.selectedMove = CONFIG.DH.GENERAL.deathMoves[move];
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application
|
|||
const msg = new cls({
|
||||
user: game.user.id,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/deathMove.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/deathMove.hbs',
|
||||
{
|
||||
player: this.actor.name,
|
||||
title: game.i18n.localize(this.selectedMove.name),
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { actionsTypes } from '../data/_module.mjs';
|
||||
import { actionsTypes } from '../../data/_module.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
this.actor = actor;
|
||||
this.shortrest = shortrest;
|
||||
|
||||
const options = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew).restMoves;
|
||||
const options = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves;
|
||||
this.moveData = shortrest ? options.shortRest : options.longRest;
|
||||
}
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
static PARTS = {
|
||||
application: {
|
||||
id: 'downtime',
|
||||
template: 'systems/daggerheart/templates/views/downtime.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/downtime.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
actor: this.actor.uuid
|
||||
},
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/downtime.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/downtime.hbs',
|
||||
{
|
||||
title: `${this.actor.name} - ${game.i18n.localize(`DAGGERHEART.Downtime.${this.shortRest ? 'ShortRest' : 'LongRest'}.title`)}`,
|
||||
moves: moves
|
||||
|
|
@ -22,7 +22,7 @@ export default class OwnershipSelection extends HandlebarsApplicationMixin(Appli
|
|||
|
||||
static PARTS = {
|
||||
selection: {
|
||||
template: 'systems/daggerheart/templates/views/ownershipSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/ownershipSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
import LevelUpBase from './levelup.mjs';
|
||||
import { DhLevelup } from '../../data/levelup.mjs';
|
||||
import { domains } from '../../config/domainConfig.mjs';
|
||||
import { abilities } from '../../config/actorConfig.mjs';
|
||||
import { domains } from '../../applications/config/domainConfig.mjs';
|
||||
import { abilities } from '../../applications/config/actorConfig.mjs';
|
||||
|
||||
export default class DhCharacterLevelUp extends LevelUpBase {
|
||||
constructor(actor) {
|
||||
super(actor);
|
||||
|
||||
this.levelTiers = this.addBonusChoices(game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.LevelTiers));
|
||||
this.levelTiers = this.addBonusChoices(
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers)
|
||||
);
|
||||
const playerLevelupData = actor.system.levelData;
|
||||
this.levelup = new DhLevelup(DhLevelup.initializeData(this.levelTiers, playerLevelupData));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import BaseLevelUp from './levelup.mjs';
|
||||
import { defaultCompanionTier, LevelOptionType } from '../../data/levelTier.mjs';
|
||||
import { DhLevelup } from '../../data/levelup.mjs';
|
||||
import { diceTypes, range } from '../../config/generalConfig.mjs';
|
||||
import { diceTypes, range } from '../../applications/config/generalConfig.mjs';
|
||||
|
||||
export default class DhCompanionLevelUp extends BaseLevelUp {
|
||||
constructor(actor) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { abilities, subclassFeatureLabels } from '../../config/actorConfig.mjs';
|
||||
import { domains } from '../../config/domainConfig.mjs';
|
||||
import { abilities, subclassFeatureLabels } from '../../applications/config/actorConfig.mjs';
|
||||
import { domains } from '../../applications/config/domainConfig.mjs';
|
||||
import { getDeleteKeys, tagifyElement } from '../../helpers/utils.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
|
@ -43,10 +43,10 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
};
|
||||
|
||||
static PARTS = {
|
||||
tabs: { template: 'systems/daggerheart/templates/views/levelup/tabs/tab-navigation.hbs' },
|
||||
advancements: { template: 'systems/daggerheart/templates/views/levelup/tabs/advancements.hbs' },
|
||||
selections: { template: 'systems/daggerheart/templates/views/levelup/tabs/selections.hbs' },
|
||||
summary: { template: 'systems/daggerheart/templates/views/levelup/tabs/summary.hbs' }
|
||||
tabs: { template: 'systems/daggerheart/templates/levelup/tabs/tab-navigation.hbs' },
|
||||
advancements: { template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs' },
|
||||
selections: { template: 'systems/daggerheart/templates/levelup/tabs/selections.hbs' },
|
||||
summary: { template: 'systems/daggerheart/templates/levelup/tabs/summary.hbs' }
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
/** NOT USED ANYMORE - TO BE DELETED **/
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class NpcRollSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(experiences, resolve, reject) {
|
||||
super({});
|
||||
|
||||
this.experiences = experiences;
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
this.selectedExperiences = [];
|
||||
this.data = {
|
||||
advantage: null
|
||||
};
|
||||
}
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.Application.RollSelection.Title');
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'views', 'npc-roll-selection'],
|
||||
position: { width: '500', height: 'auto' },
|
||||
actions: {
|
||||
updateIsAdvantage: this.updateIsAdvantage,
|
||||
selectExperience: this.selectExperience
|
||||
},
|
||||
form: { handler: this.updateData, submitOnChange: false }
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
main: {
|
||||
id: 'main',
|
||||
template: 'systems/daggerheart/templates/views/npcRollSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.advantage = this.data.advantage;
|
||||
context.experiences = Object.values(this.experiences).map(x => ({
|
||||
...x,
|
||||
selected: this.selectedExperiences.find(selected => selected.id === x.id),
|
||||
value: `${x.value >= 0 ? '+' : '-'}${x.value}`
|
||||
}));
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static updateIsAdvantage(_, button) {
|
||||
const advantage = Boolean(button.dataset.advantage);
|
||||
this.data.advantage = this.data.advantage === advantage ? null : advantage;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static selectExperience(_, button) {
|
||||
const experience = Object.values(this.experiences).find(experience => experience.id === button.id);
|
||||
this.selectedExperiences = this.selectedExperiences.find(x => x.id === experience.id)
|
||||
? this.selectedExperiences.filter(x => x.id !== experience.id)
|
||||
: [...this.selectedExperiences, experience];
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async updateData() {
|
||||
this.resolve({ ...this.data, experiences: this.selectedExperiences });
|
||||
this.close({ updateClose: true });
|
||||
}
|
||||
|
||||
async close(options = {}) {
|
||||
const { updateClose, ...baseOptions } = options;
|
||||
if (!updateClose) {
|
||||
this.reject();
|
||||
}
|
||||
|
||||
await super.close(baseOptions);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,491 +0,0 @@
|
|||
import D20RollDialog from '../dialogs/d20RollDialog.mjs';
|
||||
import DamageDialog from '../dialogs/damageDialog.mjs';
|
||||
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||
|
||||
/*
|
||||
- Damage & other resources roll
|
||||
- Close dialog => don't roll
|
||||
*/
|
||||
|
||||
export class DHRoll extends Roll {
|
||||
baseTerms = [];
|
||||
constructor(formula, data, options) {
|
||||
super(formula, data, options);
|
||||
}
|
||||
|
||||
static messageType = 'adversaryRoll';
|
||||
|
||||
static DefaultDialog = D20RollDialog;
|
||||
|
||||
static async build(config = {}, message = {}) {
|
||||
const roll = await this.buildConfigure(config, message);
|
||||
if (!roll) return;
|
||||
await this.buildEvaluate(roll, config, (message = {}));
|
||||
await this.buildPost(roll, config, (message = {}));
|
||||
return config;
|
||||
}
|
||||
|
||||
static async buildConfigure(config = {}, message = {}) {
|
||||
config.hooks = [...(config.hooks ?? []), ''];
|
||||
config.dialog ??= {};
|
||||
for (const hook of config.hooks) {
|
||||
if (Hooks.call(`${SYSTEM.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;
|
||||
}
|
||||
|
||||
this.applyKeybindings(config);
|
||||
|
||||
let roll = new this(config.roll.formula, config.data, config);
|
||||
if (config.dialog.configure !== false) {
|
||||
// Open Roll Dialog
|
||||
const DialogClass = config.dialog?.class ?? this.DefaultDialog;
|
||||
const configDialog = await DialogClass.configure(roll, config, message);
|
||||
if (!configDialog) return;
|
||||
}
|
||||
|
||||
for (const hook of config.hooks) {
|
||||
if (Hooks.call(`${SYSTEM.id}.post${hook.capitalize()}RollConfiguration`, roll, config, message) === false)
|
||||
return [];
|
||||
}
|
||||
return roll;
|
||||
}
|
||||
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
if (config.evaluate !== false) await roll.evaluate();
|
||||
this.postEvaluate(roll, config);
|
||||
}
|
||||
|
||||
static async buildPost(roll, config, message) {
|
||||
for (const hook of config.hooks) {
|
||||
if (Hooks.call(`${SYSTEM.id}.postRoll${hook.capitalize()}`, config, message) === false) return null;
|
||||
}
|
||||
|
||||
// Create Chat Message
|
||||
if (config.source?.message) {
|
||||
} else {
|
||||
const messageData = {};
|
||||
config.message = await this.toMessage(roll, config);
|
||||
}
|
||||
}
|
||||
|
||||
static postEvaluate(roll, config = {}) {
|
||||
if (!config.roll) config.roll = {};
|
||||
config.roll.total = roll.total;
|
||||
config.roll.formula = roll.formula;
|
||||
config.roll.dice = [];
|
||||
roll.dice.forEach(d => {
|
||||
config.roll.dice.push({
|
||||
dice: d.denomination,
|
||||
total: d.total,
|
||||
formula: d.formula,
|
||||
results: d.results
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
static async toMessage(roll, config) {
|
||||
const cls = getDocumentClass('ChatMessage'),
|
||||
msg = {
|
||||
type: this.messageType,
|
||||
user: game.user.id,
|
||||
sound: config.mute ? null : CONFIG.sounds.dice,
|
||||
system: config,
|
||||
rolls: [roll]
|
||||
};
|
||||
return await cls.create(msg);
|
||||
}
|
||||
|
||||
static applyKeybindings(config) {
|
||||
if (config.event)
|
||||
config.dialog.configure ??= !(config.event.shiftKey || config.event.altKey || config.event.ctrlKey);
|
||||
}
|
||||
|
||||
formatModifier(modifier) {
|
||||
const numTerm = modifier < 0 ? '-' : '+';
|
||||
return [
|
||||
new foundry.dice.terms.OperatorTerm({ operator: numTerm }),
|
||||
new foundry.dice.terms.NumericTerm({ number: Math.abs(modifier) })
|
||||
];
|
||||
}
|
||||
|
||||
getFaces(faces) {
|
||||
return Number(faces.startsWith('d') ? faces.replace('d', '') : faces);
|
||||
}
|
||||
|
||||
constructFormula(config) {
|
||||
this.terms = Roll.parse(this.options.roll.formula, config.data);
|
||||
|
||||
if (this.options.extraFormula) {
|
||||
this.terms.push(
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
...this.constructor.parse(this.options.extraFormula, this.options.data)
|
||||
);
|
||||
}
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
|
||||
static calculateTotalModifiers(roll) {
|
||||
let modifierTotal = 0;
|
||||
for (let i = 0; i < roll.terms.length; i++) {
|
||||
if (
|
||||
roll.terms[i] instanceof foundry.dice.terms.NumericTerm &&
|
||||
!!roll.terms[i - 1] &&
|
||||
roll.terms[i - 1] instanceof foundry.dice.terms.OperatorTerm
|
||||
)
|
||||
modifierTotal += Number(`${roll.terms[i - 1].operator}${roll.terms[i].total}`);
|
||||
}
|
||||
return modifierTotal;
|
||||
}
|
||||
}
|
||||
|
||||
export class DualityDie extends foundry.dice.terms.Die {
|
||||
constructor({ number = 1, faces = 12, ...args } = {}) {
|
||||
super({ number, faces, ...args });
|
||||
}
|
||||
}
|
||||
|
||||
export class D20Roll extends DHRoll {
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
this.constructFormula();
|
||||
}
|
||||
|
||||
static ADV_MODE = {
|
||||
NORMAL: 0,
|
||||
ADVANTAGE: 1,
|
||||
DISADVANTAGE: -1
|
||||
};
|
||||
|
||||
static messageType = 'adversaryRoll';
|
||||
|
||||
static CRITICAL_TRESHOLD = 20;
|
||||
|
||||
static DefaultDialog = D20RollDialog;
|
||||
|
||||
get d20() {
|
||||
if (!(this.terms[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||
return this.terms[0];
|
||||
}
|
||||
|
||||
set d20(faces) {
|
||||
if (!(this.terms[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
|
||||
this.terms[0].faces = this.getFaces(faces);
|
||||
}
|
||||
|
||||
get dAdvantage() {
|
||||
return this.dice[2];
|
||||
}
|
||||
|
||||
get isCritical() {
|
||||
if (!this.d20._evaluated) return;
|
||||
return this.d20.total >= this.constructor.CRITICAL_TRESHOLD;
|
||||
}
|
||||
|
||||
get hasAdvantage() {
|
||||
return this.options.roll.advantage === this.constructor.ADV_MODE.ADVANTAGE;
|
||||
}
|
||||
|
||||
get hasDisadvantage() {
|
||||
return this.options.roll.advantage === this.constructor.ADV_MODE.DISADVANTAGE;
|
||||
}
|
||||
|
||||
static applyKeybindings(config) {
|
||||
let keys = {
|
||||
normal: true,
|
||||
advantage: false,
|
||||
disadvantage: false
|
||||
};
|
||||
|
||||
if (config.event) {
|
||||
keys = {
|
||||
normal: config.event.shiftKey || config.event.altKey || config.event.ctrlKey,
|
||||
advantage: config.event.altKey,
|
||||
disadvantage: config.event.ctrlKey
|
||||
};
|
||||
}
|
||||
|
||||
// Should the roll configuration dialog be displayed?
|
||||
config.dialog.configure ??= !Object.values(keys).some(k => k);
|
||||
|
||||
// Determine advantage mode
|
||||
const advantage = config.roll.advantage === this.ADV_MODE.ADVANTAGE || keys.advantage || config.advantage;
|
||||
const disadvantage =
|
||||
config.roll.advantage === this.ADV_MODE.DISADVANTAGE || keys.disadvantage || config.disadvantage;
|
||||
if (advantage && !disadvantage) config.roll.advantage = this.ADV_MODE.ADVANTAGE;
|
||||
else if (!advantage && disadvantage) config.roll.advantage = this.ADV_MODE.DISADVANTAGE;
|
||||
else config.roll.advantage = this.ADV_MODE.NORMAL;
|
||||
}
|
||||
|
||||
constructFormula(config) {
|
||||
// this.terms = [];
|
||||
this.createBaseDice();
|
||||
this.configureModifiers();
|
||||
this.resetFormula();
|
||||
return this._formula;
|
||||
}
|
||||
|
||||
createBaseDice() {
|
||||
if (this.terms[0] instanceof foundry.dice.terms.Die) {
|
||||
this.terms = [this.terms[0]];
|
||||
return;
|
||||
}
|
||||
this.terms[0] = new foundry.dice.terms.Die({ faces: 20 });
|
||||
}
|
||||
|
||||
configureModifiers() {
|
||||
this.applyAdvantage();
|
||||
this.applyBaseBonus();
|
||||
|
||||
this.options.experiences?.forEach(m => {
|
||||
if (this.options.data.experiences?.[m])
|
||||
this.options.roll.modifiers.push({
|
||||
label: this.options.data.experiences[m].name,
|
||||
value: this.options.data.experiences[m].total ?? this.options.data.experiences[m].value
|
||||
});
|
||||
});
|
||||
|
||||
this.options.roll.modifiers?.forEach(m => {
|
||||
this.terms.push(...this.formatModifier(m.value));
|
||||
});
|
||||
|
||||
this.baseTerms = foundry.utils.deepClone(this.terms);
|
||||
|
||||
if (this.options.extraFormula) {
|
||||
this.terms.push(
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
...this.constructor.parse(this.options.extraFormula, this.options.data)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
applyAdvantage() {
|
||||
this.d20.modifiers.findSplice(m => ['kh', 'kl'].includes(m));
|
||||
if (!this.hasAdvantage && !this.hasDisadvantage) this.number = 1;
|
||||
else {
|
||||
this.d20.number = 2;
|
||||
this.d20.modifiers.push(this.hasAdvantage ? 'kh' : 'kl');
|
||||
}
|
||||
}
|
||||
|
||||
applyBaseBonus() {
|
||||
this.options.roll.modifiers = [];
|
||||
if (!this.options.roll.bonus) return;
|
||||
this.options.roll.modifiers.push({
|
||||
label: 'Bonus to Hit',
|
||||
value: this.options.roll.bonus
|
||||
// value: Roll.replaceFormulaData('@attackBonus', this.data)
|
||||
});
|
||||
}
|
||||
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
if (config.evaluate !== false) await roll.evaluate();
|
||||
const advantageState =
|
||||
config.roll.advantage == this.ADV_MODE.ADVANTAGE
|
||||
? true
|
||||
: config.roll.advantage == this.ADV_MODE.DISADVANTAGE
|
||||
? false
|
||||
: null;
|
||||
setDiceSoNiceForDualityRoll(roll, advantageState);
|
||||
this.postEvaluate(roll, config);
|
||||
}
|
||||
|
||||
static postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
if (config.targets?.length) {
|
||||
config.targets.forEach(target => {
|
||||
const difficulty = config.roll.difficulty ?? target.difficulty ?? target.evasion;
|
||||
target.hit = this.isCritical || roll.total >= difficulty;
|
||||
});
|
||||
} else if (config.roll.difficulty)
|
||||
config.roll.success = roll.isCritical || roll.total >= config.roll.difficulty;
|
||||
config.roll.advantage = {
|
||||
type: config.roll.advantage,
|
||||
dice: roll.dAdvantage?.denomination,
|
||||
value: roll.dAdvantage?.total
|
||||
};
|
||||
config.roll.isCritical = roll.isCritical;
|
||||
config.roll.extra = roll.dice
|
||||
.filter(d => !roll.baseTerms.includes(d))
|
||||
.map(d => {
|
||||
return {
|
||||
dice: d.denomination,
|
||||
value: d.total
|
||||
};
|
||||
});
|
||||
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
||||
}
|
||||
|
||||
resetFormula() {
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
}
|
||||
|
||||
export class DualityRoll extends D20Roll {
|
||||
_advantageFaces = 6;
|
||||
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
}
|
||||
|
||||
static messageType = 'dualityRoll';
|
||||
|
||||
static DefaultDialog = D20RollDialog;
|
||||
|
||||
get dHope() {
|
||||
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
|
||||
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
||||
return this.dice[0];
|
||||
// return this.#hopeDice;
|
||||
}
|
||||
|
||||
set dHope(faces) {
|
||||
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
||||
this.terms[0].faces = this.getFaces(faces);
|
||||
// this.#hopeDice = `d${face}`;
|
||||
}
|
||||
|
||||
get dFear() {
|
||||
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
|
||||
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
||||
return this.dice[1];
|
||||
// return this.#fearDice;
|
||||
}
|
||||
|
||||
set dFear(faces) {
|
||||
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
|
||||
this.dice[1].faces = this.getFaces(faces);
|
||||
// this.#fearDice = `d${face}`;
|
||||
}
|
||||
|
||||
get dAdvantage() {
|
||||
return this.dice[2];
|
||||
}
|
||||
|
||||
get advantageFaces() {
|
||||
return this._advantageFaces;
|
||||
}
|
||||
|
||||
set advantageFaces(faces) {
|
||||
this._advantageFaces = this.getFaces(faces);
|
||||
}
|
||||
|
||||
get isCritical() {
|
||||
if (!this.dHope._evaluated || !this.dFear._evaluated) return;
|
||||
return this.dHope.total === this.dFear.total;
|
||||
}
|
||||
|
||||
get withHope() {
|
||||
if (!this._evaluated) return;
|
||||
return this.dHope.total > this.dFear.total;
|
||||
}
|
||||
|
||||
get withFear() {
|
||||
if (!this._evaluated) return;
|
||||
return this.dHope.total < this.dFear.total;
|
||||
}
|
||||
|
||||
get hasBarRally() {
|
||||
return null;
|
||||
}
|
||||
|
||||
get totalLabel() {
|
||||
const label = this.withHope
|
||||
? 'DAGGERHEART.General.Hope'
|
||||
: this.withFear
|
||||
? 'DAGGERHEART.General.Fear'
|
||||
: 'DAGGERHEART.General.CriticalSuccess';
|
||||
|
||||
return game.i18n.localize(label);
|
||||
}
|
||||
|
||||
updateFormula() {}
|
||||
|
||||
createBaseDice() {
|
||||
if (
|
||||
this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie &&
|
||||
this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie
|
||||
) {
|
||||
this.terms = [this.terms[0], this.terms[1], this.terms[2]];
|
||||
return;
|
||||
}
|
||||
this.terms[0] = new CONFIG.Dice.daggerheart.DualityDie();
|
||||
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
|
||||
this.terms[2] = new CONFIG.Dice.daggerheart.DualityDie();
|
||||
}
|
||||
|
||||
applyAdvantage() {
|
||||
const dieFaces = this.advantageFaces,
|
||||
bardRallyFaces = this.hasBarRally,
|
||||
advDie = new foundry.dice.terms.Die({ faces: dieFaces });
|
||||
if (this.hasAdvantage || this.hasDisadvantage || bardRallyFaces)
|
||||
this.terms.push(new foundry.dice.terms.OperatorTerm({ operator: this.hasDisadvantage ? '-' : '+' }));
|
||||
if (bardRallyFaces) {
|
||||
const rallyDie = new foundry.dice.terms.Die({ faces: bardRallyFaces });
|
||||
if (this.hasAdvantage) {
|
||||
this.terms.push(
|
||||
new foundry.dice.terms.PoolTerm({
|
||||
terms: [advDie.formula, rallyDie.formula],
|
||||
modifiers: ['kh']
|
||||
})
|
||||
);
|
||||
} else if (this.hasDisadvantage) {
|
||||
this.terms.push(advDie, new foundry.dice.terms.OperatorTerm({ operator: '+' }), rallyDie);
|
||||
}
|
||||
} else if (this.hasAdvantage || this.hasDisadvantage) this.terms.push(advDie);
|
||||
}
|
||||
|
||||
applyBaseBonus() {
|
||||
this.options.roll.modifiers = [];
|
||||
if (!this.options.roll.trait) return;
|
||||
this.options.roll.modifiers.push({
|
||||
label: `DAGGERHEART.Abilities.${this.options.roll.trait}.name`,
|
||||
value: Roll.replaceFormulaData(`@traits.${this.options.roll.trait}.total`, this.data)
|
||||
});
|
||||
}
|
||||
|
||||
static postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
config.roll.hope = {
|
||||
dice: roll.dHope.denomination,
|
||||
value: roll.dHope.total
|
||||
};
|
||||
config.roll.fear = {
|
||||
dice: roll.dFear.denomination,
|
||||
value: roll.dFear.total
|
||||
};
|
||||
config.roll.result = {
|
||||
duality: roll.withHope ? 1 : roll.withFear ? -1 : 0,
|
||||
total: roll.dHope.total + roll.dFear.total,
|
||||
label: roll.totalLabel
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class DamageRoll extends DHRoll {
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
}
|
||||
|
||||
static messageType = 'damageRoll';
|
||||
|
||||
static DefaultDialog = DamageDialog;
|
||||
|
||||
static async postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
config.roll.type = config.type;
|
||||
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
||||
if (config.source?.message) {
|
||||
const chatMessage = ui.chat.collection.get(config.source.message);
|
||||
chatMessage.update({ 'system.damage': config });
|
||||
}
|
||||
}
|
||||
|
||||
constructFormula(config) {
|
||||
super.constructFormula(config);
|
||||
if(config.isCritical) {
|
||||
const tmpRoll = new Roll(this._formula)._evaluateSync({maximize: true}),
|
||||
criticalBonus = tmpRoll.total - this.constructor.calculateTotalModifiers(tmpRoll);
|
||||
this.terms.push(...this.formatModifier(criticalBonus));
|
||||
}
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/** NOT USED ANYMORE - TO BE DELETED **/
|
||||
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class RollSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(experiences, costs, action, resolve) {
|
||||
super({}, {});
|
||||
|
||||
this.experiences = experiences;
|
||||
this.costs = costs;
|
||||
this.action = action;
|
||||
this.resolve = resolve;
|
||||
this.isNpc;
|
||||
this.selectedExperiences = [];
|
||||
this.data = {
|
||||
diceOptions: [
|
||||
{ name: 'd12', value: 'd12' },
|
||||
{ name: 'd20', value: 'd20' }
|
||||
],
|
||||
hope: ['d12'],
|
||||
fear: ['d12'],
|
||||
advantage: null
|
||||
};
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'roll-selection',
|
||||
classes: ['daggerheart', 'views', 'roll-selection'],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
},
|
||||
actions: {
|
||||
updateIsAdvantage: this.updateIsAdvantage,
|
||||
selectExperience: this.selectExperience,
|
||||
finish: this.finish
|
||||
},
|
||||
form: {
|
||||
handler: this.updateSelection,
|
||||
submitOnChange: true,
|
||||
submitOnClose: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/views/costSelection.hbs'
|
||||
},
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/views/rollSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.Application.RollSelection.Title');
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.isNpc = this.isNpc;
|
||||
context.diceOptions = this.data.diceOptions;
|
||||
context.hope = this.data.hope;
|
||||
context.fear = this.data.fear;
|
||||
context.advantage = this.data.advantage;
|
||||
context.experiences = Object.keys(this.experiences).map(id => ({ id, ...this.experiences[id] }));
|
||||
if (this.costs?.length) {
|
||||
const updatedCosts = this.action.calcCosts(this.costs);
|
||||
context.costs = updatedCosts;
|
||||
context.canRoll = this.action.getRealCosts(updatedCosts)?.hasCost;
|
||||
} else context.canRoll = true;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static updateSelection(event, _, formData) {
|
||||
const { ...rest } = foundry.utils.expandObject(formData.object);
|
||||
this.data = foundry.utils.mergeObject(this.data, rest);
|
||||
this.costs = foundry.utils.mergeObject(this.costs, rest.costs);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static selectExperience(_, button) {
|
||||
if (this.selectedExperiences.find(x => x.id === button.dataset.key)) {
|
||||
this.selectedExperiences = this.selectedExperiences.filter(x => x.id !== button.dataset.key);
|
||||
} else {
|
||||
this.selectedExperiences = [...this.selectedExperiences, button.dataset.key];
|
||||
}
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
static updateIsAdvantage(_, button) {
|
||||
const advantage = Boolean(button.dataset.advantage);
|
||||
this.data.advantage = this.data.advantage === advantage ? null : advantage;
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async finish() {
|
||||
const { diceOptions, ...rest } = this.data;
|
||||
this.resolve({
|
||||
...rest,
|
||||
experiences: this.selectedExperiences.map(x => ({ id: x, ...this.experiences[x] })),
|
||||
costs: this.action.getRealCosts(this.costs)
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
import { defaultLevelTiers, DhLevelTiers } from '../data/levelTier.mjs';
|
||||
import DhCountdowns from '../data/countdowns.mjs';
|
||||
import {
|
||||
DhAppearance,
|
||||
DhAutomation,
|
||||
DhHomebrew,
|
||||
DhRangeMeasurement,
|
||||
DhVariantRules
|
||||
} from '../data/settings/_module.mjs';
|
||||
import {
|
||||
DhAppearanceSettings,
|
||||
DhAutomationSettings,
|
||||
DhHomebrewSettings,
|
||||
DhRangeMeasurementSettings,
|
||||
DhVariantRuleSettings
|
||||
} from './settings/_module.mjs';
|
||||
|
||||
export const registerDHSettings = () => {
|
||||
registerMenuSettings();
|
||||
registerMenus();
|
||||
registerNonConfigSettings();
|
||||
};
|
||||
|
||||
const registerMenuSettings = () => {
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhVariantRules
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhAutomation
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhHomebrew,
|
||||
onChange: value => {
|
||||
if (value.maxFear) {
|
||||
if (ui.resources) ui.resources.render({ force: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, {
|
||||
scope: 'client',
|
||||
config: false,
|
||||
type: DhAppearance,
|
||||
onChange: value => {
|
||||
if (value.displayFear) {
|
||||
if (ui.resources) {
|
||||
if (value.displayFear === 'hide') ui.resources.close({ allowed: true });
|
||||
else ui.resources.render({ force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.RangeMeasurement, {
|
||||
scope: 'client',
|
||||
config: false,
|
||||
type: DhRangeMeasurement
|
||||
});
|
||||
};
|
||||
|
||||
const registerMenus = () => {
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Automation.Name, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.Automation.Name'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.Automation.Label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.Automation.Hint'),
|
||||
icon: SYSTEM.SETTINGS.menu.Automation.Icon,
|
||||
type: DhAutomationSettings,
|
||||
restricted: true
|
||||
});
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Homebrew.Name, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.Homebrew.Name'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.Homebrew.Label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.Homebrew.Hint'),
|
||||
icon: SYSTEM.SETTINGS.menu.Homebrew.Icon,
|
||||
type: DhHomebrewSettings,
|
||||
restricted: true
|
||||
});
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.Range.Name, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.Range.Name'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.Range.Label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.Range.Hint'),
|
||||
icon: SYSTEM.SETTINGS.menu.Range.Icon,
|
||||
type: DhRangeMeasurementSettings,
|
||||
restricted: true
|
||||
});
|
||||
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.title'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.hint'),
|
||||
icon: 'fa-solid fa-palette',
|
||||
type: DhAppearanceSettings,
|
||||
restricted: false
|
||||
});
|
||||
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.menu.VariantRules.Name, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.title'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.VariantRules.hint'),
|
||||
icon: SYSTEM.SETTINGS.menu.VariantRules.Icon,
|
||||
type: DhVariantRuleSettings,
|
||||
restricted: false
|
||||
});
|
||||
};
|
||||
|
||||
const registerNonConfigSettings = () => {
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.LevelTiers, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhLevelTiers,
|
||||
default: defaultLevelTiers
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Resources.Fear.Name'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Resources.Fear.Hint'),
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: Number,
|
||||
default: 0,
|
||||
onChange: () => {
|
||||
if (ui.resources) ui.resources.render({ force: true });
|
||||
ui.combat.render({ force: true });
|
||||
}
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, {
|
||||
scope: 'world',
|
||||
config: false,
|
||||
type: DhCountdowns
|
||||
});
|
||||
};
|
||||
|
|
@ -7,7 +7,7 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
|
|||
super({});
|
||||
|
||||
this.settings = new DhAppearance(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).toObject()
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -53,10 +53,10 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
|
|||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, this.settings.toObject());
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance, this.settings.toObject());
|
||||
document.body.classList.toggle(
|
||||
'theme-colorful',
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||
DualityRollColor.colorful.value
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
|||
super({});
|
||||
|
||||
this.settings = new DhAutomation(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation).toObject()
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
|||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation, this.settings.toObject());
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation, this.settings.toObject());
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
|
|||
|
||||
async selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/views/actionType.hbs',
|
||||
{ types: SYSTEM.ACTIONS.actionTypes }
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type',
|
||||
type = 'form',
|
||||
|
|
@ -123,7 +123,7 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
|
|||
action = new cls({
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType.type,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType.type].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
constructor() {
|
||||
super({});
|
||||
|
||||
this.settings = new DhHomebrew(game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew).toObject());
|
||||
this.settings = new DhHomebrew(
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
get title() {
|
||||
|
|
@ -113,7 +115,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
|
||||
if (!confirmed) return;
|
||||
|
||||
const fields = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew).schema.fields;
|
||||
const fields = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).schema.fields;
|
||||
|
||||
const removeUpdate = Object.keys(this.settings.restMoves[target.dataset.type].moves).reduce((acc, key) => {
|
||||
acc[`-=${key}`] = null;
|
||||
|
|
@ -153,7 +155,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew, this.settings.toObject());
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew, this.settings.toObject());
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default class DhRangeMeasurementSettings extends HandlebarsApplicationMix
|
|||
super({});
|
||||
|
||||
this.settings = new DhRangeMeasurement(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.RangeMeasurement).toObject()
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.RangeMeasurement).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,11 @@ export default class DhRangeMeasurementSettings extends HandlebarsApplicationMix
|
|||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.RangeMeasurement, this.settings.toObject());
|
||||
await game.settings.set(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.RangeMeasurement,
|
||||
this.settings.toObject()
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default class DHVariantRuleSettings extends HandlebarsApplicationMixin(Ap
|
|||
super({});
|
||||
|
||||
this.settings = new DhVariantRules(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules).toObject()
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ export default class DHVariantRuleSettings extends HandlebarsApplicationMixin(Ap
|
|||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules, this.settings.toObject());
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules, this.settings.toObject());
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
},
|
||||
chatMessage: {
|
||||
type: 'adversaryRoll',
|
||||
template: 'systems/daggerheart/templates/chat/adversary-roll.hbs',
|
||||
template: 'systems/daggerheart/templates/ui/chat/adversary-roll.hbs',
|
||||
mute: true
|
||||
}
|
||||
};
|
||||
|
|
@ -127,7 +127,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import { capitalize } from '../../../helpers/utils.mjs';
|
||||
import DhpDeathMove from '../../deathMove.mjs';
|
||||
import DhpDowntime from '../../downtime.mjs';
|
||||
import AncestrySelectionDialog from '../../ancestrySelectionDialog.mjs';
|
||||
import DhpDeathMove from '../../dialogs/deathMove.mjs';
|
||||
import DhpDowntime from '../../dialogs/downtime.mjs';
|
||||
import DaggerheartSheet from '.././daggerheart-sheet.mjs';
|
||||
import { abilities } from '../../../config/actorConfig.mjs';
|
||||
import { abilities } from '../../../applications/config/actorConfig.mjs';
|
||||
import DhCharacterlevelUp from '../../levelup/characterLevelup.mjs';
|
||||
import DhCharacterCreation from '../../characterCreation.mjs';
|
||||
import DhCharacterCreation from '../../characterCreation/characterCreation.mjs';
|
||||
import FilterMenu from '../../ux/filter-menu.mjs';
|
||||
import { DhBeastformAction } from '../../../data/action/action.mjs';
|
||||
import DHActionConfig from '../../config/Action.mjs';
|
||||
|
||||
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||
|
|
@ -33,7 +31,6 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
useDomainCard: this.useDomainCard,
|
||||
selectClass: this.selectClass,
|
||||
selectSubclass: this.selectSubclass,
|
||||
selectAncestry: this.selectAncestry,
|
||||
selectCommunity: this.selectCommunity,
|
||||
viewObject: this.viewObject,
|
||||
useItem: this.useItem,
|
||||
|
|
@ -338,13 +335,13 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const context = await super._prepareContext(_options);
|
||||
context.document = this.document;
|
||||
context.tabs = super._getTabs(this.constructor.TABS);
|
||||
context.config = SYSTEM;
|
||||
context.config = CONFIG.DH;
|
||||
|
||||
context.attributes = Object.keys(this.document.system.traits).reduce((acc, key) => {
|
||||
acc[key] = {
|
||||
...this.document.system.traits[key],
|
||||
name: game.i18n.localize(SYSTEM.ACTOR.abilities[key].name),
|
||||
verbs: SYSTEM.ACTOR.abilities[key].verbs.map(x => game.i18n.localize(x))
|
||||
name: game.i18n.localize(CONFIG.DH.ACTOR.abilities[key].name),
|
||||
verbs: CONFIG.DH.ACTOR.abilities[key].verbs.map(x => game.i18n.localize(x))
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
|
@ -360,7 +357,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
}
|
||||
};
|
||||
|
||||
const homebrewCurrency = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew).currency;
|
||||
const homebrewCurrency = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).currency;
|
||||
if (homebrewCurrency.enabled) {
|
||||
context.inventory.currency = homebrewCurrency;
|
||||
}
|
||||
|
|
@ -631,13 +628,13 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
|
||||
static async toggleLoadoutView(_, button) {
|
||||
const newAbilityView = !(button.dataset.value === 'true');
|
||||
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||
await game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async toggleLoadoutView(_, button) {
|
||||
const newAbilityView = !(button.dataset.value === 'true');
|
||||
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||
await game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
@ -647,7 +644,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
|
||||
const wasUsed = await weapon.use(event);
|
||||
if (wasUsed) {
|
||||
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
|
||||
Hooks.callAll(CONFIG.DH.HOOKS.characterAttack, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +686,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
),
|
||||
system: systemData
|
||||
|
|
@ -706,28 +703,6 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
(await game.packs.get('daggerheart.subclasses'))?.render(true);
|
||||
}
|
||||
|
||||
static async selectAncestry() {
|
||||
const dialogClosed = new Promise((resolve, _) => {
|
||||
new AncestrySelectionDialog(resolve).render(true);
|
||||
});
|
||||
const result = await dialogClosed;
|
||||
|
||||
for (var ancestry of this.document.items.filter(x => x => x.type === 'ancestry')) {
|
||||
await ancestry.delete();
|
||||
}
|
||||
|
||||
const createdItems = [];
|
||||
for (var feature of this.document.items.filter(
|
||||
x => x.type === 'feature' && x.system.type === SYSTEM.ITEM.featureTypes.ancestry.id
|
||||
)) {
|
||||
await feature.delete();
|
||||
}
|
||||
|
||||
createdItems.push(result.data);
|
||||
|
||||
await this.document.createEmbeddedDocuments('Item', createdItems);
|
||||
}
|
||||
|
||||
static async selectCommunity() {
|
||||
(await game.packs.get('daggerheart.communities'))?.render(true);
|
||||
}
|
||||
|
|
@ -744,7 +719,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
} else {
|
||||
const wasUsed = await item.use(event);
|
||||
if (wasUsed && item.type === 'weapon') {
|
||||
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
|
||||
Hooks.callAll(CONFIG.DH.HOOKS.characterAttack, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -840,7 +815,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
),
|
||||
system: systemData
|
||||
|
|
@ -862,7 +837,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
|
@ -898,7 +873,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
|
@ -921,7 +896,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default class DhCompanionSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export default function DHApplicationMixin(Base) {
|
|||
* @param {DragEvent} event
|
||||
* @protected
|
||||
*/
|
||||
_onDrop(event) { }
|
||||
_onDrop(event) {}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Prepare Context */
|
||||
|
|
@ -154,7 +154,7 @@ export default function DHApplicationMixin(Base) {
|
|||
*/
|
||||
async _prepareContext(options, objectPath = 'document') {
|
||||
const context = await super._prepareContext(options);
|
||||
context.config = CONFIG.daggerheart;
|
||||
context.config = CONFIG.DH;
|
||||
context.source = this[objectPath];
|
||||
context.fields = this[objectPath].schema.fields;
|
||||
context.systemFields = this[objectPath].system ? this[objectPath].system.schema.fields : {};
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
*/
|
||||
static async selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/views/actionType.hbs',
|
||||
{ types: SYSTEM.ACTIONS.actionTypes }
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type';
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,24 +40,24 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
static PARTS = {
|
||||
header: {
|
||||
id: 'header',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/adversary-settings/header.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/header.hbs'
|
||||
},
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
details: {
|
||||
id: 'details',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/adversary-settings/details.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/details.hbs'
|
||||
},
|
||||
attack: {
|
||||
id: 'attack',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/adversary-settings/attack.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/attack.hbs'
|
||||
},
|
||||
experiences: {
|
||||
id: 'experiences',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/adversary-settings/experiences.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/experiences.hbs'
|
||||
},
|
||||
actions: {
|
||||
id: 'actions',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/adversary-settings/actions.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/actions.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.actor)
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { GMUpdateEvent, socketEvent } from '../../../helpers/socket.mjs';
|
||||
import { GMUpdateEvent, socketEvent } from '../../../systemRegistration/socket.mjs';
|
||||
import DhCompanionlevelUp from '../../levelup/companionLevelup.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
|
@ -35,20 +35,20 @@ export default class DHCompanionSettings extends HandlebarsApplicationMixin(Appl
|
|||
static PARTS = {
|
||||
header: {
|
||||
id: 'header',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/companion-settings/header.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/companion-settings/header.hbs'
|
||||
},
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
details: {
|
||||
id: 'details',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/companion-settings/details.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/companion-settings/details.hbs'
|
||||
},
|
||||
experiences: {
|
||||
id: 'experiences',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/companion-settings/experiences.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/companion-settings/experiences.hbs'
|
||||
},
|
||||
attack: {
|
||||
id: 'attack',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/companion-settings/attack.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/companion-settings/attack.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ export default class DHCompanionSettings extends HandlebarsApplicationMixin(Appl
|
|||
const partnerUpdate = { 'system.companion': event.target.value ? this.actor.uuid : null };
|
||||
|
||||
if (!partnerDocument.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) {
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: GMUpdateEvent.UpdateDocument,
|
||||
|
|
|
|||
|
|
@ -44,20 +44,20 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
static PARTS = {
|
||||
header: {
|
||||
id: 'header',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/environment-settings/header.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/header.hbs'
|
||||
},
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
details: {
|
||||
id: 'details',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/environment-settings/details.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/details.hbs'
|
||||
},
|
||||
actions: {
|
||||
id: 'actions',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/environment-settings/actions.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/actions.hbs'
|
||||
},
|
||||
adversaries: {
|
||||
id: 'adversaries',
|
||||
template: 'systems/daggerheart/templates/sheets/applications/environment-settings/adversaries.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/adversaries.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.actor)
|
||||
},
|
||||
{
|
||||
|
|
@ -200,7 +200,7 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = TextEditor.getDragEventData(event);
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'adversary') {
|
||||
const target = event.target.closest('.category-container');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
|||
tagifyConfigs: [
|
||||
{
|
||||
selector: '.features-input',
|
||||
options: () => CONFIG.daggerheart.ITEM.armorFeatures,
|
||||
options: () => CONFIG.DH.ITEM.armorFeatures,
|
||||
callback: ArmorSheet.#onFeatureSelect
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
|||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = TextEditor.getDragEventData(event);
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'feature') {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
tagifyConfigs: [
|
||||
{
|
||||
selector: '.domain-input',
|
||||
options: () => CONFIG.daggerheart.DOMAIN.domains,
|
||||
options: () => CONFIG.DH.DOMAIN.domains,
|
||||
callback: ClassSheet.#onDomainSelect
|
||||
}
|
||||
],
|
||||
|
|
@ -172,8 +172,8 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
//TODO: redo this
|
||||
async selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/views/actionType.hbs',
|
||||
{ types: SYSTEM.ACTIONS.actionTypes }
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type',
|
||||
type = 'form',
|
||||
|
|
@ -209,7 +209,7 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
_id: foundry.utils.randomID(),
|
||||
systemPath: actionPath,
|
||||
type: actionType.type,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType.type].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
|||
|
||||
async #selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/views/actionType.hbs',
|
||||
{ types: SYSTEM.ACTIONS.actionTypes }
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type',
|
||||
type = 'form',
|
||||
|
|
@ -87,7 +87,7 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
|||
_id: foundry.utils.randomID(),
|
||||
systemPath: `${level}.actions`,
|
||||
type: actionType.type,
|
||||
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType.type].name),
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
|||
tagifyConfigs: [
|
||||
{
|
||||
selector: '.features-input',
|
||||
options: () => CONFIG.daggerheart.ITEM.weaponFeatures,
|
||||
options: () => CONFIG.DH.ITEM.weaponFeatures,
|
||||
callback: WeaponSheet.#onFeatureSelect
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
export default class DhTooltipManager extends TooltipManager {
|
||||
async activate(element, options = {}) {
|
||||
let html = options.html;
|
||||
if (element.dataset.tooltip.startsWith('#item#')) {
|
||||
const item = await foundry.utils.fromUuid(element.dataset.tooltip.slice(6));
|
||||
if (item) {
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/tooltip/${item.type}.hbs`,
|
||||
item
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
super.activate(element, { ...options, html: html });
|
||||
}
|
||||
}
|
||||
6
module/applications/ui/_module.mjs
Normal file
6
module/applications/ui/_module.mjs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { default as DhChatLog } from './chatLog.mjs';
|
||||
import { default as DhCombatTracker } from './combatTracker.mjs';
|
||||
import * as DhCountdowns from './countdowns.mjs';
|
||||
import { default as DhFearTracker } from './fearTracker.mjs';
|
||||
|
||||
export { DhChatLog, DhCombatTracker, DhCountdowns, DhFearTracker };
|
||||
272
module/applications/ui/chatLog.mjs
Normal file
272
module/applications/ui/chatLog.mjs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
import { actionsTypes } from '../../data/_module.mjs';
|
||||
|
||||
export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLog {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.targetTemplate = {
|
||||
activeLayer: undefined,
|
||||
document: undefined,
|
||||
object: undefined,
|
||||
minimizedSheets: [],
|
||||
config: undefined,
|
||||
targets: undefined
|
||||
};
|
||||
this.setupHooks();
|
||||
}
|
||||
|
||||
addChatListeners = async (app, html, data) => {
|
||||
html.querySelectorAll('.duality-action-damage').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollDamage(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.duality-action-healing').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollHealing(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.target-save-container').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollSave(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.roll-all-save-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollAllSave(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.duality-action-effect').forEach(element =>
|
||||
element.addEventListener('click', event => this.onApplyEffect(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.target-container').forEach(element => {
|
||||
element.addEventListener('mouseenter', this.hoverTarget);
|
||||
element.addEventListener('mouseleave', this.unhoverTarget);
|
||||
element.addEventListener('click', this.clickTarget);
|
||||
});
|
||||
html.querySelectorAll('.button-target-selection').forEach(element => {
|
||||
element.addEventListener('click', event => this.onTargetSelection(event, data.message));
|
||||
});
|
||||
html.querySelectorAll('.damage-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.onDamage(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.healing-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.onHealing(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.target-indicator').forEach(element =>
|
||||
element.addEventListener('click', this.onToggleTargets)
|
||||
);
|
||||
html.querySelectorAll('.advantage').forEach(element =>
|
||||
element.addEventListener('mouseenter', this.hoverAdvantage)
|
||||
);
|
||||
html.querySelectorAll('.advantage').forEach(element =>
|
||||
element.addEventListener('click', event => this.selectAdvantage.bind(this)(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.ability-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.abilityUseButton.bind(this)(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.action-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.actionUseButton.bind(this)(event, data.message))
|
||||
);
|
||||
};
|
||||
|
||||
setupHooks() {
|
||||
Hooks.on('renderChatMessageHTML', this.addChatListeners.bind());
|
||||
}
|
||||
|
||||
close(options) {
|
||||
Hooks.off('renderChatMessageHTML', this.addChatListeners);
|
||||
super.close(options);
|
||||
}
|
||||
|
||||
async getActor(id) {
|
||||
// return game.actors.get(id);
|
||||
return await fromUuid(id);
|
||||
}
|
||||
|
||||
getAction(actor, itemId, actionId) {
|
||||
const item = actor.items.get(itemId),
|
||||
action =
|
||||
actor.system.attack?._id === actionId
|
||||
? actor.system.attack
|
||||
: item?.system?.actions?.find(a => a._id === actionId);
|
||||
return action;
|
||||
}
|
||||
|
||||
onRollDamage = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const actor = await this.getActor(message.system.source.actor);
|
||||
if (!actor || !game.user.isGM) return true;
|
||||
if (message.system.source.item && message.system.source.action) {
|
||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
if (!action || !action?.rollDamage) return;
|
||||
await action.rollDamage(event, message);
|
||||
}
|
||||
};
|
||||
|
||||
onRollHealing = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const actor = await this.getActor(message.system.source.actor);
|
||||
if (!actor || !game.user.isGM) return true;
|
||||
if (message.system.source.item && message.system.source.action) {
|
||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
if (!action || !action?.rollHealing) return;
|
||||
await action.rollHealing(event, message);
|
||||
}
|
||||
};
|
||||
|
||||
onRollSave = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const actor = await this.getActor(message.system.source.actor),
|
||||
tokenId = event.target.closest('[data-token]')?.dataset.token,
|
||||
token = game.canvas.tokens.get(tokenId);
|
||||
if (!token?.actor || !token.isOwner) return true;
|
||||
if (message.system.source.item && message.system.source.action) {
|
||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
if (!action || !action?.hasSave) return;
|
||||
action.rollSave(token, event, message);
|
||||
}
|
||||
};
|
||||
|
||||
onRollAllSave = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const targets = event.target.parentElement.querySelectorAll(
|
||||
'.target-section > [data-token] .target-save-container'
|
||||
);
|
||||
targets.forEach(el => {
|
||||
el.dispatchEvent(new PointerEvent('click', { shiftKey: true }));
|
||||
});
|
||||
};
|
||||
|
||||
onApplyEffect = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const actor = await this.getActor(message.system.source.actor);
|
||||
if (!actor || !game.user.isGM) return true;
|
||||
if (message.system.source.item && message.system.source.action) {
|
||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
if (!action || !action?.applyEffects) return;
|
||||
const { isHit, targets } = this.getTargetList(event, message);
|
||||
if (targets.length === 0)
|
||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||
await action.applyEffects(event, message, targets);
|
||||
}
|
||||
};
|
||||
|
||||
onTargetSelection = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const targetSelection = Boolean(event.target.dataset.targetHit),
|
||||
msg = ui.chat.collection.get(message._id);
|
||||
if (msg.system.targetSelection === targetSelection) return;
|
||||
if (targetSelection !== true && !Array.from(game.user.targets).length)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||
msg.system.targetSelection = targetSelection;
|
||||
msg.system.prepareDerivedData();
|
||||
ui.chat.updateMessage(msg);
|
||||
};
|
||||
|
||||
getTargetList = (event, message) => {
|
||||
const targetSelection = event.target
|
||||
.closest('.message-content')
|
||||
.querySelector('.button-target-selection.target-selected'),
|
||||
isHit = Boolean(targetSelection.dataset.targetHit);
|
||||
return {
|
||||
isHit,
|
||||
targets: isHit
|
||||
? message.system.targets.filter(t => t.hit === true).map(target => game.canvas.tokens.get(target.id))
|
||||
: Array.from(game.user.targets)
|
||||
};
|
||||
};
|
||||
|
||||
hoverTarget = event => {
|
||||
event.stopPropagation();
|
||||
const token = canvas.tokens.get(event.currentTarget.dataset.token);
|
||||
if (!token?.controlled) token._onHoverIn(event, { hoverOutOthers: true });
|
||||
};
|
||||
|
||||
unhoverTarget = event => {
|
||||
const token = canvas.tokens.get(event.currentTarget.dataset.token);
|
||||
if (!token?.controlled) token._onHoverOut(event);
|
||||
};
|
||||
|
||||
clickTarget = event => {
|
||||
event.stopPropagation();
|
||||
const token = canvas.tokens.get(event.currentTarget.dataset.token);
|
||||
if (!token) {
|
||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.AttackTargetDoesNotExist'));
|
||||
return;
|
||||
}
|
||||
|
||||
game.canvas.pan(token);
|
||||
};
|
||||
|
||||
onDamage = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const { isHit, targets } = this.getTargetList(event, message);
|
||||
|
||||
if (message.system.onSave && isHit) {
|
||||
const pendingingSaves = message.system.targets.filter(
|
||||
target => target.hit && target.saved.success === null
|
||||
);
|
||||
if (pendingingSaves.length) {
|
||||
const confirm = await foundry.applications.api.DialogV2.confirm({
|
||||
window: { title: 'Pending Reaction Rolls found' },
|
||||
content: `<p>Some Tokens still need to roll their Reaction Roll.</p><p>Are you sure you want to continue ?</p><p><i>Undone reaction rolls will be considered as failed</i></p>`
|
||||
});
|
||||
if (!confirm) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (targets.length === 0)
|
||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||
for (let target of targets) {
|
||||
let damage = message.system.roll.total;
|
||||
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true)
|
||||
damage = Math.ceil(damage * (CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1));
|
||||
|
||||
await target.actor.takeDamage(damage, message.system.roll.type);
|
||||
}
|
||||
};
|
||||
|
||||
onHealing = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
const targets = Array.from(game.user.targets);
|
||||
|
||||
if (targets.length === 0)
|
||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||
|
||||
for (var target of targets) {
|
||||
await target.actor.takeHealing([{ value: message.system.roll.total, type: message.system.roll.type }]);
|
||||
}
|
||||
};
|
||||
|
||||
onToggleTargets = async event => {
|
||||
event.stopPropagation();
|
||||
$($(event.currentTarget).parent()).find('.target-container').toggleClass('hidden');
|
||||
};
|
||||
|
||||
hoverAdvantage = event => {
|
||||
$(event.currentTarget).siblings('.advantage').toggleClass('unused');
|
||||
};
|
||||
|
||||
selectAdvantage = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
|
||||
const updateMessage = game.messages.get(message._id);
|
||||
await updateMessage.update({ system: { advantageSelected: event.currentTarget.id === 'hope' ? 1 : 2 } });
|
||||
|
||||
$(event.currentTarget).siblings('.advantage').off('click');
|
||||
$(event.currentTarget).off('click');
|
||||
};
|
||||
|
||||
abilityUseButton = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
|
||||
const action = message.system.actions[Number.parseInt(event.currentTarget.dataset.index)];
|
||||
const actor = game.actors.get(message.system.source.actor);
|
||||
await actor.useAction(action);
|
||||
};
|
||||
|
||||
actionUseButton = async (_, message) => {
|
||||
const parent = await foundry.utils.fromUuid(message.system.actor);
|
||||
const testAction = Object.values(message.system.moves)[0].actions[0];
|
||||
const cls = actionsTypes[testAction.type];
|
||||
const action = new cls(
|
||||
{ ...testAction, _id: foundry.utils.randomID(), name: game.i18n.localize(testAction.name) },
|
||||
{ parent: parent }
|
||||
);
|
||||
|
||||
action.use();
|
||||
};
|
||||
}
|
||||
109
module/applications/ui/combatTracker.mjs
Normal file
109
module/applications/ui/combatTracker.mjs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
import { EncounterCountdowns } from '../ui/countdowns.mjs';
|
||||
|
||||
export default class DhCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
||||
static DEFAULT_OPTIONS = {
|
||||
actions: {
|
||||
requestSpotlight: this.requestSpotlight,
|
||||
toggleSpotlight: this.toggleSpotlight,
|
||||
setActionTokens: this.setActionTokens,
|
||||
openCountdowns: this.openCountdowns
|
||||
}
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
header: {
|
||||
template: 'systems/daggerheart/templates/ui/combatTracker/combatTrackerHeader.hbs'
|
||||
},
|
||||
tracker: {
|
||||
template: 'systems/daggerheart/templates/ui/combatTracker/combatTracker.hbs'
|
||||
},
|
||||
footer: {
|
||||
template: 'systems/daggerheart/templates/ui/combatTracker/combatTrackerFooter.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareCombatContext(context, options) {
|
||||
await super._prepareCombatContext(context, options);
|
||||
|
||||
Object.assign(context, {
|
||||
fear: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear)
|
||||
});
|
||||
}
|
||||
|
||||
async _prepareTrackerContext(context, options) {
|
||||
await super._prepareTrackerContext(context, options);
|
||||
|
||||
const adversaries = context.turns?.filter(x => x.isNPC) ?? [];
|
||||
const characters = context.turns?.filter(x => !x.isNPC) ?? [];
|
||||
|
||||
Object.assign(context, {
|
||||
actionTokens: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).actionTokens,
|
||||
adversaries,
|
||||
characters
|
||||
});
|
||||
}
|
||||
|
||||
async _prepareTurnContext(combat, combatant, index) {
|
||||
const turn = await super._prepareTurnContext(combat, combatant, index);
|
||||
return { ...turn, isNPC: combatant.isNPC, system: combatant.system.toObject() };
|
||||
}
|
||||
|
||||
_getCombatContextOptions() {
|
||||
return [
|
||||
{
|
||||
name: 'COMBAT.ClearMovementHistories',
|
||||
icon: '<i class="fa-solid fa-shoe-prints"></i>',
|
||||
condition: () => game.user.isGM && this.viewed?.combatants.size > 0,
|
||||
callback: () => this.viewed.clearMovementHistories()
|
||||
},
|
||||
{
|
||||
name: 'COMBAT.Delete',
|
||||
icon: '<i class="fa-solid fa-trash"></i>',
|
||||
condition: () => game.user.isGM && !!this.viewed,
|
||||
callback: () => this.viewed.endCombat()
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
static async requestSpotlight(_, target) {
|
||||
const { combatantId } = target.closest('[data-combatant-id]')?.dataset ?? {};
|
||||
const combatant = this.viewed.combatants.get(combatantId);
|
||||
await combatant.update({
|
||||
'system.spotlight': {
|
||||
requesting: !combatant.system.spotlight.requesting
|
||||
}
|
||||
});
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async toggleSpotlight(_, target) {
|
||||
const { combatantId } = target.closest('[data-combatant-id]')?.dataset ?? {};
|
||||
const combatant = this.viewed.combatants.get(combatantId);
|
||||
|
||||
const toggleTurn = this.viewed.combatants.contents
|
||||
.sort(this.viewed._sortCombatants)
|
||||
.map(x => x.id)
|
||||
.indexOf(combatantId);
|
||||
|
||||
if (this.viewed.turn !== toggleTurn) Hooks.callAll(CONFIG.DH.HOOKS.spotlight, {});
|
||||
|
||||
await this.viewed.update({ turn: this.viewed.turn === toggleTurn ? null : toggleTurn });
|
||||
await combatant.update({ 'system.spotlight.requesting': false });
|
||||
}
|
||||
|
||||
static async setActionTokens(_, target) {
|
||||
const { combatantId, tokenIndex } = target.closest('[data-combatant-id]')?.dataset ?? {};
|
||||
|
||||
const combatant = this.viewed.combatants.get(combatantId);
|
||||
const changeIndex = Number(tokenIndex);
|
||||
const newIndex = combatant.system.actionTokens > changeIndex ? changeIndex : changeIndex + 1;
|
||||
|
||||
await combatant.update({ 'system.actionTokens': newIndex });
|
||||
this.render();
|
||||
}
|
||||
|
||||
static openCountdowns() {
|
||||
new EncounterCountdowns().open();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { countdownTypes } from '../config/generalConfig.mjs';
|
||||
import { GMUpdateEvent, RefreshType, socketEvent } from '../helpers/socket.mjs';
|
||||
import constructHTMLButton from '../helpers/utils.mjs';
|
||||
import OwnershipSelection from './ownershipSelection.mjs';
|
||||
import { GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
|
||||
import constructHTMLButton from '../../helpers/utils.mjs';
|
||||
import OwnershipSelection from '../dialogs/ownershipSelection.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
static PARTS = {
|
||||
countdowns: {
|
||||
template: 'systems/daggerheart/templates/views/countdowns.hbs',
|
||||
template: 'systems/daggerheart/templates/ui/countdowns.hbs',
|
||||
scrollable: ['.expanded-view']
|
||||
}
|
||||
};
|
||||
|
|
@ -57,18 +57,18 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
async _preFirstRender(context, options) {
|
||||
options.position =
|
||||
game.user.getFlag(SYSTEM.id, SYSTEM.FLAGS[`${this.basePath}Countdown`].position) ??
|
||||
game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.basePath}Countdown`].position) ??
|
||||
Countdowns.DEFAULT_OPTIONS.position;
|
||||
|
||||
const viewSetting =
|
||||
game.user.getFlag(SYSTEM.id, SYSTEM.FLAGS[`${this.basePath}Countdown`].simple) ?? !game.user.isGM;
|
||||
game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.basePath}Countdown`].simple) ?? !game.user.isGM;
|
||||
this.simpleView =
|
||||
game.user.isGM || !this.testUserPermission(CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER) ? viewSetting : true;
|
||||
context.simple = this.simpleView;
|
||||
}
|
||||
|
||||
_onPosition(position) {
|
||||
game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS[`${this.basePath}Countdown`].position, position);
|
||||
game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.basePath}Countdown`].position, position);
|
||||
}
|
||||
|
||||
async _renderFrame(options) {
|
||||
|
|
@ -90,7 +90,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
if (game.user.isGM) return true;
|
||||
|
||||
const settings =
|
||||
altSettings ?? game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
altSettings ?? game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const defaultAllowed = exact ? settings.ownership.default === level : settings.ownership.default >= level;
|
||||
const userAllowed = exact
|
||||
? settings.playerOwnership[game.user.id]?.value === level
|
||||
|
|
@ -100,7 +100,9 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
const countdownData = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const countdownData = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[
|
||||
this.basePath
|
||||
];
|
||||
|
||||
context.isGM = game.user.isGM;
|
||||
context.base = this.basePath;
|
||||
|
|
@ -131,19 +133,19 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
static async updateData(event, _, formData) {
|
||||
const data = foundry.utils.expandObject(formData.object);
|
||||
const newSetting = foundry.utils.mergeObject(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns).toObject(),
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns).toObject(),
|
||||
data
|
||||
);
|
||||
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, newSetting);
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, newSetting);
|
||||
this.render();
|
||||
} else {
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: GMUpdateEvent.UpdateSetting,
|
||||
uuid: SYSTEM.SETTINGS.gameSettings.Countdowns,
|
||||
uuid: CONFIG.DH.SETTINGS.gameSettings.Countdowns,
|
||||
update: newSetting
|
||||
}
|
||||
});
|
||||
|
|
@ -152,8 +154,8 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
async updateSetting(update) {
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, update);
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, update);
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.Refresh,
|
||||
data: {
|
||||
refreshType: RefreshType.Countdown,
|
||||
|
|
@ -163,11 +165,11 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
this.render();
|
||||
} else {
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: GMUpdateEvent.UpdateSetting,
|
||||
uuid: SYSTEM.SETTINGS.gameSettings.Countdowns,
|
||||
uuid: CONFIG.DH.SETTINGS.gameSettings.Countdowns,
|
||||
update: update,
|
||||
refresh: { refreshType: RefreshType.Countdown, application: `${this.basePath}-countdowns` }
|
||||
}
|
||||
|
|
@ -176,7 +178,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
static onEditImage(_, target) {
|
||||
const setting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const current = setting.countdowns[target.dataset.countdown].img;
|
||||
const fp = new foundry.applications.apps.FilePicker.implementation({
|
||||
current,
|
||||
|
|
@ -189,7 +191,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
async updateImage(path, countdown) {
|
||||
const setting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
await setting.updateSource({
|
||||
[`${this.basePath}.countdowns.${countdown}.img`]: path
|
||||
});
|
||||
|
|
@ -199,16 +201,16 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
static openOwnership(_, target) {
|
||||
new Promise((resolve, reject) => {
|
||||
const setting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[this.basePath];
|
||||
const ownership = { default: setting.ownership.default, players: setting.playerOwnership };
|
||||
new OwnershipSelection(resolve, reject, this.title, ownership).render(true);
|
||||
}).then(async ownership => {
|
||||
const setting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
await setting.updateSource({
|
||||
[`${this.basePath}.ownership`]: ownership
|
||||
});
|
||||
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, setting.toObject());
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, setting.toObject());
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
|
|
@ -216,29 +218,29 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
static openCountdownOwnership(_, target) {
|
||||
const countdownId = target.dataset.countdown;
|
||||
new Promise((resolve, reject) => {
|
||||
const countdown = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath]
|
||||
const countdown = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[this.basePath]
|
||||
.countdowns[countdownId];
|
||||
const ownership = { default: countdown.ownership.default, players: countdown.playerOwnership };
|
||||
new OwnershipSelection(resolve, reject, countdown.name, ownership).render(true);
|
||||
}).then(async ownership => {
|
||||
const setting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
await setting.updateSource({
|
||||
[`${this.basePath}.countdowns.${countdownId}.ownership`]: ownership
|
||||
});
|
||||
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, setting);
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, setting);
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
|
||||
static async toggleSimpleView() {
|
||||
this.simpleView = !this.simpleView;
|
||||
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS[`${this.basePath}Countdown`].simple, this.simpleView);
|
||||
await game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.basePath}Countdown`].simple, this.simpleView);
|
||||
this.render();
|
||||
}
|
||||
|
||||
async updateCountdownValue(event, increase) {
|
||||
const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const countdownSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
const countdown = countdownSetting[this.basePath].countdowns[event.currentTarget.dataset.countdown];
|
||||
|
||||
if (!this.testUserPermission(CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) {
|
||||
|
|
@ -260,7 +262,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
static async addCountdown() {
|
||||
const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const countdownSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
await countdownSetting.updateSource({
|
||||
[`${this.basePath}.countdowns.${foundry.utils.randomID()}`]: {
|
||||
name: game.i18n.localize('DAGGERHEART.Countdown.NewCountdown'),
|
||||
|
|
@ -278,7 +280,7 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
static async removeCountdown(_, target) {
|
||||
const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
const countdownSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
const countdownName = countdownSetting[this.basePath].countdowns[target.dataset.countdown].name;
|
||||
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
|
|
@ -297,8 +299,9 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
async open() {
|
||||
await this.render(true);
|
||||
if (
|
||||
Object.keys(game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns)[this.basePath].countdowns)
|
||||
.length > 0
|
||||
Object.keys(
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns)[this.basePath].countdowns
|
||||
).length > 0
|
||||
) {
|
||||
this.minimize();
|
||||
}
|
||||
|
|
@ -327,8 +330,8 @@ export class EncounterCountdowns extends Countdowns {
|
|||
|
||||
export const registerCountdownApplicationHooks = () => {
|
||||
const updateCountdowns = async shouldProgress => {
|
||||
if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation).countdowns) {
|
||||
const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
|
||||
if (game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).countdowns) {
|
||||
const countdownSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||
for (let countdownCategoryKey in countdownSetting) {
|
||||
const countdownCategory = countdownSetting[countdownCategoryKey];
|
||||
for (let countdownKey in countdownCategory.countdowns) {
|
||||
|
|
@ -339,7 +342,11 @@ export const registerCountdownApplicationHooks = () => {
|
|||
[`${countdownCategoryKey}.countdowns.${countdownKey}.progress.current`]:
|
||||
countdown.progress.current - 1
|
||||
});
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, countdownSetting);
|
||||
await game.settings.set(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.Countdowns,
|
||||
countdownSetting
|
||||
);
|
||||
foundry.applications.instances.get(`${countdownCategoryKey}-countdowns`)?.render();
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +354,7 @@ export const registerCountdownApplicationHooks = () => {
|
|||
}
|
||||
};
|
||||
|
||||
Hooks.on(SYSTEM.HOOKS.characterAttack, async () => {
|
||||
Hooks.on(CONFIG.DH.HOOKS.characterAttack, async () => {
|
||||
updateCountdowns(countdown => {
|
||||
return (
|
||||
countdown.progress.type.value === countdownTypes.characterAttack.id && countdown.progress.current > 0
|
||||
|
|
@ -355,7 +362,7 @@ export const registerCountdownApplicationHooks = () => {
|
|||
});
|
||||
});
|
||||
|
||||
Hooks.on(SYSTEM.HOOKS.spotlight, async () => {
|
||||
Hooks.on(CONFIG.DH.HOOKS.spotlight, async () => {
|
||||
updateCountdowns(countdown => {
|
||||
return countdown.progress.type.value === countdownTypes.spotlight.id && countdown.progress.current > 0;
|
||||
});
|
||||
|
|
@ -8,7 +8,7 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
|||
* @mixes HandlebarsApplication
|
||||
*/
|
||||
|
||||
export default class Resources extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
}
|
||||
|
|
@ -26,8 +26,8 @@ export default class Resources extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
minimizable: false
|
||||
},
|
||||
actions: {
|
||||
setFear: Resources.setFear,
|
||||
increaseFear: Resources.increaseFear
|
||||
setFear: FearTracker.setFear,
|
||||
increaseFear: FearTracker.increaseFear
|
||||
},
|
||||
position: {
|
||||
width: 222,
|
||||
|
|
@ -41,16 +41,16 @@ export default class Resources extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
static PARTS = {
|
||||
resources: {
|
||||
root: true,
|
||||
template: 'systems/daggerheart/templates/views/resources.hbs'
|
||||
template: 'systems/daggerheart/templates/ui/fearTracker.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
get currentFear() {
|
||||
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
||||
return game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear);
|
||||
}
|
||||
|
||||
get maxFear() {
|
||||
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Homebrew).maxFear;
|
||||
return game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxFear;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -59,7 +59,7 @@ export default class Resources extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
/** @override */
|
||||
async _prepareContext(_options) {
|
||||
const display = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).displayFear,
|
||||
const display = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).displayFear,
|
||||
current = this.currentFear,
|
||||
max = this.maxFear,
|
||||
percent = (current / max) * 100,
|
||||
|
|
@ -70,17 +70,18 @@ export default class Resources extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
/** @override */
|
||||
async _preFirstRender(context, options) {
|
||||
options.position = game.user.getFlag(SYSTEM.id, 'app.resources.position') ?? Resources.DEFAULT_OPTIONS.position;
|
||||
options.position =
|
||||
game.user.getFlag(CONFIG.DH.id, 'app.resources.position') ?? FearTracker.DEFAULT_OPTIONS.position;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _preRender(context, options) {
|
||||
if (this.currentFear > this.maxFear)
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, this.maxFear);
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, this.maxFear);
|
||||
}
|
||||
|
||||
_onPosition(position) {
|
||||
game.user.setFlag(SYSTEM.id, 'app.resources.position', position);
|
||||
game.user.setFlag(CONFIG.DH.id, 'app.resources.position', position);
|
||||
}
|
||||
|
||||
async close(options = {}) {
|
||||
|
|
@ -104,6 +105,6 @@ export default class Resources extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
async updateFear(value) {
|
||||
if (!game.user.isGM) return;
|
||||
value = Math.max(0, Math.min(this.maxFear, value));
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, value);
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,8 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
const mergedOptions = {
|
||||
eventName: 'click',
|
||||
fixed: true,
|
||||
...options
|
||||
...options,
|
||||
jQuery: false
|
||||
};
|
||||
|
||||
super(container, selector, menuItems, mergedOptions);
|
||||
|
|
@ -176,7 +177,7 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
}
|
||||
}));
|
||||
|
||||
const burdenFilter = Object.values(CONFIG.daggerheart.GENERAL.burden).map(({ value, label }) => ({
|
||||
const burdenFilter = Object.values(CONFIG.DH.GENERAL.burden).map(({ value, label }) => ({
|
||||
group: game.i18n.localize('DAGGERHEART.Sheets.Weapon.Burden'),
|
||||
name: game.i18n.localize(label),
|
||||
filter: {
|
||||
|
|
@ -186,7 +187,7 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
}
|
||||
}));
|
||||
|
||||
const damageTypeFilter = Object.values(CONFIG.daggerheart.GENERAL.damageTypes).map(({ id, abbreviation }) => ({
|
||||
const damageTypeFilter = Object.values(CONFIG.DH.GENERAL.damageTypes).map(({ id, abbreviation }) => ({
|
||||
group: 'Damage Type', //TODO localize
|
||||
name: game.i18n.localize(abbreviation),
|
||||
filter: {
|
||||
|
|
@ -210,7 +211,7 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
static get cardsFilters() {
|
||||
const { OPERATORS } = foundry.applications.ux.SearchFilter;
|
||||
|
||||
const typesFilters = Object.values(CONFIG.daggerheart.DOMAIN.cardTypes).map(({ id, label }) => ({
|
||||
const typesFilters = Object.values(CONFIG.DH.DOMAIN.cardTypes).map(({ id, label }) => ({
|
||||
group: game.i18n.localize('Type'),
|
||||
name: game.i18n.localize(label),
|
||||
filter: {
|
||||
|
|
@ -220,7 +221,7 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
}
|
||||
}));
|
||||
|
||||
const domainFilter = Object.values(CONFIG.daggerheart.DOMAIN.domains).map(({ id, label }) => ({
|
||||
const domainFilter = Object.values(CONFIG.DH.DOMAIN.domains).map(({ id, label }) => ({
|
||||
group: game.i18n.localize('DAGGERHEART.Sheets.DomainCard.Domain'),
|
||||
name: game.i18n.localize(label),
|
||||
filter: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue