pf2e-sage-stats 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +5 -4
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -656,11 +656,12 @@ const formatTracker = (tracker) => {
|
|
|
656
656
|
var _a, _b;
|
|
657
657
|
const aliasSpace = (t) => (t.alias.length > 0 ? 0 : 5);
|
|
658
658
|
const nameLengthWithAlias = (t) => t.name.length - aliasSpace(t);
|
|
659
|
-
const
|
|
659
|
+
const chars = [...tracker.chars];
|
|
660
|
+
const nameLength = chars.reduce((p, c) => {
|
|
660
661
|
const length = c.children.reduce((pp, cc) => pp > nameLengthWithAlias(cc) ? pp : nameLengthWithAlias(cc), nameLengthWithAlias(c));
|
|
661
662
|
return p > length ? p : length;
|
|
662
663
|
}, 0);
|
|
663
|
-
const hpLength =
|
|
664
|
+
const hpLength = chars.reduce((p, c) => {
|
|
664
665
|
const hpLength = c.maxhp.toString().length + 1 + c.hp.toString().length + (c.temphp > 1 ? c.temphp.toString().length + 1 : 0);
|
|
665
666
|
const length = c.children.reduce((pp, cc) => {
|
|
666
667
|
const hhpLength = cc.maxhp.toString().length + 1 + cc.hp.toString().length + (cc.temphp > 1 ? cc.temphp.toString().length + 1 : 0);
|
|
@@ -681,9 +682,9 @@ const formatTracker = (tracker) => {
|
|
|
681
682
|
':limping:',
|
|
682
683
|
':dying:',
|
|
683
684
|
].reverse();
|
|
684
|
-
const lines =
|
|
685
|
+
const lines = chars.sort((a, b) => (a.init === b.init) ? (b.foe ? 1 : 0) - (a.foe ? 1 : 0) : b.init - a.init).flatMap((char, index) => {
|
|
685
686
|
const ls = [];
|
|
686
|
-
if (
|
|
687
|
+
if (chars[index - 1] && chars[index - 1].foe !== char.foe) {
|
|
687
688
|
ls.push('');
|
|
688
689
|
}
|
|
689
690
|
const hp = !char.foe && char.hp > 0 ? (`${char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}/${char.maxhp}`.padStart(hpLength)) : char.hp > 0 ? (`-${char.maxhp - char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}`.padStart(hpLength)) : (`${char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}`.padStart(hpLength));
|