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:
2024-02-06 17:19:56 +01:00
parent a7d79d921b
commit 9e17887167
2 changed files with 34 additions and 10 deletions
+16 -10
View File
@@ -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 || "",
};
});