@archivist-gg/dnd5e 0.2.0 → 0.3.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/chunk-353WXS6S.js +25 -0
- package/dist/{chunk-DC74TZNA.js → chunk-4LZJXJJS.js} +7 -2
- package/dist/{chunk-R5SQHP2X.js → chunk-5MZSB6OM.js} +8 -11
- package/dist/{chunk-5WQD3WNZ.js → chunk-A4WENOUQ.js} +5 -1
- package/dist/{chunk-V6SOFUJW.js → chunk-AIRFC5NQ.js} +3 -1
- package/dist/{chunk-TQZB4OCJ.js → chunk-EMOORSQ7.js} +45 -20
- package/dist/{chunk-3TRGRSCH.js → chunk-LV4SNWZQ.js} +7 -1
- package/dist/{chunk-IXZXFFFW.js → chunk-M2EMFD6S.js} +1 -1
- package/dist/{chunk-UC4FE5X3.js → chunk-N6N74K6X.js} +1 -1
- package/dist/{chunk-J2RYSZMQ.js → chunk-VTTA2ALZ.js} +2 -2
- package/dist/class/class.slug.d.ts +7 -5
- package/dist/class/class.slug.js +1 -1
- package/dist/entities/base-item-resolver.d.ts +9 -0
- package/dist/entities/base-item-resolver.js +6 -4
- package/dist/entities/slug.d.ts +7 -0
- package/dist/entities/slug.js +3 -1
- package/dist/index.js +3812 -3604
- package/dist/item/item.actions-map.d.ts +8 -7
- package/dist/item/item.actions-map.js +3 -4
- package/dist/pc/pc.decision-engine.d.ts +0 -3
- package/dist/pc/pc.decision-engine.js +6 -8
- package/dist/pc/pc.equipment.js +5 -12
- package/dist/pc/pc.feature-effects.d.ts +5 -0
- package/dist/pc/pc.feature-effects.js +2 -11
- package/dist/pc/pc.parser.js +1 -1
- package/dist/pc/pc.pools.js +6 -6
- package/dist/pc/pc.recalc.d.ts +7 -0
- package/dist/pc/pc.recalc.js +82 -38
- package/dist/pc/pc.resolver.js +6 -6
- package/dist/pc/pc.rest.d.ts +1 -1
- package/dist/pc/pc.rest.js +20 -11
- package/dist/pc/pc.schema.d.ts +2 -0
- package/dist/pc/pc.schema.js +1 -1
- package/dist/pc/pc.slotting.js +3 -3
- package/dist/pc/pc.spellcasting.js +2 -2
- package/dist/pc/pc.types.d.ts +28 -0
- package/dist/spell/spell.access.js +1 -1
- package/dist/weapon/weapon.classify.d.ts +21 -0
- package/dist/weapon/weapon.classify.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bareEntitySlug
|
|
3
|
+
} from "./chunk-LV4SNWZQ.js";
|
|
4
|
+
|
|
5
|
+
// src/weapon/weapon.classify.ts
|
|
6
|
+
var PURE_RANGED_THROWN_SLUGS = /* @__PURE__ */ new Set(["dart", "net"]);
|
|
7
|
+
function classifyWeaponRange(weapon) {
|
|
8
|
+
const has = (p) => weapon.properties.some((x) => x === p);
|
|
9
|
+
const isCatRanged = /ranged/.test(weapon.category);
|
|
10
|
+
const pureRanged = isCatRanged && (has("ammunition") || has("loading") || PURE_RANGED_THROWN_SLUGS.has(bareEntitySlug(weapon.slug)));
|
|
11
|
+
if (pureRanged) {
|
|
12
|
+
return {
|
|
13
|
+
melee: null,
|
|
14
|
+
ranged: weapon.range ? { normal: weapon.range.normal, long: weapon.range.long, thrown: false } : null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
melee: { reach: 5 + (has("reach") ? 5 : 0) },
|
|
19
|
+
ranged: weapon.range ? { normal: weapon.range.normal, long: weapon.range.long, thrown: true } : null
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
classifyWeaponRange
|
|
25
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
slugify
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LV4SNWZQ.js";
|
|
4
4
|
|
|
5
5
|
// src/entities/base-item-resolver.ts
|
|
6
6
|
function unwrapWikilink(input) {
|
|
@@ -10,6 +10,7 @@ function unwrapWikilink(input) {
|
|
|
10
10
|
const pipe = inner.indexOf("|");
|
|
11
11
|
return pipe === -1 ? inner : inner.slice(0, pipe);
|
|
12
12
|
}
|
|
13
|
+
var FOLDER_TO_TYPE = { Weapons: "weapon", Armor: "armor" };
|
|
13
14
|
function vaultPathToSlug(target) {
|
|
14
15
|
const segments = target.split("/").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
15
16
|
if (segments.length === 0) return "";
|
|
@@ -17,10 +18,13 @@ function vaultPathToSlug(target) {
|
|
|
17
18
|
return slugify(segments[0]);
|
|
18
19
|
}
|
|
19
20
|
const compendiumName = segments[0];
|
|
21
|
+
const typeFolder = segments[segments.length - 2];
|
|
20
22
|
const basename = segments[segments.length - 1];
|
|
21
23
|
const prefix = slugify(compendiumName);
|
|
22
24
|
const nameSlug = slugify(basename);
|
|
23
|
-
|
|
25
|
+
if (!prefix || !nameSlug) return nameSlug;
|
|
26
|
+
const type = FOLDER_TO_TYPE[typeFolder];
|
|
27
|
+
return type ? `${prefix}_${type}_${nameSlug}` : `${prefix}_${nameSlug}`;
|
|
24
28
|
}
|
|
25
29
|
function resolveBaseItem(baseItem, registry) {
|
|
26
30
|
var _a, _b;
|
|
@@ -41,6 +45,7 @@ function resolveBaseItemOfType(baseItem, entityType, registry) {
|
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
export {
|
|
48
|
+
vaultPathToSlug,
|
|
44
49
|
resolveBaseItem,
|
|
45
50
|
resolveBaseItemOfType
|
|
46
51
|
};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ALL_SKILL_SLUGS
|
|
3
3
|
} from "./chunk-BH6AMZVY.js";
|
|
4
|
-
import {
|
|
5
|
-
isItemEntity,
|
|
6
|
-
resolveEntityForEntry
|
|
7
|
-
} from "./chunk-UC4FE5X3.js";
|
|
8
4
|
import {
|
|
9
5
|
normalizeKnownSpell,
|
|
10
6
|
resolveSpellcasting
|
|
11
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M2EMFD6S.js";
|
|
12
8
|
import {
|
|
13
9
|
readTableColumn
|
|
14
10
|
} from "./chunk-5XUXXAQJ.js";
|
|
15
11
|
import {
|
|
16
12
|
recognizeDecision
|
|
17
13
|
} from "./chunk-JEYQU3JT.js";
|
|
14
|
+
import {
|
|
15
|
+
isItemEntity,
|
|
16
|
+
resolveEntityForEntry
|
|
17
|
+
} from "./chunk-N6N74K6X.js";
|
|
18
|
+
import {
|
|
19
|
+
bareEntitySlug
|
|
20
|
+
} from "./chunk-LV4SNWZQ.js";
|
|
18
21
|
import {
|
|
19
22
|
ABILITY_KEYS
|
|
20
23
|
} from "./chunk-WP2CX2JO.js";
|
|
@@ -483,11 +486,6 @@ function wikilinkTailSlug(link) {
|
|
|
483
486
|
const tail = (_a = inner.split("/").pop()) != null ? _a : inner;
|
|
484
487
|
return tail.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
485
488
|
}
|
|
486
|
-
function bareEntitySlug(slug) {
|
|
487
|
-
if (!slug) return "";
|
|
488
|
-
const i = slug.indexOf("_");
|
|
489
|
-
return i === -1 ? slug : slug.slice(i + 1);
|
|
490
|
-
}
|
|
491
489
|
function matchesFilter(e, where, ownerBare) {
|
|
492
490
|
var _a, _b, _c, _d, _e;
|
|
493
491
|
const d = e.data;
|
|
@@ -1084,7 +1082,6 @@ export {
|
|
|
1084
1082
|
collectChosenGrantedFeatures,
|
|
1085
1083
|
collectResolvedFeatures,
|
|
1086
1084
|
wikilinkTailSlug,
|
|
1087
|
-
bareEntitySlug,
|
|
1088
1085
|
__matchesFilterForTest,
|
|
1089
1086
|
collectChosenProficiencies,
|
|
1090
1087
|
collectChosenAbilityPoints,
|
|
@@ -94,7 +94,11 @@ var characterOverridesSchema = z.object({
|
|
|
94
94
|
investigation: z.number().int().optional(),
|
|
95
95
|
insight: z.number().int().optional()
|
|
96
96
|
}).partial().optional(),
|
|
97
|
-
hp: z.object({
|
|
97
|
+
hp: z.object({
|
|
98
|
+
max: z.number().int().positive().optional(),
|
|
99
|
+
rolled: z.number().int().positive().optional(),
|
|
100
|
+
modifier: z.number().int().optional()
|
|
101
|
+
}).optional(),
|
|
98
102
|
ac: z.number().int().optional(),
|
|
99
103
|
speed: z.number().int().optional(),
|
|
100
104
|
initiative: z.number().int().optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bareEntitySlug
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LV4SNWZQ.js";
|
|
4
4
|
import {
|
|
5
5
|
ABILITY_KEYS
|
|
6
6
|
} from "./chunk-WP2CX2JO.js";
|
|
@@ -10,6 +10,7 @@ function emptyFeatureEffectTotals() {
|
|
|
10
10
|
return {
|
|
11
11
|
initiative_bonus: 0,
|
|
12
12
|
hp_per_level_bonus: 0,
|
|
13
|
+
hp_per_level_terms: [],
|
|
13
14
|
speed_walk_bonus: 0,
|
|
14
15
|
speed_walk_set: 0,
|
|
15
16
|
senses: { darkvision: 0, blindsight: 0, tremorsense: 0, truesight: 0 },
|
|
@@ -66,6 +67,7 @@ function applyEffect(out, eff, label) {
|
|
|
66
67
|
break;
|
|
67
68
|
case "hp-per-level-bonus":
|
|
68
69
|
out.hp_per_level_bonus += eff.value;
|
|
70
|
+
out.hp_per_level_terms.push({ label, value: eff.value });
|
|
69
71
|
break;
|
|
70
72
|
case "speed-bonus":
|
|
71
73
|
if (eff.mode === "walk") {
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
classifyWeaponRange
|
|
3
|
+
} from "./chunk-353WXS6S.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultSlotForType,
|
|
6
6
|
effectiveArmor,
|
|
7
7
|
isItemEntity,
|
|
8
8
|
isWeaponEntity,
|
|
9
9
|
resolveEntityForEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-N6N74K6X.js";
|
|
11
11
|
import {
|
|
12
12
|
readNumericBonus
|
|
13
13
|
} from "./chunk-LWFTHJIE.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveBaseItem
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4LZJXJJS.js";
|
|
17
|
+
import {
|
|
18
|
+
bareEntitySlug
|
|
19
|
+
} from "./chunk-LV4SNWZQ.js";
|
|
17
20
|
|
|
18
21
|
// src/weapon/weapon-mastery.ts
|
|
19
22
|
var MASTERY = {
|
|
@@ -245,7 +248,14 @@ function assignSlots(resolved, registry, warnings) {
|
|
|
245
248
|
const { entity, entityType } = resolveEntityForEntry(entry.item, registry);
|
|
246
249
|
if (!entity || !entityType) continue;
|
|
247
250
|
const defaultSlot = defaultSlotForType(entityType, entity, registry);
|
|
248
|
-
if (!defaultSlot)
|
|
251
|
+
if (!defaultSlot) {
|
|
252
|
+
if (isItemEntity(entity) && typeof entity.base_item === "string" && entity.base_item.length > 0) {
|
|
253
|
+
warnings.push(
|
|
254
|
+
`Magic item "${entity.name}" base_item ${entity.base_item} did not resolve to a base weapon or armor; not slotted (AC/attack not applied).`
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
249
259
|
const placed = { index: i, entity, entityType, entry };
|
|
250
260
|
if (defaultSlot === "mainhand") {
|
|
251
261
|
if (!slots.mainhand) slots.mainhand = placed;
|
|
@@ -265,12 +275,17 @@ function assignSlots(resolved, registry, warnings) {
|
|
|
265
275
|
}
|
|
266
276
|
return slots;
|
|
267
277
|
}
|
|
268
|
-
function computeAC(equippedSlots, resolved, mods, registry) {
|
|
278
|
+
function computeAC(equippedSlots, resolved, mods, registry, warnings) {
|
|
269
279
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
270
280
|
const breakdown = [];
|
|
271
281
|
const armorSlot = equippedSlots.armor;
|
|
272
282
|
const armorEntity = (_a = armorSlot == null ? void 0 : armorSlot.entity) != null ? _a : null;
|
|
273
283
|
const armor = effectiveArmor(armorEntity, registry);
|
|
284
|
+
if (isItemEntity(armorEntity) && typeof armorEntity.base_item === "string" && !armor) {
|
|
285
|
+
warnings.push(
|
|
286
|
+
`Magic armor "${armorEntity.name}" base_item ${armorEntity.base_item} did not resolve to a base armor; AC not applied.`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
274
289
|
let ac = 10;
|
|
275
290
|
if (armor) {
|
|
276
291
|
const armorBase = armor.ac.base + ((_b = armor.ac.flat) != null ? _b : 0);
|
|
@@ -329,8 +344,9 @@ function hasProperty(weapon, prop) {
|
|
|
329
344
|
return weapon.properties.some((p) => p === prop);
|
|
330
345
|
}
|
|
331
346
|
function attackAbility(weapon, mods, weaponAbilities) {
|
|
332
|
-
const
|
|
333
|
-
|
|
347
|
+
const modes = classifyWeaponRange(weapon);
|
|
348
|
+
const finesse = hasProperty(weapon, "finesse");
|
|
349
|
+
if (modes.melee) {
|
|
334
350
|
const scoped = weaponAbilities.find((o2) => {
|
|
335
351
|
var _a;
|
|
336
352
|
return (_a = o2.weaponSlugs) == null ? void 0 : _a.includes(bareEntitySlug(weapon.slug));
|
|
@@ -338,10 +354,10 @@ function attackAbility(weapon, mods, weaponAbilities) {
|
|
|
338
354
|
const glob = weaponAbilities.find((o2) => !o2.weaponSlugs);
|
|
339
355
|
const o = scoped != null ? scoped : glob;
|
|
340
356
|
if (o) return o.ability;
|
|
357
|
+
if (finesse) return mods.dex >= mods.str ? "dex" : "str";
|
|
358
|
+
return "str";
|
|
341
359
|
}
|
|
342
|
-
|
|
343
|
-
if (hasProperty(weapon, "finesse")) return mods.dex >= mods.str ? "dex" : "str";
|
|
344
|
-
return "str";
|
|
360
|
+
return finesse && mods.str > mods.dex ? "str" : "dex";
|
|
345
361
|
}
|
|
346
362
|
function isWeaponSlugProficient(weapon, weaponSlug, profs) {
|
|
347
363
|
const wp = profs.weapons;
|
|
@@ -420,8 +436,10 @@ function buildAttackRow(args) {
|
|
|
420
436
|
{ source: `${ability.toUpperCase()} modifier`, amount: abilityMod, kind: "ability" },
|
|
421
437
|
{ source: magicSource, amount: magic.dmg, kind: "item" }
|
|
422
438
|
];
|
|
423
|
-
const
|
|
424
|
-
const
|
|
439
|
+
const modes = classifyWeaponRange(weapon);
|
|
440
|
+
const fmtRanged = (r) => `${r.normal}/${r.long} ft`;
|
|
441
|
+
const range = modes.melee ? `${modes.melee.reach} ft` : modes.ranged ? fmtRanged(modes.ranged) : void 0;
|
|
442
|
+
const thrownRange = modes.melee && modes.ranged ? fmtRanged(modes.ranged) : void 0;
|
|
425
443
|
const stringProps = weapon.properties.filter(
|
|
426
444
|
(p) => typeof p === "string"
|
|
427
445
|
);
|
|
@@ -429,7 +447,8 @@ function buildAttackRow(args) {
|
|
|
429
447
|
const row = {
|
|
430
448
|
id,
|
|
431
449
|
name,
|
|
432
|
-
range,
|
|
450
|
+
...range !== void 0 ? { range } : {},
|
|
451
|
+
...thrownRange !== void 0 ? { thrownRange } : {},
|
|
433
452
|
toHit,
|
|
434
453
|
damageDice,
|
|
435
454
|
damageType: (_b = magic.damageTypeOverride) != null ? _b : weapon.damage.type,
|
|
@@ -446,7 +465,7 @@ function buildAttackRow(args) {
|
|
|
446
465
|
breakdown: { toHit: toHitBreakdown, damage: damageBreakdown },
|
|
447
466
|
informational: args.magic.informational.length > 0 ? args.magic.informational : void 0,
|
|
448
467
|
slotKey: args.slotKey,
|
|
449
|
-
subLabel: formatWeaponSubLabel(weapon, finalProps),
|
|
468
|
+
subLabel: formatWeaponSubLabel(weapon, finalProps, modes),
|
|
450
469
|
actionCost: args.actionCost,
|
|
451
470
|
versatile: args.versatileDice ? { damageDice: formatDice(args.versatileDice) } : void 0
|
|
452
471
|
};
|
|
@@ -460,10 +479,16 @@ function buildAttackRow(args) {
|
|
|
460
479
|
}
|
|
461
480
|
return row;
|
|
462
481
|
}
|
|
463
|
-
function
|
|
482
|
+
function humanizeWeaponToken(s) {
|
|
483
|
+
return s.replace(/[-_]/g, " ").replace(/(^|[\s(])\w/g, (c) => c.toUpperCase());
|
|
484
|
+
}
|
|
485
|
+
function formatWeaponSubLabel(weapon, properties, modes) {
|
|
464
486
|
const parts = [];
|
|
465
|
-
if (weapon.category)
|
|
466
|
-
|
|
487
|
+
if (weapon.category) {
|
|
488
|
+
const cat = modes.melee && /ranged/.test(weapon.category) ? weapon.category.replace("ranged", "melee") : weapon.category;
|
|
489
|
+
parts.push(humanizeWeaponToken(cat));
|
|
490
|
+
}
|
|
491
|
+
if (properties.length > 0) parts.push(properties.map(humanizeWeaponToken).join(", "));
|
|
467
492
|
return parts.join(" \xB7 ");
|
|
468
493
|
}
|
|
469
494
|
function computeAttacks(equippedSlots, mods, profs, registry, warnings, proficiencyBonus, ctx, weaponMasteries, weaponAbilities = []) {
|
|
@@ -486,7 +511,7 @@ function computeAttacks(equippedSlots, mods, profs, registry, warnings, proficie
|
|
|
486
511
|
if (found && found.entityType === "weapon" && isWeaponEntity(found.data)) {
|
|
487
512
|
weapon = found.data;
|
|
488
513
|
} else {
|
|
489
|
-
warnings.push(`Magic weapon ${entity.name} references missing base_item
|
|
514
|
+
warnings.push(`Magic weapon ${entity.name} references missing base_item ${baseSlug}.`);
|
|
490
515
|
continue;
|
|
491
516
|
}
|
|
492
517
|
} else {
|
|
@@ -547,7 +572,7 @@ function computeSlotsAndAttacks(resolved, mods, profs, registry, warnings, profi
|
|
|
547
572
|
var _a, _b, _c;
|
|
548
573
|
const equippedSlots = assignSlots(resolved, registry, warnings);
|
|
549
574
|
const overrides = (_a = resolved.definition.overrides) != null ? _a : {};
|
|
550
|
-
const acOut = computeAC(equippedSlots, resolved, mods, registry);
|
|
575
|
+
const acOut = computeAC(equippedSlots, resolved, mods, registry, warnings);
|
|
551
576
|
const ctx = buildConditionContext(resolved, equippedSlots);
|
|
552
577
|
const attacks = computeAttacks(equippedSlots, mods, profs, registry, warnings, proficiencyBonus, ctx, weaponMasteries, weaponAbilities);
|
|
553
578
|
return {
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
function slugify(name) {
|
|
3
3
|
return name.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/[\s]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
|
|
4
4
|
}
|
|
5
|
+
function bareEntitySlug(slug) {
|
|
6
|
+
if (!slug) return "";
|
|
7
|
+
const p = slug.split("_");
|
|
8
|
+
return p.length >= 3 ? p.slice(2).join("_") : p[p.length - 1];
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
export {
|
|
7
|
-
slugify
|
|
12
|
+
slugify,
|
|
13
|
+
bareEntitySlug
|
|
8
14
|
};
|
|
@@ -6,8 +6,8 @@ function bareSlug(ref) {
|
|
|
6
6
|
}
|
|
7
7
|
function baseClassName(ref) {
|
|
8
8
|
const bare = bareSlug(ref);
|
|
9
|
-
const
|
|
10
|
-
return
|
|
9
|
+
const p = bare.split("_");
|
|
10
|
+
return p.length >= 3 ? p.slice(2).join("_") : p[p.length - 1];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export {
|
|
@@ -2,10 +2,12 @@ export declare function bareSlug(ref: string): string;
|
|
|
2
2
|
/**
|
|
3
3
|
* Bare class name for profile / spell-`classes` lookups.
|
|
4
4
|
*
|
|
5
|
-
* Compendium-qualified slugs are `<compendium>_<name>`
|
|
6
|
-
* `srd-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Compendium-qualified slugs are `<compendium>_<type>_<name>` (3-part, e.g.
|
|
6
|
+
* `srd-2024_class_wizard`) or the legacy `<compendium>_<name>` (2-part, e.g.
|
|
7
|
+
* `srd-5e_wizard`); compendium/type segments are hyphen-cased, so `_` only ever
|
|
8
|
+
* separates the structural parts from the entity name. Strip that prefix to get
|
|
9
|
+
* the canonical class key (`wizard`). Name-slugs never contain `_`, so a 3-part
|
|
10
|
+
* slug's name is `parts.slice(2).join("_")`. Hand-written/test slugs without a
|
|
11
|
+
* `_` pass through unchanged (`wizard` → `wizard`).
|
|
10
12
|
*/
|
|
11
13
|
export declare function baseClassName(ref: string): string;
|
package/dist/class/class.slug.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { EntityRegistry, RegisteredEntity } from "@archivist-gg/core";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a vault-path target (e.g. `SRD 5e/Weapons/Longsword`) to a
|
|
4
|
+
* registry-compatible slug (`srd-5e_weapon_longsword`). The middle Type folder
|
|
5
|
+
* (`segments[length-2]`) supplies the entity-type token so the slug matches
|
|
6
|
+
* the now type-namespaced registry key. For a bare basename without any `/`,
|
|
7
|
+
* returns the slugified basename - which lets legacy wikilinks like
|
|
8
|
+
* `[[longsword]]` continue to resolve when registered under that bare slug.
|
|
9
|
+
*/
|
|
10
|
+
export declare function vaultPathToSlug(target: string): string;
|
|
2
11
|
/**
|
|
3
12
|
* Public: take a `base_item` string (vault-path wikilink, alias-form
|
|
4
13
|
* wikilink, bare-slug wikilink, or bare slug) and return the matching
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveBaseItem,
|
|
3
|
-
resolveBaseItemOfType
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
resolveBaseItemOfType,
|
|
4
|
+
vaultPathToSlug
|
|
5
|
+
} from "../chunk-4LZJXJJS.js";
|
|
6
|
+
import "../chunk-LV4SNWZQ.js";
|
|
6
7
|
export {
|
|
7
8
|
resolveBaseItem,
|
|
8
|
-
resolveBaseItemOfType
|
|
9
|
+
resolveBaseItemOfType,
|
|
10
|
+
vaultPathToSlug
|
|
9
11
|
};
|
package/dist/entities/slug.d.ts
CHANGED
|
@@ -3,3 +3,10 @@
|
|
|
3
3
|
* "Ancient Red Dragon" -> "ancient-red-dragon"
|
|
4
4
|
*/
|
|
5
5
|
export declare function slugify(name: string): string;
|
|
6
|
+
/** "srd-2024_fighter" → "fighter", "srd-2024_background_acolyte" → "acolyte".
|
|
7
|
+
* Arity-robust: strips a `<prefix>_<type>_<name>` (3-part) or legacy `<prefix>_<name>`
|
|
8
|
+
* (2-part) slug down to the bare NAME, and passes a bare slug through unchanged.
|
|
9
|
+
* Name-slugs never contain `_`, so for a 3-part-or-longer slug the name is
|
|
10
|
+
* `parts.slice(2).join("_")`. Tolerates a nullish slug (degrades to "") so a
|
|
11
|
+
* malformed entity can't hard-crash the builder; the resolver backfills real slugs. */
|
|
12
|
+
export declare function bareEntitySlug(slug: string | null | undefined): string;
|