pf2e-sage-stats 0.3.3 → 0.4.0
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 +17 -0
- package/dist/app.js +35 -0
- package/package.json +1 -1
package/dist/app.d.ts
CHANGED
|
@@ -735,6 +735,23 @@ export type TrackerCommand = {
|
|
|
735
735
|
name?: string;
|
|
736
736
|
alias?: string;
|
|
737
737
|
hp?: number;
|
|
738
|
+
} | {
|
|
739
|
+
command: 'friend';
|
|
740
|
+
name?: string;
|
|
741
|
+
alias?: string;
|
|
742
|
+
hp?: number;
|
|
743
|
+
} | {
|
|
744
|
+
command: 'update';
|
|
745
|
+
tag: string;
|
|
746
|
+
name?: string;
|
|
747
|
+
alias?: string;
|
|
748
|
+
hp?: number;
|
|
749
|
+
} | {
|
|
750
|
+
command: 'child';
|
|
751
|
+
tag: string;
|
|
752
|
+
name?: string;
|
|
753
|
+
alias?: string;
|
|
754
|
+
hp?: number;
|
|
738
755
|
} | {
|
|
739
756
|
command: 'heal';
|
|
740
757
|
} | {
|
package/dist/app.js
CHANGED
|
@@ -728,6 +728,15 @@ const trackerCommands = [{
|
|
|
728
728
|
}, {
|
|
729
729
|
regex: /^\s*foe(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
|
|
730
730
|
map: (match) => ({ command: 'foe', name: match[2], alias: match[4], hp: match[6] ? parseInt(match[6], 10) : undefined }),
|
|
731
|
+
}, {
|
|
732
|
+
regex: /^\s*friend(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
|
|
733
|
+
map: (match) => ({ command: 'friend', name: match[2], alias: match[4], hp: match[6] ? parseInt(match[6], 10) : undefined }),
|
|
734
|
+
}, {
|
|
735
|
+
regex: /^\s*child\s+(\S+)(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
|
|
736
|
+
map: (match) => ({ command: 'child', tag: match[1], name: match[3], alias: match[5], hp: match[7] ? parseInt(match[7], 10) : undefined }),
|
|
737
|
+
}, {
|
|
738
|
+
regex: /^\s*update\s+(\S+)(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
|
|
739
|
+
map: (match) => ({ command: 'update', tag: match[1], name: match[3], alias: match[5], hp: match[7] ? parseInt(match[7], 10) : undefined }),
|
|
731
740
|
}, {
|
|
732
741
|
regex: /^\s*heal/i,
|
|
733
742
|
map: () => ({ command: 'heal' }),
|
|
@@ -1014,6 +1023,32 @@ const applyTrackerCommand = (tracker, action) => {
|
|
|
1014
1023
|
case 'foe':
|
|
1015
1024
|
tracker.chars.push(exports.charSchema.parse({ foe: true, name: action.name, alias: action.alias, maxhp: action.hp, hp: action.hp }));
|
|
1016
1025
|
return tracker;
|
|
1026
|
+
case 'friend':
|
|
1027
|
+
tracker.chars.push(exports.charSchema.parse({ foe: false, name: action.name, alias: action.alias, maxhp: action.hp, hp: action.hp }));
|
|
1028
|
+
return tracker;
|
|
1029
|
+
case 'child': {
|
|
1030
|
+
const item = findCharacter(tracker, action.tag);
|
|
1031
|
+
if (item) {
|
|
1032
|
+
item.children.push(childSchema.parse({ name: action.name, alias: action.alias, maxhp: action.hp, hp: action.hp }));
|
|
1033
|
+
}
|
|
1034
|
+
return tracker;
|
|
1035
|
+
}
|
|
1036
|
+
case 'update': {
|
|
1037
|
+
const item = findCharacterOrChild(tracker, action.tag);
|
|
1038
|
+
if (item) {
|
|
1039
|
+
if (action.name) {
|
|
1040
|
+
item.name = action.name;
|
|
1041
|
+
}
|
|
1042
|
+
if (action.alias) {
|
|
1043
|
+
item.alias = action.alias;
|
|
1044
|
+
}
|
|
1045
|
+
if (action.hp) {
|
|
1046
|
+
item.maxhp = action.hp;
|
|
1047
|
+
item.hp = action.hp;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return tracker;
|
|
1051
|
+
}
|
|
1017
1052
|
default:
|
|
1018
1053
|
return unexpectedTrackerCommand(action);
|
|
1019
1054
|
}
|