From 72f3ac4eee3caaad297b2e40ddf9b84a177ec8ad Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 16 Dec 2023 01:29:35 -0700 Subject: [PATCH] Remove non-existant template and add new helper --- module/handlebars.mjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/module/handlebars.mjs b/module/handlebars.mjs index 5a9f119..ec139b0 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -3,7 +3,6 @@ export const partials = [ `actors/char-sheet-mvp/partials/stat.hbs`, `actors/char-sheet-mvp/partials/skill.hbs`, `actors/char-sheet-mvp/partials/panel.hbs`, - `actors/char-sheet-mvp/partials/panels/skills.hbs`, `items/aspect.hbs`, ]; @@ -11,6 +10,7 @@ export async function registerHandlebarsHelpers() { Handlebars.registerHelper({ "dotdungeon-array": createArray, "dotdungeon-toFriendlyDuration": toFriendlyDuration, + "dotdungeon-objectValue": objectValue }); }; @@ -36,6 +36,19 @@ function createArray(...args) { return args.slice(0, -1); }; +function objectValue(obj, keypath) { + // console.log(obj, keypath.string) + return keypath + function helper(o, k) { + let v = o[k[0]]; + if (typeof v === "object") { + return helper(v, k.slice(1)); + }; + return v; + }; + return helper(obj, keypath.string.split(`.`)) +}; + const secondsInAMinute = 60; const secondsInAnHour = 60 * secondsInAMinute;