diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 61d05fe..4c224ce 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -204,7 +204,7 @@ export class M5Character extends Actor { ret.stats.heavyLoad = M5Character.heavyLoadValue(data.attributes.st); ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st); ret.stats.thrustLoad = M5Character.thrustLoadValue(data.attributes.st); - ret.stats.encumbrance = 0; + ret.stats.encumbrance = parseFloat((0).toPrecision(3)); // let loadMessage = false; @@ -288,10 +288,10 @@ export class M5Character extends Actor { label += "*"; } if (item.system.valuable) { - ret.stats.wealth += parseFloat((this.calculateValue(item.system.value, item.system.currency) * (item.system.quantity)).toPrecision(3)); + ret.stats.wealth += parseFloat((this.calculateValue(item.system.value * item.system.quantity, item.system.currency)).toPrecision(3)); } if (item.system.hoarded) { - ret.stats.hoard += parseFloat((this.calculateValue(item.system.value, item.system.currency) * (item.system.quantity)).toPrecision(3)); + ret.stats.hoard += parseFloat((this.calculateValue(item.system.value * item.system.quantity, item.system.currency)).toPrecision(3)); } if (!!item.system.containerId) { @@ -300,7 +300,7 @@ export class M5Character extends Actor { ret.stats.encumbrance += parseFloat((item.system.weight * item.system.quantity).toPrecision(3)); } } else if (item.system.equipped) { - ret.stats.encumbrance += parseFloat(((item.system.weight || 0) * (item.system.quantity)).toPrecision(3)); + ret.stats.encumbrance += parseFloat((item.system.weight * item.system.quantity).toPrecision(3)); } let icon = item.img; @@ -348,10 +348,10 @@ export class M5Character extends Actor { ")"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (!!item.system.containerId) { ret.gear.containers[item.system.containerId].weight += item.system.weight; @@ -369,10 +369,12 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", calc: item.system.calc, special: item.system.special, damageBase: item.system.damageBase, equipped: item.system?.equipped, + weight: item.system.weight || 0, containerId: item.system.containerId || "", }; }); @@ -387,10 +389,10 @@ export class M5Character extends Actor { label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (!!item.system.containerId) { ret.gear.containers[item.system.containerId].weight += item.system.weight; @@ -408,9 +410,11 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", defenseBonus: item.system.stats.defenseBonus, calc: item.system.calc, equipped: item.system?.equipped, + weight: item.system.weight || 0, containerId: item.system.containerId || "", }; }); @@ -425,10 +429,10 @@ export class M5Character extends Actor { label += "*"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (!!item.system.containerId) { ret.gear.containers[item.system.containerId].weight += item.system.weight; @@ -447,9 +451,11 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", lpProtection: item.system.lpProtection, calc: item.system.calc, equipped: item.system?.equipped, + weight: item.system.weight || 0, containerId: item.system.containerId || "", }; }); diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index 861a85d..1e984ca 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -95,6 +95,7 @@ {{localize "TYPES.Item.weapon"}} {{localize "midgard5.item-value"}} + {{localize "midgard5.item-weight"}} @@ -109,6 +110,11 @@ {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} {{/unless}} + + {{#unless (or (eq item.weight "") (eq item.equipped?))}} + {{item.weight}} kg + {{/unless}} + {{#if item.equipped}} @@ -130,6 +136,7 @@ {{localize "TYPES.Item.defensiveWeapon"}} {{localize "midgard5.item-value"}} + {{localize "midgard5.item-weight"}} @@ -143,6 +150,11 @@ {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} {{/unless}} + + {{#unless (or (eq item.weight "") (eq item.equipped?))}} + {{item.weight}} kg + {{/unless}} + {{#if item.equipped}} @@ -164,6 +176,7 @@ {{localize "TYPES.Item.armor"}} {{localize "midgard5.item-value"}} + {{localize "midgard5.item-weight"}} @@ -177,6 +190,11 @@ {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} {{/unless}} + + {{#unless (or (eq item.weight "") (eq item.equipped?))}} + {{item.weight}} kg + {{/unless}} + {{#if item.equipped}}