From 3b768ca44cdd350f96666953a71c4586a67480af Mon Sep 17 00:00:00 2001 From: macniel Date: Thu, 25 Sep 2025 19:26:26 +0200 Subject: [PATCH] initial skill data and dialog test --- src/module/items/skill.mjs | 18 +++++++++++ src/module/items/skillItemSheet.mjs | 43 +++++++++++++++++++++++++ src/templates/character/character.hbs | 27 ++++++++++++++++ src/templates/items/skillItem-sheet.hbs | 28 ++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 src/module/items/skill.mjs create mode 100644 src/module/items/skillItemSheet.mjs create mode 100644 src/templates/character/character.hbs create mode 100644 src/templates/items/skillItem-sheet.hbs diff --git a/src/module/items/skill.mjs b/src/module/items/skill.mjs new file mode 100644 index 00000000..2c7a1815 --- /dev/null +++ b/src/module/items/skill.mjs @@ -0,0 +1,18 @@ +const { BooleanField, NumberField, SchemaField, SetField, StringField } = foundry.data.fields; + +export default class Skill extends foundry.abstract.TypeDataModel { + + static defineSchema() { + return { + name: StringField({required: true}), + category: StringField({required: true}), + attributeReference1: StringField(), // References one of the eight attributes by name + attributeReference2: StringField(), // References one of the eight attributes by name + attributeReference3: StringField(), // References one of the eight attributes by name + skillValue: NumberField(), // TaW + handicapValue: NumberField(), // BE-X + complexity: NumberField(), // In case of languages + } + } + +} \ No newline at end of file diff --git a/src/module/items/skillItemSheet.mjs b/src/module/items/skillItemSheet.mjs new file mode 100644 index 00000000..50a2e2e8 --- /dev/null +++ b/src/module/items/skillItemSheet.mjs @@ -0,0 +1,43 @@ +export class SkillItemSheet extends ItemSheet { + /**@override */ + static get defaultOptions() { + return foundry.utils.mergeObject(super.defaultOptions, { + classes: ['dsa41', 'sheet', 'item', 'skill'], + width: 520, + height: 480, + tabs: [ + { + navSelector: '.sheet-tabs', + contentSelector: '.sheet-body', + initial: 'description', + }, + ], + }); + } + + /** @override */ + get template() { + return `${path}/item-${this.item.type}-sheet.hbs`; + } + + /** @override */ + getData() { + // Retrieve base data structure. + const context = super.getData(); + + // Use a safe clone of the item data for further operations. + const itemData = context.data; + + // Retrieve the roll data for TinyMCE editors. + context.rollData = this.item.getRollData(); + + // Add the item's data to context.data for easier access, as well as flags. + context.system = itemData.system; + context.flags = itemData.flags; + + // Prepare active effects for easier access + context.effects = prepareActiveEffectCategories(this.item.effects); + + return context; + } +} \ No newline at end of file diff --git a/src/templates/character/character.hbs b/src/templates/character/character.hbs new file mode 100644 index 00000000..c2b820a7 --- /dev/null +++ b/src/templates/character/character.hbs @@ -0,0 +1,27 @@ +
+ + {{!-- Sheet Header --}} +
+ {{!-- Header stuff goes here --}} + +
+

+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+
+ + + + +
+
+
\ No newline at end of file diff --git a/src/templates/items/skillItem-sheet.hbs b/src/templates/items/skillItem-sheet.hbs new file mode 100644 index 00000000..e0996ec5 --- /dev/null +++ b/src/templates/items/skillItem-sheet.hbs @@ -0,0 +1,28 @@ +
+ + {{!-- Sheet Header --}} +
+ {{!-- Header stuff goes here --}} + +
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+
+ + + + + + + + +
+ +
+
\ No newline at end of file