Skip to content

Commit 0552965

Browse files
committed
Turn this in to an NPM package
1 parent 6acfc5f commit 0552965

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# dnd5-srd
2+
3+
Dungeons & Dragons (5th edition) System Reference Document in node module form, as JSON.
4+
5+
Fork of a [project](https://github.com/adrpadua/5e-database) by [adrpadua](https://github.com/adrpadua).
6+
7+
# Documentation
8+
9+
## How to use?
10+
11+
As a simple example, lets display how many hit points an Aboleth has.
12+
There are two ways to access the data about monsters:
13+
14+
### Approach 1:
15+
16+
```javascript
17+
const monsters = require('dnd5-srd/monsters');
18+
const aboleth = monsters.find(monster => monster.name === 'Aboleth');
19+
console.log(aboleth.hit_points);
20+
```
21+
22+
### Approach 2:
23+
24+
```javascript
25+
const dnd = require('dnd5-srd');
26+
const monsters = dnd.data.monsters;
27+
const aboleth = monsters.find(monster => monster.name === 'Aboleth');
28+
console.log(aboleth.hit_points);
29+
```
30+
31+
## Reference
32+
33+
Currently there's no documentation for how the data looks like. You'll have to explore the JSON files to figure that out.
34+
The following data types are available:
35+
36+
* `abilityScores`
37+
* `classes`
38+
* `conditions`
39+
* `damageTypes`
40+
* `equipment`
41+
* `equipmentCategories`
42+
* `features`
43+
* `languages`
44+
* `levels`
45+
* `magicSchools`
46+
* `monsters`
47+
* `proficiencies`
48+
* `races`
49+
* `skills`
50+
* `spellcasting`
51+
* `spells`
52+
* `startingEquipment`
53+
* `subclasses`
54+
* `subraces`
55+
* `traits`
56+
* `weaponProperties`

index.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const abilityScores = require('./abilityScores.json');
2+
const classes = require('./classes.json');
3+
const conditions = require('./conditions.json');
4+
const damageTypes = require('./damageTypes.json');
5+
const equipment = require('./equipment.json');
6+
const equipmentCategories = require('./equipmentCategories.json');
7+
const features = require('./features.json');
8+
const languages = require('./languages.json');
9+
const levels = require('./levels.json');
10+
const magicSchools = require('./magicSchools.json');
11+
const monsters = require('./monsters.json');
12+
const proficiencies = require('./proficiencies.json');
13+
const races = require('./races.json');
14+
const skills = require('./skills.json');
15+
const spellcasting = require('./spellcasting.json');
16+
const spells = require('./spells.json');
17+
const startingEquipment = require('./startingEquipment.json');
18+
const subclasses = require('./subclasses.json');
19+
const subraces = require('./subraces.json');
20+
const traits = require('./traits.json');
21+
const weaponProperties = require('./weaponProperties.json');
22+
23+
const data = {
24+
abilityScores,
25+
classes,
26+
conditions,
27+
damageTypes,
28+
equipment,
29+
equipmentCategories,
30+
features,
31+
languages,
32+
levels,
33+
magicSchools,
34+
monsters,
35+
proficiencies,
36+
races,
37+
skills,
38+
spellcasting,
39+
spells,
40+
startingEquipment,
41+
subclasses,
42+
subraces,
43+
traits,
44+
weaponProperties,
45+
};
46+
47+
module.exports = {
48+
data,
49+
};

package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "dnd5-srd",
3+
"version": "1.0.0",
4+
"description": "Dungeons & Dragons 5th Edition - SRD Database",
5+
"keywords": ["dungeons", "dragons", "dnd", "5e", "5th", "edition", "srd", "json"],
6+
"homepage": "https://github.com/soryy708/5e-database",
7+
"bugs": {"url": "https://github.com/soryy708/5e-database/issues"},
8+
"license": "MIT",
9+
"author": {
10+
"name": "Adrian Padua",
11+
"url": "https://github.com/adrpadua"
12+
},
13+
"contributors": [{
14+
"name": "Ivan Rubinson",
15+
"email": "[email protected]",
16+
"url": "https://github.com/soryy708"
17+
}],
18+
"repository": {"type": "git", "url": "https://github.com/soryy708/5e-database"}
19+
}

0 commit comments

Comments
 (0)