From fc5913e7426b7ea7da9711d91e14719c41901775 Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:08:19 +0200 Subject: [PATCH] add basic ItemSheet --- ItemSheets/Armor.html | 11 ++++++++++ ItemSheets/Generic Item.html | 11 ++++++++++ ItemSheets/Melee Weapon.html | 11 ++++++++++ ItemSheets/Ranged Weapon.html | 11 ++++++++++ ItemSheets/Shield.html | 11 ++++++++++ src/main.css | 21 ++++++++++++++++++ src/main.mjs | 41 ++++++++++++++++++++++++++++++----- system.json | 7 +++--- template.json | 19 ++++++++-------- 9 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 ItemSheets/Armor.html create mode 100644 ItemSheets/Generic Item.html create mode 100644 ItemSheets/Melee Weapon.html create mode 100644 ItemSheets/Ranged Weapon.html create mode 100644 ItemSheets/Shield.html create mode 100644 src/main.css diff --git a/ItemSheets/Armor.html b/ItemSheets/Armor.html new file mode 100644 index 0000000..8eb9abb --- /dev/null +++ b/ItemSheets/Armor.html @@ -0,0 +1,11 @@ +
\ No newline at end of file diff --git a/ItemSheets/Generic Item.html b/ItemSheets/Generic Item.html new file mode 100644 index 0000000..8eb9abb --- /dev/null +++ b/ItemSheets/Generic Item.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/ItemSheets/Melee Weapon.html b/ItemSheets/Melee Weapon.html new file mode 100644 index 0000000..8eb9abb --- /dev/null +++ b/ItemSheets/Melee Weapon.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/ItemSheets/Ranged Weapon.html b/ItemSheets/Ranged Weapon.html new file mode 100644 index 0000000..8eb9abb --- /dev/null +++ b/ItemSheets/Ranged Weapon.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/ItemSheets/Shield.html b/ItemSheets/Shield.html new file mode 100644 index 0000000..8eb9abb --- /dev/null +++ b/ItemSheets/Shield.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/src/main.css b/src/main.css new file mode 100644 index 0000000..fe1bc29 --- /dev/null +++ b/src/main.css @@ -0,0 +1,21 @@ +.item-sheet header { + display: flex; + flex-flow: row wrap; + justify-content: flex-start; + align-items: center; +} + +.item-sheet header img { + flex: 0 0 64px; + height: 64px; + margin-right: 6px; +} + +.item-sheet header input, +.item-sheet header div { + flex: 1; + height: 48px; + line-height: 48px; + margin: 8px; + font-size: 2em; +} \ No newline at end of file diff --git a/src/main.mjs b/src/main.mjs index b56d656..96a421f 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -1,14 +1,43 @@ -console.log("Hello World! This code runs immediately when the file is loaded."); - function init() { console.log("INIT"); - console.log(foundry.documents.BaseItem.metadata.types); - foundry.documents.BaseItem.metadata.types.push("talent"); + + //DocumentSheetConfig.unregisterSheet(Item, "core", ItemSheet); + DocumentSheetConfig.registerSheet(Item, "dsa41", DSA41_ItemSheet, { + makeDefault: true, + types: [ + "Generic Item", + "Melee Weapon", + "Ranged Weapon", + "Armor", + "Shield", + ] + } + ); +} + +class DSA41_ItemSheet extends ItemSheet { + get template() { + return "systems/dsa-4th-edition/ItemSheets/" + this.item.type + ".html" + } + + + getData() { + const data = super.getData(); + console.log(data); + return data; + } + } function ready() { console.log("READY"); } -Hooks.on("init", init); -Hooks.on("ready", ready); +function setup() { + console.log("SETUP"); + //Item.create({"name": "TestItem4", "type": "spell", "system": {"price": "15"}}); +} + +Hooks.once("init", init); +Hooks.once("ready", ready); +Hooks.once("setup", setup); diff --git a/system.json b/system.json index 9d7f05c..1fe166a 100644 --- a/system.json +++ b/system.json @@ -2,11 +2,10 @@ "id": "dsa-4th-edition", "title": "Custom Das Schwarze Auge 4.1", "description": "", - "esmodules": [ - "src/main.mjs" - ], + "esmodules": ["src/main.mjs"], + "styles": ["src/main.css"], "version": "0.1.5", "manifest": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/latest/system.json", "download": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/test2/dsa-4th-edition.zip" -} \ No newline at end of file +} diff --git a/template.json b/template.json index 409c1a4..3c61cfc 100644 --- a/template.json +++ b/template.json @@ -1,19 +1,20 @@ { "Item": { "templates": { - "rarity": { - "rarity": "Common", - "price": 20 - } + }, - "types": ["weapon", "spell"], + "types": [ + "Generic Item", + "Melee Weapon", + "Ranged Weapon", + "Armor", + "Shield" + ], "weapon": { - "templates": ["rarity"], - "damage": 5 + "templates": [] }, "spell": { - "templates": ["rarity"], - "cost": 2 + "templates": [] } } } \ No newline at end of file