diff --git a/assets/icons/icon/black-hand-shield.svg b/assets/icons/icon/black-hand-shield.svg new file mode 100644 index 0000000..38ba4cd --- /dev/null +++ b/assets/icons/icon/black-hand-shield.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/logo/midgard.webp b/assets/icons/logo/midgard.webp old mode 100755 new mode 100644 index ce6ec38..207d53f Binary files a/assets/icons/logo/midgard.webp and b/assets/icons/logo/midgard.webp differ diff --git a/lang/de.json b/lang/de.json index 4109c79..a9d1480 100644 --- a/lang/de.json +++ b/lang/de.json @@ -4,12 +4,14 @@ "ACTOR.TypeVehicle": "Transportmittel / Pferd etc.", "TYPES.Item.item": "Gegenstand", + "TYPES.Item.skill": "Fertigkeit", "TYPES.Item.weapon": "Waffe", "TYPES.Item.defensiveWeapon": "Verteidigungswaffe", "TYPES.Item.armor": "Rüstung", "TYPES.Item.spell": "Zauber", - "TYPES.Item.effect": "Aktive Effekte", - "TYPES.Item.kampfkunst": "Kampfkünste", + "TYPES.Item.effect": "Aktiver Effekt", + "TYPES.Item.kampfkunst": "Kampfkunst", + "TYPES.Item.container": "Aufbewahrung", "midgard5.phase-action": "Handlungsphase", "midgard5.phase-movement": "Bewegungsphase", @@ -91,10 +93,13 @@ "midgard5.origin": "Heimat", "midgard5.faith": "Glaube", + "midgard5.currency": "Geld", "midgard5.currency-gold": "Gold", "midgard5.currency-silver": "Silber", "midgard5.currency-copper": "Kupfer", + "midgard5.no-container": "Ohne", + "midgard5.exp-overall": "Erfahrungsschatz", "midgard5.exp-available": "Erfahrungspunkte", "midgard5.grace": "Göttliche Gnade", @@ -219,7 +224,7 @@ "midgard5.equipped": "Ausgerüstet", "midgard5.active": "Aktiv", "midgard5.rangedWeapon": "Schusswaffe", - "midgard5.assignItemToCharacter": "Füge Gegenstand einem Charakter hinzu, um Fähigkeit auwählen zu können", + "midgard5.assignItemToCharacter": "Füge Gegenstand einem Charakter hinzu, um hier etwas auswählen zu können", "midgard5.pw": "Prüfwurf", "midgard5.attack": "Angriff", diff --git a/source/module/M5Base.ts b/source/module/M5Base.ts index 0562cce..6e68710 100644 --- a/source/module/M5Base.ts +++ b/source/module/M5Base.ts @@ -187,6 +187,7 @@ export interface M5CharacterCalculatedData { defensiveWeapons: {}; armor: {}; items: {}; + containers: {}; effects: {}; }; spells: {}; diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index e067c62..a689a89 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -32,6 +32,7 @@ export class M5Character extends Actor { defensiveWeapons?: boolean; armor?: boolean; items?: boolean; + containers?: boolean; spells?: boolean; effects?: boolean; kampfkuenste?: boolean; @@ -85,6 +86,7 @@ export class M5Character extends Actor { defensiveWeapons: {}, armor: {}, items: {}, + containers: {}, effects: {}, }, spells: {}, @@ -171,6 +173,7 @@ export class M5Character extends Actor { if (item.system.magic) { label += "*"; } + let icon = item.img; let rollable = false; // console.log(item.system.rolls.formulas.map((p) => p.enabled)); @@ -182,9 +185,48 @@ export class M5Character extends Actor { } ret.gear.items[item.id] = { label: label, + icon: icon, magic: item.system.magic, calc: item.system.calc, equipped: item.system?.equipped, + weight: item.system.weight || 0, + containerId: item.system.containerId || "", + value: item.system.value || 0, + currency: item.system.currency || "", + quantity: item.system.quantity || 0, + rollExist: rollable, + }; + }); + } + + if (!skip?.containers) { + context.items + ?.filter((item) => item.type === "container") + .forEach((item) => { + item.prepareDerivedData(); + + let label = item.name; + if (item.system.magic) { + label += "*"; + } + let icon = item.img; + let rollable = false; + + // console.log(item.system.rolls.formulas.map((p) => p.enabled)); + for (let key in item.system.rolls.formulas) { + rollable = item.system.rolls.formulas[key].enabled; + if (rollable) { + break; + } + } + ret.gear.containers[item.id] = { + label: label, + icon: icon, + magic: item.system.magic, + calc: item.system.calc, + equipped: item.system?.equipped, + weight: item.system.weight || 0, + containerId: item.system.containerId || "", value: item.system.value || 0, currency: item.system.currency || "", quantity: item.system.quantity || 0, diff --git a/source/module/items/M5Item.ts b/source/module/items/M5Item.ts index 037a5e1..d9138da 100644 --- a/source/module/items/M5Item.ts +++ b/source/module/items/M5Item.ts @@ -14,7 +14,22 @@ export class M5Item extends Item { const itemData = (this as any).system; const calc = itemData.calc; - if (itemType === "skill") { + if (itemType === "item") { + calc.containers = null; + + if (actor) { + const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true }); + if (actorCalc) { + calc.containers = actorCalc.gear.containers; + } + const container = character.getItem(itemData.containerId); + //console.log("M5Item.prepareDerivedData:containers", itemData, container?.system) + if (container) { + container.prepareDerivedData(); + const containerData = container.system; + } + } + } else if (itemType === "skill") { calc.fw = itemData.fw; calc.bonus = 0; diff --git a/source/module/sheets/M5CharacterSheet.ts b/source/module/sheets/M5CharacterSheet.ts index e98a1ae..ff225fe 100644 --- a/source/module/sheets/M5CharacterSheet.ts +++ b/source/module/sheets/M5CharacterSheet.ts @@ -8,7 +8,7 @@ export default class M5CharacterSheet extends ActorSheet { static get defaultOptions() { return mergeObject(super.defaultOptions, { template: "systems/midgard5/templates/sheets/character/main.hbs", - width: 800, + width: 1200, height: 800, classes: ["midgard5", "sheet", "character"], tabs: [{ navSelector: ".sheet-navigation", contentSelector: ".sheet-content", initial: "base_values" }], @@ -270,7 +270,7 @@ export default class M5CharacterSheet extends ActorSheet { const item = this.actor.items.get(li.dataset.itemId); // limit transfer on personal weapons/armour/gear - if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect", "kampfkunst"].includes(item.type)) { + if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect", "kampfkunst", "container"].includes(item.type)) { const dragData = { type: "Transfer", actorId: this.actor.id, diff --git a/source/module/sheets/M5ItemSheet.ts b/source/module/sheets/M5ItemSheet.ts index d930a22..1a1c073 100644 --- a/source/module/sheets/M5ItemSheet.ts +++ b/source/module/sheets/M5ItemSheet.ts @@ -30,7 +30,7 @@ export class M5ItemSheet extends ItemSheet { context.rollData = {} let actor = this.object?.parent ?? null if (actor) { - context.rollData = actor.getRollData() + context.rollData = actor.getRollData() } context.data = itemData.system diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index c1a8895..a88acb5 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -3,6 +3,37 @@ @attributeBorderColor: rgba(0, 0, 0, 0.5); .midgard5 { + .flexbox { + display: flex; + flex-direction: row; + flex-wrap: wrap + } + + .flexcolumn-2 { + flex: 50%; + } + + .flexpart { + gap: 0; + padding: 0; + margin: 10px; + background-color: beige; + border: 2px solid black; + } + + .flexpart-header { + font-weight: bold; + font-size: large; + text-align: center; + color: black; + } + + .flexpart-icon { + height: 2rem; + float: left; + border: 0px solid transparent; + } + .flexrow { align-items: center; } @@ -33,7 +64,7 @@ .profile-img { max-width: 128px; - height: 160px; + height: 128px; border: 0px solid black; } @@ -68,6 +99,7 @@ table { background-color: beige; + border: 0px solid transparent; } td, @@ -104,10 +136,16 @@ padding: 0.5rem 0.5rem 0.5rem 0.5rem; text-align: left; font-weight: bold; - background-color: dimgray; } } + .table-icon { + height: 1rem; + width: 1rem; + float: left; + border: 0px solid transparent; + } + input.skill { width: 5rem; } diff --git a/source/template.json b/source/template.json index f1665f5..1c9ef75 100644 --- a/source/template.json +++ b/source/template.json @@ -138,17 +138,21 @@ "wahrsagen": { "fw": 0, "attribute": "zt", "initial": 8, "pp": 0 }, "wasserkampf": { "fw": 0, "attribute": "gw", "initial": 8, "pp": 0 }, "zauberkunde": { "fw": 0, "attribute": "in", "initial": 8, "pp": 0 } - } + } + } + }, + "gear": { + "gear": { } } }, "character": { - "templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills"], + "templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills", "gear"], "calc": {} } }, "Item": { - "types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "kampfkunst", "item", "effect"], + "types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "kampfkunst", "item", "effect", "container"], "templates": { "itemDescription": { "description": "" @@ -202,6 +206,8 @@ }, "physical": { "value": 0, + "weight": 0, + "containerId": "", "magic": false }, "durationSelection": { @@ -305,6 +311,15 @@ "mods": {}, "calc": {} }, + "container": { + "templates": ["itemDescription", "equippable", "physical"], + "rolls": { + "formulas": {}, + "output": "" + }, + "mods": {}, + "calc": {} + }, "effect": { "templates": ["itemDescription", "equippable", "physical", "durationSelection"], "rolls": { diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index e2dc767..62ab4d2 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -1,157 +1,162 @@ - - - - - - - - - - - - - - - -
{{localize "midgard5.currency-gold"}}{{localize "midgard5.currency-silver"}}{{localize "midgard5.currency-copper"}}
+
+
- - - - - - - - - - - {{#each data.calc.gear.weapons as |item itemId|}} - - - - - - - {{/each}} +
+
Geld
+
{{localize "TYPES.Item.weapon"}}{{localize "midgard5.ew"}}
{{item.label}}{{item.calc.ew}}
+ + + + + + + + + + + + + + + +
{{localize "midgard5.currency-gold"}}{{localize "midgard5.currency-silver"}}{{localize "midgard5.currency-copper"}}
+
- - {{localize "midgard5.brawl"}} - {{data.calc.stats.brawlFw}} - - - - - +
+
{{localize "TYPES.Item.item"}}
+ + + + + + + + + + + + + + + {{#each data.calc.gear.items as |item itemId|}} + + + + + + + + + {{/each}} + +
{{localize "TYPES.Item.item"}}{{localize "midgard5.equipped"}}{{localize "midgard5.item-quantity"}}{{localize "midgard5.item-value"}}
+ {{item.label}} + + {{#if item.equipped}} + + {{/if}} + + + {{item.quantity}} + + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + {{#if item.rollExist}}{{/if}}
+
+
- - - - - - - - - - - {{#each data.calc.gear.defensiveWeapons as |item itemId|}} - - - - - - - {{/each}} +
-
- - - - - +
+
{{localize "TYPES.Item.container"}}
+
{{localize "TYPES.Item.defensiveWeapon"}}{{localize "midgard5.ew"}}
{{item.label}}{{item.calc.ew}}
{{localize "midgard5.defense"}}{{add data.calc.stats.defense.value data.calc.stats.defenseBonus.value}}
+ + + + + + + + + + + + + {{#each data.calc.gear.containers as |item itemId|}} + + + + + + + + {{/each}} + +
{{localize "TYPES.Item.container"}}{{localize "midgard5.equipped"}}{{localize "midgard5.item-value"}}
+ {{item.label}} + + {{#if item.equipped}} + + {{/if}} + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + {{#if item.rollExist}}{{/if}}
+ - - {{localize "midgard5.resistanceMind"}} - {{data.calc.stats.resistanceMind.value}} - - - - - - {{localize "midgard5.resistanceBody"}} - {{data.calc.stats.resistanceBody.value}} - - - - - - - - - - - - - - - - - - - - - {{#each data.calc.gear.armor as |item itemId|}} - - - - - - - - - - - {{/each}} - -
{{localize "TYPES.Item.armor"}}{{localize "midgard5.actor-lp-short"}}{{localize "midgard5.actor-ap-short"}}{{localize "midgard5.attackBonus-short"}}{{localize "midgard5.defenseBonus-short"}}BGw
- {{item.label}} - {{#if item.equipped}} - {{localize "midgard5.equipped"}} - {{/if}} - {{actorItemValue ../actor._id itemId "lpProtection" ../actor.isToken}}{{actorItemValue ../actor._id itemId "apProtection"}}{{actorItemValue ../actor._id itemId "stats.attackBonus"}}{{actorItemValue ../actor._id itemId "stats.defenseBonus"}}{{actorItemValue ../actor._id itemId "stats.movementBonus"}}{{actorItemValue ../actor._id itemId "attributeMod.gw"}}
- - - - - - - - - - - - - - {{#each data.calc.gear.items as |item itemId|}} - - - - - - - - {{/each}} - -
{{localize "TYPES.Item.item"}}{{localize "midgard5.item-quantity"}}{{localize "midgard5.item-value"}}
- {{item.label}} - {{#if item.equipped}} - {{localize "midgard5.equipped"}} - {{/if}} - - - {{item.quantity}} - - - {{#unless (or (eq item.value 0) (eq item.currency ""))}} - {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} - {{/unless}} - {{#if item.rollExist}}{{/if}}
+ {{#each data.calc.gear.containers as |container containerId|}} +
+
{{container.label}}
+ + + + + + + + + + + + + + + + {{#each ../data.calc.gear.items as |item itemId|}} + {{#if (eq item.containerId containerId)}} + + + + + + + + + + {{/if}} + {{/each}} + +
{{localize "TYPES.Item.item"}}{{localize "midgard5.equipped"}}{{localize "TYPES.Item.container"}}{{localize "midgard5.item-quantity"}}{{localize "midgard5.item-value"}}
+ {{item.label}} + + {{#if item.equipped}} + + {{/if}} + + {{localize "TYPES.Item.container"}} + + + {{item.quantity}} + + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + {{#if item.rollExist}}{{/if}}
+
+ {{/each}} + + \ No newline at end of file diff --git a/templates/sheets/character/kampfkuenste.hbs b/templates/sheets/character/kampfkuenste.hbs index 4662b34..c1e7cf8 100644 --- a/templates/sheets/character/kampfkuenste.hbs +++ b/templates/sheets/character/kampfkuenste.hbs @@ -30,4 +30,107 @@ {{/each}} + + + + + + + + + + + + {{#each data.calc.gear.weapons as |item itemId|}} + + + + + + + {{/each}} + + + + + + + + +
{{localize "TYPES.Item.weapon"}}{{localize "midgard5.ew"}}
{{item.label}}{{item.calc.ew}}
{{localize "midgard5.brawl"}}{{data.calc.stats.brawlFw}}
+ + + + + + + + + + + + {{#each data.calc.gear.defensiveWeapons as |item itemId|}} + + + + + + + {{/each}} + + + + + + + + + + + + + + + + + + + + + + +
{{localize "TYPES.Item.defensiveWeapon"}}{{localize "midgard5.ew"}}
{{item.label}}{{item.calc.ew}}
{{localize "midgard5.defense"}}{{add data.calc.stats.defense.value data.calc.stats.defenseBonus.value}}
{{localize "midgard5.resistanceMind"}}{{data.calc.stats.resistanceMind.value}}
{{localize "midgard5.resistanceBody"}}{{data.calc.stats.resistanceBody.value}}
+ + + + + + + + + + + + + + + + {{#each data.calc.gear.armor as |item itemId|}} + + + + + + + + + + + {{/each}} +
{{localize "TYPES.Item.armor"}}{{localize "midgard5.actor-lp-short"}}{{localize "midgard5.actor-ap-short"}}{{localize "midgard5.attackBonus-short"}}{{localize "midgard5.defenseBonus-short"}}BGw
+ {{item.label}} + {{#if item.equipped}} + {{localize "midgard5.equipped"}} + {{/if}} + {{actorItemValue ../actor._id itemId "lpProtection" ../actor.isToken}}{{actorItemValue ../actor._id itemId "apProtection"}}{{actorItemValue ../actor._id itemId "stats.attackBonus"}}{{actorItemValue ../actor._id itemId "stats.defenseBonus"}}{{actorItemValue ../actor._id itemId "stats.movementBonus"}}{{actorItemValue ../actor._id itemId "attributeMod.gw"}}
\ No newline at end of file diff --git a/templates/sheets/character/main.hbs b/templates/sheets/character/main.hbs index 1a46ce5..a250aaa 100644 --- a/templates/sheets/character/main.hbs +++ b/templates/sheets/character/main.hbs @@ -15,7 +15,7 @@ - + diff --git a/templates/sheets/item/container.hbs b/templates/sheets/item/container.hbs new file mode 100644 index 0000000..2add63f --- /dev/null +++ b/templates/sheets/item/container.hbs @@ -0,0 +1,55 @@ +
+
+ +

+
+
+ + + + + + + + + + +
+
+ + + + + + + + +
+
+
+ {{localize "midgard5.item-quantity"}} + +
+
+
+ {{localize "midgard5.item-value"}} + + +
+
+ + {{> "systems/midgard5/templates/sheets/item/rolls.hbs"}} + + {{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}} + + + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
+
\ No newline at end of file diff --git a/templates/sheets/item/item.hbs b/templates/sheets/item/item.hbs index 2add63f..f91f011 100644 --- a/templates/sheets/item/item.hbs +++ b/templates/sheets/item/item.hbs @@ -43,6 +43,26 @@ + + + +
+ {{localize "TYPES.Item.container"}} + {{#if data.calc.containers}} + + {{else}} + {{localize "midgard5.assignItemToCharacter"}} + {{/if}} +
+ + {{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}