Fixed Items on Charactersheet (now opening again thanx Byroks)

+ Added missing Currency & Weight for several items
+ Added Weight on Gearsheet for Weapons, Defensive Weapons and Armor
This commit is contained in:
LeFrique 2024-02-06 17:19:56 +01:00
parent a7d79d921b
commit 9e17887167
2 changed files with 34 additions and 10 deletions

View File

@ -204,7 +204,7 @@ export class M5Character extends Actor {
ret.stats.heavyLoad = M5Character.heavyLoadValue(data.attributes.st); ret.stats.heavyLoad = M5Character.heavyLoadValue(data.attributes.st);
ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st); ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st);
ret.stats.thrustLoad = M5Character.thrustLoadValue(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; // let loadMessage = false;
@ -288,10 +288,10 @@ export class M5Character extends Actor {
label += "*"; label += "*";
} }
if (item.system.valuable) { 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) { 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) { 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)); ret.stats.encumbrance += parseFloat((item.system.weight * item.system.quantity).toPrecision(3));
} }
} else if (item.system.equipped) { } 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; let icon = item.img;
@ -348,10 +348,10 @@ export class M5Character extends Actor {
")"; ")";
} }
if (item.system.valuable) { 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) { 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) { if (!!item.system.containerId) {
ret.gear.containers[item.system.containerId].weight += item.system.weight; ret.gear.containers[item.system.containerId].weight += item.system.weight;
@ -369,10 +369,12 @@ export class M5Character extends Actor {
valuable: item.system?.valuable, valuable: item.system?.valuable,
hoarded: item.system?.hoarded, hoarded: item.system?.hoarded,
value: item.system.value || 0, value: item.system.value || 0,
currency: item.system.currency || "",
calc: item.system.calc, calc: item.system.calc,
special: item.system.special, special: item.system.special,
damageBase: item.system.damageBase, damageBase: item.system.damageBase,
equipped: item.system?.equipped, equipped: item.system?.equipped,
weight: item.system.weight || 0,
containerId: item.system.containerId || "", containerId: item.system.containerId || "",
}; };
}); });
@ -387,10 +389,10 @@ export class M5Character extends Actor {
label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")"; label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")";
} }
if (item.system.valuable) { 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) { 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) { if (!!item.system.containerId) {
ret.gear.containers[item.system.containerId].weight += item.system.weight; ret.gear.containers[item.system.containerId].weight += item.system.weight;
@ -408,9 +410,11 @@ export class M5Character extends Actor {
valuable: item.system?.valuable, valuable: item.system?.valuable,
hoarded: item.system?.hoarded, hoarded: item.system?.hoarded,
value: item.system.value || 0, value: item.system.value || 0,
currency: item.system.currency || "",
defenseBonus: item.system.stats.defenseBonus, defenseBonus: item.system.stats.defenseBonus,
calc: item.system.calc, calc: item.system.calc,
equipped: item.system?.equipped, equipped: item.system?.equipped,
weight: item.system.weight || 0,
containerId: item.system.containerId || "", containerId: item.system.containerId || "",
}; };
}); });
@ -425,10 +429,10 @@ export class M5Character extends Actor {
label += "*"; label += "*";
} }
if (item.system.valuable) { 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) { 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) { if (!!item.system.containerId) {
ret.gear.containers[item.system.containerId].weight += item.system.weight; ret.gear.containers[item.system.containerId].weight += item.system.weight;
@ -447,9 +451,11 @@ export class M5Character extends Actor {
valuable: item.system?.valuable, valuable: item.system?.valuable,
hoarded: item.system?.hoarded, hoarded: item.system?.hoarded,
value: item.system.value || 0, value: item.system.value || 0,
currency: item.system.currency || "",
lpProtection: item.system.lpProtection, lpProtection: item.system.lpProtection,
calc: item.system.calc, calc: item.system.calc,
equipped: item.system?.equipped, equipped: item.system?.equipped,
weight: item.system.weight || 0,
containerId: item.system.containerId || "", containerId: item.system.containerId || "",
}; };
}); });

View File

@ -95,6 +95,7 @@
<tr> <tr>
<th class="title">{{localize "TYPES.Item.weapon"}}</th> <th class="title">{{localize "TYPES.Item.weapon"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-weapon"><i class="fa-regular fa-plus"></i></th> <th class="title add-weapon"><i class="fa-regular fa-plus"></i></th>
@ -109,6 +110,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="change-equipped"> <td class="change-equipped">
{{#if item.equipped}} {{#if item.equipped}}
<i class="fa-solid fa-circle-check"></i> <i class="fa-solid fa-circle-check"></i>
@ -130,6 +136,7 @@
<tr> <tr>
<th class="title">{{localize "TYPES.Item.defensiveWeapon"}}</th> <th class="title">{{localize "TYPES.Item.defensiveWeapon"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-defensiveWeapon"><i class="fa-regular fa-plus"></i></th> <th class="title add-defensiveWeapon"><i class="fa-regular fa-plus"></i></th>
</tr> </tr>
@ -143,6 +150,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="change-equipped"> <td class="change-equipped">
{{#if item.equipped}} {{#if item.equipped}}
<i class="fa-solid fa-circle-check"></i> <i class="fa-solid fa-circle-check"></i>
@ -164,6 +176,7 @@
<tr> <tr>
<th class="title">{{localize "TYPES.Item.armor"}}</th> <th class="title">{{localize "TYPES.Item.armor"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-armor"><i class="fa-regular fa-plus"></i></th> <th class="title add-armor"><i class="fa-regular fa-plus"></i></th>
</tr> </tr>
@ -177,6 +190,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="change-equipped"> <td class="change-equipped">
{{#if item.equipped}} {{#if item.equipped}}
<i class="fa-solid fa-circle-check"></i> <i class="fa-solid fa-circle-check"></i>