Add the combined sheet to make sure that it works in practice and make the changes to make it work
This commit is contained in:
parent
5b903f7e74
commit
7271323a75
6 changed files with 90 additions and 2 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
"RipCrypt": {
|
"RipCrypt": {
|
||||||
"sheet-names": {
|
"sheet-names": {
|
||||||
"AllItemsSheetV1": "RipCrypt Item Sheet",
|
"AllItemsSheetV1": "RipCrypt Item Sheet",
|
||||||
|
"CombinedHeroSheet": "Hero Sheet",
|
||||||
"HeroSummaryCardV1": "Hero Stat Card",
|
"HeroSummaryCardV1": "Hero Stat Card",
|
||||||
"HeroSkillsCardV1": "Hero Skill Card"
|
"HeroSkillsCardV1": "Hero Skill Card"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
68
module/Apps/ActorSheets/CombinedHeroSheet.mjs
Normal file
68
module/Apps/ActorSheets/CombinedHeroSheet.mjs
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
import { filePath } from "../../consts.mjs";
|
||||||
|
import { GenericAppMixin } from "../GenericApp.mjs";
|
||||||
|
import { HeroSummaryCardV1 } from "./HeroSummaryCardV1.mjs";
|
||||||
|
import { Logger } from "../../utils/Logger.mjs";
|
||||||
|
|
||||||
|
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||||
|
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
||||||
|
export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
|
||||||
|
|
||||||
|
// #region Options
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: [
|
||||||
|
`ripcrypt--actor`,
|
||||||
|
`ripcrypt--CombinedHeroSheet`,
|
||||||
|
],
|
||||||
|
position: {
|
||||||
|
width: `auto`,
|
||||||
|
height: `auto`,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: false,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
editItem: (_event, target) => HeroSummaryCardV1._editItem(target),
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
closeOnSubmit: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static PARTS = {
|
||||||
|
summary: {
|
||||||
|
template: filePath(`templates/Apps/HeroSummaryCardV1/content.hbs`),
|
||||||
|
},
|
||||||
|
skills: {
|
||||||
|
template: filePath(`templates/Apps/HeroSkillsCardV1/content.hbs`),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Lifecycle
|
||||||
|
async _onRender(context, options) {
|
||||||
|
await super._onRender(context, options);
|
||||||
|
HeroSummaryCardV1._onRender.bind(this)(context, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
async _preparePartContext(partId, ctx, opts) {
|
||||||
|
ctx = await super._preparePartContext(partId, ctx, opts);
|
||||||
|
ctx.actor = this.document;
|
||||||
|
|
||||||
|
ctx = await HeroSummaryCardV1.prepareGuts(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareWeapons(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareArmor(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareFatePath(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareSpeed(ctx);
|
||||||
|
ctx = await HeroSummaryCardV1.prepareLevelData(ctx);
|
||||||
|
|
||||||
|
Logger.debug(`Context:`, ctx);
|
||||||
|
return ctx;
|
||||||
|
};
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
// #endregion
|
||||||
|
};
|
||||||
|
|
@ -42,7 +42,10 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
|
||||||
// #region Lifecycle
|
// #region Lifecycle
|
||||||
async _onRender(context, options) {
|
async _onRender(context, options) {
|
||||||
await super._onRender(context, options);
|
await super._onRender(context, options);
|
||||||
|
HeroSummaryCardV1._onRender.bind(this)(context, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
static async _onRender() {
|
||||||
const itemMenuOptions = [
|
const itemMenuOptions = [
|
||||||
{
|
{
|
||||||
name: `Edit`,
|
name: `Edit`,
|
||||||
|
|
@ -63,7 +66,7 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
|
||||||
];
|
];
|
||||||
if (itemMenuOptions.length) {
|
if (itemMenuOptions.length) {
|
||||||
new ContextMenu(this.element, `.weapon-ctx-menu`, itemMenuOptions, { jQuery: false, fixed: true });
|
new ContextMenu(this.element, `.weapon-ctx-menu`, itemMenuOptions, { jQuery: false, fixed: true });
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
async _preparePartContext(partId, ctx, opts) {
|
async _preparePartContext(partId, ctx, opts) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Applications
|
// Applications
|
||||||
import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs";
|
import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs";
|
||||||
|
import { CombinedHeroSheet } from "../Apps/ActorSheets/CombinedHeroSheet.mjs";
|
||||||
import { HeroSkillsCardV1 } from "../Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
import { HeroSkillsCardV1 } from "../Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
||||||
import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
||||||
|
|
||||||
|
|
@ -46,8 +47,13 @@ Hooks.once(`init`, () => {
|
||||||
/* eslint-enabled no-undef */
|
/* eslint-enabled no-undef */
|
||||||
|
|
||||||
// #region Actors
|
// #region Actors
|
||||||
Actors.registerSheet(game.system.id, HeroSummaryCardV1, {
|
Actors.registerSheet(game.system.id, CombinedHeroSheet, {
|
||||||
makeDefault: true,
|
makeDefault: true,
|
||||||
|
types: [`hero`],
|
||||||
|
label: `RipCrypt.sheet-names.CombinedHeroSheet`,
|
||||||
|
themes: CombinedHeroSheet.themes,
|
||||||
|
});
|
||||||
|
Actors.registerSheet(game.system.id, HeroSummaryCardV1, {
|
||||||
types: [`hero`],
|
types: [`hero`],
|
||||||
label: `RipCrypt.sheet-names.HeroSummaryCardV1`,
|
label: `RipCrypt.sheet-names.HeroSummaryCardV1`,
|
||||||
themes: HeroSummaryCardV1.themes,
|
themes: HeroSummaryCardV1.themes,
|
||||||
|
|
|
||||||
9
templates/Apps/CombinedHeroSheet/style.css
Normal file
9
templates/Apps/CombinedHeroSheet/style.css
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
.ripcrypt.ripcrypt--CombinedHeroSheet {
|
||||||
|
> .window-content {
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.HeroSkillsCardV1 {
|
||||||
|
--col-gap: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
@import url("./AllItemSheetV1/style.css");
|
@import url("./AllItemSheetV1/style.css");
|
||||||
|
@import url("./CombinedHeroSheet/style.css");
|
||||||
@import url("./HeroSummaryCardV1/style.css");
|
@import url("./HeroSummaryCardV1/style.css");
|
||||||
@import url("./HeroSkillsCardV1/style.css");
|
@import url("./HeroSkillsCardV1/style.css");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue