diff --git a/assets/caret-right.svg b/assets/caret-right.svg
new file mode 100644
index 0000000..56252c0
--- /dev/null
+++ b/assets/caret-right.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/garbage-bin.svg b/assets/garbage-bin.svg
new file mode 100644
index 0000000..b9268a5
--- /dev/null
+++ b/assets/garbage-bin.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/sources.txt b/assets/sources.txt
new file mode 100644
index 0000000..5f999e2
--- /dev/null
+++ b/assets/sources.txt
@@ -0,0 +1,5 @@
+Amer Alamer
+ caret-right.svg (https://thenounproject.com/icon/arrow-caret-right-1143917/)
+
+Alice Design:
+ garbage-bin.svg (https://thenounproject.com/icon/garbage-2025492/)
\ No newline at end of file
diff --git a/module/handlebars.mjs b/module/handlebars.mjs
index 6d3e0fd..710d5f4 100644
--- a/module/handlebars.mjs
+++ b/module/handlebars.mjs
@@ -20,7 +20,14 @@ export const partials = [
`actors/char-sheet-mvp/panels/weapons.pc.hbs`,
];
+export const icons = [
+ `caret-right.svg`,
+ `garbage-bin.svg`,
+];
+
+
export async function registerHandlebarsHelpers() {
+ console.log(Handlebars)
Handlebars.registerHelper(helpers);
};
@@ -50,4 +57,43 @@ export async function preloadHandlebarsTemplates() {
console.debug(`Loaded ${partials.length} partials`);
console.groupEnd();
return loadTemplates(paths);
+};
+
+/**
+ * Loads all of the icons that are needed in the handlebars templating to make
+ * the sheet look nicer.
+ *
+ * @returns An object containing icon names to the corresponding HTML data for
+ * displaying the icon
+ */
+export async function preloadIcons() {
+ console.groupCollapsed(`.dungeon | Loading icons for handlebars`);
+ const pathPrefix = `systems/dotdungeon/assets/`
+ const parsedIcons = {};
+
+ for (const icon of icons) {
+ const iconName = icon.slice(0, -4);
+ if (icon.endsWith(`.svg`)) {
+ try {
+ const response = await fetchWithTimeout(`${pathPrefix}${icon}`);
+ if (response.status !== 200) { continue };
+ const svgData = await response.text();
+ parsedIcons[iconName] = svgData;
+ console.debug(`Loaded icon: ${icon}`);
+ } catch {
+ console.error(`Failed to fetch/parse icon: ${icon}`);
+ continue;
+ };
+ }
+ else if (icon.endsWith(`.png`)) {
+ parsedIcons[iconName] = `
`;
+ console.debug(`Loaded icon: ${icon}`);
+ }
+ else {
+ console.warn(`Icon "${icon}" failed to be handled by a loader`)
+ };
+ };
+
+ console.groupEnd();
+ return parsedIcons;
};
\ No newline at end of file