pf2e-sage-stats 0.4.4 → 0.4.5
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 +3 -3
- package/dist/app.js +61 -85
- package/package.json +1 -1
package/dist/app.d.ts
CHANGED
|
@@ -761,18 +761,18 @@ export type TrackerCommand = {
|
|
|
761
761
|
} | {
|
|
762
762
|
command: 'foe';
|
|
763
763
|
name: string;
|
|
764
|
-
alias
|
|
764
|
+
alias?: string;
|
|
765
765
|
hp: number;
|
|
766
766
|
} | {
|
|
767
767
|
command: 'friend';
|
|
768
768
|
name: string;
|
|
769
|
-
alias
|
|
769
|
+
alias?: string;
|
|
770
770
|
hp: number;
|
|
771
771
|
} | {
|
|
772
772
|
command: 'child';
|
|
773
773
|
tag: string;
|
|
774
774
|
name: string;
|
|
775
|
-
alias
|
|
775
|
+
alias?: string;
|
|
776
776
|
hp: number;
|
|
777
777
|
} | {
|
|
778
778
|
command: 'name';
|
package/dist/app.js
CHANGED
|
@@ -724,187 +724,163 @@ const formatTracker = (tracker) => {
|
|
|
724
724
|
exports.formatTracker = formatTracker;
|
|
725
725
|
const trackerCommands = [{
|
|
726
726
|
regex: /^\s*title\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
727
|
-
map: (match) => { var _a; return
|
|
727
|
+
map: (match) => { var _a; return [{ command: 'title', title: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
728
728
|
}, {
|
|
729
729
|
regex: /^\s*map-text\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
730
|
-
map: (match) => { var _a; return
|
|
730
|
+
map: (match) => { var _a; return [{ command: 'map-text', mapText: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
731
731
|
}, {
|
|
732
732
|
regex: /^\s*map\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
733
|
-
map: (match) => { var _a; return
|
|
733
|
+
map: (match) => { var _a; return [{ command: 'map', map: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
734
734
|
}, {
|
|
735
735
|
regex: /^\s*round-text\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
736
|
-
map: (match) => { var _a; return
|
|
736
|
+
map: (match) => { var _a; return [{ command: 'round-text', roundText: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
737
737
|
}, {
|
|
738
738
|
regex: /^\s*round\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
739
|
-
map: (match) => { var _a; return
|
|
739
|
+
map: (match) => { var _a; return [{ command: 'round', round: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
740
740
|
}, {
|
|
741
741
|
regex: /^\s*(?:desc|description)\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
742
|
-
map: (match) => { var _a; return
|
|
742
|
+
map: (match) => { var _a; return [{ command: 'desc', description: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2] }]; },
|
|
743
743
|
}, {
|
|
744
744
|
regex: /^\s*(?:b|block)\s*(\d+)/i,
|
|
745
|
-
map: (match) => {
|
|
745
|
+
map: (match) => [{ command: 'block', index: parseInt(match[1], 10) }],
|
|
746
746
|
}, {
|
|
747
747
|
regex: /^\s*reset/i,
|
|
748
|
-
map: () =>
|
|
748
|
+
map: () => [{ command: 'reset' }],
|
|
749
749
|
}, {
|
|
750
750
|
regex: /^\s*purge/i,
|
|
751
|
-
map: () =>
|
|
751
|
+
map: () => [{ command: 'purge' }],
|
|
752
752
|
}, {
|
|
753
753
|
regex: /^\s*(?:blank|blanc|clear)/i,
|
|
754
|
-
map: () =>
|
|
754
|
+
map: () => [{ command: 'blank' }],
|
|
755
755
|
}, {
|
|
756
756
|
regex: /^\s*expire/i,
|
|
757
|
-
map: () =>
|
|
757
|
+
map: () => [{ command: 'expire' }],
|
|
758
758
|
}, {
|
|
759
|
-
regex: /^\s*foe\s+(?:([^"\s]+)|"([^"]*)")
|
|
760
|
-
map: (match) => { var _a; return
|
|
759
|
+
regex: /^\s*foe\s+(?:([^"\s]+)|"([^"]*)")(?:\s+(\S+))?\s+(\d+)/i,
|
|
760
|
+
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) }]; },
|
|
761
761
|
}, {
|
|
762
|
-
regex: /^\s*friend\s+(?:([^"\s]+)|"([^"]*)")
|
|
763
|
-
map: (match) => { var _a; return
|
|
762
|
+
regex: /^\s*friend\s+(?:([^"\s]+)|"([^"]*)")(?:\s+(\S+))?\s+(\d+)/i,
|
|
763
|
+
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) }]; },
|
|
764
764
|
}, {
|
|
765
|
-
regex: /^\s*child\s+(\S+)\s+(?:([^"\s]+)|"([^"]*)")
|
|
766
|
-
map: (match) => { var _a; return
|
|
765
|
+
regex: /^\s*child\s+(\S+)\s+(?:([^"\s]+)|"([^"]*)")(?:\s+(\S+))?\s+(\d+)/i,
|
|
766
|
+
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) }]; },
|
|
767
767
|
}, {
|
|
768
768
|
regex: /^\s*name\s+(\S+)\s+(?:([^"\s]+)|"([^"]*)")/i,
|
|
769
|
-
map: (match) => { var _a; return
|
|
769
|
+
map: (match) => { var _a; return [{ command: 'name', tag: match[1], name: (_a = match[2]) !== null && _a !== void 0 ? _a : match[3] }]; },
|
|
770
770
|
}, {
|
|
771
771
|
regex: /^\s*alias\s+(\S+)\s+(\S+)/i,
|
|
772
|
-
map: (match) =>
|
|
772
|
+
map: (match) => [{ command: 'alias', tag: match[1], alias: match[2] }],
|
|
773
773
|
}, {
|
|
774
774
|
regex: /^\s*hp\s+(\S+)\s+(\d+)/i,
|
|
775
|
-
map: (match) =>
|
|
775
|
+
map: (match) => [{ command: 'hp', tag: match[1], hp: parseInt(match[2], 10) }],
|
|
776
776
|
}, {
|
|
777
777
|
regex: /^\s*heal/i,
|
|
778
|
-
map: () =>
|
|
778
|
+
map: () => [{ command: 'heal' }],
|
|
779
779
|
}, {
|
|
780
780
|
regex: /^\s*exit/i,
|
|
781
|
-
map: () =>
|
|
781
|
+
map: () => [{ command: 'exit' }],
|
|
782
782
|
}, {
|
|
783
783
|
regex: /^\s*([^\s="+-]+)\s*([+-]\d+)/,
|
|
784
|
-
map: (match) => {
|
|
785
|
-
var _a, _b;
|
|
786
|
-
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
787
|
-
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
788
|
-
return { command: 'mod-hp', tag, value: parseInt(raw, 10) };
|
|
789
|
-
},
|
|
784
|
+
map: (match) => [{ command: 'mod-hp', tag: match[1], value: parseInt(match[2], 10) }],
|
|
790
785
|
}, {
|
|
791
786
|
regex: /^\s*([^\s="+-]+)(?:\s+|\s*=)(\d+)/,
|
|
792
|
-
map: (match) => {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return { command: 'set-hp', tag, value: parseInt(raw, 10) };
|
|
797
|
-
},
|
|
787
|
+
map: (match) => [{ command: 'set-hp', tag: match[1], value: parseInt(match[2], 10) }],
|
|
788
|
+
}, {
|
|
789
|
+
regex: /^\s*(?:t|temp)((?:\s+([^\s="+-]+)(?:\s+|\s*=)(\d+))+)/i,
|
|
790
|
+
map: (match) => { var _a; return (_a = [...match[1].matchAll(/\s+([^\s="+-]+)(?:\s+|\s*=)(\d+)/g)].map((sub) => ({ command: 'set-thp', tag: sub[1], value: parseInt(sub[2], 10) }))) !== null && _a !== void 0 ? _a : []; },
|
|
798
791
|
}, {
|
|
799
792
|
regex: /^\s*([^\s="+-]+)\s+[tT]\s*([+-]\d+)/,
|
|
800
|
-
map: (match) => {
|
|
801
|
-
var _a, _b;
|
|
802
|
-
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
803
|
-
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
804
|
-
return { command: 'mod-thp', tag, value: parseInt(raw, 10) };
|
|
805
|
-
},
|
|
793
|
+
map: (match) => [{ command: 'mod-thp', tag: match[1], value: parseInt(match[2], 10) }],
|
|
806
794
|
}, {
|
|
807
795
|
regex: /^\s*([^\s="+-]+)\s+[tT]\s*=?(\d+)/,
|
|
808
|
-
map: (match) => {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
return { command: 'set-thp', tag, value: parseInt(raw, 10) };
|
|
813
|
-
},
|
|
796
|
+
map: (match) => [{ command: 'set-thp', tag: match[1], value: parseInt(match[2], 10) }],
|
|
797
|
+
}, {
|
|
798
|
+
regex: /^\s*(?:i|init)((?:\s+([^\s="+-]+)(?:\s+|\s*=)(\d+))+)/i,
|
|
799
|
+
map: (match) => { var _a; return (_a = [...match[1].matchAll(/\s+([^\s="+-]+)(?:\s+|\s*=)(\d+)/g)].map((sub) => ({ command: 'set-init', tag: sub[1], value: parseInt(sub[2], 10) }))) !== null && _a !== void 0 ? _a : []; },
|
|
814
800
|
}, {
|
|
815
801
|
regex: /^\s*([^\s="+-]+)\s+[iI]\s*([+-]\d+)/,
|
|
816
|
-
map: (match) => {
|
|
817
|
-
var _a, _b;
|
|
818
|
-
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
819
|
-
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
820
|
-
return { command: 'mod-init', tag, value: parseInt(raw, 10) };
|
|
821
|
-
},
|
|
802
|
+
map: (match) => [{ command: 'mod-init', tag: match[1], value: parseInt(match[2], 10) }],
|
|
822
803
|
}, {
|
|
823
804
|
regex: /^\s*([^\s="+-]+)\s+[iI]\s*=?(\d+)/,
|
|
824
|
-
map: (match) => {
|
|
825
|
-
var _a, _b;
|
|
826
|
-
const tag = (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
827
|
-
const raw = (_b = match[2]) !== null && _b !== void 0 ? _b : '';
|
|
828
|
-
return { command: 'set-init', tag, value: parseInt(raw, 10) };
|
|
829
|
-
},
|
|
805
|
+
map: (match) => [{ command: 'set-init', tag: match[1], value: parseInt(match[2], 10) }],
|
|
830
806
|
}, {
|
|
831
807
|
regex: /^\s*([^\s="+-]+)\s*=?"([^"]*)"/,
|
|
832
|
-
map: (match) => {
|
|
808
|
+
map: (match) => [{ command: 'set-conditions', tag: match[1], value: match[2] }],
|
|
833
809
|
}, {
|
|
834
810
|
regex: /^\s*([^\s="+-]+)\s*\+\+"([^"]*)"/,
|
|
835
|
-
map: (match) => {
|
|
811
|
+
map: (match) => [{ command: 'inc-conditions', tag: match[1], value: match[2] }],
|
|
836
812
|
}, {
|
|
837
813
|
regex: /^\s*([^\s="+-]+)\s*--"([^"]*)"/,
|
|
838
|
-
map: (match) => {
|
|
814
|
+
map: (match) => [{ command: 'dec-conditions', tag: match[1], value: match[2] }],
|
|
839
815
|
}, {
|
|
840
816
|
regex: /^\s*([^\s="+-]+)\s*\+"([^"]*)"/,
|
|
841
|
-
map: (match) => {
|
|
817
|
+
map: (match) => [{ command: 'add-conditions', tag: match[1], value: match[2] }],
|
|
842
818
|
}, {
|
|
843
819
|
regex: /^\s*([^\s="+-]+)\s*-"([^"]*)"/,
|
|
844
|
-
map: (match) => {
|
|
820
|
+
map: (match) => [{ command: 'rem-conditions', tag: match[1], value: match[2] }],
|
|
845
821
|
}, {
|
|
846
822
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*=?"([^"]*)"/,
|
|
847
|
-
map: (match) => {
|
|
823
|
+
map: (match) => [{ command: 'set-conditions', tag: match[1], value: match[2] }],
|
|
848
824
|
}, {
|
|
849
825
|
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*\+\+"([^"]*)"/,
|
|
850
|
-
map: (match) => {
|
|
826
|
+
map: (match) => [{ command: 'inc-conditions', tag: match[1], value: match[2] }],
|
|
851
827
|
}, {
|
|
852
828
|
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*--"([^"]*)"/,
|
|
853
|
-
map: (match) => {
|
|
829
|
+
map: (match) => [{ command: 'dec-conditions', tag: match[1], value: match[2] }],
|
|
854
830
|
}, {
|
|
855
831
|
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*\+"([^"]*)"/,
|
|
856
|
-
map: (match) => {
|
|
832
|
+
map: (match) => [{ command: 'add-conditions', tag: match[1], value: match[2] }],
|
|
857
833
|
}, {
|
|
858
834
|
regex: /^\s*([^\s="+-]+)\s+[sS]?\s*-"([^"]*)"/,
|
|
859
|
-
map: (match) => {
|
|
835
|
+
map: (match) => [{ command: 'rem-conditions', tag: match[1], value: match[2] }],
|
|
860
836
|
}, {
|
|
861
837
|
regex: /^\s*([^\s="+-]+)\s*=(\S+)/,
|
|
862
|
-
map: (match) => {
|
|
838
|
+
map: (match) => [{ command: 'set-conditions', tag: match[1], value: match[2] }],
|
|
863
839
|
}, {
|
|
864
840
|
regex: /^\s*([^\s="+-]+)\s*\+\+(\S+)/,
|
|
865
|
-
map: (match) => {
|
|
841
|
+
map: (match) => [{ command: 'inc-conditions', tag: match[1], value: match[2] }],
|
|
866
842
|
}, {
|
|
867
843
|
regex: /^\s*([^\s="+-]+)\s*--(\S+)/,
|
|
868
|
-
map: (match) => {
|
|
844
|
+
map: (match) => [{ command: 'dec-conditions', tag: match[1], value: match[2] }],
|
|
869
845
|
}, {
|
|
870
846
|
regex: /^\s*([^\s="+-]+)\s*\+(\S+)/,
|
|
871
|
-
map: (match) => {
|
|
847
|
+
map: (match) => [{ command: 'add-conditions', tag: match[1], value: match[2] }],
|
|
872
848
|
}, {
|
|
873
849
|
regex: /^\s*([^\s="+-]+)\s*-(\S+)/,
|
|
874
|
-
map: (match) => {
|
|
850
|
+
map: (match) => [{ command: 'rem-conditions', tag: match[1], value: match[2] }],
|
|
875
851
|
}, {
|
|
876
852
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*=(\S+)/,
|
|
877
|
-
map: (match) => {
|
|
853
|
+
map: (match) => [{ command: 'set-conditions', tag: match[1], value: match[2] }],
|
|
878
854
|
}, {
|
|
879
855
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*\+\+(\S+)/,
|
|
880
|
-
map: (match) => {
|
|
856
|
+
map: (match) => [{ command: 'inc-conditions', tag: match[1], value: match[2] }],
|
|
881
857
|
}, {
|
|
882
858
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*--(\S+)/,
|
|
883
|
-
map: (match) => {
|
|
859
|
+
map: (match) => [{ command: 'dec-conditions', tag: match[1], value: match[2] }],
|
|
884
860
|
}, {
|
|
885
861
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*\+(\S+)/,
|
|
886
|
-
map: (match) => {
|
|
862
|
+
map: (match) => [{ command: 'add-conditions', tag: match[1], value: match[2] }],
|
|
887
863
|
}, {
|
|
888
864
|
regex: /^\s*([^\s="+-]+)\s+[sS]\s*-(\S+)/,
|
|
889
|
-
map: (match) => {
|
|
865
|
+
map: (match) => [{ command: 'rem-conditions', tag: match[1], value: match[2] }],
|
|
890
866
|
}, {
|
|
891
867
|
regex: /^\s*(\S+)\s+[cC]/,
|
|
892
|
-
map: (match) => {
|
|
868
|
+
map: (match) => [{ command: 'check', tag: match[1] }],
|
|
893
869
|
}, {
|
|
894
870
|
regex: /^\s*(\S+)\s+[aA]/,
|
|
895
|
-
map: (match) => {
|
|
871
|
+
map: (match) => [{ command: 'arrow', tag: match[1] }],
|
|
896
872
|
}, {
|
|
897
873
|
regex: /^\s*(\S+)\s+[eE]/,
|
|
898
|
-
map: (match) => {
|
|
874
|
+
map: (match) => [{ command: 'empty', tag: match[1] }],
|
|
899
875
|
}, {
|
|
900
876
|
regex: /^\s*(\S+)\s+[xX]/,
|
|
901
|
-
map: (match) => {
|
|
877
|
+
map: (match) => [{ command: 'cross', tag: match[1] }],
|
|
902
878
|
}, {
|
|
903
879
|
regex: /^\s*(\S+)\s+[dD]/,
|
|
904
|
-
map: (match) => {
|
|
880
|
+
map: (match) => [{ command: 'delete', tag: match[1] }],
|
|
905
881
|
}, {
|
|
906
882
|
regex: /^\s*(\S+)\s+[wW]/,
|
|
907
|
-
map: (match) => {
|
|
883
|
+
map: (match) => [{ command: 'wait', tag: match[1] }],
|
|
908
884
|
}];
|
|
909
885
|
const parseTrackerCommands = (line) => {
|
|
910
886
|
const actions = [];
|
|
@@ -918,7 +894,7 @@ const parseTrackerCommands = (line) => {
|
|
|
918
894
|
if (!match) {
|
|
919
895
|
break;
|
|
920
896
|
}
|
|
921
|
-
actions.push(command.map(match));
|
|
897
|
+
actions.push(...command.map(match));
|
|
922
898
|
input = input.slice(match[0].length);
|
|
923
899
|
}
|
|
924
900
|
return actions;
|