@alicanc/dndsrd
v0.1.0-3153575
Published
D&D SRD data library
Readme
@alicanc/dndsrd
A TypeScript library providing D&D SRD (System Reference Document) data.
Installation
npm install @alicanc/dndsrdUsage
import { classes, spells, monsters, CharacterClass, Spell, Monster } from '@alicanc/dndsrd';
// Get all character classes
console.log(classes);
// [
// {
// name: 'Fighter',
// hitDie: 10,
// proficiencies: [...],
// savingThrows: ['Strength', 'Constitution']
// },
// ...
// ]
// Get all spells
console.log(spells);
// [
// {
// name: 'Magic Missile',
// level: 1,
// school: 'Evocation',
// castingTime: '1 action',
// range: '120 feet',
// components: ['V', 'S'],
// duration: 'Instantaneous',
// description: '...'
// },
// ...
// ]
// Get all monsters
console.log(monsters);
// [
// {
// name: 'Goblin',
// size: 'Small',
// type: 'humanoid',
// alignment: 'neutral evil',
// armorClass: 15,
// hitPoints: 7,
// speed: '30 ft.',
// abilities: { strength: 8, dexterity: 14, ... },
// challengeRating: 0.25
// },
// ...
// ]Data Included
Character Classes
- Fighter
- Wizard
- Cleric
- Rogue
Spells
- Magic Missile (Level 1)
- Fireball (Level 3)
- Cure Wounds (Level 1)
Monsters
- Goblin (CR 1/4)
- Adult Red Dragon (CR 17)
- Owlbear (CR 3)
Types
The library exports TypeScript types for all data structures:
interface CharacterClass {
name: string;
hitDie: number;
proficiencies: string[];
savingThrows: string[];
}
interface Spell {
name: string;
level: number;
school: string;
castingTime: string;
range: string;
components: string[];
duration: string;
description: string;
}
interface Monster {
name: string;
size: string;
type: string;
alignment: string;
armorClass: number;
hitPoints: number;
speed: string;
abilities: {
strength: number;
dexterity: number;
constitution: number;
intelligence: number;
wisdom: number;
charisma: number;
};
challengeRating: number;
}License
MIT
