Implement POC of rolling check from character sheet
This commit is contained in:
parent
fcfba63488
commit
9e72c6560f
9 changed files with 54 additions and 10 deletions
|
@ -109,7 +109,9 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Data<DS4Actor>> {
|
||||||
|
|
||||||
html.find(".item-change").on("change", this._onItemChange.bind(this));
|
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<ActorSheet.Data<DS4Actor>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle clickable rolls.
|
* Handle clickable item rolls.
|
||||||
* @param event - The originating click event
|
* @param event - The originating click event
|
||||||
*/
|
*/
|
||||||
protected _onRoll(event: JQuery.ClickEvent): void {
|
protected _onRollItem(event: JQuery.ClickEvent): void {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const id = $(event.currentTarget).parents(".item").data("itemId");
|
const id = $(event.currentTarget).parents(".item").data("itemId");
|
||||||
const item = this.actor.getOwnedItem(id);
|
const item = this.actor.getOwnedItem(id);
|
||||||
item.roll();
|
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 */
|
/** @override */
|
||||||
protected async _onDropItem(
|
protected async _onDropItem(
|
||||||
event: DragEvent,
|
event: DragEvent,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
export default async function registerHandlebarsPartials(): Promise<void> {
|
export default async function registerHandlebarsPartials(): Promise<void> {
|
||||||
const templatePaths = [
|
const templatePaths = [
|
||||||
"systems/ds4/templates/sheets/actor/components/character-progression.hbs",
|
"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-value.hbs",
|
||||||
"systems/ds4/templates/sheets/actor/components/combat-values.hbs",
|
"systems/ds4/templates/sheets/actor/components/combat-values.hbs",
|
||||||
"systems/ds4/templates/sheets/actor/components/core-value.hbs",
|
"systems/ds4/templates/sheets/actor/components/core-value.hbs",
|
||||||
|
|
3
src/scss/components/_check.scss
Normal file
3
src/scss/components/_check.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.ds4-check {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
6
src/scss/components/_checks.scss
Normal file
6
src/scss/components/_checks.scss
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.ds4-checks {
|
||||||
|
display: grid;
|
||||||
|
column-gap: 0.5em;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(10em, 1fr));
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
|
@ -6,24 +6,27 @@
|
||||||
@include meta.load-css("global/fonts");
|
@include meta.load-css("global/fonts");
|
||||||
@include meta.load-css("global/grid");
|
@include meta.load-css("global/grid");
|
||||||
@include meta.load-css("global/window");
|
@include meta.load-css("global/window");
|
||||||
|
|
||||||
@include meta.load-css("components/actor_sheet");
|
@include meta.load-css("components/actor_sheet");
|
||||||
@include meta.load-css("components/dice_total");
|
@include meta.load-css("components/dice_total");
|
||||||
|
|
||||||
/* Styles limited to ds4 sheets */
|
/* Styles limited to ds4 sheets */
|
||||||
.ds4 {
|
.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/apps");
|
||||||
@include meta.load-css("components/basic_property");
|
@include meta.load-css("components/basic_property");
|
||||||
@include meta.load-css("components/character_progression");
|
@include meta.load-css("components/character_progression");
|
||||||
@include meta.load-css("components/character_values");
|
@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_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/description");
|
||||||
@include meta.load-css("components/forms");
|
@include meta.load-css("components/forms");
|
||||||
@include meta.load-css("components/item_list");
|
@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/tabs");
|
||||||
@include meta.load-css("components/talent_rank_equation");
|
@include meta.load-css("components/talent_rank_equation");
|
||||||
@include meta.load-css("components/currency");
|
|
||||||
@include meta.load-css("components/rollable_image");
|
|
||||||
}
|
}
|
||||||
|
|
11
src/templates/sheets/actor/components/check.hbs
Normal file
11
src/templates/sheets/actor/components/check.hbs
Normal file
|
@ -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
|
||||||
|
--}}
|
||||||
|
|
||||||
|
<div class="ds4-check rollable-check" data-check="{{check-key}}">
|
||||||
|
{{check-label}}: {{check-target-number}}
|
||||||
|
</div>
|
6
src/templates/sheets/actor/components/checks.hbs
Normal file
6
src/templates/sheets/actor/components/checks.hbs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="ds4-checks">
|
||||||
|
{{#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}}
|
||||||
|
</div>
|
|
@ -2,8 +2,8 @@
|
||||||
!-- Render a combat value.
|
!-- Render a combat value.
|
||||||
!--
|
!--
|
||||||
!-- @param combat-value-key: The key of the combat value
|
!-- @param combat-value-key: The key of the combat value
|
||||||
!-- @param combat-value-data: The data for the attribute
|
!-- @param combat-value-data: The data for the combat value
|
||||||
!-- @param combat-value-label: The label for the attribute
|
!-- @param combat-value-label: The label for the combat value
|
||||||
--}}
|
--}}
|
||||||
|
|
||||||
<div class="ds4-combat-value">
|
<div class="ds4-combat-value">
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="tab values" data-group="primary" data-tab="values">
|
<div class="tab values" data-group="primary" data-tab="values">
|
||||||
{{> systems/ds4/templates/sheets/actor/components/core-values.hbs}}
|
{{> systems/ds4/templates/sheets/actor/components/core-values.hbs}}
|
||||||
{{> systems/ds4/templates/sheets/actor/components/combat-values.hbs}}
|
{{> systems/ds4/templates/sheets/actor/components/combat-values.hbs}}
|
||||||
|
{{> systems/ds4/templates/sheets/actor/components/checks.hbs}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue