JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q26686F
  • License MIT

D&D SRD data library

Package Exports

  • dndsrd
  • dndsrd/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dndsrd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dndsrd

A TypeScript library providing D&D SRD (System Reference Document) data.

Installation

npm install dndsrd

Usage

import { classes, spells, monsters, CharacterClass, Spell, Monster } from '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