@iamjameslennon/ddb-mcp 2.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/README.md +520 -0
- package/dist/auth.d.ts +3 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +69 -0
- package/dist/auth.js.map +1 -0
- package/dist/browser.d.ts +9 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +68 -0
- package/dist/browser.js.map +1 -0
- package/dist/cache.d.ts +18 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +45 -0
- package/dist/cache.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +654 -0
- package/dist/index.js.map +1 -0
- package/dist/open5e.d.ts +74 -0
- package/dist/open5e.d.ts.map +1 -0
- package/dist/open5e.js +455 -0
- package/dist/open5e.js.map +1 -0
- package/dist/session-fetch.d.ts +35 -0
- package/dist/session-fetch.d.ts.map +1 -0
- package/dist/session-fetch.js +155 -0
- package/dist/session-fetch.js.map +1 -0
- package/dist/tools/campaign.d.ts +4 -0
- package/dist/tools/campaign.d.ts.map +1 -0
- package/dist/tools/campaign.js +72 -0
- package/dist/tools/campaign.js.map +1 -0
- package/dist/tools/character.d.ts +21 -0
- package/dist/tools/character.d.ts.map +1 -0
- package/dist/tools/character.js +1128 -0
- package/dist/tools/character.js.map +1 -0
- package/dist/tools/encounter.d.ts +22 -0
- package/dist/tools/encounter.d.ts.map +1 -0
- package/dist/tools/encounter.js +453 -0
- package/dist/tools/encounter.js.map +1 -0
- package/dist/tools/library.d.ts +4 -0
- package/dist/tools/library.d.ts.map +1 -0
- package/dist/tools/library.js +112 -0
- package/dist/tools/library.js.map +1 -0
- package/dist/tools/monster.d.ts +27 -0
- package/dist/tools/monster.d.ts.map +1 -0
- package/dist/tools/monster.js +378 -0
- package/dist/tools/monster.js.map +1 -0
- package/dist/tools/navigate.d.ts +5 -0
- package/dist/tools/navigate.d.ts.map +1 -0
- package/dist/tools/navigate.js +67 -0
- package/dist/tools/navigate.js.map +1 -0
- package/dist/tools/reference.d.ts +58 -0
- package/dist/tools/reference.d.ts.map +1 -0
- package/dist/tools/reference.js +850 -0
- package/dist/tools/reference.js.map +1 -0
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +64 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/treasure.d.ts +12 -0
- package/dist/tools/treasure.d.ts.map +1 -0
- package/dist/tools/treasure.js +522 -0
- package/dist/tools/treasure.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +21 -0
- package/dist/utils.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { getMonsterStats } from "./monster.js";
|
|
2
|
+
// ── Dice helpers ──────────────────────────────────────────────────────────────
|
|
3
|
+
function roll(n, sides) {
|
|
4
|
+
let total = 0;
|
|
5
|
+
for (let i = 0; i < n; i++)
|
|
6
|
+
total += Math.floor(Math.random() * sides) + 1;
|
|
7
|
+
return total;
|
|
8
|
+
}
|
|
9
|
+
function d100() {
|
|
10
|
+
return roll(1, 100);
|
|
11
|
+
}
|
|
12
|
+
function crToTier(cr) {
|
|
13
|
+
if (cr <= 4)
|
|
14
|
+
return "0-4";
|
|
15
|
+
if (cr <= 10)
|
|
16
|
+
return "5-10";
|
|
17
|
+
if (cr <= 16)
|
|
18
|
+
return "11-16";
|
|
19
|
+
return "17+";
|
|
20
|
+
}
|
|
21
|
+
function zeroCoins() {
|
|
22
|
+
return { cp: 0, sp: 0, gp: 0, pp: 0 };
|
|
23
|
+
}
|
|
24
|
+
function addCoins(a, b) {
|
|
25
|
+
return { cp: a.cp + b.cp, sp: a.sp + b.sp, gp: a.gp + b.gp, pp: a.pp + b.pp };
|
|
26
|
+
}
|
|
27
|
+
function coinsGp(c) {
|
|
28
|
+
return c.cp * 0.01 + c.sp * 0.1 + c.gp + c.pp * 10;
|
|
29
|
+
}
|
|
30
|
+
function formatCoins(c) {
|
|
31
|
+
const parts = [];
|
|
32
|
+
if (c.cp)
|
|
33
|
+
parts.push(`${c.cp.toLocaleString()} cp`);
|
|
34
|
+
if (c.sp)
|
|
35
|
+
parts.push(`${c.sp.toLocaleString()} sp`);
|
|
36
|
+
if (c.gp)
|
|
37
|
+
parts.push(`${c.gp.toLocaleString()} gp`);
|
|
38
|
+
if (c.pp)
|
|
39
|
+
parts.push(`${c.pp.toLocaleString()} pp`);
|
|
40
|
+
return parts.length ? parts.join(" · ") : "—";
|
|
41
|
+
}
|
|
42
|
+
// ── XDMG Individual treasure (XDMG p.120) ────────────────────────────────────
|
|
43
|
+
function rollIndividualCoins(tier) {
|
|
44
|
+
const c = zeroCoins();
|
|
45
|
+
switch (tier) {
|
|
46
|
+
case "0-4":
|
|
47
|
+
c.gp = roll(3, 6);
|
|
48
|
+
break; // 3d6 gp
|
|
49
|
+
case "5-10":
|
|
50
|
+
c.gp = roll(2, 8) * 10;
|
|
51
|
+
break; // 2d8×10 gp
|
|
52
|
+
case "11-16":
|
|
53
|
+
c.pp = roll(2, 10) * 10;
|
|
54
|
+
break; // 2d10×10 pp
|
|
55
|
+
case "17+":
|
|
56
|
+
c.pp = roll(2, 8) * 100;
|
|
57
|
+
break; // 2d8×100 pp
|
|
58
|
+
}
|
|
59
|
+
return c;
|
|
60
|
+
}
|
|
61
|
+
function individualDiceExpr(tier) {
|
|
62
|
+
switch (tier) {
|
|
63
|
+
case "0-4": return "3d6 gp each";
|
|
64
|
+
case "5-10": return "2d8×10 gp each";
|
|
65
|
+
case "11-16": return "2d10×10 pp each";
|
|
66
|
+
case "17+": return "2d8×100 pp each";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function rollHoardCoins(tier) {
|
|
70
|
+
const c = zeroCoins();
|
|
71
|
+
let itemCount = 0;
|
|
72
|
+
let itemDiceExpr = "";
|
|
73
|
+
switch (tier) {
|
|
74
|
+
case "0-4":
|
|
75
|
+
c.gp = roll(2, 4) * 100;
|
|
76
|
+
itemCount = Math.max(0, roll(1, 4) - 1);
|
|
77
|
+
itemDiceExpr = "1d4-1";
|
|
78
|
+
break;
|
|
79
|
+
case "5-10":
|
|
80
|
+
c.gp = roll(8, 10) * 100;
|
|
81
|
+
itemCount = roll(1, 3);
|
|
82
|
+
itemDiceExpr = "1d3";
|
|
83
|
+
break;
|
|
84
|
+
case "11-16":
|
|
85
|
+
c.gp = roll(8, 8) * 1000;
|
|
86
|
+
itemCount = roll(1, 4);
|
|
87
|
+
itemDiceExpr = "1d4";
|
|
88
|
+
break;
|
|
89
|
+
case "17+":
|
|
90
|
+
c.gp = roll(6, 10) * 10000;
|
|
91
|
+
itemCount = roll(1, 6);
|
|
92
|
+
itemDiceExpr = "1d6";
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return { coins: c, itemCount, itemDiceExpr };
|
|
96
|
+
}
|
|
97
|
+
const CATEGORIES = ["arcana", "armaments", "implements", "relics"];
|
|
98
|
+
function charLevelToRange(level) {
|
|
99
|
+
if (level <= 4)
|
|
100
|
+
return "1-4";
|
|
101
|
+
if (level <= 10)
|
|
102
|
+
return "5-10";
|
|
103
|
+
if (level <= 16)
|
|
104
|
+
return "11-16";
|
|
105
|
+
return "17-20";
|
|
106
|
+
}
|
|
107
|
+
const BY_LEVEL_TABLE = {
|
|
108
|
+
"1-4": [
|
|
109
|
+
{ min: 1, max: 54, rarity: "common" },
|
|
110
|
+
{ min: 55, max: 91, rarity: "uncommon" },
|
|
111
|
+
{ min: 92, max: 100, rarity: "rare" },
|
|
112
|
+
],
|
|
113
|
+
"5-10": [
|
|
114
|
+
{ min: 1, max: 30, rarity: "common" },
|
|
115
|
+
{ min: 31, max: 81, rarity: "uncommon" },
|
|
116
|
+
{ min: 82, max: 98, rarity: "rare" },
|
|
117
|
+
{ min: 99, max: 100, rarity: "very rare" },
|
|
118
|
+
],
|
|
119
|
+
"11-16": [
|
|
120
|
+
{ min: 1, max: 11, rarity: "common" },
|
|
121
|
+
{ min: 12, max: 34, rarity: "uncommon" },
|
|
122
|
+
{ min: 35, max: 70, rarity: "rare" },
|
|
123
|
+
{ min: 71, max: 93, rarity: "very rare" },
|
|
124
|
+
{ min: 94, max: 100, rarity: "legendary" },
|
|
125
|
+
],
|
|
126
|
+
"17-20": [
|
|
127
|
+
{ min: 1, max: 20, rarity: "rare" },
|
|
128
|
+
{ min: 21, max: 64, rarity: "very rare" },
|
|
129
|
+
{ min: 65, max: 100, rarity: "legendary" },
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
const ITEM_TABLES = {
|
|
133
|
+
arcana: {
|
|
134
|
+
common: [
|
|
135
|
+
"Bead of Nourishment", "Bead of Refreshment", "Candle of the Deep", "Cloak of Billowing",
|
|
136
|
+
"Cloak of Many Fashions", "Clothes of Mending", "Dark Shard Amulet", "Enduring Spellbook",
|
|
137
|
+
"Ersatz Eye", "Hat of Vermin", "Hat of Wizardry", "Heward's Handy Spice Pouch",
|
|
138
|
+
"Horn of Silent Alarm", "Instrument of Illusions", "Instrument of Scribing", "Lock of Trickery",
|
|
139
|
+
"Mystery Key", "Orb of Direction", "Orb of Time", "Perfume of Bewitching",
|
|
140
|
+
"Pipe of Smoke Monsters", "Potion of Climbing", "Potion of Comprehension", "Pot of Awakening",
|
|
141
|
+
"Prosthetic Limb", "Rival Coin", "Rope of Mending", "Ruby of the War Mage",
|
|
142
|
+
"Spell Scroll", "Staff of Adornment", "Staff of Birdcalls", "Staff of Flowers",
|
|
143
|
+
"Talking Doll", "Tankard of Sobriety", "Wand of Conducting", "Wand of Pyrotechnics",
|
|
144
|
+
],
|
|
145
|
+
uncommon: [
|
|
146
|
+
"Amulet of Proof against Detection and Location", "Baba Yaga's Dancing Broom", "Bag of Holding",
|
|
147
|
+
"Bag of Tricks", "Brooch of Shielding", "Broom of Flying", "Cap of Water Breathing",
|
|
148
|
+
"Circlet of Blasting", "Cloak of Protection", "Cloak of the Manta Ray", "Decanter of Endless Water",
|
|
149
|
+
"Deck of Illusions", "Driftglobe", "Dust of Disappearance", "Dust of Dryness",
|
|
150
|
+
"Dust of Sneezing and Choking", "Elemental Gem", "Enspelled Staff", "Eversmoking Bottle",
|
|
151
|
+
"Eyes of Charming", "Eyes of Minute Seeing", "Figurine of Wondrous Power, Silver Raven",
|
|
152
|
+
"Gem of Brightness", "Hag Eye", "Hat of Disguise", "Headband of Intellect",
|
|
153
|
+
"Helm of Comprehending Languages", "Helm of Telepathy", "Immovable Rod", "Lantern of Revealing",
|
|
154
|
+
"Medallion of Thoughts", "Mithral Armor", "Necklace of Adaptation", "Oil of Slipperiness",
|
|
155
|
+
"Pearl of Power", "Periapt of Health", "Philter of Love", "Potion of Animal Friendship",
|
|
156
|
+
"Potion of Fire Breath", "Potion of Hill Giant Strength", "Potion of Growth", "Potion of Poison",
|
|
157
|
+
"Potion of Resistance", "Potion of Water Breathing", "Quaal's Feather Token",
|
|
158
|
+
"Ring of Mind Shielding", "Robe of Useful Items", "Rod of the Pact Keeper", "Rope of Climbing",
|
|
159
|
+
"Saddle of the Cavalier", "Sending Stones", "Slippers of Spider Climbing", "Spell Scroll",
|
|
160
|
+
"Staff of the Adder", "Staff of the Python", "Wand of Magic Detection", "Wand of Magic Missiles",
|
|
161
|
+
"Wand of Secrets", "+1 Wand of the War Mage", "Wand of Web", "Wind Fan", "Winged Boots",
|
|
162
|
+
],
|
|
163
|
+
rare: [
|
|
164
|
+
"Bag of Beans", "Bead of Force", "Bowl of Commanding Water Elementals", "Bracers of Defense",
|
|
165
|
+
"Brazier of Commanding Fire Elementals", "Cape of the Mountebank", "Censer of Controlling Air Elementals",
|
|
166
|
+
"Chime of Opening", "Cloak of Displacement", "Cloak of the Bat", "Cube of Force",
|
|
167
|
+
"Cube of Summoning", "Daern's Instant Fortress", "Enspelled Staff", "Figurine of Wondrous Power",
|
|
168
|
+
"Folding Boat", "Gem of Seeing", "Helm of Teleportation", "Heward's Handy Haversack",
|
|
169
|
+
"Horseshoes of Speed", "Ioun Stone, Reserve", "Iron Bands of Bilarro", "Mantle of Spell Resistance",
|
|
170
|
+
"Necklace of Fireballs", "Oil of Etherealness", "Portable Hole", "Potion of Clairvoyance",
|
|
171
|
+
"Potion of Diminution", "Potion of Gaseous Form", "Potion of Fire Giant Strength",
|
|
172
|
+
"Potion of Giant Strength", "Potion of Heroism", "Potion of Invisibility", "Potion of Invulnerability",
|
|
173
|
+
"Potion of Mind Reading", "Quaal's Feather Token", "Ring of Feather Falling", "Ring of Spell Storing",
|
|
174
|
+
"Ring of X-ray Vision", "Robe of Eyes", "Rod of Rulership", "+2 Rod of the Pact Keeper",
|
|
175
|
+
"Scroll of Protection", "Spell Scroll", "Staff of Charming", "Staff of Swarming Insects",
|
|
176
|
+
"Staff of Withering", "Stone of Controlling Earth Elementals", "Wand of Binding", "Wand of Fear",
|
|
177
|
+
"Wand of Fireballs", "Wand of Lightning Bolts", "+2 Wand of the War Mage", "Wand of Wonder",
|
|
178
|
+
"Wings of Flying",
|
|
179
|
+
],
|
|
180
|
+
"very rare": [
|
|
181
|
+
"Amulet of the Planes", "Bag of Devouring", "Carpet of Flying", "Cauldron of Rebirth",
|
|
182
|
+
"Cloak of Arachnida", "Crystal Ball", "Dancing Sword", "Efreeti Bottle", "Enspelled Staff",
|
|
183
|
+
"Figurine of Wondrous Power, Obsidian Steed", "Hat of Many Spells", "Helm of Brilliance",
|
|
184
|
+
"Horseshoes of a Zephyr", "Ioun Stone", "Manual of Golems", "Mirror of Life Trapping",
|
|
185
|
+
"Nolzur's Marvelous Pigments", "Oil of Sharpness", "Potion of Flying",
|
|
186
|
+
"Potion of Cloud Giant Strength", "Potion of Greater Invisibility", "Potion of Longevity",
|
|
187
|
+
"Potion of Speed", "Potion of Vitality", "Ring of Regeneration", "Ring of Shooting Stars",
|
|
188
|
+
"Ring of Telekinesis", "Robe of Scintillating Colors", "Robe of Stars", "Rod of Absorption",
|
|
189
|
+
"Rod of Security", "+3 Rod of the Pact Keeper", "Spell Scroll", "Staff of Fire", "Staff of Frost",
|
|
190
|
+
"Staff of Power", "Staff of Thunder and Lightning", "Tome of Clear Thought", "Wand of Polymorph",
|
|
191
|
+
"+3 Wand of the War Mage",
|
|
192
|
+
],
|
|
193
|
+
legendary: [
|
|
194
|
+
"Apparatus of Kwalish", "Cloak of Invisibility", "Crystal Ball of Mind Reading",
|
|
195
|
+
"Crystal Ball of Telepathy", "Crystal Ball of True Seeing", "Cubic Gate", "Deck of Many Things",
|
|
196
|
+
"Enspelled Staff", "Ioun Stone", "Iron Flask", "Potion of Storm Giant Strength",
|
|
197
|
+
"Ring of Djinni Summoning", "Ring of Elemental Command", "Ring of Invisibility",
|
|
198
|
+
"Ring of Spell Turning", "Ring of Three Wishes", "Robe of the Archmagi",
|
|
199
|
+
"Scroll of Titan Summoning", "Sovereign Glue", "Spell Scroll (Level 9)", "Sphere of Annihilation",
|
|
200
|
+
"Staff of the Magi", "Talisman of the Sphere", "Tome of the Stilled Tongue", "Universal Solvent",
|
|
201
|
+
"Well of Many Worlds",
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
armaments: {
|
|
205
|
+
common: [
|
|
206
|
+
"Armor of Gleaming", "Cast-Off Armor", "Dread Helm", "Moon-Touched Sword",
|
|
207
|
+
"Shield of Expression", "Silvered Weapon", "Smoldering Armor", "Sylvan Talon",
|
|
208
|
+
"Veteran's Cane", "Walloping Ammunition",
|
|
209
|
+
],
|
|
210
|
+
uncommon: [
|
|
211
|
+
"Adamantine Armor", "Adamantine Weapon", "+1 Ammunition", "Bracers of Archery",
|
|
212
|
+
"Enspelled Armor", "Enspelled Weapon", "Gauntlets of Ogre Power", "Javelin of Lightning",
|
|
213
|
+
"Mariner's Armor", "Mithral Armor", "Potion of Hill Giant Strength", "Potion of Pugilism",
|
|
214
|
+
"Quiver of Ehlonna", "Saddle of the Cavalier", "Sentinel Shield", "+1 Shield",
|
|
215
|
+
"Sword of Vengeance", "Trident of Fish Command", "+1 Weapon", "Weapon of Warning",
|
|
216
|
+
"+1 Wraps of Unarmed Power",
|
|
217
|
+
],
|
|
218
|
+
rare: [
|
|
219
|
+
"+2 Ammunition", "+1 Armor", "Armor of Resistance", "Armor of Vulnerability",
|
|
220
|
+
"Arrow-Catching Shield", "Belt of Hill Giant Strength", "Berserker Axe", "Daern's Instant Fortress",
|
|
221
|
+
"Dagger of Venom", "Dragon Slayer", "Elven Chain", "Enspelled Armor", "Enspelled Weapon",
|
|
222
|
+
"Flame Tongue", "Giant Slayer", "Horn of Blasting", "Horn of Valhalla", "Ioun Stone",
|
|
223
|
+
"Mace of Disruption", "Mace of Smiting", "Mace of Terror", "Potion of Fire Giant Strength",
|
|
224
|
+
"Potion of Giant Strength", "Potion of Heroism", "Potion of Invulnerability", "Ring of Protection",
|
|
225
|
+
"Ring of the Ram", "+2 Shield", "Shield of Missile Attraction", "Sun Blade",
|
|
226
|
+
"Sword of Life Stealing", "Sword of Wounding", "Tentacle Rod", "Vicious Weapon",
|
|
227
|
+
"+2 Weapon", "+2 Wraps of Unarmed Power",
|
|
228
|
+
],
|
|
229
|
+
"very rare": [
|
|
230
|
+
"+3 Ammunition", "Ammunition of Slaying", "Animated Shield", "+2 Armor",
|
|
231
|
+
"Belt of Fire Giant Strength", "Belt of Giant Strength", "Dancing Sword", "Demon Armor",
|
|
232
|
+
"Dragon Scale Mail", "Dwarven Plate", "Dwarven Thrower", "Energy Bow", "Enspelled Armor",
|
|
233
|
+
"Enspelled Weapon", "Executioner's Axe", "Frost Brand", "Horn of Valhalla, Bronze",
|
|
234
|
+
"Ioun Stone", "Lute of Thunderous Thumping", "Manual of Gainful Exercise", "Nine Lives Stealer",
|
|
235
|
+
"Oathbow", "Oil of Sharpness", "Potion of Cloud Giant Strength", "Quarterstaff of the Acrobat",
|
|
236
|
+
"Scimitar of Speed", "+3 Shield", "Shield of the Cavalier", "Spellguard Shield",
|
|
237
|
+
"Sword of Sharpness", "Thunderous Greatclub", "+3 Weapon", "+3 Wraps of Unarmed Power",
|
|
238
|
+
],
|
|
239
|
+
legendary: [
|
|
240
|
+
"+3 Armor", "Armor of Invulnerability", "Belt of Cloud Giant Strength",
|
|
241
|
+
"Belt of Storm Giant Strength", "Defender", "Efreeti Chain", "Enspelled Armor",
|
|
242
|
+
"Enspelled Weapon", "Hammer of Thunderbolts", "Holy Avenger", "Horn of Valhalla, Iron",
|
|
243
|
+
"Luck Blade", "Moonblade", "Plate Armor of Etherealness", "Potion of Storm Giant Strength",
|
|
244
|
+
"Rod of Lordly Might", "Sword of Answering", "Vorpal Sword",
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
implements: {
|
|
248
|
+
common: [
|
|
249
|
+
"Bead of Nourishment", "Bead of Refreshment", "Boots of False Tracks", "Candle of the Deep",
|
|
250
|
+
"Charlatan's Die", "Cloak of Many Fashions", "Clockwork Amulet", "Ear Horn of Hearing",
|
|
251
|
+
"Ersatz Eye", "Heward's Handy Spice Pouch", "Horn of Silent Alarm", "Instrument of Illusions",
|
|
252
|
+
"Instrument of Scribing", "Lock of Trickery", "Moon-Touched Sword", "Mystery Key",
|
|
253
|
+
"Orb of Direction", "Orb of Time", "Perfume of Bewitching", "Pipe of Smoke Monsters",
|
|
254
|
+
"Pole of Angling", "Pole of Collapsing", "Potion of Climbing", "Potion of Comprehension",
|
|
255
|
+
"Potion of Healing", "Prosthetic Limb", "Rope of Mending", "Staff of Birdcalls",
|
|
256
|
+
"Sylvan Talon", "Talking Doll", "Tankard of Sobriety", "Veteran's Cane",
|
|
257
|
+
"Walloping Ammunition", "Wand of Conducting", "Wand of Enemy Detection", "Wand of Pyrotechnics",
|
|
258
|
+
],
|
|
259
|
+
uncommon: [
|
|
260
|
+
"Alchemy Jug", "+1 Ammunition", "Bag of Holding", "Boots of Elvenkind",
|
|
261
|
+
"Boots of Striding and Springing", "Boots of the Winterlands", "Broom of Flying",
|
|
262
|
+
"Cap of Water Breathing", "Cloak of Elvenkind", "Cloak of Protection", "Cloak of the Manta Ray",
|
|
263
|
+
"Decanter of Endless Water", "Driftglobe", "Dust of Disappearance", "Dust of Dryness",
|
|
264
|
+
"Dust of Sneezing and Choking", "Enspelled Weapon", "Eyes of Minute Seeing", "Eyes of the Eagle",
|
|
265
|
+
"Gloves of Missile Snaring", "Gloves of Swimming and Climbing", "Gloves of Thievery",
|
|
266
|
+
"Goggles of Night", "Hag Eye", "Helm of Comprehending Languages", "Immovable Rod",
|
|
267
|
+
"Instrument of the Bards", "Lantern of Revealing", "Nature's Mantle", "Oil of Slipperiness",
|
|
268
|
+
"Pipes of Haunting", "Pipes of the Sewers", "Potion of Growth", "Potion of Greater Healing",
|
|
269
|
+
"Potion of Water Breathing", "Quaal's Feather Token", "Ring of Jumping", "Ring of Swimming",
|
|
270
|
+
"Ring of Warmth", "Robe of Useful Items", "Rope of Climbing", "Stone of Good Luck",
|
|
271
|
+
"Wand of Secrets",
|
|
272
|
+
],
|
|
273
|
+
rare: [
|
|
274
|
+
"+2 Ammunition", "Bag of Beans", "Belt of Dwarvenkind", "Boots of Levitation",
|
|
275
|
+
"Boots of Speed", "Chime of Opening", "Dimensional Shackles", "Enspelled Weapon",
|
|
276
|
+
"Folding Boat", "Glamoured Studded Leather", "Heward's Handy Haversack", "Horseshoes of Speed",
|
|
277
|
+
"Instrument of the Bards", "Ioun Stone", "Portable Hole", "Potion of Diminution",
|
|
278
|
+
"Potion of Gaseous Form", "Potion of Superior Healing", "Quaal's Feather Token",
|
|
279
|
+
"Ring of Evasion", "Ring of Free Action", "Rope of Entanglement", "Staff of Healing",
|
|
280
|
+
"Wand of Enemy Detection",
|
|
281
|
+
],
|
|
282
|
+
"very rare": [
|
|
283
|
+
"+3 Ammunition", "Bag of Devouring", "Carpet of Flying", "Enspelled Weapon",
|
|
284
|
+
"Horseshoes of a Zephyr", "Instrument of the Bards, Anstruth Harp", "Ioun Stone",
|
|
285
|
+
"Lute of Thunderous Thumping", "Manual of Quickness of Action", "Nolzur's Marvelous Pigments",
|
|
286
|
+
"Potion of Flying", "Potion of Supreme Healing", "Potion of Speed", "Tome of Leadership and Influence",
|
|
287
|
+
],
|
|
288
|
+
legendary: [
|
|
289
|
+
"Enspelled Weapon", "Instrument of the Bards", "Sovereign Glue", "Sphere of Annihilation",
|
|
290
|
+
"Talisman of the Sphere", "Universal Solvent",
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
relics: {
|
|
294
|
+
common: [
|
|
295
|
+
"Ear Horn of Hearing", "Potion of Healing", "Pot of Awakening", "Ruby of the War Mage",
|
|
296
|
+
"Shield of Expression", "Smoldering Armor", "Spell Scroll", "Staff of Adornment",
|
|
297
|
+
"Staff of Flowers",
|
|
298
|
+
],
|
|
299
|
+
uncommon: [
|
|
300
|
+
"Enspelled Staff", "Keoghtom's Ointment", "Mariner's Armor", "Nature's Mantle",
|
|
301
|
+
"Pearl of Power", "Periapt of Health", "Periapt of Wound Closure", "Potion of Animal Friendship",
|
|
302
|
+
"Potion of Greater Healing", "Potion of Resistance", "Ring of Water Walking", "Sending Stones",
|
|
303
|
+
"Spell Scroll", "Staff of the Adder", "Staff of the Python", "Wand of Magic Detection",
|
|
304
|
+
"+1 Wand of the War Mage",
|
|
305
|
+
],
|
|
306
|
+
rare: [
|
|
307
|
+
"Amulet of Health", "+1 Armor", "Bowl of Commanding Water Elementals",
|
|
308
|
+
"Brazier of Commanding Fire Elementals", "Censer of Controlling Air Elementals",
|
|
309
|
+
"Elixir of Health", "Enspelled Staff", "Horn of Blasting", "Horn of Valhalla", "Ioun Stone",
|
|
310
|
+
"Mace of Disruption", "Mace of Smiting", "Mace of Terror", "Necklace of Prayer Beads",
|
|
311
|
+
"Periapt of Proof against Poison", "Potion of Superior Healing", "Ring of Animal Influence",
|
|
312
|
+
"Ring of Resistance", "Ring of Spell Storing", "Scroll of Protection", "Spell Scroll",
|
|
313
|
+
"Staff of Charming", "Staff of Healing", "Staff of Swarming Insects", "Staff of the Woodlands",
|
|
314
|
+
"Staff of Withering", "Stone of Controlling Earth Elementals", "Tentacle Rod",
|
|
315
|
+
"Wand of Paralysis", "+2 Wand of the War Mage",
|
|
316
|
+
],
|
|
317
|
+
"very rare": [
|
|
318
|
+
"+2 Armor", "Candle of Invocation", "Cauldron of Rebirth", "Enspelled Staff",
|
|
319
|
+
"Horn of Valhalla, Bronze", "Ioun Stone", "Manual of Bodily Health", "Potion of Supreme Healing",
|
|
320
|
+
"Potion of Vitality", "Rod of Alertness", "Spell Scroll", "Spirit Board", "Staff of Fire",
|
|
321
|
+
"Staff of Frost", "Staff of Striking", "Staff of Thunder and Lightning", "Tome of Understanding",
|
|
322
|
+
"+3 Wand of the War Mage",
|
|
323
|
+
],
|
|
324
|
+
legendary: [
|
|
325
|
+
"Armor of Invulnerability", "+3 Armor", "Enspelled Staff", "Holy Avenger",
|
|
326
|
+
"Horn of Valhalla, Iron", "Rod of Resurrection", "Scarab of Protection",
|
|
327
|
+
"Scroll of Titan Summoning", "Spell Scroll (Level 9)", "Talisman of Pure Good",
|
|
328
|
+
"Talisman of Ultimate Evil",
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
function rollRarity(levelRange) {
|
|
333
|
+
const roll100 = d100();
|
|
334
|
+
const table = BY_LEVEL_TABLE[levelRange];
|
|
335
|
+
const row = table.find(r => roll100 >= r.min && roll100 <= r.max);
|
|
336
|
+
return row.rarity;
|
|
337
|
+
}
|
|
338
|
+
function rollMagicItem(levelRange) {
|
|
339
|
+
const rarity = rollRarity(levelRange);
|
|
340
|
+
const category = CATEGORIES[Math.floor(Math.random() * CATEGORIES.length)];
|
|
341
|
+
const items = ITEM_TABLES[category][rarity];
|
|
342
|
+
const name = items[Math.floor(Math.random() * items.length)];
|
|
343
|
+
return { category, rarity, name };
|
|
344
|
+
}
|
|
345
|
+
function rollMagicItems(count, characterLevel) {
|
|
346
|
+
const levelRange = charLevelToRange(characterLevel);
|
|
347
|
+
const results = [];
|
|
348
|
+
for (let i = 0; i < count; i++) {
|
|
349
|
+
results.push(rollMagicItem(levelRange));
|
|
350
|
+
}
|
|
351
|
+
return results;
|
|
352
|
+
}
|
|
353
|
+
// ── Formatting helpers ────────────────────────────────────────────────────────
|
|
354
|
+
function crDisplay(cr) {
|
|
355
|
+
if (cr === 0.125)
|
|
356
|
+
return "1/8";
|
|
357
|
+
if (cr === 0.25)
|
|
358
|
+
return "1/4";
|
|
359
|
+
if (cr === 0.5)
|
|
360
|
+
return "1/2";
|
|
361
|
+
return String(cr);
|
|
362
|
+
}
|
|
363
|
+
function titleCase(s) {
|
|
364
|
+
return s.replace(/\b\w/g, c => c.toUpperCase());
|
|
365
|
+
}
|
|
366
|
+
function itemLabel(category, rarity) {
|
|
367
|
+
return `${titleCase(category)} – ${titleCase(rarity)}`;
|
|
368
|
+
}
|
|
369
|
+
// ── Main function ─────────────────────────────────────────────────────────────
|
|
370
|
+
export async function generateTreasure(input) {
|
|
371
|
+
const { cr, monsters, treasureType, characterLevel } = input;
|
|
372
|
+
if (cr === undefined && (!monsters || monsters.length === 0)) {
|
|
373
|
+
return "Error: provide either cr or a monsters list.";
|
|
374
|
+
}
|
|
375
|
+
if (cr !== undefined && monsters && monsters.length > 0) {
|
|
376
|
+
return "Error: provide either cr or monsters, not both.";
|
|
377
|
+
}
|
|
378
|
+
// ── Direct CR path ────────────────────────────────────────────────────────
|
|
379
|
+
if (cr !== undefined) {
|
|
380
|
+
const tier = crToTier(cr);
|
|
381
|
+
const crStr = crDisplay(cr);
|
|
382
|
+
if (treasureType === "hoard") {
|
|
383
|
+
const { coins, itemCount, itemDiceExpr } = rollHoardCoins(tier);
|
|
384
|
+
const items = characterLevel !== undefined && itemCount > 0
|
|
385
|
+
? rollMagicItems(itemCount, characterLevel)
|
|
386
|
+
: [];
|
|
387
|
+
const totalGp = Math.round(coinsGp(coins) * 100) / 100;
|
|
388
|
+
return formatHoardOutput(crStr, tier, undefined, coins, itemCount, itemDiceExpr, items, characterLevel, totalGp);
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
const coins = rollIndividualCoins(tier);
|
|
392
|
+
const totalGp = Math.round(coinsGp(coins) * 100) / 100;
|
|
393
|
+
return formatIndividualOutput([{ label: `CR ${crStr}`, tier, count: 1 }], [coins], totalGp, 1);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// ── Monster list path ─────────────────────────────────────────────────────
|
|
397
|
+
const monsterList = monsters;
|
|
398
|
+
const uniqueNames = [...new Set(monsterList.map(m => m.name))];
|
|
399
|
+
const statsResults = await Promise.all(uniqueNames.map(n => getMonsterStats(n)));
|
|
400
|
+
const resolvedMap = new Map();
|
|
401
|
+
for (let i = 0; i < uniqueNames.length; i++) {
|
|
402
|
+
resolvedMap.set(uniqueNames[i], statsResults[i]);
|
|
403
|
+
}
|
|
404
|
+
const found = [];
|
|
405
|
+
const notFound = [];
|
|
406
|
+
for (const entry of monsterList) {
|
|
407
|
+
const stats = resolvedMap.get(entry.name);
|
|
408
|
+
if (stats) {
|
|
409
|
+
found.push({ inputName: entry.name, name: stats.name, crValue: stats.crValue, count: entry.count });
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
if (!notFound.includes(entry.name))
|
|
413
|
+
notFound.push(entry.name);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (found.length === 0) {
|
|
417
|
+
const lines = [`TREASURE — could not resolve all monsters`, ``];
|
|
418
|
+
for (const entry of monsterList) {
|
|
419
|
+
lines.push(` ✗ "${entry.name}" — not found in DDB or Open5e`);
|
|
420
|
+
}
|
|
421
|
+
lines.push(``, `No treasure rolled — no monsters could be resolved. Provide cr directly.`);
|
|
422
|
+
return lines.join("\n");
|
|
423
|
+
}
|
|
424
|
+
const statusLines = [];
|
|
425
|
+
if (notFound.length > 0) {
|
|
426
|
+
statusLines.push(`TREASURE — could not resolve all monsters`, ``);
|
|
427
|
+
for (const f of found) {
|
|
428
|
+
statusLines.push(` ✓ ${f.inputName} → CR ${crDisplay(f.crValue)}`);
|
|
429
|
+
}
|
|
430
|
+
for (const n of notFound) {
|
|
431
|
+
statusLines.push(` ✗ "${n}" — not found in DDB or Open5e`);
|
|
432
|
+
}
|
|
433
|
+
statusLines.push(``);
|
|
434
|
+
}
|
|
435
|
+
if (treasureType === "hoard") {
|
|
436
|
+
const highestCr = Math.max(...found.map(f => f.crValue));
|
|
437
|
+
const tier = crToTier(highestCr);
|
|
438
|
+
const { coins, itemCount, itemDiceExpr } = rollHoardCoins(tier);
|
|
439
|
+
const items = characterLevel !== undefined && itemCount > 0
|
|
440
|
+
? rollMagicItems(itemCount, characterLevel)
|
|
441
|
+
: [];
|
|
442
|
+
const totalGp = Math.round(coinsGp(coins) * 100) / 100;
|
|
443
|
+
const sourceDesc = found
|
|
444
|
+
.map(f => `${f.count > 1 ? f.count + " × " : ""}${f.name} (CR ${crDisplay(f.crValue)})`)
|
|
445
|
+
.join(", ");
|
|
446
|
+
return [
|
|
447
|
+
...statusLines,
|
|
448
|
+
...formatHoardOutput(crDisplay(highestCr), tier, sourceDesc, coins, itemCount, itemDiceExpr, items, characterLevel, totalGp).split("\n"),
|
|
449
|
+
].join("\n");
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
// Individual — one roll per monster instance
|
|
453
|
+
const rollEntries = [];
|
|
454
|
+
const allCoins = [];
|
|
455
|
+
for (const f of found) {
|
|
456
|
+
const tier = crToTier(f.crValue);
|
|
457
|
+
rollEntries.push({ label: `${f.name} (CR ${crDisplay(f.crValue)})`, tier, count: f.count });
|
|
458
|
+
for (let i = 0; i < f.count; i++) {
|
|
459
|
+
allCoins.push(rollIndividualCoins(tier));
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const totalMonsters = found.reduce((sum, f) => sum + f.count, 0);
|
|
463
|
+
const combined = allCoins.reduce(addCoins, zeroCoins());
|
|
464
|
+
const totalGp = Math.round(coinsGp(combined) * 100) / 100;
|
|
465
|
+
return [
|
|
466
|
+
...statusLines,
|
|
467
|
+
...formatIndividualOutput(rollEntries, allCoins, totalGp, totalMonsters).split("\n"),
|
|
468
|
+
].join("\n");
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
// ── Output builders ───────────────────────────────────────────────────────────
|
|
472
|
+
function formatHoardOutput(crStr, tier, sourceDesc, coins, itemCount, itemDiceExpr, items, characterLevel, totalGp) {
|
|
473
|
+
const lines = [];
|
|
474
|
+
lines.push(`TREASURE HOARD — CR ${crStr} (tier ${tier})`);
|
|
475
|
+
if (sourceDesc)
|
|
476
|
+
lines.push(`Source: ${sourceDesc} — using highest CR`);
|
|
477
|
+
lines.push(``);
|
|
478
|
+
lines.push(`COINS`);
|
|
479
|
+
lines.push(` ${formatCoins(coins)}`);
|
|
480
|
+
lines.push(``);
|
|
481
|
+
if (characterLevel !== undefined) {
|
|
482
|
+
const levelRange = charLevelToRange(characterLevel);
|
|
483
|
+
if (itemCount === 0) {
|
|
484
|
+
lines.push(`MAGIC ITEMS — ${itemDiceExpr} = 0 rolled (no items this hoard)`);
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
lines.push(`MAGIC ITEMS — ${itemDiceExpr} = ${itemCount} rolled (character level ${characterLevel}, table: levels ${levelRange})`);
|
|
488
|
+
for (let i = 0; i < items.length; i++) {
|
|
489
|
+
const { category, rarity, name } = items[i];
|
|
490
|
+
lines.push(` ${i + 1}. ${name} [${itemLabel(category, rarity)}]`);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
lines.push(``);
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
lines.push(`(provide character_level to include magic items)`);
|
|
497
|
+
lines.push(``);
|
|
498
|
+
}
|
|
499
|
+
lines.push(`TOTAL VALUE ~${totalGp.toLocaleString()} gp`);
|
|
500
|
+
return lines.join("\n");
|
|
501
|
+
}
|
|
502
|
+
function formatIndividualOutput(entries, allCoins, totalGp, totalMonsters) {
|
|
503
|
+
const lines = [];
|
|
504
|
+
lines.push(`INDIVIDUAL TREASURE — ${totalMonsters} monster${totalMonsters !== 1 ? "s" : ""} rolled separately`);
|
|
505
|
+
lines.push(``);
|
|
506
|
+
let coinIdx = 0;
|
|
507
|
+
for (const entry of entries) {
|
|
508
|
+
const diceExpr = individualDiceExpr(entry.tier);
|
|
509
|
+
lines.push(` ${entry.label} ×${entry.count} — ${entry.count} roll${entry.count !== 1 ? "s" : ""} on tier ${entry.tier} (${diceExpr})`);
|
|
510
|
+
for (let i = 0; i < entry.count; i++) {
|
|
511
|
+
lines.push(` Roll ${i + 1}: ${formatCoins(allCoins[coinIdx++])}`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const combined = allCoins.reduce(addCoins, zeroCoins());
|
|
515
|
+
lines.push(``);
|
|
516
|
+
lines.push(`COINS (combined)`);
|
|
517
|
+
lines.push(` ${formatCoins(combined)}`);
|
|
518
|
+
lines.push(``);
|
|
519
|
+
lines.push(`TOTAL VALUE ~${totalGp.toLocaleString()} gp`);
|
|
520
|
+
return lines.join("\n");
|
|
521
|
+
}
|
|
522
|
+
//# sourceMappingURL=treasure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treasure.js","sourceRoot":"","sources":["../../src/tools/treasure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,iFAAiF;AAEjF,SAAS,IAAI,CAAC,CAAS,EAAE,KAAa;IACpC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,IAAI;IACX,OAAO,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtB,CAAC;AAMD,SAAS,QAAQ,CAAC,EAAU;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C,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY,KAAK,CAAC,IAAI,KAAK,QAAQ,GAAG,CAAC,CAAC;QACxI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAe9D"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip HTML tags and decode common HTML entities from a string.
|
|
3
|
+
*/
|
|
4
|
+
export function stripHtml(s) {
|
|
5
|
+
if (!s)
|
|
6
|
+
return "";
|
|
7
|
+
return s
|
|
8
|
+
.replace(/<[^>]*>/g, "")
|
|
9
|
+
.replace(/ /g, " ")
|
|
10
|
+
.replace(/&/g, "&")
|
|
11
|
+
.replace(/</g, "<")
|
|
12
|
+
.replace(/>/g, ">")
|
|
13
|
+
.replace(/"/g, '"')
|
|
14
|
+
.replace(/'/g, "'")
|
|
15
|
+
.replace(/–/g, "–")
|
|
16
|
+
.replace(/—/g, "—")
|
|
17
|
+
.replace(/&#\d+;/g, (m) => String.fromCharCode(parseInt(m.slice(2, -1))))
|
|
18
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
19
|
+
.trim();
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,CAA4B;IACpD,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAClB,OAAO,CAAC;SACL,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iamjameslennon/ddb-mcp",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "D&D Beyond MCP Server with Google Auth",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": ["dist/", "README.md"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"start": "node dist/index.js",
|
|
10
|
+
"dev": "tsx src/index.ts",
|
|
11
|
+
"prepare": "npm run build",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"build:watch": "tsc --watch",
|
|
14
|
+
"lint": "eslint src/",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"release": "node scripts/release.js",
|
|
18
|
+
"preinstall": "node -e \"if (process.env.npm_command && process.env.npm_command !== 'ci' && !process.env.npm_config_global) { console.error('\\nERROR: Use npm ci instead of npm install.\\nThis project pins exact dependency versions via package-lock.json.\\nRunning npm install can silently upgrade packages and break things.\\n'); process.exit(1); }\""
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
25
|
+
"playwright": "^1.49.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^25.3.0",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
31
|
+
"eslint": "^10.0.1",
|
|
32
|
+
"tsx": "^4.19.0",
|
|
33
|
+
"typescript": "^5.7.0",
|
|
34
|
+
"vitest": "^4.1.5"
|
|
35
|
+
}
|
|
36
|
+
}
|