From 4de123ae81598ce0454c6b58bdffea8264559492 Mon Sep 17 00:00:00 2001 From: Ender Date: Sun, 14 Apr 2024 13:31:10 +0200 Subject: [PATCH] - Defined npc in template.json - Created main.hbs in templates/sheets/npc --- source/PreloadTemplates.ts | 1 + source/module/sheets/M5CharacterSheet.ts | 11 +- source/template.json | 13 +- templates/sheets/npc/main.hbs | 152 +++++++++++++++++++++++ 4 files changed, 173 insertions(+), 4 deletions(-) create mode 100644 templates/sheets/npc/main.hbs diff --git a/source/PreloadTemplates.ts b/source/PreloadTemplates.ts index b2f2d19..f014a0b 100644 --- a/source/PreloadTemplates.ts +++ b/source/PreloadTemplates.ts @@ -15,6 +15,7 @@ const preloadTemplates = async (): Promise[]> = "sheets/character/spells.hbs", "sheets/character/combat.hbs", "sheets/character/effects.hbs", + "sheets/npc/main.hbs", "sheets/partial/mod.hbs", "sheets/item/rolls.hbs", "chat/roll-m5.hbs", diff --git a/source/module/sheets/M5CharacterSheet.ts b/source/module/sheets/M5CharacterSheet.ts index c61c7bb..e91fe79 100644 --- a/source/module/sheets/M5CharacterSheet.ts +++ b/source/module/sheets/M5CharacterSheet.ts @@ -7,7 +7,6 @@ import { M5Roll } from "../rolls/M5Roll"; export default class M5CharacterSheet extends ActorSheet { static get defaultOptions() { return mergeObject(super.defaultOptions, { - template: "systems/midgard5/templates/sheets/character/main.hbs", width: 1000, height: 800, classes: ["midgard5", "sheet", "character"], @@ -21,7 +20,15 @@ export default class M5CharacterSheet extends ActorSheet { }); } - // get template() { + get template() { + //console.log("M5CharacterSheet", this.actor.data.type) + if (this.actor.data.type === "npc") { + return "systems/midgard5/templates/sheets/npc/main.hbs"; + } + else { + return "systems/midgard5/templates/sheets/character/main.hbs"; + } + } // return "systems/midgard5/templates/character_sheet/main.hbs" // }Options extends ActorSheet.Options = ActorSheet.Options, Data extends object = ActorSheet.Data diff --git a/source/template.json b/source/template.json index ba41359..7f0ecb5 100644 --- a/source/template.json +++ b/source/template.json @@ -1,6 +1,9 @@ { "Actor": { - "types": ["character"], + "types": [ + "character", + "npc" + ], "templates": { "characterDescription": { "info": { @@ -19,6 +22,7 @@ "occupation": "", "origin": "", "faith": "", + "level": 1, "gold": 0, "silver": 0, "copper": 0 @@ -53,7 +57,8 @@ "zt": { "value": 50, "bonus": 0 }, "au": { "value": 50, "bonus": 0 }, "pa": { "value": 50, "bonus": 0 }, - "wk": { "value": 50, "bonus": 0 } + "wk": { "value": 50, "bonus": 0 }, + "git": { "value": 50, "bonus": 0 } } }, "skills": { @@ -156,6 +161,10 @@ "character": { "templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills", "gear"], "calc": {} + }, + "npc": { + "templates": ["characterBars", "attributes", "characterDescription", "skills", "gear"], + "calc": {} } }, "Item": { diff --git a/templates/sheets/npc/main.hbs b/templates/sheets/npc/main.hbs new file mode 100644 index 0000000..3458616 --- /dev/null +++ b/templates/sheets/npc/main.hbs @@ -0,0 +1,152 @@ +
+
+ + +
+ Midgard +
+ + +
+ + + + + + + + + + +
{{localize "midgard5.actor-name"}}
{{localize "midgard5.class"}} + + {{localize "midgard5.level"}}
+ + + + + + + + + + + +
{{localize "midgard5.race"}}{{localize "midgard5.occupation"}}
+ + + + + + + + + + + + + + + + +
{{localize "midgard5.actor-st"}}{{localize "midgard5.actor-gs"}}{{localize "midgard5.actor-gw"}}{{localize "midgard5.actor-ko"}}{{localize "midgard5.actor-in"}}{{localize "midgard5.actor-zt"}}{{localize "midgard5.actor-au"}}{{localize "midgard5.actor-pa"}}{{localize "midgard5.actor-wk"}}{{localize "midgard5.actor-git"}}
+ + + + + + + + + +
+
+ + +
+ +
+ + +
+ + + + + + + + + +
{{localize "midgard5.actor-lp-short"}} +
+ + {{#times data.lp.max}} + {{#if (lt this ../data.lp.value)}} +
+ {{else}} +
+ {{/if}} + {{/times}} +
{{data.lp.max}}
+
+
{{localize "midgard5.actor-ap-short"}} +
+ + {{#times data.ap.max}} + {{#if (lt this ../data.ap.value)}} +
+ {{else}} +
+ {{/if}} + {{/times}} +
{{data.ap.max}}
+
+
+
+
+ + {{!-- Character Sheet Navigation --}} + + +
+ +
+ {{> "systems/midgard5/templates/sheets/character/base_values.hbs"}} +
+ +
+ {{> "systems/midgard5/templates/sheets/character/skills.hbs"}} +
+ +
+ {{> "systems/midgard5/templates/sheets/character/gear.hbs"}} +
+ +
+ {{> "systems/midgard5/templates/sheets/character/combat.hbs"}} +
+ +
+ {{> "systems/midgard5/templates/sheets/character/spells.hbs"}} +
+ +
+ {{> "systems/midgard5/templates/sheets/character/effects.hbs"}} +
+
+ {{> "systems/midgard5/templates/sheets/character/description.hbs"}} +
+ +
+
\ No newline at end of file