diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index ef3a6d3..357cdf0 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -207,7 +207,7 @@ export class M5Character extends Actor { const aggregate = new M5ModAggregate(data, ret); context.items - ?.filter((item) => (item.type === "item" || item.type === "effect" || item.type === "armor" || item.type === "container" || item.type === "klasse") && item.system.equipped) + ?.filter((item) => (item.type === "item" || item.type === "effect" || item.type === "armor" || item.type === "container" || item.type === "class") && item.system.equipped) .forEach((item) => { const mods = item.system.mods; //console.log("Actor item mods", mods) @@ -497,11 +497,19 @@ export class M5Character extends Actor { } if (!skip?.class) { - const item = context.items?.find((item) => item.type === "class"); - if (item) { - data.info.class = item.name; - data.info.magicUsing = item.system.magicUsing; - } + const item = context.items + ?.filter((item) => item.type === "class") + .forEach((item) => { + if (item) { + if (typeof data.info.class === "string") { + data.info.class = {}; + } + data.info.class[item.id] = item.name; + if (item.system.magicUsing) { + data.info.magicUsing = item.system.magicUsing; + } + } + }); } if (!skip?.effects) { diff --git a/source/module/sheets/M5CharacterSheet.ts b/source/module/sheets/M5CharacterSheet.ts index 454a7ab..7cbc2ff 100644 --- a/source/module/sheets/M5CharacterSheet.ts +++ b/source/module/sheets/M5CharacterSheet.ts @@ -433,6 +433,14 @@ export default class M5CharacterSheet extends ActorSheet { } }); + html.find(".class-item-edit").on("click", async (event) => { + this.actor.items.find((x) => x.type === "class").sheet.render(true); + }); + + html.find(".class-item-delete").on("click", async (event) => { + this.actor.items.find((x) => x.type === "class").delete(); + }); + // Drag & Drop const dragDrop = new DragDrop({ dragSelector: ".items-list .item", diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index 68c3dcc..898b404 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -365,4 +365,27 @@ } } } + + .chip { + display: inline-block; + padding: 0 25px; + height: 35px; + font-size: 16px; + line-height: 35px; + border-radius: 25px; + background-color: #f1f1f1; + } + + .closebtn { + padding-left: 10px; + color: #888; + font-weight: bold; + float: right; + font-size: 20px; + cursor: pointer; + } + + .closebtn:hover { + color: #000; + } } diff --git a/source/template.json b/source/template.json index 49310a9..23483b4 100644 --- a/source/template.json +++ b/source/template.json @@ -6,7 +6,7 @@ "info": { "description": "", "background": "", - "class": "", + "class": {}, "race": "", "magicUsing": false, "showAllItems": false, @@ -259,7 +259,7 @@ "zauberschutz": "midgard5.spell-process-zauberschutz", "zaubersiegel": "midgard5.spell-process-zaubersiegel", "zaubertaenze": "midgard5.spell-process-zaubertaenze", - "zerstoeren": "midgard5.spell-process-zerstoeren" + "zerstoeren": "midgard5.spell-process-zerstoeren" }, "spellTypeSelection": { "gedanke": "midgard5.spell-type-gedanke", @@ -467,7 +467,7 @@ "calc": {} }, "class": { - "templates": ["itemDescription", "stats"], + "templates": ["itemDescription"], "magicUsing": false, "equipped": true, "resistanceBody": 1, diff --git a/templates/sheets/character/main.hbs b/templates/sheets/character/main.hbs index b05a249..d5cef81 100644 --- a/templates/sheets/character/main.hbs +++ b/templates/sheets/character/main.hbs @@ -15,7 +15,14 @@ {{localize "midgard5.class"}} - + + {{#each data.info.class as |class id|}} +
+ {{class}} + +
+ {{/each}} + {{localize "midgard5.level"}} {{data.calc.level}}