diff --git a/eslint.config.js b/eslint.config.js index 9a2da83c..1f584aea 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -33,8 +33,6 @@ const foundryGlobals = { renderTemplate: false, TokenDocument: false, Roll: false, - PoolTerm: false, - DiceTerm: false, TextEditor: false, CONST: false, getProperty: false, diff --git a/src/dice/check.js b/src/dice/check.js index 93e0766f..38bd9383 100644 --- a/src/dice/check.js +++ b/src/dice/check.js @@ -15,7 +15,7 @@ import { evaluateCheck, getRequiredNumberOfDice } from "./check-evaluation"; * - Roll a check with a racial ability that makes `2` a coup and `19` a fumble: `/r dsv19c2:19` * - Roll a check with a racial ability that makes `5` a coup and default fumble: `/r dsv19c5` */ -export class DS4Check extends DiceTerm { +export class DS4Check extends foundry.dice.terms.DiceTerm { constructor({ modifiers = [], results = [], options } = {}) { super({ faces: 20, @@ -86,8 +86,15 @@ export class DS4Check extends DiceTerm { } /** @override */ - _evaluateSync({ minimize = false, maximize = false } = {}) { - super._evaluateSync({ minimize, maximize }); + _evaluateSync(options = {}) { + super._evaluateSync(options); + this.evaluateResults(); + return this; + } + + /** @override */ + async _evaluateAsync(options = {}) { + await super._evaluateAsync(options); this.evaluateResults(); return this; } diff --git a/src/dice/slaying-dice-modifier.js b/src/dice/slaying-dice-modifier.js index bc0e2cd7..5f50aec0 100644 --- a/src/dice/slaying-dice-modifier.js +++ b/src/dice/slaying-dice-modifier.js @@ -7,14 +7,14 @@ import { getGame } from "../utils/utils"; import { DS4Check } from "./check"; export function registerSlayingDiceModifier() { - PoolTerm.MODIFIERS.x = slay; + foundry.dice.terms.PoolTerm.MODIFIERS.x = slay; } /** * @this {PoolTerm} * @param {string} modifier */ -function slay(modifier) { +async function slay(modifier) { const rgx = /[xX]/; const match = modifier.match(rgx); if (!match || !this.rolls) return; @@ -25,7 +25,7 @@ function slay(modifier) { checked++; if (diceTerm instanceof DS4Check && diceTerm.coup) { const formula = `dsv${diceTerm.checkTargetNumber}c${diceTerm.maximumCoupResult}:${diceTerm.minimumFumbleResult}n`; - const additionalRoll = Roll.create(formula).evaluate({ async: false }); + const additionalRoll = await Roll.create(formula).evaluate(); this.rolls.push(additionalRoll); this.results.push({ result: additionalRoll.total ?? 0, active: true }); diff --git a/system.json b/system.json index 85054fef..0e67ae56 100644 --- a/system.json +++ b/system.json @@ -40,8 +40,8 @@ } }, "compatibility": { - "minimum": "11.305", - "verified": "11" + "minimum": "12.331", + "verified": "12" }, "esmodules": ["ds4.js"], "styles": ["css/ds4.css"], @@ -118,9 +118,10 @@ "manifest": "https://git.f3l.de/api/packages/dungeonslayers/generic/ds4/latest/system.json", "download": "https://git.f3l.de/dungeonslayers/ds4/releases/download/1.21.1/ds4.zip", "initiative": "@combatValues.initiative.total", - "gridDistance": 1, - "gridUnits": "m", + "grid": { + "distance": 1, + "units": "m" + }, "primaryTokenAttribute": "combatValues.hitPoints", - "manifestPlusVersion": "1.2.0", "url": "https://git.f3l.de/dungeonslayers/ds4" } diff --git a/templates/dialogs/roll-options.hbs b/templates/dialogs/roll-options.hbs index 426fcba4..406a512e 100644 --- a/templates/dialogs/roll-options.hbs +++ b/templates/dialogs/roll-options.hbs @@ -25,11 +25,7 @@ SPDX-License-Identifier: MIT <label for="check-modifier-{{id}}">{{localize "DS4.DialogRollOptionsCheckModifierLabel"}}</label> <div class="form-fields"> <select id="check-modifier-{{id}}" name="check-modifier" data-dtype="String"> - {{#select "custom"}} - {{#each checkModifiers as |checkModifier|}} - <option value="{{checkModifier.value}}">{{checkModifier.label}}</option> - {{/each}} - {{/select}} + {{selectOptions checkModifiers selected="custom"}} </select> </div> </div> @@ -52,11 +48,7 @@ SPDX-License-Identifier: MIT <label for="roll-mode-{{id}}">{{localize "DS4.DialogRollOptionsRollModeLabel"}}</label> <div class="form-fields"> <select id="roll-mode-{{id}}" name="roll-mode" data-dtype="String"> - {{#select rollMode}} - {{#each rollModes as |rollModeValue rollModeKey|}} - <option value="{{rollModeKey}}">{{localize rollModeValue}}</option> - {{/each}} - {{/select}} + {{selectOptions rollModes selected=rollMode localize=true}} </select> </div> </div> diff --git a/templates/sheets/active-effect/active-effect-config.hbs b/templates/sheets/active-effect/active-effect-config.hbs index 2d42a394..5a52247a 100644 --- a/templates/sheets/active-effect/active-effect-config.hbs +++ b/templates/sheets/active-effect/active-effect-config.hbs @@ -8,14 +8,14 @@ SPDX-License-Identifier: MIT <!-- Effect Header --> <header class="sheet-header"> - <img class="effect-icon" src="{{ data.icon }}" data-edit="icon"> + <img class="effect-img" src="{{ data.img }}" data-edit="img"> <h1 class="effect-title"> <input name="name" type="text" value="{{data.name}}" placeholder="{{ localize 'Name' }}" /> </h1> </header> <!-- Effect Configuration Tabs --> - <nav class="sheet-tabs tabs"> + <nav class="sheet-tabs tabs" aria-role="{{localize 'SHEETS.FormNavLabel'}}"> <a class="item" data-tab="details"><i class="fas fa-book"></i> {{localize "EFFECT.TabDetails"}}</a> <a class="item" data-tab="duration"><i class="fas fa-clock"></i> {{localize "EFFECT.TabDuration"}}</a> <a class="item" data-tab="effects"><i class="fas fa-cogs"></i> {{localize "EFFECT.TabEffects"}}</a> @@ -24,9 +24,9 @@ SPDX-License-Identifier: MIT <!-- Details Tab --> <section class="tab" data-tab="details"> <div class="form-group"> - <label>{{ localize "EFFECT.IconTint" }}</label> + <label>{{ localize "EFFECT.Tint" }}</label> <div class="form-fields"> - {{colorPicker name="tint" value=data.tint}} + <color-picker name="tint" value="{{data.tint}}" placeholder="#ffffff"></color-picker> </div> </div> @@ -38,9 +38,7 @@ SPDX-License-Identifier: MIT <div class="form-group"> <label>{{ localize "EFFECT.Disabled" }}</label> - <div class="form-fields"> - <input type="checkbox" name="disabled" {{ checked data.disabled }} /> - </div> + <input type="checkbox" name="disabled" {{ checked data.disabled }}/> </div> {{#if isActorEffect}} @@ -62,6 +60,17 @@ SPDX-License-Identifier: MIT </div> {{/if}} + <div class="form-group"> + <label>Status Conditions</label> + <div class="form-fields"> + <multi-select name="statuses"> + {{#each statuses as |status|}} + <option value="{{status.id}}" {{status.selected}}>{{status.label}}</option> + {{/each}} + </multi-select> + </div> + </div> + <div class="form-group"> <label>{{ localize "DS4.ActiveEffectApplyToItems" }}</label> <div class="form-fields"> diff --git a/templates/sheets/actor/components/creature-properties.hbs b/templates/sheets/actor/components/creature-properties.hbs index 303b7197..25d20a54 100644 --- a/templates/sheets/actor/components/creature-properties.hbs +++ b/templates/sheets/actor/components/creature-properties.hbs @@ -12,11 +12,7 @@ SPDX-License-Identifier: MIT for="system.baseInfo.creatureType-{{data._id}}">{{config.i18n.creatureBaseInfo.creatureType}}</label> <select class="ds4-actor-properties__property-select" id="system.baseInfo.creatureType-{{data._id}}" name="system.baseInfo.creatureType" data-dtype="String"> - {{#select data.system.baseInfo.creatureType}} - {{#each config.i18n.creatureTypes as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.creatureTypes selected=data.system.baseInfo.creatureType}} </select> </div> <div class="ds4-actor-properties__property"> @@ -36,11 +32,7 @@ SPDX-License-Identifier: MIT for="system.baseInfo.sizeCategory-{{data._id}}">{{config.i18n.creatureBaseInfo.sizeCategory}}</label> <select class="ds4-actor-properties__property-select" id="system.baseInfo.sizeCategory-{{data._id}}" name="system.baseInfo.sizeCategory" data-dtype="String"> - {{#select data.system.baseInfo.sizeCategory}} - {{#each config.i18n.creatureSizeCategories as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.creatureSizeCategories selected=data.system.baseInfo.sizeCategory}} </select> </div> <div class="ds4-actor-properties__property"> diff --git a/templates/sheets/actor/components/effect-list-entry.hbs b/templates/sheets/actor/components/effect-list-entry.hbs index 42f67f26..9fd21553 100644 --- a/templates/sheets/actor/components/effect-list-entry.hbs +++ b/templates/sheets/actor/components/effect-list-entry.hbs @@ -18,8 +18,8 @@ SPDX-License-Identifier: MIT {{!-- active --}} {{#if effectData.active}}<i class="fas fa-check"></i>{{else}}<i class="fas fa-ban"></i>{{/if}} - {{!-- icon --}} - {{> systems/ds4/templates/sheets/shared/components/rollable-image.hbs rollable=false src=effectData.icon + {{!-- img --}} + {{> systems/ds4/templates/sheets/shared/components/rollable-image.hbs rollable=false src=effectData.img alt=(localize "DS4.DocumentImageAltText" name=effectData.label) title=effectData.label}} {{!-- name --}} diff --git a/templates/sheets/item/components/effect-list-entry.hbs b/templates/sheets/item/components/effect-list-entry.hbs index a6b93da2..47c452ce 100644 --- a/templates/sheets/item/components/effect-list-entry.hbs +++ b/templates/sheets/item/components/effect-list-entry.hbs @@ -9,8 +9,8 @@ SPDX-License-Identifier: MIT !-- @param effectData: The data of the item. --}} <li class="ds4-embedded-document-list__row effect" data-effect-id="{{effectData._id}}"> - {{!-- icon --}} - {{> systems/ds4/templates/sheets/shared/components/rollable-image.hbs rollable=false src=effectData.icon + {{!-- img --}} + {{> systems/ds4/templates/sheets/shared/components/rollable-image.hbs rollable=false src=effectData.img alt=(localize "DS4.DocumentImageAltText" name=effectData.name) title=effectData.name}} {{!-- name --}} diff --git a/templates/sheets/item/components/properties/armor.hbs b/templates/sheets/item/components/properties/armor.hbs index 5dd7e9f6..458bd65b 100644 --- a/templates/sheets/item/components/properties/armor.hbs +++ b/templates/sheets/item/components/properties/armor.hbs @@ -10,11 +10,7 @@ SPDX-License-Identifier: MIT <label for="system.armorType-{{data._id}}">{{localize "DS4.ArmorType"}}</label> <div class="form-fields"> <select id="system.armorType-{{data._id}}" name="system.armorType" data-dtype="String"> - {{#select data.system.armorType}} - {{#each config.i18n.armorTypes as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.armorTypes selected=data.system.armorType}} </select> </div> </div> @@ -22,11 +18,7 @@ SPDX-License-Identifier: MIT <label for="system.armorMaterialType-{{data._id}}">{{localize "DS4.ArmorMaterialType"}}</label> <div class="form-fields"> <select id="system.armorMaterialType-{{data._id}}" name="system.armorMaterialType" data-dtype="String"> - {{#select data.system.armorMaterialType}} - {{#each config.i18n.armorMaterialTypes as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.armorMaterialTypes selected=data.system.armorMaterialType}} </select> </div> </div> diff --git a/templates/sheets/item/components/properties/physical.hbs b/templates/sheets/item/components/properties/physical.hbs index ef330748..bd15ac0e 100644 --- a/templates/sheets/item/components/properties/physical.hbs +++ b/templates/sheets/item/components/properties/physical.hbs @@ -15,11 +15,7 @@ SPDX-License-Identifier: MIT <label for="system.availability-{{data._id}}">{{localize "DS4.ItemAvailability"}}</label> <div class="form-fields"> <select id="system.availability-{{data._id}}" name="system.availability" data-dtype="String"> - {{#select data.system.availability}} - {{#each config.i18n.itemAvailabilities as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.itemAvailabilities selected=data.system.availability}} </select> </div> </div> diff --git a/templates/sheets/item/components/properties/spell.hbs b/templates/sheets/item/components/properties/spell.hbs index 38870700..2d1069b8 100644 --- a/templates/sheets/item/components/properties/spell.hbs +++ b/templates/sheets/item/components/properties/spell.hbs @@ -29,11 +29,7 @@ SPDX-License-Identifier: MIT "DS4.SpellType"}}</label> <div class="form-fields"> <select id="system.spellType-{{data._id}}" name="system.spellType" data-dtype="String"> - {{#select data.system.spellType}} - {{#each config.i18n.spellTypes as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.spellTypes selected=data.system.spellType}} </select> </div> </div> @@ -43,11 +39,7 @@ SPDX-License-Identifier: MIT <input data-dtype="String" type="text" name="system.maxDistance.value" value="{{data.system.maxDistance.value}}" /> <select name="system.maxDistance.unit" data-dtype="String"> - {{#select data.system.maxDistance.unit}} - {{#each config.i18n.distanceUnits as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.distanceUnits selected=data.system.maxDistance.unit}} </select> </div> </div> @@ -57,11 +49,7 @@ SPDX-License-Identifier: MIT <input data-dtype="String" type="text" name="system.effectRadius.value" value="{{data.system.effectRadius.value}}" /> <select name="system.effectRadius.unit" data-dtype="String"> - {{#select data.system.effectRadius.unit}} - {{#each config.i18n.distanceUnits as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.distanceUnits selected=data.system.effectRadius.unit}} </select> </div> </div> @@ -70,11 +58,7 @@ SPDX-License-Identifier: MIT <div class="form-fields"> <input data-dtype="String" type="text" name="system.duration.value" value="{{data.system.duration.value}}" /> <select name="system.duration.unit" data-dtype="String"> - {{#select data.system.duration.unit}} - {{#each config.i18n.temporalUnits as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.temporalUnits selected=data.system.duration.unit}} </select> </div> </div> @@ -83,11 +67,7 @@ SPDX-License-Identifier: MIT title="{{localize 'DS4.CooldownDurationDescription'}}">{{localize "DS4.CooldownDuration"}}</label> <div class="form-fields"> <select id="system.cooldownDuration-{{data._id}}" name="system.cooldownDuration" data-dtype="String"> - {{#select data.system.cooldownDuration}} - {{#each config.i18n.cooldownDurations as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.cooldownDurations selected=data.system.cooldownDuration}} </select> </div> </div> diff --git a/templates/sheets/item/components/properties/weapon.hbs b/templates/sheets/item/components/properties/weapon.hbs index c3173183..703a0c25 100644 --- a/templates/sheets/item/components/properties/weapon.hbs +++ b/templates/sheets/item/components/properties/weapon.hbs @@ -10,11 +10,7 @@ SPDX-License-Identifier: MIT <label for="system.attackType-{{data._id}}">{{localize "DS4.AttackType"}}</label> <div class="form-fields"> <select id="system.attackType-{{data._id}}" name="system.attackType" data-dtype="String"> - {{#select data.system.attackType}} - {{#each config.i18n.attackTypes as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} + {{selectOptions config.i18n.attackTypes selected=data.system.attackType}} </select> </div> </div>