diff --git a/lang/de.json b/lang/de.json index a062873..e9115d1 100644 --- a/lang/de.json +++ b/lang/de.json @@ -94,7 +94,8 @@ "effects": "Effekte", "zauber": "Zauber", "biographie": "Biographie", - "hintergrund": "Hintergrund" + "hintergrund": "Hintergrund", + "sperre": "Sperre" }, "spezialisierung": "Spezialisierung" }, diff --git a/src/data/character-data.mjs b/src/data/character-data.mjs index 5fc97ce..d51a4c0 100644 --- a/src/data/character-data.mjs +++ b/src/data/character-data.mjs @@ -1,6 +1,7 @@ function defineSchema() { const fields = foundry.data.fields; return { + locked: new fields.BooleanField({ initial: false }), biographie: new fields.SchemaField({ mondgestalt: new fields.StringField({ initial: "" }), abenteuertyp: new fields.StringField({ initial: "" }), diff --git a/src/helpers/handlebar-helpers.mjs b/src/helpers/handlebar-helpers.mjs index 6808062..3057984 100644 --- a/src/helpers/handlebar-helpers.mjs +++ b/src/helpers/handlebar-helpers.mjs @@ -15,8 +15,9 @@ export const loadHelpers = async function () { return foundry.utils.getProperty(actor, arg); }); - Handlebars.registerHelper("isdefined", function (value) { - return value !== undefined; + Handlebars.registerHelper("isdefined", function (value, options) { + console.warn(value, value !== undefined); + return value !== undefined ? options.fn(this) : options.inverse(this); }); Handlebars.registerHelper("localizeConcat", function (arg1, arg2) { diff --git a/src/sheets/character-sheet.mjs b/src/sheets/character-sheet.mjs index 05a81de..bf9ef11 100644 --- a/src/sheets/character-sheet.mjs +++ b/src/sheets/character-sheet.mjs @@ -28,6 +28,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe rollWeapon: this.#rollWeapon, rollSpell: this.#rollSpell, cycleEquip: this.#cycleEquip, + cycleLock: this.#cycleLock, addSpezialisierung: addSpezialisierung, editSepzialisierung: editSepzialisierung, increaseDoc: this.#increaseDoc, @@ -161,7 +162,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe flags: this.actor.flags, config: CONFIG }); - + console.warn(context); return context; } @@ -334,6 +335,13 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe }); } + static async #cycleLock(event) { + const actor = this.actor; + + // Update the locked state + actor.update({ "system.locked": !actor.system.locked }); + } + /* -------------------------------------------------- */ /** diff --git a/src/styles/M6.scss b/src/styles/M6.scss index c904ee4..a1b84c2 100644 --- a/src/styles/M6.scss +++ b/src/styles/M6.scss @@ -78,6 +78,9 @@ } } } + input:disabled { + border: none; + } input:focus { outline: none; } diff --git a/src/templates/actor/eigenschaften.hbs b/src/templates/actor/eigenschaften.hbs index 699da4f..7e258ba 100644 --- a/src/templates/actor/eigenschaften.hbs +++ b/src/templates/actor/eigenschaften.hbs @@ -38,11 +38,14 @@ type="number" name="{{field.fieldPath}}" value="{{value}}" + {{#if @root.system.locked}}disabled{{/if}} /> +
@@ -52,6 +55,8 @@ data-level="{{level}}" data-path="{{path}}" style="white-space: nowrap;" + {{#if @root.system.locked}}disabled{{/if}} + {{#unless @last}}style="margin-right: 4px"{{/unless}}>{{name}}: {{level}}{{#unless @last}},{{/unless}} {{/each}}
@@ -84,6 +89,7 @@ type="number" name="{{field.fieldPath}}" value="{{value}}" + {{#if @root.system.locked}}disabled{{/if}} /> @@ -117,6 +123,7 @@ type="number" name="system.resources.leben.max" value="{{system.resources.leben.max}}" + {{#if @root.system.locked}}disabled{{/if}} /> @@ -142,6 +149,7 @@ type="number" name="system.resources.ausdauer.max" value="{{system.resources.ausdauer.max}}" + {{#if @root.system.locked}}disabled{{/if}} /> diff --git a/src/templates/actor/header.hbs b/src/templates/actor/header.hbs index 2c5db0a..61915ad 100644 --- a/src/templates/actor/header.hbs +++ b/src/templates/actor/header.hbs @@ -2,9 +2,9 @@
- - - + + +
- - - + + +
diff --git a/src/templates/actor/items.hbs b/src/templates/actor/items.hbs index 668bb25..cd9cd19 100644 --- a/src/templates/actor/items.hbs +++ b/src/templates/actor/items.hbs @@ -28,31 +28,31 @@
  • {{item.name}}
    {{item.system.anzahl}}x {{item.name}}
    -
    - - - - + - - -
    -
    - - - - {{#if @root.editable}} + > + + + + + +
    +
    + + + - {{/if}} -
    + + {{/if}}
  • {{/each}} @@ -93,14 +93,14 @@ {{item.name}}
    {{item.system.anzahl}}x {{item.name}}
    - - - {{#if @root.editable}} + + + {{item.system.anzahl}}x {{item.name}}
    -
    - - - - {{#if @root.editable}} - - - - {{/if}} -
    +
    + {{#if @root.editable}} + + + + + + + {{/if}} +
    {{/each}} @@ -199,14 +199,14 @@
    {{item.system.anzahl}}x {{item.name}}
    - - - {{#if @root.editable}} + + + 65% + >
    \ No newline at end of file diff --git a/src/templates/shared/tabs.hbs b/src/templates/shared/tabs.hbs index 6a8efc3..ccf421a 100644 --- a/src/templates/shared/tabs.hbs +++ b/src/templates/shared/tabs.hbs @@ -16,4 +16,25 @@ {{/each}} + {{#isdefined system.locked}} + +
    +
    +
    + + {{#if system.locked}} + + {{else}} + + {{/if}} + +
    +
    + {{/isdefined}} \ No newline at end of file