pf2e-sage-stats 0.4.1 → 0.4.3
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.d.ts +4 -2
- package/dist/app.js +101 -54
- package/package.json +1 -1
package/dist/app.d.ts
CHANGED
|
@@ -733,13 +733,13 @@ export type TrackerCommand = {
|
|
|
733
733
|
command: 'title';
|
|
734
734
|
title: string;
|
|
735
735
|
} | {
|
|
736
|
-
command: '
|
|
736
|
+
command: 'map-text';
|
|
737
737
|
mapText: string;
|
|
738
738
|
} | {
|
|
739
739
|
command: 'map';
|
|
740
740
|
map: string;
|
|
741
741
|
} | {
|
|
742
|
-
command: '
|
|
742
|
+
command: 'round-text';
|
|
743
743
|
roundText: string;
|
|
744
744
|
} | {
|
|
745
745
|
command: 'round';
|
|
@@ -754,6 +754,8 @@ export type TrackerCommand = {
|
|
|
754
754
|
command: 'reset';
|
|
755
755
|
} | {
|
|
756
756
|
command: 'purge';
|
|
757
|
+
} | {
|
|
758
|
+
command: 'expire';
|
|
757
759
|
} | {
|
|
758
760
|
command: 'blank';
|
|
759
761
|
} | {
|
package/dist/app.js
CHANGED
|
@@ -622,26 +622,28 @@ const formatHP = (arg) => {
|
|
|
622
622
|
};
|
|
623
623
|
exports.formatHP = formatHP;
|
|
624
624
|
const newtracker = (status, desc) => {
|
|
625
|
-
var _a, _b;
|
|
626
|
-
const regex = /((
|
|
625
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
626
|
+
const regex = /(([^[(\n]+)\s+(?:\[(\S+)\]\s+)?\((\d+)\/(\d+)\s+HP\):[^\S\n]*([^\n]*)(\n>\s*([^[(\n]+)\s+(?:\[(\S+)\]\s+)?\((\d+)\/(\d+)\s+HP\):[^\S\n]*([^\n]*))*)/gm;
|
|
627
627
|
const match = status.match(regex);
|
|
628
628
|
const tracker = zod_1.default.array(exports.charSchema).parse([]);
|
|
629
629
|
for (const m of match !== null && match !== void 0 ? match : []) {
|
|
630
|
-
const mmatch = m.match(
|
|
631
|
-
const cmatch = m.match(/>\s+(\S+)\s
|
|
630
|
+
const mmatch = m.match(/^([^[(\n]+)\s+(?:\[(\S+)\]\s+)?\((\d+)\/(\d+)\s+HP\):[^\S\n]*([^\n]*)/);
|
|
631
|
+
const cmatch = m.match(/>\s*([^[(\n]+)\s+(?:\[(\S+)\]\s+)?\((\d+)\/(\d+)\s+HP\):[^\S\n]*([^\n]*)/g);
|
|
632
632
|
const char = exports.charSchema.parse({
|
|
633
|
-
name: mmatch === null || mmatch === void 0 ? void 0 : mmatch[1],
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
633
|
+
name: (_a = mmatch === null || mmatch === void 0 ? void 0 : mmatch[1]) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
634
|
+
alias: (_b = mmatch === null || mmatch === void 0 ? void 0 : mmatch[2]) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
635
|
+
hp: (_c = mmatch === null || mmatch === void 0 ? void 0 : mmatch[3]) === null || _c === void 0 ? void 0 : _c.trim(),
|
|
636
|
+
maxhp: (_d = mmatch === null || mmatch === void 0 ? void 0 : mmatch[4]) === null || _d === void 0 ? void 0 : _d.trim(),
|
|
637
|
+
conditions: (_e = mmatch === null || mmatch === void 0 ? void 0 : mmatch[5]) === null || _e === void 0 ? void 0 : _e.trim(),
|
|
637
638
|
});
|
|
638
639
|
for (const c of cmatch !== null && cmatch !== void 0 ? cmatch : []) {
|
|
639
|
-
const fmatch = c.match(/>\s+(\S+)\s
|
|
640
|
+
const fmatch = c.match(/>\s*([^[(\n]+)\s+(?:\[(\S+)\]\s+)?\((\d+)\/(\d+)\s+HP\):[^\S\n]*([^\n]*)/);
|
|
640
641
|
const child = childSchema.parse({
|
|
641
|
-
name: fmatch === null || fmatch === void 0 ? void 0 : fmatch[1],
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
642
|
+
name: (_f = fmatch === null || fmatch === void 0 ? void 0 : fmatch[1]) === null || _f === void 0 ? void 0 : _f.trim(),
|
|
643
|
+
alias: (_g = fmatch === null || fmatch === void 0 ? void 0 : fmatch[2]) === null || _g === void 0 ? void 0 : _g.trim(),
|
|
644
|
+
hp: (_h = fmatch === null || fmatch === void 0 ? void 0 : fmatch[3]) === null || _h === void 0 ? void 0 : _h.trim(),
|
|
645
|
+
maxhp: (_j = fmatch === null || fmatch === void 0 ? void 0 : fmatch[4]) === null || _j === void 0 ? void 0 : _j.trim(),
|
|
646
|
+
conditions: (_k = fmatch === null || fmatch === void 0 ? void 0 : fmatch[5]) === null || _k === void 0 ? void 0 : _k.trim(),
|
|
645
647
|
});
|
|
646
648
|
char.children.push(child);
|
|
647
649
|
}
|
|
@@ -709,32 +711,36 @@ const formatTracker = (tracker) => {
|
|
|
709
711
|
}
|
|
710
712
|
if (tracker.title || tracker.round) {
|
|
711
713
|
lines.unshift('');
|
|
712
|
-
lines.unshift(
|
|
714
|
+
lines.unshift([
|
|
715
|
+
'##',
|
|
716
|
+
...(tracker.title ? [tracker.title] : []),
|
|
717
|
+
...(tracker.round ? [`${(_b = tracker.roundText) !== null && _b !== void 0 ? _b : 'Round'} ${tracker.round}`] : [])
|
|
718
|
+
].join(' '));
|
|
713
719
|
}
|
|
714
720
|
lines.push(':spacer:');
|
|
715
721
|
return lines.join('\n');
|
|
716
722
|
};
|
|
717
723
|
exports.formatTracker = formatTracker;
|
|
718
724
|
const trackerCommands = [{
|
|
719
|
-
regex: /^\s*title\s+(?:([^"]+)|"([^"]*)")/i,
|
|
725
|
+
regex: /^\s*title\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
720
726
|
map: (match) => { var _a; return ({ command: 'title', title: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
721
727
|
}, {
|
|
722
|
-
regex: /^\s*
|
|
723
|
-
map: (match) => { var _a; return ({ command: '
|
|
728
|
+
regex: /^\s*map-text\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
729
|
+
map: (match) => { var _a; return ({ command: 'map-text', mapText: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
724
730
|
}, {
|
|
725
|
-
regex: /^\s*map\s+(?:([^"]+)|"([^"]*)")/i,
|
|
731
|
+
regex: /^\s*map\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
726
732
|
map: (match) => { var _a; return ({ command: 'map', map: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
727
733
|
}, {
|
|
728
|
-
regex: /^\s*
|
|
729
|
-
map: (match) => { var _a; return ({ command: '
|
|
734
|
+
regex: /^\s*round-text\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
735
|
+
map: (match) => { var _a; return ({ command: 'round-text', roundText: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
730
736
|
}, {
|
|
731
|
-
regex: /^\s*round\s+(?:([^"]+)|"([^"]*)")/i,
|
|
737
|
+
regex: /^\s*round\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
732
738
|
map: (match) => { var _a; return ({ command: 'round', round: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
733
739
|
}, {
|
|
734
|
-
regex: /^\s*desc\s+(?:([^"]+)|"([^"]*)")/i,
|
|
740
|
+
regex: /^\s*(?:desc|description)\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
735
741
|
map: (match) => { var _a; return ({ command: 'desc', description: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }); },
|
|
736
742
|
}, {
|
|
737
|
-
regex: /^\s*
|
|
743
|
+
regex: /^\s*(?:b|block)\s*(\d+)/i,
|
|
738
744
|
map: (match) => { var _a; return ({ command: 'block', index: parseInt((_a = match[1]) !== null && _a !== void 0 ? _a : '', 10) }); },
|
|
739
745
|
}, {
|
|
740
746
|
regex: /^\s*reset/i,
|
|
@@ -743,19 +749,22 @@ const trackerCommands = [{
|
|
|
743
749
|
regex: /^\s*purge/i,
|
|
744
750
|
map: () => ({ command: 'purge' }),
|
|
745
751
|
}, {
|
|
746
|
-
regex: /^\s*blank/i,
|
|
752
|
+
regex: /^\s*(?:blank|blanc|clear)/i,
|
|
747
753
|
map: () => ({ command: 'blank' }),
|
|
748
754
|
}, {
|
|
749
|
-
regex: /^\s*
|
|
755
|
+
regex: /^\s*expire/i,
|
|
756
|
+
map: () => ({ command: 'expire' }),
|
|
757
|
+
}, {
|
|
758
|
+
regex: /^\s*foe\s+(?:([^"\s]+)|"([^"]*)")\s+(\S+)\s+(\d+)/i,
|
|
750
759
|
map: (match) => { var _a; return ({ command: 'foe', name: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2], alias: match[3], hp: parseInt(match[4], 10) }); },
|
|
751
760
|
}, {
|
|
752
|
-
regex: /^\s*friend\s+(?:([^"]+)|"([^"]*)")\s+(\S+)\s+(\d+)/i,
|
|
761
|
+
regex: /^\s*friend\s+(?:([^"\s]+)|"([^"]*)")\s+(\S+)\s+(\d+)/i,
|
|
753
762
|
map: (match) => { var _a; return ({ command: 'friend', name: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2], alias: match[3], hp: parseInt(match[4], 10) }); },
|
|
754
763
|
}, {
|
|
755
|
-
regex: /^\s*child\s+(\S+)\s+(?:([^"]+)|"([^"]*)")\s+(\S+)\s+(\d+)/i,
|
|
764
|
+
regex: /^\s*child\s+(\S+)\s+(?:([^"\s]+)|"([^"]*)")\s+(\S+)\s+(\d+)/i,
|
|
756
765
|
map: (match) => { var _a; return ({ command: 'child', tag: match[1], name: (_a = match[2]) !== null && _a !== void 0 ? _a : match[3], alias: match[4], hp: parseInt(match[5], 10) }); },
|
|
757
766
|
}, {
|
|
758
|
-
regex: /^\s*name\s+(\S+)\s+(?:([^"]+)|"([^"]*)")/i,
|
|
767
|
+
regex: /^\s*name\s+(\S+)\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
759
768
|
map: (match) => { var _a; return ({ command: 'name', tag: match[1], name: (_a = match[2]) !== null && _a !== void 0 ? _a : match[3] }); },
|
|
760
769
|
}, {
|
|
761
770
|
regex: /^\s*alias\s+(\S+)\s+(\S+)/i,
|
|
@@ -770,36 +779,51 @@ const trackerCommands = [{
|
|
|
770
779
|
regex: /^\s*exit/i,
|
|
771
780
|
map: () => ({ command: 'exit' }),
|
|
772
781
|
}, {
|
|
773
|
-
regex: /^\s*([^\
|
|
782
|
+
regex: /^\s*([^\s="+-]+)\s*([+-]\d+)/,
|
|
783
|
+
map: (match) => {
|
|
784
|
+
var _a, _b;
|
|
785
|
+
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
786
|
+
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
787
|
+
return { command: 'mod-hp', tag, value: parseInt(raw, 10) };
|
|
788
|
+
},
|
|
789
|
+
}, {
|
|
790
|
+
regex: /^\s*([^\s="+-]+)(?:\s+|\s*=)(\d+)/,
|
|
774
791
|
map: (match) => {
|
|
775
792
|
var _a, _b;
|
|
776
793
|
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
777
794
|
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
778
|
-
if (raw.match(/^[+-]/)) {
|
|
779
|
-
return { command: 'mod-hp', tag, value: parseInt(raw, 10) };
|
|
780
|
-
}
|
|
781
795
|
return { command: 'set-hp', tag, value: parseInt(raw, 10) };
|
|
782
796
|
},
|
|
783
797
|
}, {
|
|
784
|
-
regex: /^\s*(
|
|
798
|
+
regex: /^\s*([^\s="+-]+)\s+[tT]\s*([+-]\d+)/,
|
|
799
|
+
map: (match) => {
|
|
800
|
+
var _a, _b;
|
|
801
|
+
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
802
|
+
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
803
|
+
return { command: 'mod-thp', tag, value: parseInt(raw, 10) };
|
|
804
|
+
},
|
|
805
|
+
}, {
|
|
806
|
+
regex: /^\s*([^\s="+-]+)\s+[tT]\s*=?(\d+)/,
|
|
785
807
|
map: (match) => {
|
|
786
808
|
var _a, _b;
|
|
787
809
|
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
788
810
|
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
789
|
-
if (raw.match(/^[+-]/)) {
|
|
790
|
-
return { command: 'mod-thp', tag, value: parseInt(raw, 10) };
|
|
791
|
-
}
|
|
792
811
|
return { command: 'set-thp', tag, value: parseInt(raw, 10) };
|
|
793
812
|
},
|
|
794
813
|
}, {
|
|
795
|
-
regex: /^\s*(
|
|
814
|
+
regex: /^\s*([^\s="+-]+)\s+[iI]\s*([+-]\d+)/,
|
|
815
|
+
map: (match) => {
|
|
816
|
+
var _a, _b;
|
|
817
|
+
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
818
|
+
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
819
|
+
return { command: 'mod-init', tag, value: parseInt(raw, 10) };
|
|
820
|
+
},
|
|
821
|
+
}, {
|
|
822
|
+
regex: /^\s*([^\s="+-]+)\s+[iI]\s*=?(\d+)/,
|
|
796
823
|
map: (match) => {
|
|
797
824
|
var _a, _b;
|
|
798
825
|
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
799
826
|
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
800
|
-
if (raw.match(/^[+-]/)) {
|
|
801
|
-
return { command: 'mod-init', tag, value: parseInt(raw, 10) };
|
|
802
|
-
}
|
|
803
827
|
return { command: 'set-init', tag, value: parseInt(raw, 10) };
|
|
804
828
|
},
|
|
805
829
|
}, {
|
|
@@ -818,34 +842,49 @@ const trackerCommands = [{
|
|
|
818
842
|
regex: /^\s*([^\s="+-]+)\s*-"([^"]*)"/,
|
|
819
843
|
map: (match) => { var _a, _b; return ({ command: 'rem-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
820
844
|
}, {
|
|
821
|
-
regex: /^\s*(
|
|
845
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*=?"([^"]*)"/,
|
|
822
846
|
map: (match) => { var _a, _b; return ({ command: 'set-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
823
847
|
}, {
|
|
824
|
-
regex: /^\s*(
|
|
848
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*\+\+"([^"]*)"/,
|
|
825
849
|
map: (match) => { var _a, _b; return ({ command: 'inc-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
826
850
|
}, {
|
|
827
|
-
regex: /^\s*(
|
|
851
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*--"([^"]*)"/,
|
|
828
852
|
map: (match) => { var _a, _b; return ({ command: 'dec-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
829
853
|
}, {
|
|
830
|
-
regex: /^\s*(
|
|
854
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*\+"([^"]*)"/,
|
|
831
855
|
map: (match) => { var _a, _b; return ({ command: 'add-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
832
856
|
}, {
|
|
833
|
-
regex: /^\s*(
|
|
857
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*-"([^"]*)"/,
|
|
834
858
|
map: (match) => { var _a, _b; return ({ command: 'rem-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
835
859
|
}, {
|
|
836
|
-
regex: /^\s*([^\s
|
|
860
|
+
regex: /^\s*([^\s="+-]+)\s*=(\S+)/,
|
|
837
861
|
map: (match) => { var _a, _b; return ({ command: 'set-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
838
862
|
}, {
|
|
839
|
-
regex: /^\s*([^\s
|
|
863
|
+
regex: /^\s*([^\s="+-]+)\s*\+\+(\S+)/,
|
|
840
864
|
map: (match) => { var _a, _b; return ({ command: 'inc-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
841
865
|
}, {
|
|
842
|
-
regex: /^\s*([^\s
|
|
866
|
+
regex: /^\s*([^\s="+-]+)\s*--(\S+)/,
|
|
843
867
|
map: (match) => { var _a, _b; return ({ command: 'dec-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
844
868
|
}, {
|
|
845
|
-
regex: /^\s*([^\s
|
|
869
|
+
regex: /^\s*([^\s="+-]+)\s*\+(\S+)/,
|
|
846
870
|
map: (match) => { var _a, _b; return ({ command: 'add-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
847
871
|
}, {
|
|
848
|
-
regex: /^\s*([^\s
|
|
872
|
+
regex: /^\s*([^\s="+-]+)\s*-(\S+)/,
|
|
873
|
+
map: (match) => { var _a, _b; return ({ command: 'rem-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
874
|
+
}, {
|
|
875
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*=(\S+)/,
|
|
876
|
+
map: (match) => { var _a, _b; return ({ command: 'set-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
877
|
+
}, {
|
|
878
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*\+\+(\S+)/,
|
|
879
|
+
map: (match) => { var _a, _b; return ({ command: 'inc-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
880
|
+
}, {
|
|
881
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*--(\S+)/,
|
|
882
|
+
map: (match) => { var _a, _b; return ({ command: 'dec-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
883
|
+
}, {
|
|
884
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*\+(\S+)/,
|
|
885
|
+
map: (match) => { var _a, _b; return ({ command: 'add-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
886
|
+
}, {
|
|
887
|
+
regex: /^\s*([^\s="+-]+)\s+[sS]\s*-(\S+)/,
|
|
849
888
|
map: (match) => { var _a, _b; return ({ command: 'rem-conditions', tag: (_a = match[1]) !== null && _a !== void 0 ? _a : '', value: (_b = match[2]) !== null && _b !== void 0 ? _b : '' }); },
|
|
850
889
|
}, {
|
|
851
890
|
regex: /^\s*(\S+)\s+[cC]/,
|
|
@@ -969,6 +1008,14 @@ const applyTrackerCommand = (tracker, action) => {
|
|
|
969
1008
|
...tracker,
|
|
970
1009
|
chars: tracker.chars.filter((entry) => !entry.foe),
|
|
971
1010
|
};
|
|
1011
|
+
case 'expire':
|
|
1012
|
+
tracker.chars.forEach((char) => {
|
|
1013
|
+
char.temphp = 0;
|
|
1014
|
+
char.children.forEach((child) => {
|
|
1015
|
+
child.temphp = 0;
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
1018
|
+
return tracker;
|
|
972
1019
|
case 'heal':
|
|
973
1020
|
tracker.chars.forEach((char) => {
|
|
974
1021
|
char.hp = char.maxhp;
|
|
@@ -1025,10 +1072,10 @@ const applyTrackerCommand = (tracker, action) => {
|
|
|
1025
1072
|
updateConditions(tracker, action.tag, (conditions) => conditions.filter((condition) => !condition.includes(action.value.toLowerCase().trim())));
|
|
1026
1073
|
return tracker;
|
|
1027
1074
|
case 'inc-conditions':
|
|
1028
|
-
updateConditions(tracker, action.tag, (conditions) => conditions.map((condition) => (numberedCondition(condition, action.value.toLowerCase().trim(), (label, value) => `${label} ${value + 1}`))));
|
|
1075
|
+
updateConditions(tracker, action.tag, (conditions) => conditions.map((condition) => (numberedCondition(condition, action.value.toLowerCase().trim(), (label, value) => `${label} ${value + 1}`))).filter((c) => c !== null));
|
|
1029
1076
|
return tracker;
|
|
1030
1077
|
case 'dec-conditions':
|
|
1031
|
-
updateConditions(tracker, action.tag, (conditions) => conditions.map((condition) => (numberedCondition(condition, action.value.toLowerCase().trim(), (label, value) => (value > 1 ? `${label} ${value - 1}` :
|
|
1078
|
+
updateConditions(tracker, action.tag, (conditions) => conditions.map((condition) => (numberedCondition(condition, action.value.toLowerCase().trim(), (label, value) => (value > 1 ? `${label} ${value - 1}` : null)))).filter((c) => c !== null));
|
|
1032
1079
|
return tracker;
|
|
1033
1080
|
case 'mod-thp': {
|
|
1034
1081
|
const item = findCharacterOrChild(tracker, action.tag);
|
|
@@ -1099,13 +1146,13 @@ const applyTrackerCommand = (tracker, action) => {
|
|
|
1099
1146
|
case 'title':
|
|
1100
1147
|
tracker.title = action.title;
|
|
1101
1148
|
return tracker;
|
|
1102
|
-
case '
|
|
1149
|
+
case 'map-text':
|
|
1103
1150
|
tracker.mapText = action.mapText;
|
|
1104
1151
|
return tracker;
|
|
1105
1152
|
case 'map':
|
|
1106
1153
|
tracker.map = action.map;
|
|
1107
1154
|
return tracker;
|
|
1108
|
-
case '
|
|
1155
|
+
case 'round-text':
|
|
1109
1156
|
tracker.roundText = action.roundText;
|
|
1110
1157
|
return tracker;
|
|
1111
1158
|
case 'round':
|