pf2e-sage-stats 0.3.0 → 0.3.1
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 +79 -79
- package/dist/app.js +44 -45
- package/dist/lines.d.ts +13 -0
- package/dist/lines.js +237 -0
- package/package.json +2 -3
package/dist/app.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ declare const schema: zod.ZodObject<{
|
|
|
63
63
|
piloting: zod.ZodOptional<zod.ZodNumber>;
|
|
64
64
|
computers: zod.ZodOptional<zod.ZodNumber>;
|
|
65
65
|
}, "strip", zod.ZodTypeAny, {
|
|
66
|
+
stealth?: number | undefined;
|
|
66
67
|
acrobatics?: number | undefined;
|
|
67
68
|
arcana?: number | undefined;
|
|
68
69
|
athletics?: number | undefined;
|
|
@@ -76,12 +77,12 @@ declare const schema: zod.ZodObject<{
|
|
|
76
77
|
performance?: number | undefined;
|
|
77
78
|
religion?: number | undefined;
|
|
78
79
|
society?: number | undefined;
|
|
79
|
-
stealth?: number | undefined;
|
|
80
80
|
survival?: number | undefined;
|
|
81
81
|
thievery?: number | undefined;
|
|
82
82
|
piloting?: number | undefined;
|
|
83
83
|
computers?: number | undefined;
|
|
84
84
|
}, {
|
|
85
|
+
stealth?: number | undefined;
|
|
85
86
|
acrobatics?: number | undefined;
|
|
86
87
|
arcana?: number | undefined;
|
|
87
88
|
athletics?: number | undefined;
|
|
@@ -95,7 +96,6 @@ declare const schema: zod.ZodObject<{
|
|
|
95
96
|
performance?: number | undefined;
|
|
96
97
|
religion?: number | undefined;
|
|
97
98
|
society?: number | undefined;
|
|
98
|
-
stealth?: number | undefined;
|
|
99
99
|
survival?: number | undefined;
|
|
100
100
|
thievery?: number | undefined;
|
|
101
101
|
piloting?: number | undefined;
|
|
@@ -166,22 +166,22 @@ declare const schema: zod.ZodObject<{
|
|
|
166
166
|
hp: zod.ZodOptional<zod.ZodNumber>;
|
|
167
167
|
}, "strip", zod.ZodTypeAny, {
|
|
168
168
|
default: number;
|
|
169
|
-
saves?: number | undefined;
|
|
170
|
-
ac?: number | undefined;
|
|
171
169
|
perception?: number | undefined;
|
|
172
170
|
skills?: number | undefined;
|
|
173
|
-
attack?: number | undefined;
|
|
174
|
-
spells?: number | undefined;
|
|
175
171
|
hp?: number | undefined;
|
|
176
|
-
|
|
172
|
+
spells?: number | undefined;
|
|
177
173
|
saves?: number | undefined;
|
|
178
174
|
ac?: number | undefined;
|
|
175
|
+
attack?: number | undefined;
|
|
176
|
+
}, {
|
|
179
177
|
perception?: number | undefined;
|
|
180
178
|
skills?: number | undefined;
|
|
181
|
-
|
|
179
|
+
hp?: number | undefined;
|
|
182
180
|
spells?: number | undefined;
|
|
181
|
+
saves?: number | undefined;
|
|
182
|
+
ac?: number | undefined;
|
|
183
|
+
attack?: number | undefined;
|
|
183
184
|
default?: number | undefined;
|
|
184
|
-
hp?: number | undefined;
|
|
185
185
|
}>>;
|
|
186
186
|
bullwark: zod.ZodDefault<zod.ZodNumber>;
|
|
187
187
|
saveInfo: zod.ZodDefault<zod.ZodObject<{
|
|
@@ -217,6 +217,7 @@ declare const schema: zod.ZodObject<{
|
|
|
217
217
|
piloting: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
|
|
218
218
|
computers: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
|
|
219
219
|
}, "strip", zod.ZodTypeAny, {
|
|
220
|
+
stealth?: string[] | undefined;
|
|
220
221
|
acrobatics?: string[] | undefined;
|
|
221
222
|
arcana?: string[] | undefined;
|
|
222
223
|
athletics?: string[] | undefined;
|
|
@@ -230,12 +231,12 @@ declare const schema: zod.ZodObject<{
|
|
|
230
231
|
performance?: string[] | undefined;
|
|
231
232
|
religion?: string[] | undefined;
|
|
232
233
|
society?: string[] | undefined;
|
|
233
|
-
stealth?: string[] | undefined;
|
|
234
234
|
survival?: string[] | undefined;
|
|
235
235
|
thievery?: string[] | undefined;
|
|
236
236
|
piloting?: string[] | undefined;
|
|
237
237
|
computers?: string[] | undefined;
|
|
238
238
|
}, {
|
|
239
|
+
stealth?: string[] | undefined;
|
|
239
240
|
acrobatics?: string[] | undefined;
|
|
240
241
|
arcana?: string[] | undefined;
|
|
241
242
|
athletics?: string[] | undefined;
|
|
@@ -249,34 +250,15 @@ declare const schema: zod.ZodObject<{
|
|
|
249
250
|
performance?: string[] | undefined;
|
|
250
251
|
religion?: string[] | undefined;
|
|
251
252
|
society?: string[] | undefined;
|
|
252
|
-
stealth?: string[] | undefined;
|
|
253
253
|
survival?: string[] | undefined;
|
|
254
254
|
thievery?: string[] | undefined;
|
|
255
255
|
piloting?: string[] | undefined;
|
|
256
256
|
computers?: string[] | undefined;
|
|
257
257
|
}>>;
|
|
258
258
|
}, "strip", zod.ZodTypeAny, {
|
|
259
|
-
name: string;
|
|
260
|
-
level: number;
|
|
261
|
-
maxhp: number;
|
|
262
|
-
attributes: {
|
|
263
|
-
strength: number;
|
|
264
|
-
dexterity: number;
|
|
265
|
-
constitution: number;
|
|
266
|
-
intelligence: number;
|
|
267
|
-
wisdom: number;
|
|
268
|
-
charisma: number;
|
|
269
|
-
};
|
|
270
|
-
saves: {
|
|
271
|
-
fortitude: number;
|
|
272
|
-
reflex: number;
|
|
273
|
-
will: number;
|
|
274
|
-
};
|
|
275
|
-
ac: number;
|
|
276
259
|
perception: number;
|
|
277
|
-
perceptionInfo: string[];
|
|
278
|
-
initiativeInfo: string[];
|
|
279
260
|
skills: {
|
|
261
|
+
stealth?: number | undefined;
|
|
280
262
|
acrobatics?: number | undefined;
|
|
281
263
|
arcana?: number | undefined;
|
|
282
264
|
athletics?: number | undefined;
|
|
@@ -290,12 +272,34 @@ declare const schema: zod.ZodObject<{
|
|
|
290
272
|
performance?: number | undefined;
|
|
291
273
|
religion?: number | undefined;
|
|
292
274
|
society?: number | undefined;
|
|
293
|
-
stealth?: number | undefined;
|
|
294
275
|
survival?: number | undefined;
|
|
295
276
|
thievery?: number | undefined;
|
|
296
277
|
piloting?: number | undefined;
|
|
297
278
|
computers?: number | undefined;
|
|
298
279
|
};
|
|
280
|
+
attributes: {
|
|
281
|
+
strength: number;
|
|
282
|
+
dexterity: number;
|
|
283
|
+
constitution: number;
|
|
284
|
+
intelligence: number;
|
|
285
|
+
wisdom: number;
|
|
286
|
+
charisma: number;
|
|
287
|
+
};
|
|
288
|
+
spells: {
|
|
289
|
+
attack?: number | undefined;
|
|
290
|
+
dc?: number | undefined;
|
|
291
|
+
};
|
|
292
|
+
name: string;
|
|
293
|
+
level: number;
|
|
294
|
+
maxhp: number;
|
|
295
|
+
saves: {
|
|
296
|
+
fortitude: number;
|
|
297
|
+
reflex: number;
|
|
298
|
+
will: number;
|
|
299
|
+
};
|
|
300
|
+
ac: number;
|
|
301
|
+
perceptionInfo: string[];
|
|
302
|
+
initiativeInfo: string[];
|
|
299
303
|
lores: Record<string, {
|
|
300
304
|
name: string;
|
|
301
305
|
mod: number;
|
|
@@ -311,10 +315,6 @@ declare const schema: zod.ZodObject<{
|
|
|
311
315
|
desc: string;
|
|
312
316
|
damage?: string | undefined;
|
|
313
317
|
}>;
|
|
314
|
-
spells: {
|
|
315
|
-
attack?: number | undefined;
|
|
316
|
-
dc?: number | undefined;
|
|
317
|
-
};
|
|
318
318
|
extra: Record<string, number>;
|
|
319
319
|
extraDCs: Record<string, number>;
|
|
320
320
|
extraDice: Record<string, string>;
|
|
@@ -322,13 +322,13 @@ declare const schema: zod.ZodObject<{
|
|
|
322
322
|
untrained: number;
|
|
323
323
|
bump: {
|
|
324
324
|
default: number;
|
|
325
|
-
saves?: number | undefined;
|
|
326
|
-
ac?: number | undefined;
|
|
327
325
|
perception?: number | undefined;
|
|
328
326
|
skills?: number | undefined;
|
|
329
|
-
attack?: number | undefined;
|
|
330
|
-
spells?: number | undefined;
|
|
331
327
|
hp?: number | undefined;
|
|
328
|
+
spells?: number | undefined;
|
|
329
|
+
saves?: number | undefined;
|
|
330
|
+
ac?: number | undefined;
|
|
331
|
+
attack?: number | undefined;
|
|
332
332
|
};
|
|
333
333
|
bullwark: number;
|
|
334
334
|
saveInfo: {
|
|
@@ -337,6 +337,7 @@ declare const schema: zod.ZodObject<{
|
|
|
337
337
|
will: string[];
|
|
338
338
|
};
|
|
339
339
|
skillInfo: {
|
|
340
|
+
stealth?: string[] | undefined;
|
|
340
341
|
acrobatics?: string[] | undefined;
|
|
341
342
|
arcana?: string[] | undefined;
|
|
342
343
|
athletics?: string[] | undefined;
|
|
@@ -350,7 +351,6 @@ declare const schema: zod.ZodObject<{
|
|
|
350
351
|
performance?: string[] | undefined;
|
|
351
352
|
religion?: string[] | undefined;
|
|
352
353
|
society?: string[] | undefined;
|
|
353
|
-
stealth?: string[] | undefined;
|
|
354
354
|
survival?: string[] | undefined;
|
|
355
355
|
thievery?: string[] | undefined;
|
|
356
356
|
piloting?: string[] | undefined;
|
|
@@ -359,27 +359,9 @@ declare const schema: zod.ZodObject<{
|
|
|
359
359
|
alias?: string | undefined;
|
|
360
360
|
}, {
|
|
361
361
|
name: string;
|
|
362
|
-
alias?: string | undefined;
|
|
363
|
-
level?: number | undefined;
|
|
364
|
-
maxhp?: number | undefined;
|
|
365
|
-
attributes?: {
|
|
366
|
-
strength?: number | undefined;
|
|
367
|
-
dexterity?: number | undefined;
|
|
368
|
-
constitution?: number | undefined;
|
|
369
|
-
intelligence?: number | undefined;
|
|
370
|
-
wisdom?: number | undefined;
|
|
371
|
-
charisma?: number | undefined;
|
|
372
|
-
} | undefined;
|
|
373
|
-
saves?: {
|
|
374
|
-
fortitude?: number | undefined;
|
|
375
|
-
reflex?: number | undefined;
|
|
376
|
-
will?: number | undefined;
|
|
377
|
-
} | undefined;
|
|
378
|
-
ac?: number | undefined;
|
|
379
362
|
perception?: number | undefined;
|
|
380
|
-
perceptionInfo?: string[] | undefined;
|
|
381
|
-
initiativeInfo?: string[] | undefined;
|
|
382
363
|
skills?: {
|
|
364
|
+
stealth?: number | undefined;
|
|
383
365
|
acrobatics?: number | undefined;
|
|
384
366
|
arcana?: number | undefined;
|
|
385
367
|
athletics?: number | undefined;
|
|
@@ -393,12 +375,34 @@ declare const schema: zod.ZodObject<{
|
|
|
393
375
|
performance?: number | undefined;
|
|
394
376
|
religion?: number | undefined;
|
|
395
377
|
society?: number | undefined;
|
|
396
|
-
stealth?: number | undefined;
|
|
397
378
|
survival?: number | undefined;
|
|
398
379
|
thievery?: number | undefined;
|
|
399
380
|
piloting?: number | undefined;
|
|
400
381
|
computers?: number | undefined;
|
|
401
382
|
} | undefined;
|
|
383
|
+
attributes?: {
|
|
384
|
+
strength?: number | undefined;
|
|
385
|
+
dexterity?: number | undefined;
|
|
386
|
+
constitution?: number | undefined;
|
|
387
|
+
intelligence?: number | undefined;
|
|
388
|
+
wisdom?: number | undefined;
|
|
389
|
+
charisma?: number | undefined;
|
|
390
|
+
} | undefined;
|
|
391
|
+
spells?: {
|
|
392
|
+
attack?: number | undefined;
|
|
393
|
+
dc?: number | undefined;
|
|
394
|
+
} | undefined;
|
|
395
|
+
alias?: string | undefined;
|
|
396
|
+
level?: number | undefined;
|
|
397
|
+
maxhp?: number | undefined;
|
|
398
|
+
saves?: {
|
|
399
|
+
fortitude?: number | undefined;
|
|
400
|
+
reflex?: number | undefined;
|
|
401
|
+
will?: number | undefined;
|
|
402
|
+
} | undefined;
|
|
403
|
+
ac?: number | undefined;
|
|
404
|
+
perceptionInfo?: string[] | undefined;
|
|
405
|
+
initiativeInfo?: string[] | undefined;
|
|
402
406
|
lores?: Record<string, {
|
|
403
407
|
name: string;
|
|
404
408
|
mod?: number | undefined;
|
|
@@ -414,24 +418,20 @@ declare const schema: zod.ZodObject<{
|
|
|
414
418
|
mod?: number | undefined;
|
|
415
419
|
damage?: string | undefined;
|
|
416
420
|
}> | undefined;
|
|
417
|
-
spells?: {
|
|
418
|
-
attack?: number | undefined;
|
|
419
|
-
dc?: number | undefined;
|
|
420
|
-
} | undefined;
|
|
421
421
|
extra?: Record<string, number> | undefined;
|
|
422
422
|
extraDCs?: Record<string, number> | undefined;
|
|
423
423
|
extraDice?: Record<string, string> | undefined;
|
|
424
424
|
classDC?: number | undefined;
|
|
425
425
|
untrained?: number | undefined;
|
|
426
426
|
bump?: {
|
|
427
|
-
saves?: number | undefined;
|
|
428
|
-
ac?: number | undefined;
|
|
429
427
|
perception?: number | undefined;
|
|
430
428
|
skills?: number | undefined;
|
|
431
|
-
|
|
429
|
+
hp?: number | undefined;
|
|
432
430
|
spells?: number | undefined;
|
|
431
|
+
saves?: number | undefined;
|
|
432
|
+
ac?: number | undefined;
|
|
433
|
+
attack?: number | undefined;
|
|
433
434
|
default?: number | undefined;
|
|
434
|
-
hp?: number | undefined;
|
|
435
435
|
} | undefined;
|
|
436
436
|
bullwark?: number | undefined;
|
|
437
437
|
saveInfo?: {
|
|
@@ -440,6 +440,7 @@ declare const schema: zod.ZodObject<{
|
|
|
440
440
|
will?: string[] | undefined;
|
|
441
441
|
} | undefined;
|
|
442
442
|
skillInfo?: {
|
|
443
|
+
stealth?: string[] | undefined;
|
|
443
444
|
acrobatics?: string[] | undefined;
|
|
444
445
|
arcana?: string[] | undefined;
|
|
445
446
|
athletics?: string[] | undefined;
|
|
@@ -453,7 +454,6 @@ declare const schema: zod.ZodObject<{
|
|
|
453
454
|
performance?: string[] | undefined;
|
|
454
455
|
religion?: string[] | undefined;
|
|
455
456
|
society?: string[] | undefined;
|
|
456
|
-
stealth?: string[] | undefined;
|
|
457
457
|
survival?: string[] | undefined;
|
|
458
458
|
thievery?: string[] | undefined;
|
|
459
459
|
piloting?: string[] | undefined;
|
|
@@ -471,18 +471,18 @@ declare const childSchema: zod.ZodObject<{
|
|
|
471
471
|
maxhp: zod.ZodDefault<zod.ZodNumber>;
|
|
472
472
|
conditions: zod.ZodDefault<zod.ZodString>;
|
|
473
473
|
}, "strip", zod.ZodTypeAny, {
|
|
474
|
+
hp: number;
|
|
474
475
|
name: string;
|
|
475
476
|
alias: string;
|
|
476
477
|
maxhp: number;
|
|
477
|
-
hp: number;
|
|
478
478
|
id: string;
|
|
479
479
|
temphp: number;
|
|
480
480
|
conditions: string;
|
|
481
481
|
}, {
|
|
482
|
+
hp?: number | undefined;
|
|
482
483
|
name?: string | undefined;
|
|
483
484
|
alias?: string | undefined;
|
|
484
485
|
maxhp?: number | undefined;
|
|
485
|
-
hp?: number | undefined;
|
|
486
486
|
id?: string | undefined;
|
|
487
487
|
temphp?: number | undefined;
|
|
488
488
|
conditions?: string | undefined;
|
|
@@ -508,27 +508,27 @@ export declare const charSchema: zod.ZodObject<{
|
|
|
508
508
|
maxhp: zod.ZodDefault<zod.ZodNumber>;
|
|
509
509
|
conditions: zod.ZodDefault<zod.ZodString>;
|
|
510
510
|
}, "strip", zod.ZodTypeAny, {
|
|
511
|
+
hp: number;
|
|
511
512
|
name: string;
|
|
512
513
|
alias: string;
|
|
513
514
|
maxhp: number;
|
|
514
|
-
hp: number;
|
|
515
515
|
id: string;
|
|
516
516
|
temphp: number;
|
|
517
517
|
conditions: string;
|
|
518
518
|
}, {
|
|
519
|
+
hp?: number | undefined;
|
|
519
520
|
name?: string | undefined;
|
|
520
521
|
alias?: string | undefined;
|
|
521
522
|
maxhp?: number | undefined;
|
|
522
|
-
hp?: number | undefined;
|
|
523
523
|
id?: string | undefined;
|
|
524
524
|
temphp?: number | undefined;
|
|
525
525
|
conditions?: string | undefined;
|
|
526
526
|
}>, "many">>;
|
|
527
527
|
}, "strip", zod.ZodTypeAny, {
|
|
528
|
+
hp: number;
|
|
528
529
|
name: string;
|
|
529
530
|
alias: string;
|
|
530
531
|
maxhp: number;
|
|
531
|
-
hp: number;
|
|
532
532
|
id: string;
|
|
533
533
|
temphp: number;
|
|
534
534
|
conditions: string;
|
|
@@ -536,19 +536,19 @@ export declare const charSchema: zod.ZodObject<{
|
|
|
536
536
|
foe: boolean;
|
|
537
537
|
state: "empty" | "arrow" | "check" | "cross";
|
|
538
538
|
children: {
|
|
539
|
+
hp: number;
|
|
539
540
|
name: string;
|
|
540
541
|
alias: string;
|
|
541
542
|
maxhp: number;
|
|
542
|
-
hp: number;
|
|
543
543
|
id: string;
|
|
544
544
|
temphp: number;
|
|
545
545
|
conditions: string;
|
|
546
546
|
}[];
|
|
547
547
|
}, {
|
|
548
|
+
hp?: number | undefined;
|
|
548
549
|
name?: string | undefined;
|
|
549
550
|
alias?: string | undefined;
|
|
550
551
|
maxhp?: number | undefined;
|
|
551
|
-
hp?: number | undefined;
|
|
552
552
|
id?: string | undefined;
|
|
553
553
|
temphp?: number | undefined;
|
|
554
554
|
conditions?: string | undefined;
|
|
@@ -556,10 +556,10 @@ export declare const charSchema: zod.ZodObject<{
|
|
|
556
556
|
foe?: boolean | undefined;
|
|
557
557
|
state?: "empty" | "arrow" | "check" | "cross" | undefined;
|
|
558
558
|
children?: {
|
|
559
|
+
hp?: number | undefined;
|
|
559
560
|
name?: string | undefined;
|
|
560
561
|
alias?: string | undefined;
|
|
561
562
|
maxhp?: number | undefined;
|
|
562
|
-
hp?: number | undefined;
|
|
563
563
|
id?: string | undefined;
|
|
564
564
|
temphp?: number | undefined;
|
|
565
565
|
conditions?: string | undefined;
|
|
@@ -579,10 +579,10 @@ export declare const formatCommand: (stats: Schema, secretDC?: boolean, defaultS
|
|
|
579
579
|
export declare const formatTable: (table: string, season: string, scenario: string, _name: string, gm: string, players: string) => string;
|
|
580
580
|
export declare const formatHP: (arg: string) => string;
|
|
581
581
|
export declare const newtracker: (status: string) => {
|
|
582
|
+
hp: number;
|
|
582
583
|
name: string;
|
|
583
584
|
alias: string;
|
|
584
585
|
maxhp: number;
|
|
585
|
-
hp: number;
|
|
586
586
|
id: string;
|
|
587
587
|
temphp: number;
|
|
588
588
|
conditions: string;
|
|
@@ -590,10 +590,10 @@ export declare const newtracker: (status: string) => {
|
|
|
590
590
|
foe: boolean;
|
|
591
591
|
state: "empty" | "arrow" | "check" | "cross";
|
|
592
592
|
children: {
|
|
593
|
+
hp: number;
|
|
593
594
|
name: string;
|
|
594
595
|
alias: string;
|
|
595
596
|
maxhp: number;
|
|
596
|
-
hp: number;
|
|
597
597
|
id: string;
|
|
598
598
|
temphp: number;
|
|
599
599
|
conditions: string;
|
package/dist/app.js
CHANGED
|
@@ -11,6 +11,7 @@ const lodash_1 = require("lodash");
|
|
|
11
11
|
const dedent_js_1 = __importDefault(require("dedent-js"));
|
|
12
12
|
const abbreviate_1 = __importDefault(require("abbreviate"));
|
|
13
13
|
const pluralize_1 = __importDefault(require("pluralize"));
|
|
14
|
+
const lines_1 = require("./lines");
|
|
14
15
|
const schema = zod_1.default.object({
|
|
15
16
|
name: zod_1.default.string(),
|
|
16
17
|
alias: zod_1.default.string().optional(),
|
|
@@ -367,75 +368,73 @@ const locateSpells = (statblock) => {
|
|
|
367
368
|
const parseStatblock = (name, _statblock, alias) => {
|
|
368
369
|
var _a;
|
|
369
370
|
const defaults = schema.parse({ name: name !== null && name !== void 0 ? name : 'Unknown' });
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
.replace('', '')
|
|
375
|
-
.replace(/–/g, '-') + '\n';
|
|
376
|
-
const basic = locateName(statblock);
|
|
371
|
+
const lines = (0, lines_1.classifyStatblockLines)(_statblock);
|
|
372
|
+
const improvisation = (0, lines_1.getLine)(lines, 'feats').match(/Untrained\s+Improvisation/);
|
|
373
|
+
const plate = (0, lines_1.getLine)(lines, 'items').match(/Full\s+Plate/);
|
|
374
|
+
const basic = locateName((0, lines_1.getLine)(lines, 'title'));
|
|
377
375
|
const result = {
|
|
378
376
|
...defaults,
|
|
379
377
|
...basic,
|
|
380
378
|
...(name && { name: name }),
|
|
381
379
|
...{ alias: alias !== null && alias !== void 0 ? alias : (0, abbreviate_1.default)((_a = name !== null && name !== void 0 ? name : basic === null || basic === void 0 ? void 0 : basic.name) !== null && _a !== void 0 ? _a : defaults.name, { length: 3 }).toLowerCase() },
|
|
382
|
-
...locateInt('perception',
|
|
383
|
-
...locateInt('ac',
|
|
384
|
-
...locateInt('maxhp',
|
|
380
|
+
...locateInt('perception', (0, lines_1.getLine)(lines, 'perception')),
|
|
381
|
+
...locateInt('ac', (0, lines_1.getLine)(lines, 'defence'), null, false, 'AC'),
|
|
382
|
+
...locateInt('maxhp', (0, lines_1.getLine)(lines, 'hp'), null, false, 'HP'),
|
|
385
383
|
attributes: {
|
|
386
384
|
...defaults.attributes,
|
|
387
|
-
...locateInt('strength',
|
|
388
|
-
...locateInt('dexterity',
|
|
389
|
-
...locateInt('constitution',
|
|
390
|
-
...locateInt('intelligence',
|
|
391
|
-
...locateInt('wisdom',
|
|
392
|
-
...locateInt('charisma',
|
|
385
|
+
...locateInt('strength', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Str'),
|
|
386
|
+
...locateInt('dexterity', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Dex'),
|
|
387
|
+
...locateInt('constitution', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Con'),
|
|
388
|
+
...locateInt('intelligence', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Int'),
|
|
389
|
+
...locateInt('wisdom', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Wis'),
|
|
390
|
+
...locateInt('charisma', (0, lines_1.getLine)(lines, 'attributes'), null, true, 'Cha'),
|
|
393
391
|
},
|
|
394
392
|
saves: {
|
|
395
393
|
...defaults.saves,
|
|
396
|
-
...locateInt('fortitude',
|
|
397
|
-
...locateInt('reflex',
|
|
398
|
-
...locateInt('fortitude',
|
|
399
|
-
...locateInt('reflex',
|
|
400
|
-
...locateInt('will',
|
|
394
|
+
...locateInt('fortitude', (0, lines_1.getLine)(lines, 'defence'), null, true, 'Fortitude'),
|
|
395
|
+
...locateInt('reflex', (0, lines_1.getLine)(lines, 'defence'), null, true, 'Reflex'),
|
|
396
|
+
...locateInt('fortitude', (0, lines_1.getLine)(lines, 'defence'), null, true, 'Fort'),
|
|
397
|
+
...locateInt('reflex', (0, lines_1.getLine)(lines, 'defence'), null, true, 'Ref'),
|
|
398
|
+
...locateInt('will', (0, lines_1.getLine)(lines, 'defence'), null, true, 'Will'),
|
|
401
399
|
},
|
|
402
400
|
skills: {
|
|
403
401
|
...defaults.skills,
|
|
404
|
-
...locateInt('acrobatics',
|
|
405
|
-
...locateInt('arcana',
|
|
406
|
-
...locateInt('athletics',
|
|
407
|
-
...locateInt('crafting',
|
|
408
|
-
...locateInt('deception',
|
|
409
|
-
...locateInt('diplomacy',
|
|
410
|
-
...locateInt('intimidation',
|
|
411
|
-
...locateInt('medicine',
|
|
412
|
-
...locateInt('nature',
|
|
413
|
-
...locateInt('occultism',
|
|
414
|
-
...locateInt('performance',
|
|
415
|
-
...locateInt('religion',
|
|
416
|
-
...locateInt('society',
|
|
417
|
-
...locateInt('stealth',
|
|
418
|
-
...locateInt('
|
|
419
|
-
...locateInt('
|
|
420
|
-
...locateInt('
|
|
421
|
-
...locateInt('
|
|
402
|
+
...locateInt('acrobatics', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
403
|
+
...locateInt('arcana', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
404
|
+
...locateInt('athletics', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
405
|
+
...locateInt('crafting', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
406
|
+
...locateInt('deception', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
407
|
+
...locateInt('diplomacy', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
408
|
+
...locateInt('intimidation', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
409
|
+
...locateInt('medicine', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
410
|
+
...locateInt('nature', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
411
|
+
...locateInt('occultism', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
412
|
+
...locateInt('performance', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
413
|
+
...locateInt('religion', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
414
|
+
...locateInt('society', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
415
|
+
...locateInt('stealth', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
416
|
+
...locateInt('stealth', (0, lines_1.getLine)(lines, 'stealth'), 'Skills'),
|
|
417
|
+
...locateInt('survival', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
418
|
+
...locateInt('thievery', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
419
|
+
...locateInt('piloting', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
420
|
+
...locateInt('computers', (0, lines_1.getLine)(lines, 'skills'), 'Skills'),
|
|
422
421
|
},
|
|
423
422
|
lores: {
|
|
424
|
-
...locateInts(
|
|
425
|
-
...locateIntsAfter(
|
|
423
|
+
...locateInts((0, lines_1.getLine)(lines, 'skills'), 'Skills', 'Lore'),
|
|
424
|
+
...locateIntsAfter((0, lines_1.getLine)(lines, 'skills'), 'Lore:')
|
|
426
425
|
},
|
|
427
426
|
melee: {
|
|
428
|
-
...locateStrikes(
|
|
427
|
+
...locateStrikes((0, lines_1.listLines)(lines, 'strike'), 'Melee'),
|
|
429
428
|
},
|
|
430
429
|
ranged: {
|
|
431
|
-
...locateStrikes(
|
|
430
|
+
...locateStrikes((0, lines_1.listLines)(lines, 'strike'), 'Ranged'),
|
|
432
431
|
},
|
|
433
432
|
spells: {
|
|
434
|
-
...locateSpells(
|
|
433
|
+
...locateSpells((0, lines_1.listLines)(lines, 'spells')),
|
|
435
434
|
},
|
|
436
435
|
extra: {},
|
|
437
436
|
extraDCs: {
|
|
438
|
-
...locateInt('stealth',
|
|
437
|
+
...locateInt('stealth', (0, lines_1.getLine)(lines, 'stealth'), null, false, 'Stealth DC'),
|
|
439
438
|
},
|
|
440
439
|
extraDice: {},
|
|
441
440
|
};
|
package/dist/lines.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface NormalisedLine {
|
|
2
|
+
text: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ClassifiedLine {
|
|
5
|
+
text: string;
|
|
6
|
+
kind: string;
|
|
7
|
+
lineFrom: number;
|
|
8
|
+
lineTo: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function normaliseStatblockLines(source: string): NormalisedLine[];
|
|
11
|
+
export declare function classifyStatblockLines(source: string): ClassifiedLine[];
|
|
12
|
+
export declare function getLine(lines: ClassifiedLine[], kind: string): string;
|
|
13
|
+
export declare function listLines(lines: ClassifiedLine[], kind: string): string;
|
package/dist/lines.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normaliseStatblockLines = normaliseStatblockLines;
|
|
4
|
+
exports.classifyStatblockLines = classifyStatblockLines;
|
|
5
|
+
exports.getLine = getLine;
|
|
6
|
+
exports.listLines = listLines;
|
|
7
|
+
function isCapitalised(token) {
|
|
8
|
+
const first = token.charAt(0);
|
|
9
|
+
return /^\p{L}/u.test(first) && first.toUpperCase() === first;
|
|
10
|
+
}
|
|
11
|
+
function isUnbalanced(str) {
|
|
12
|
+
let count = 0;
|
|
13
|
+
for (const char of str) {
|
|
14
|
+
if (char === '(')
|
|
15
|
+
count++;
|
|
16
|
+
if (char === ')')
|
|
17
|
+
count--;
|
|
18
|
+
if (count < 0)
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return count > 0;
|
|
22
|
+
}
|
|
23
|
+
function normaliseLine(line) {
|
|
24
|
+
return line
|
|
25
|
+
.replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g, " ")
|
|
26
|
+
.replace(/[\u00AD\b]/g, "")
|
|
27
|
+
.replace(/[\u2010\u2011\u2012\u2013\u2014\u2212]/g, "-")
|
|
28
|
+
.replace(/[\u2018\u2019\u2032]/g, "'")
|
|
29
|
+
.replace(/[\u201C\u201D]/g, '"')
|
|
30
|
+
.replace(/[ \t\f\v]+/g, " ")
|
|
31
|
+
.trim();
|
|
32
|
+
}
|
|
33
|
+
const CONTINUATIONS = [
|
|
34
|
+
"plus", "and", "but", "or", 'a', "•",
|
|
35
|
+
];
|
|
36
|
+
const POINTS = [
|
|
37
|
+
"•",
|
|
38
|
+
];
|
|
39
|
+
function normaliseStatblockLines(source) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const pieces = source.replace(/^\uFEFF/, "").split(/\r\n|\n|\r|\u2028|\u2029/u);
|
|
42
|
+
const lines = [];
|
|
43
|
+
for (const piece of pieces) {
|
|
44
|
+
const text = normaliseLine(piece);
|
|
45
|
+
if (text.length === 0) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const lastLine = lines[lines.length - 1];
|
|
49
|
+
// Pathbuilder exception
|
|
50
|
+
if (/^Languages\s+/.test(text) && /^Perception\s+.*;$/.test((_a = lastLine === null || lastLine === void 0 ? void 0 : lastLine.text) !== null && _a !== void 0 ? _a : '')) {
|
|
51
|
+
lastLine.text = lastLine.text.slice(0, -1);
|
|
52
|
+
}
|
|
53
|
+
const lastText = lastLine === null || lastLine === void 0 ? void 0 : lastLine.text.split(' ');
|
|
54
|
+
const lastWord = lastText === null || lastText === void 0 ? void 0 : lastText[lastText.length - 1];
|
|
55
|
+
if ((isCapitalised(text) || POINTS.includes(text.charAt(0)))
|
|
56
|
+
&&
|
|
57
|
+
!(lastWord && (CONTINUATIONS.includes(lastWord) || /[,:;]$/.test(lastWord)))
|
|
58
|
+
&&
|
|
59
|
+
!isUnbalanced((_b = lastLine === null || lastLine === void 0 ? void 0 : lastLine.text) !== null && _b !== void 0 ? _b : '')) {
|
|
60
|
+
lines.push({ text });
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
lines[lines.length - 1].text = [lines[lines.length - 1].text, text].join(' ');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return lines;
|
|
67
|
+
}
|
|
68
|
+
function findIndexFrom(array, predicate, index) {
|
|
69
|
+
return array.slice(index).findIndex(predicate) + index;
|
|
70
|
+
}
|
|
71
|
+
function classifyStatblockLines(source) {
|
|
72
|
+
const normalised = normaliseStatblockLines(source);
|
|
73
|
+
const lines = [];
|
|
74
|
+
let lastLine = -1;
|
|
75
|
+
const titleLine = findIndexFrom(normalised, ({ text }) => /\S+\s+-?\d+$/.test(text), lastLine + 1);
|
|
76
|
+
const title = { text: normalised[titleLine].text, kind: 'title', lineFrom: titleLine, lineTo: titleLine };
|
|
77
|
+
lastLine = titleLine;
|
|
78
|
+
lines.push(title);
|
|
79
|
+
const perceptionLine = findIndexFrom(normalised, ({ text }) => /^Perception\s+[+-]\d+/.test(text), lastLine + 1);
|
|
80
|
+
if (perceptionLine > lastLine) {
|
|
81
|
+
const perception = { text: normalised[perceptionLine].text, kind: 'perception', lineFrom: perceptionLine, lineTo: perceptionLine };
|
|
82
|
+
lastLine = perceptionLine;
|
|
83
|
+
lines.push(perception);
|
|
84
|
+
}
|
|
85
|
+
const stealthLine = findIndexFrom(normalised, ({ text }) => /^Stealth\s+(?:DC)\s?[+-]?\d+/.test(text), lastLine + 1);
|
|
86
|
+
if (stealthLine > lastLine) {
|
|
87
|
+
const stealth = { text: normalised[stealthLine].text, kind: 'stealth', lineFrom: stealthLine, lineTo: stealthLine };
|
|
88
|
+
lastLine = stealthLine;
|
|
89
|
+
lines.push(stealth);
|
|
90
|
+
}
|
|
91
|
+
const languagesLine = findIndexFrom(normalised, ({ text }) => /^Languages\s+/.test(text), lastLine + 1);
|
|
92
|
+
if (languagesLine > lastLine) {
|
|
93
|
+
const languages = { text: normalised[languagesLine].text, kind: 'languages', lineFrom: languagesLine, lineTo: languagesLine };
|
|
94
|
+
lastLine = languagesLine;
|
|
95
|
+
lines.push(languages);
|
|
96
|
+
}
|
|
97
|
+
const skillsLine = findIndexFrom(normalised, ({ text }) => /^Skills\s+/.test(text), lastLine + 1);
|
|
98
|
+
if (skillsLine > lastLine) {
|
|
99
|
+
const skills = { text: normalised[skillsLine].text, kind: 'skills', lineFrom: skillsLine, lineTo: skillsLine };
|
|
100
|
+
lastLine = skillsLine;
|
|
101
|
+
lines.push(skills);
|
|
102
|
+
}
|
|
103
|
+
const descriptionLine = findIndexFrom(normalised, ({ text }) => /^Description\s+/.test(text), lastLine + 1);
|
|
104
|
+
if (descriptionLine > lastLine) {
|
|
105
|
+
const description = { text: normalised[descriptionLine].text, kind: 'description', lineFrom: descriptionLine, lineTo: descriptionLine };
|
|
106
|
+
lastLine = descriptionLine;
|
|
107
|
+
lines.push(description);
|
|
108
|
+
}
|
|
109
|
+
const disableLine = findIndexFrom(normalised, ({ text }) => /^Disable\s+/.test(text), lastLine + 1);
|
|
110
|
+
if (disableLine > lastLine) {
|
|
111
|
+
const disable = { text: normalised[disableLine].text, kind: 'disable', lineFrom: disableLine, lineTo: disableLine };
|
|
112
|
+
lastLine = disableLine;
|
|
113
|
+
lines.push(disable);
|
|
114
|
+
}
|
|
115
|
+
const attributeLine = findIndexFrom(normalised, ({ text }) => /^Str\s+[+-]\d+,/.test(text), lastLine + 1);
|
|
116
|
+
if (attributeLine > lastLine) {
|
|
117
|
+
const attributes = { text: normalised[attributeLine].text, kind: 'attributes', lineFrom: attributeLine, lineTo: attributeLine };
|
|
118
|
+
lastLine = attributeLine;
|
|
119
|
+
lines.push(attributes);
|
|
120
|
+
}
|
|
121
|
+
const itemsLine = findIndexFrom(normalised, ({ text }) => /^Items\s+/.test(text), lastLine + 1);
|
|
122
|
+
if (itemsLine > lastLine) {
|
|
123
|
+
const items = { text: normalised[itemsLine].text, kind: 'items', lineFrom: itemsLine, lineTo: itemsLine };
|
|
124
|
+
lastLine = itemsLine;
|
|
125
|
+
lines.push(items);
|
|
126
|
+
}
|
|
127
|
+
const defenceLine = findIndexFrom(normalised, ({ text }) => /^AC\s+\d+/.test(text), lastLine + 1);
|
|
128
|
+
if (defenceLine > lastLine) {
|
|
129
|
+
const defence = { text: normalised[defenceLine].text, kind: 'defence', lineFrom: defenceLine, lineTo: defenceLine };
|
|
130
|
+
lastLine = defenceLine;
|
|
131
|
+
lines.push(defence);
|
|
132
|
+
}
|
|
133
|
+
const hpLine = findIndexFrom(normalised, ({ text }) => /^(?:Hardness\s+\d+;\s+)?HP\s+\d+/.test(text), lastLine + 1);
|
|
134
|
+
if (hpLine > lastLine) {
|
|
135
|
+
const hp = { text: normalised[hpLine].text, kind: 'hp', lineFrom: hpLine, lineTo: hpLine };
|
|
136
|
+
lastLine = hpLine;
|
|
137
|
+
lines.push(hp);
|
|
138
|
+
}
|
|
139
|
+
const speedLine = findIndexFrom(normalised, ({ text }) => /^Speed\s+(?:(?:fly|climb|swim|burrow)\s+)?\d+/.test(text), lastLine + 1);
|
|
140
|
+
if (speedLine > lastLine) {
|
|
141
|
+
const speed = { text: normalised[speedLine].text, kind: 'speed', lineFrom: speedLine, lineTo: speedLine };
|
|
142
|
+
lastLine = speedLine;
|
|
143
|
+
lines.push(speed);
|
|
144
|
+
}
|
|
145
|
+
let strikeLine = findIndexFrom(normalised, ({ text }) => /^(?:Melee|Ranged)\s+/.test(text), lastLine + 1);
|
|
146
|
+
while (strikeLine > lastLine) {
|
|
147
|
+
const strike = { text: normalised[strikeLine].text, kind: 'strike', lineFrom: strikeLine, lineTo: strikeLine };
|
|
148
|
+
lastLine = strikeLine;
|
|
149
|
+
lines.push(strike);
|
|
150
|
+
strikeLine = findIndexFrom(normalised, ({ text }) => /^(?:Melee|Ranged)\s+/.test(text), lastLine + 1);
|
|
151
|
+
}
|
|
152
|
+
let spellsLine = findIndexFrom(normalised, ({ text }) => /^(?:Arcane|Divine|Occult|Primal)\s+(?:(?:Prepared|Spontaneous|Innate)\s+)?Spells/.test(text), lastLine + 1);
|
|
153
|
+
while (spellsLine > lastLine) {
|
|
154
|
+
const spells = { text: normalised[spellsLine].text, kind: 'spells', lineFrom: spellsLine, lineTo: spellsLine };
|
|
155
|
+
lastLine = spellsLine;
|
|
156
|
+
lines.push(spells);
|
|
157
|
+
spellsLine = findIndexFrom(normalised, ({ text }) => /^(?:Arcane|Divine|Occult|Primal)\s+(?:(?:Prepared|Spontaneous|Innate)\s+)?Spells/.test(text), lastLine + 1);
|
|
158
|
+
}
|
|
159
|
+
const ritualsLine = findIndexFrom(normalised, ({ text }) => /^Rituals\s+/.test(text), lastLine + 1);
|
|
160
|
+
if (ritualsLine > lastLine) {
|
|
161
|
+
const rituals = { text: normalised[ritualsLine].text, kind: 'rituals', lineFrom: ritualsLine, lineTo: ritualsLine };
|
|
162
|
+
lastLine = ritualsLine;
|
|
163
|
+
lines.push(rituals);
|
|
164
|
+
}
|
|
165
|
+
const featsLine = findIndexFrom(normalised, ({ text }) => /^Additional\s+Feats\s+/.test(text), lastLine + 1);
|
|
166
|
+
if (featsLine > lastLine) {
|
|
167
|
+
const feats = { text: normalised[featsLine].text, kind: 'feats', lineFrom: featsLine, lineTo: featsLine };
|
|
168
|
+
lastLine = featsLine;
|
|
169
|
+
lines.push(feats);
|
|
170
|
+
}
|
|
171
|
+
const specialsLine = findIndexFrom(normalised, ({ text }) => /^Additional\s+Specials\s+/.test(text), lastLine + 1);
|
|
172
|
+
if (specialsLine > lastLine) {
|
|
173
|
+
const specials = { text: normalised[specialsLine].text, kind: 'specials', lineFrom: specialsLine, lineTo: specialsLine };
|
|
174
|
+
lastLine = specialsLine;
|
|
175
|
+
lines.push(specials);
|
|
176
|
+
}
|
|
177
|
+
// Recovery
|
|
178
|
+
const skills = lines.find(({ kind }) => kind === 'skills');
|
|
179
|
+
while (skills && skills.lineTo + 1 < attributeLine) { // There's more skill lines
|
|
180
|
+
if (/\S+\s+[+-]\d+/.test(normalised[skills.lineTo + 1].text)) {
|
|
181
|
+
skills.text = [skills.text, normalised[skills.lineTo + 1].text].join(' ');
|
|
182
|
+
skills.lineTo = skills.lineTo + 1;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (title.lineTo + 1 < lines[1].lineFrom) {
|
|
189
|
+
const traits = { text: normalised[title.lineTo + 1].text, kind: 'traits', lineFrom: title.lineTo + 1, lineTo: title.lineTo + 1 };
|
|
190
|
+
lines.splice(1, 0, traits);
|
|
191
|
+
}
|
|
192
|
+
const traitsIndex = lines.findIndex(({ kind }) => kind === 'traits');
|
|
193
|
+
if (traitsIndex > 0 && lines[traitsIndex].lineTo + 1 < lines[traitsIndex + 1].lineFrom) {
|
|
194
|
+
const source = { text: normalised[lines[traitsIndex].lineTo + 1].text, kind: 'source', lineFrom: lines[traitsIndex].lineTo + 1, lineTo: lines[traitsIndex].lineTo + 1 };
|
|
195
|
+
lines.splice(traitsIndex + 1, 0, source);
|
|
196
|
+
}
|
|
197
|
+
const abilityBlocks = [...lines, { text: 'stub', kind: 'stub', lineFrom: normalised.length, lineTo: normalised.length }].flatMap((item, i) => {
|
|
198
|
+
const prevTo = i === 0 ? 0 : lines[i - 1].lineTo;
|
|
199
|
+
const start = prevTo + 1;
|
|
200
|
+
return start <= item.lineFrom - 1 ? [
|
|
201
|
+
{ lineFrom: start, lineTo: item.lineFrom - 1 }
|
|
202
|
+
] : [];
|
|
203
|
+
}).map((s) => (normalised.slice(s.lineFrom, s.lineTo + 1).map((l, i) => ({ text: l.text, kind: 'ability', lineFrom: s.lineFrom + i, lineTo: s.lineFrom + i }))));
|
|
204
|
+
for (const abilityBlock of abilityBlocks) {
|
|
205
|
+
let ability = abilityBlock[0];
|
|
206
|
+
let line = 1;
|
|
207
|
+
while (line < abilityBlock.length) {
|
|
208
|
+
const text = abilityBlock[line].text.replace(/(\[.+\]|\(.+\))\s+/g, '');
|
|
209
|
+
if (!/^\p{Lu}[\p{L}\p{P}]*(?:\s+[\p{Ll}\p{N}][\p{L}\p{N}\p{P}]*){2}/u.test(text)
|
|
210
|
+
&&
|
|
211
|
+
!/^\p{Lu}\p{L}*\./u.test(text)
|
|
212
|
+
&&
|
|
213
|
+
!/^\p{Lu}[\p{L}\p{P}]*\s+[\p{L}\p{N}\p{P}]+\./u.test(text)
|
|
214
|
+
&&
|
|
215
|
+
!/^(Success|Critical Success|Failure|Critical Failure|Maximum Duration|Recall Knowledge|Hit Points|Saving Throw|Effect|Requirements)\p{P}?\s+/u.test(abilityBlock[line].text)
|
|
216
|
+
&&
|
|
217
|
+
!/^\p{L}+;\s+/u.test(text)) {
|
|
218
|
+
lines.push(ability);
|
|
219
|
+
ability = abilityBlock[line];
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
ability.text = [ability.text, abilityBlock[line].text].join(' ');
|
|
223
|
+
ability.lineTo = abilityBlock[line].lineTo;
|
|
224
|
+
}
|
|
225
|
+
line++;
|
|
226
|
+
}
|
|
227
|
+
lines.push(ability);
|
|
228
|
+
}
|
|
229
|
+
return lines.sort((a, b) => a.lineFrom - b.lineFrom);
|
|
230
|
+
}
|
|
231
|
+
function getLine(lines, kind) {
|
|
232
|
+
var _a, _b;
|
|
233
|
+
return (_b = (_a = lines.find((l) => kind === l.kind)) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : '';
|
|
234
|
+
}
|
|
235
|
+
function listLines(lines, kind) {
|
|
236
|
+
return lines.filter((l) => kind === l.kind).map(({ text }) => text).join('\n');
|
|
237
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pf2e-sage-stats",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "An RPG Sage's .tsv stat generation tool",
|
|
5
5
|
"author": "ikariott@gmail.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,6 +48,5 @@
|
|
|
48
48
|
"pluralize": "^8.0.0",
|
|
49
49
|
"tsv": "^0.2.0",
|
|
50
50
|
"zod": "^3.24.1"
|
|
51
|
-
}
|
|
52
|
-
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
|
51
|
+
}
|
|
53
52
|
}
|