From fb71eaff34add44f2855e725d59cd2acb05e3c8f Mon Sep 17 00:00:00 2001 From: Cass Unterholzner Date: Tue, 21 Jul 2026 20:06:17 -0500 Subject: [PATCH] Adding code to render Influence statblocks --- src/lib/components/influenceStatblock.svelte | 42 ++++++++++++++++++++ src/lib/components/influenceThreshold.svelte | 5 +++ src/lib/data/influence.ts | 17 ++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/lib/components/influenceStatblock.svelte create mode 100644 src/lib/components/influenceThreshold.svelte create mode 100644 src/lib/data/influence.ts diff --git a/src/lib/components/influenceStatblock.svelte b/src/lib/components/influenceStatblock.svelte new file mode 100644 index 0000000..9757410 --- /dev/null +++ b/src/lib/components/influenceStatblock.svelte @@ -0,0 +1,42 @@ + + +
+

{statblock.name}

+

Creature {statblock.level}

+
+
+
{statblock.rarity}
+
{statblock.size}
+ {#each statblock.traits as trait} +
{trait}
+ {/each} +
+

{statblock.type}

+

Perception {#if statblock.perception >= 0}+{/if}{statblock.perception}

+

Will {#if statblock.will >= 0}+{/if}{statblock.will}

+

Discovery {#each statblock.discovery as discovery, index} + {#if index < statblock.discovery.length - 1}, {/if} + {/each}

+

Influence Skills {#each statblock.influence as influence, index} + {#if influence.reason !== undefined}({influence.reason}){/if}{#if index < statblock.influence.length - 1}, {/if} + {/each}

+ {@render children()} +
+

Resistances {@html statblock.resistance.replace("\n\n", "
")}

+

Weakness {@html statblock.weakness.replace("\n\n", "
")}

+
+

Background {@html statblock.background.replace("\n\n", "
")}

+

Appearance {@html statblock.appearance.replace("\n\n", "
")}

+

Personality {@html statblock.personality.replace("\n\n", "
")}

+ {#if statblock.penalty !== undefined} +

Penalty {@html statblock.penalty.replace("\n\n", "
")}

+ {/if} +
\ No newline at end of file diff --git a/src/lib/components/influenceThreshold.svelte b/src/lib/components/influenceThreshold.svelte new file mode 100644 index 0000000..53d27d2 --- /dev/null +++ b/src/lib/components/influenceThreshold.svelte @@ -0,0 +1,5 @@ + + +

Influence {value} {@render children()}

\ No newline at end of file diff --git a/src/lib/data/influence.ts b/src/lib/data/influence.ts new file mode 100644 index 0000000..638c031 --- /dev/null +++ b/src/lib/data/influence.ts @@ -0,0 +1,17 @@ +const statblocks = import.meta.glob( + "/data/*-influence.json", + { + eager: true + } +); + +const influence: Record = Object.fromEntries( + Object.entries(statblocks).map(([path, module]: [string, any]): [string, any] => { + return [ + path.split("/").pop()!.replace("-influence.json", ""), + module.default + ]; + }) +); + +export default influence; \ No newline at end of file -- 2.51.2