diff --git a/scripts/mb-cypher2.js b/scripts/mb-cypher2.js
index 3992715..8509aef 100644
--- a/scripts/mb-cypher2.js
+++ b/scripts/mb-cypher2.js
@@ -9,6 +9,17 @@ const TEMPLATE_FILES = ["actor.hbs", "actor-inline.hbs"];
const TEMPLATE_BASE = "embeds";
const TEMPLATES = normalizeTemplatePaths(TEMPLATE_FILES, TEMPLATE_BASE);
+function csLocKey(name) {
+ return `CYPHERSYSTEM.${name[0].toUpperCase()}${name.slice(1)}`;
+}
+
+function enrich(text, options) {
+ return foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ text,
+ options,
+ );
+}
+
async function buildActorEmbedHTML(doc, content, config, options) {
// Types: community, pc, marker, npc, vehicle
// LIMITED access can see Name and Description
@@ -51,8 +62,11 @@ async function buildActorEmbedHTML(doc, content, config, options) {
const context = {
config: { ...config },
actor: doc,
- basic: doc.system.basic,
- pools: doc.system.pools,
+ actorName: config?.label ?? doc.name,
+ sentence: doc.system.basic,
+ stats: [],
+ pools: [],
+ enriched: {},
options,
viewFullDocument: doc.testUserPermission(
game.user,
@@ -61,6 +75,59 @@ async function buildActorEmbedHTML(doc, content, config, options) {
icon,
user: game.user,
};
+ for (const basic of ["rank", "level", "tier"]) {
+ const value = doc.system.basic?.[basic];
+ if (value !== undefined && value !== null) {
+ context.stats.push({
+ name: csLocKey(basic),
+ value,
+ });
+ }
+ }
+ if (!config.inline) {
+ context.enriched.notes = await enrich(doc.system.notes, options);
+ context.enriched.description = await enrich(
+ doc.system.description,
+ options,
+ );
+ if (doc.type === "pc") {
+ context.enriched.gmNotes = await enrich(doc.system.gmNotes, options);
+ }
+ }
+ for (const pool of [
+ "health",
+ "infrastructure",
+ "might",
+ "speed",
+ "intellect",
+ ]) {
+ if (doc.system.pools?.[pool]) {
+ context.pools.push({
+ name: csLocKey(pool),
+ value: doc.system.pools[pool],
+ });
+ }
+ }
+ let armor = doc.system.combat?.armor;
+ if (armor !== undefined && armor !== null) {
+ const ratingTotal = armor?.ratingTotal;
+ if (ratingTotal !== undefined && ratingTotal != null) {
+ armor = ratingTotal;
+ }
+ context.stats.push({
+ name: csLocKey("armor"),
+ value: armor,
+ noInline: true,
+ });
+ }
+ let damage = doc.system.combat?.damage;
+ if (damage !== undefined && damage !== null) {
+ context.stats.push({
+ name: csLocKey("damage"),
+ value: damage,
+ noInline: true,
+ });
+ }
const template = config.inline
? TEMPLATES["actor-inline.hbs"]
: TEMPLATES["actor.hbs"];
diff --git a/styles/mb-cypher2.css b/styles/mb-cypher2.css
index a354c1f..a35bf35 100644
--- a/styles/mb-cypher2.css
+++ b/styles/mb-cypher2.css
@@ -1,19 +1,7 @@
-:root {
- --mbcypher2-journal-embed-background: #ccccaa;
- --mbcypher2-journal-embed-border-color: #aaaa88;
- --mbcypher2-journal-embed-font-color: #000000;
-}
-
-body.theme-dark {
- --mbcypher2-journal-embed-background: #333300;
- --mbcypher2-journal-embed-border-color: #666633;
- --mbcypher2-journal-embed-font-color: #eeeecc;
-}
-
.mb-cypher2-embed.content-embed {
- background: var(--mbcypher2-journal-embed-background);
- border: 1px solid var(--mbcypher2-journal-embed-border-color);
- border-radius: 2px;
+ background: var(--table-header-bg-color);
+ border: 1px solid var(--table-header-border-color);
+ border-radius: 0.25em;
}
span.mb-cypher2-embed.content-embed {
@@ -23,7 +11,10 @@ span.mb-cypher2-embed.content-embed {
word-break: break-all;
}
+div.mb-cypher2-embed {
+ padding: 0.25em;
+}
+
figure.content-embed figcaption cite {
margin-left: 0.5em;
}
-}
diff --git a/templates/embeds/actor-inline.hbs b/templates/embeds/actor-inline.hbs
index 57f9ef8..ddcc2eb 100644
--- a/templates/embeds/actor-inline.hbs
+++ b/templates/embeds/actor-inline.hbs
@@ -1,32 +1,14 @@
-{{actor.name}}
-{{#if (eq actor.type "pc") }}
- {{ localize "CYPHERSYSTEM.IsA" }} {{ basic.descriptor }} {{ basic.type }}
- {{ localize "CYPHERSYSTEM.Who" }} {{ basic.focus }} {{ basic.additionalSentence }}
-{{/if}}
+{{actorName}}:
{{#if viewFullDocument}}
- {{#if basic.rank}}
- {{ localize "CYPHERSYSTEM.Rank" }} {{ basic.rank }}
- {{/if}}
- {{#if basic.level}}
- {{ localize "CYPHERSYSTEM.Level" }} {{ basic.level }}
- {{/if}}
- {{#if basic.tier}}
- {{ localize "CYPHERSYSTEM.Tier" }} {{ basic.tier }}
- {{/if}}
- {{#if pools.health}}
- {{ localize "CYPHERSYSTEM.Health" }} {{ pools.health.value }}/{{ pools.health.max}}
- {{/if}}
- {{#if pools.infrastructure}}
- {{ localize "CYPHERSYSTEM.Infrastructure" }} {{ pools.infrastructure.value }}/{{ pools.infrastructure.max}}
- {{/if}}
- {{#if pools.might}}
- {{ localize "CYPHERSYSTEM.Might" }} {{ pools.might.value }}/{{ pools.might.max}}
- {{/if}}
- {{#if pools.speed}}
- {{ localize "CYPHERSYSTEM.Speed" }} {{ pools.speed.value }}/{{ pools.speed.max}}
- {{/if}}
- {{#if pools.intellect}}
- {{ localize "CYPHERSYSTEM.Intellect" }} {{ pools.intellect.value }}/{{ pools.intellect.max}}
- {{/if}}
+ {{#each stats}}
+ {{#unless noInline}}
+ {{ localize name }}: {{ value }}
+ {{~#unless @last}},{{/unless}}
+ {{/unless}}
+ {{/each}}
+ {{#each pools}}
+ {{ localize name }}: {{ value.value }}
+ {{~#unless @last}},{{/unless}}
+ {{/each}}
{{/if}}
diff --git a/templates/embeds/actor.hbs b/templates/embeds/actor.hbs
index e69de29..2fd49f5 100644
--- a/templates/embeds/actor.hbs
+++ b/templates/embeds/actor.hbs
@@ -0,0 +1,54 @@
+
+
+ {{#if enriched.description}}
+
+ Description
+ {{{enriched.description}}}
+
+ {{/if}}
+ {{#if (and enriched.gmNotes user.isGM)}}
+
+ GM Notes
+ {{{enriched.gmNotes}}}
+
+ {{/if}}
+ {{#if (and enriched.notes viewFullDocument)}}
+
+ Notes
+ {{{enriched.notes}}}
+
+ {{/if}}
+