diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 6dd57ec8..72857cee 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -109,7 +109,9 @@ export class DS4ActorSheet extends ActorSheet> { html.find(".item-change").on("change", this._onItemChange.bind(this)); - html.find(".rollable-item").on("click", this._onRoll.bind(this)); + html.find(".rollable-item").on("click", this._onRollItem.bind(this)); + + html.find(".rollable-check").on("click", this._onRollCheck.bind(this)); } /** @@ -218,16 +220,26 @@ export class DS4ActorSheet extends ActorSheet> { } /** - * Handle clickable rolls. + * Handle clickable item rolls. * @param event - The originating click event */ - protected _onRoll(event: JQuery.ClickEvent): void { + protected _onRollItem(event: JQuery.ClickEvent): void { event.preventDefault(); const id = $(event.currentTarget).parents(".item").data("itemId"); const item = this.actor.getOwnedItem(id); item.roll(); } + /** + * Handle clickable check rolls. + * @param event - The originating click event + */ + protected _onRollCheck(event: JQuery.ClickEvent): void { + event.preventDefault(); + const check = event.currentTarget.dataset["check"]; + this.actor.rollCheck(check); + } + /** @override */ protected async _onDropItem( event: DragEvent, diff --git a/src/module/handlebars/handlebars-partials.ts b/src/module/handlebars/handlebars-partials.ts index e4ad0e9d..64a5f5a8 100644 --- a/src/module/handlebars/handlebars-partials.ts +++ b/src/module/handlebars/handlebars-partials.ts @@ -1,6 +1,8 @@ export default async function registerHandlebarsPartials(): Promise { const templatePaths = [ "systems/ds4/templates/sheets/actor/components/character-progression.hbs", + "systems/ds4/templates/sheets/actor/components/check.hbs", + "systems/ds4/templates/sheets/actor/components/checks.hbs", "systems/ds4/templates/sheets/actor/components/combat-value.hbs", "systems/ds4/templates/sheets/actor/components/combat-values.hbs", "systems/ds4/templates/sheets/actor/components/core-value.hbs", diff --git a/src/scss/components/_check.scss b/src/scss/components/_check.scss new file mode 100644 index 00000000..373ab1f9 --- /dev/null +++ b/src/scss/components/_check.scss @@ -0,0 +1,3 @@ +.ds4-check { + cursor: pointer; +} diff --git a/src/scss/components/_checks.scss b/src/scss/components/_checks.scss new file mode 100644 index 00000000..5f88d0b8 --- /dev/null +++ b/src/scss/components/_checks.scss @@ -0,0 +1,6 @@ +.ds4-checks { + display: grid; + column-gap: 0.5em; + grid-template-columns: repeat(auto-fit, minmax(10em, 1fr)); + white-space: nowrap; +} diff --git a/src/scss/ds4.scss b/src/scss/ds4.scss index 6ede0479..69f44dae 100644 --- a/src/scss/ds4.scss +++ b/src/scss/ds4.scss @@ -6,24 +6,27 @@ @include meta.load-css("global/fonts"); @include meta.load-css("global/grid"); @include meta.load-css("global/window"); + @include meta.load-css("components/actor_sheet"); @include meta.load-css("components/dice_total"); /* Styles limited to ds4 sheets */ .ds4 { - @include meta.load-css("components/core_values"); - @include meta.load-css("components/core_value"); @include meta.load-css("components/apps"); @include meta.load-css("components/basic_property"); @include meta.load-css("components/character_progression"); @include meta.load-css("components/character_values"); - @include meta.load-css("components/combat_values"); + @include meta.load-css("components/check"); + @include meta.load-css("components/checks"); @include meta.load-css("components/combat_value"); + @include meta.load-css("components/combat_values"); + @include meta.load-css("components/core_value"); + @include meta.load-css("components/core_values"); + @include meta.load-css("components/currency"); @include meta.load-css("components/description"); @include meta.load-css("components/forms"); @include meta.load-css("components/item_list"); + @include meta.load-css("components/rollable_image"); @include meta.load-css("components/tabs"); @include meta.load-css("components/talent_rank_equation"); - @include meta.load-css("components/currency"); - @include meta.load-css("components/rollable_image"); } diff --git a/src/templates/sheets/actor/components/check.hbs b/src/templates/sheets/actor/components/check.hbs new file mode 100644 index 00000000..731d5d52 --- /dev/null +++ b/src/templates/sheets/actor/components/check.hbs @@ -0,0 +1,11 @@ +{{!-- +!-- Render a check. +!-- +!-- @param check-key: The key of the combat value +!-- @param check-target-number: The check target number +!-- @param check-label: The label for the check +--}} + +
+ {{check-label}}: {{check-target-number}} +
diff --git a/src/templates/sheets/actor/components/checks.hbs b/src/templates/sheets/actor/components/checks.hbs new file mode 100644 index 00000000..e10f6712 --- /dev/null +++ b/src/templates/sheets/actor/components/checks.hbs @@ -0,0 +1,6 @@ +
+ {{#each config.i18n.checks as |check-label check-key|}} + {{> systems/ds4/templates/sheets/actor/components/check.hbs check-key=check-key check-target-number=(lookup + ../data.checks check-key) check-label=check-label}} + {{/each}} +
diff --git a/src/templates/sheets/actor/components/combat-value.hbs b/src/templates/sheets/actor/components/combat-value.hbs index 30b7dac8..b2368d87 100644 --- a/src/templates/sheets/actor/components/combat-value.hbs +++ b/src/templates/sheets/actor/components/combat-value.hbs @@ -2,8 +2,8 @@ !-- Render a combat value. !-- !-- @param combat-value-key: The key of the combat value -!-- @param combat-value-data: The data for the attribute -!-- @param combat-value-label: The label for the attribute +!-- @param combat-value-data: The data for the combat value +!-- @param combat-value-label: The label for the combat value --}}
diff --git a/src/templates/sheets/actor/tabs/values.hbs b/src/templates/sheets/actor/tabs/values.hbs index 493d9973..e2ca14e0 100644 --- a/src/templates/sheets/actor/tabs/values.hbs +++ b/src/templates/sheets/actor/tabs/values.hbs @@ -1,4 +1,5 @@
{{> systems/ds4/templates/sheets/actor/components/core-values.hbs}} {{> systems/ds4/templates/sheets/actor/components/combat-values.hbs}} + {{> systems/ds4/templates/sheets/actor/components/checks.hbs}}