diff --git a/Apps/HeroSummaryCardV1/content.hbs b/Apps/HeroSummaryCardV1/content.hbs
index 7dd3f30..6e68d31 100644
--- a/Apps/HeroSummaryCardV1/content.hbs
+++ b/Apps/HeroSummaryCardV1/content.hbs
@@ -21,6 +21,12 @@
{{!-- * Fate & Advancement --}}
+
+
+
+
{{!-- * Weapons --}}
diff --git a/Apps/HeroSummaryCardV1/style.css b/Apps/HeroSummaryCardV1/style.css
index 7419db7..e15e8d2 100644
--- a/Apps/HeroSummaryCardV1/style.css
+++ b/Apps/HeroSummaryCardV1/style.css
@@ -1,4 +1,8 @@
.ripcrypt .HeroSummaryCardV1 {
+
+ /* Foundry Variable Tweaks */
+ --input-height: 1rem;
+
display: grid;
grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2.5fr);
grid-template-rows: repeat(15, minmax(0, 1fr));
@@ -7,6 +11,10 @@
background: white;
color: black;
+ .col-header {
+ background: black;
+ color: white;
+ }
.row-alt {
background: rgba(0,0,0, 0.3);
}
@@ -16,12 +24,6 @@
padding: 2px 4px;
}
- .hero_name {
- grid-column: span 3;
- margin-left: calc(var(--col-gap) * -1);
- padding-left: var(--col-gap);
- }
-
.header {
grid-row: span 2;
grid-column: span 1;
@@ -36,4 +38,17 @@
align-items: center;
}
}
+
+ .hero_name {
+ grid-column: span 3;
+ margin-left: calc(var(--col-gap) * -1);
+ padding-left: var(--col-gap);
+ }
+
+ .fate {
+ grid-column: 1 / span 1;
+ grid-row: 4 / span 2;
+ display: grid;
+ grid-template-rows: subgrid;
+ }
}
diff --git a/Apps/common.css b/Apps/common.css
index 21c9e42..9605c7b 100644
--- a/Apps/common.css
+++ b/Apps/common.css
@@ -23,4 +23,13 @@
border-bottom: 2px dashed purple;
}
}
+
+ select {
+ all: initial;
+ box-sizing: border-box;
+ border: none;
+ outline: none;
+ font-family: inherit;
+ font-size: inherit;
+ }
}
diff --git a/langs/en-ca.json b/langs/en-ca.json
index 751507c..4c8c336 100644
--- a/langs/en-ca.json
+++ b/langs/en-ca.json
@@ -9,7 +9,13 @@
"HeroSummaryCardV1": "Hero Stat Card"
},
"common": {
- "empty": "---"
+ "empty": "---",
+ "fate": {
+ "North": "North",
+ "East": "East",
+ "South": "South",
+ "West": "West"
+ }
}
}
}
diff --git a/module/Apps/ActorSheets/HeroSummaryCardV1.mjs b/module/Apps/ActorSheets/HeroSummaryCardV1.mjs
index 67e0446..0d93da1 100644
--- a/module/Apps/ActorSheets/HeroSummaryCardV1.mjs
+++ b/module/Apps/ActorSheets/HeroSummaryCardV1.mjs
@@ -1,4 +1,6 @@
import { filePath } from "../../consts.mjs";
+import { gameTerms } from "../../gameTerms.mjs";
+import { Logger } from "../../utils/Logger.mjs";
const { HandlebarsApplicationMixin } = foundry.applications.api;
const { ActorSheetV2 } = foundry.applications.sheets;
@@ -43,10 +45,25 @@ export class HeroSummaryCardV1 extends HandlebarsApplicationMixin(ActorSheetV2)
ctx.actor = this.document;
+ ctx = await this._prepareFatePath(ctx);
+
partId = partId.slice(0,1).toUpperCase() + partId.slice(1);
if (this[`_prepare${partId}Context`] != null) {
ctx = await this[`_prepare${partId}Context`](ctx, opts);
};
+
+ Logger.debug(`Context:`, ctx);
+ return ctx;
+ };
+
+ async _prepareFatePath(ctx) {
+ ctx.fate = {};
+ ctx.fate.selected = ctx.actor.system.fate;
+ ctx.fate.options = [
+ { label: `RipCrypt.common.empty`, v: `` },
+ ...gameTerms.FatePath
+ .map(v => ({ label: `RipCrypt.common.fate.${v}`, value: v })),
+ ];
return ctx;
};
// #endregion
diff --git a/module/data/Actor/Hero.mjs b/module/data/Actor/Hero.mjs
index 12f8c64..44c2129 100644
--- a/module/data/Actor/Hero.mjs
+++ b/module/data/Actor/Hero.mjs
@@ -1,4 +1,4 @@
-import { FatePath } from "../../gameTerms.mjs";
+import { gameTerms } from "../../gameTerms.mjs";
const { fields } = foundry.data;
@@ -61,7 +61,7 @@ export class HeroData extends foundry.abstract.TypeDataModel {
trim: true,
nullable: false,
choices: () => {
- return Object.values(FatePath).concat(``);
+ return gameTerms.FatePath.concat(``);
},
}),
level: new fields.SchemaField({
diff --git a/module/gameTerms.mjs b/module/gameTerms.mjs
index 36a0200..239486a 100644
--- a/module/gameTerms.mjs
+++ b/module/gameTerms.mjs
@@ -1,6 +1,8 @@
-export const FatePath = {
- NORTH: `North`,
- EAST: `East`,
- SOUTH: `South`,
- WEST: `West`,
-};
+export const gameTerms = Object.preventExtensions({
+ FatePath: [
+ `North`,
+ `East`,
+ `South`,
+ `West`,
+ ],
+});
diff --git a/module/handlebarHelpers/options.mjs b/module/handlebarHelpers/options.mjs
index e88ba34..13585f2 100644
--- a/module/handlebarHelpers/options.mjs
+++ b/module/handlebarHelpers/options.mjs
@@ -13,9 +13,8 @@ import { localizer } from "../utils/Localizer.mjs";
* @param {any} meta
*/
export function options(selected, opts, meta) {
- const { localize = false } = meta;
+ const { localize = false } = meta.hash;
selected = Handlebars.escapeExpression(selected);
-
const htmlOptions = [];
for (let opt of opts) {
@@ -33,4 +32,5 @@ export function options(selected, opts, meta) {
`,
);
};
+ return new Handlebars.SafeString(htmlOptions.join(`\n`));
};
diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs
index 0519436..aaa2c20 100644
--- a/module/hooks/init.mjs
+++ b/module/hooks/init.mjs
@@ -9,6 +9,7 @@ import { registerDevSettings } from "../settings/devSettings.mjs";
import { CryptDie } from "../dice/CryptDie.mjs";
// Misc
+import helpers from "../handlebarHelpers/_index.mjs";
import { Logger } from "../utils/Logger.mjs";
Hooks.once(`init`, () => {
@@ -35,4 +36,6 @@ Hooks.once(`init`, () => {
});
// #endregion
// #endregion
+
+ Handlebars.registerHelper(helpers);
});
diff --git a/module/utils/Localizer.mjs b/module/utils/Localizer.mjs
index 1a92058..0525913 100644
--- a/module/utils/Localizer.mjs
+++ b/module/utils/Localizer.mjs
@@ -1,4 +1,7 @@
-import { localizerConfig } from "../config.mjs";
+const config = Object.preventExtensions({
+ subKeyPattern: /@(?[a-zA-Z.]+)/gm,
+ maxDepth: 10,
+});
export function handlebarsLocalizer(key, ...args) {
let data = args[0];
@@ -11,10 +14,10 @@ export function handlebarsLocalizer(key, ...args) {
export function localizer(key, args = {}, depth = 0) {
/** @type {string} */
let localized = game.i18n.format(key, args);
- const subkeys = localized.matchAll(localizerConfig.subKeyPattern);
+ const subkeys = localized.matchAll(config.subKeyPattern);
// Short-cut to help prevent infinite recursion
- if (depth > localizerConfig.maxDepth) {
+ if (depth > config.maxDepth) {
return localized;
};
@@ -29,7 +32,7 @@ export function localizer(key, args = {}, depth = 0) {
};
return localized.replace(
- localizerConfig.subKeyPattern,
+ config.subKeyPattern,
(_fullMatch, subkey) => {
return localizedSubkeys.get(subkey);
},