npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pf2e-database

v1.0.7

Published

Database module for Pathfinder 2.

Downloads

19

Readme

pf2e-database

pf2e-database is a module alowing to access data from Pathfinder 2E.

The data comes from 2 github repositories:

  • https://github.com/foundryvtt/pf2e
  • https://github.com/pathfinder-fr/foundryvtt-pathfinder2-fr

Disclaimer : the data doesn't belong to me and this project was purely made as an exercise.

Installation

npm install pf2e-database

Get datasets

getDataSet(dataSetName) -> promise

Retrieve a whole dataset by providing its name. See the list of allowed dataSetName arguments here. Returns a empty object if the dataset name is incorrect.

Exemple:

import { getDataSet } from "pf2e-database";
let set = await getDataSet("classes");
console.log(set);
/*
{
  alchemist: {
    _id: 'XwfcJuskrhI9GIjX',
    data: {
      ancestryFeatLevels: [Object],
      attacks: [Object],
      classDC: 1,
      classFeatLevels: [Object],
      defenses: [Object],
      description: [Object],
      generalFeatLevels: [Object],
      hp: 8,
      items: [Object],
      keyAbility: [Object],
      perception: 1,
      rules: [Array],
      savingThrows: [Object],
      skillFeatLevels: [Object],
      skillIncreaseLevels: [Object],
      source: [Object],
      trainedSkills: [Object],
      traits: [Object]
    },
    img: 'systems/pf2e/icons/classes/alchemist.webp',
    name: 'Alchemist',
    type: 'class'
  },
  barbarian: {
    _id: 'YDRiP7uVvr9WRhOI',
    data: {
      ancestryFeatLevels: [Object],
      attacks: [Object],
      ...
*/
let set = await getDataSet("foo");
console.log(set);
/*
{}
*/

Get item (english)

getDataEn(id) -> promise

Retrieve the item by providing its id. Returns a empty object if the id is incorrect.

Exemple:

import { getDataEn } from "pf2e-database";
let description = await getDataEn("Xg57qG1rOfSSobke");
console.log(description);
/*
{
  _id: 'Xg57qG1rOfSSobke',
  data: {
    actionCategory: { value: 'offensive' },
    actionType: { value: 'action' },
    actions: { value: 2 },
    description: {
      value: "<p>The riding drake breathes a @Template[type:cone|distance:30]{30-foot cone} of fire, dealing [[/r ((ceil(@actor.level/2))d6)[fire]]]{1d6 fire damage for every 2 levels the drake has} to all creatures in the area (basic Reflex save). This uses a trained DC using the drake's Constitution modifier or an expert DC if the drake is specialized.</p>"
    },
    requirements: { value: '' },
    rules: [],
    source: { value: "Pathfinder Advanced Player's Guide" },
    traits: { custom: '', rarity: 'common', value: [] },
    trigger: { value: '' },
    weapon: { value: '' }
  },
  img: 'systems/pf2e/icons/actions/TwoActions.webp',
  name: 'Breath Weapon (Riding Drake)',
  type: 'action'
}
*/
let description = await getDataEn("foo");
console.log(description);
/*
{}
*/

French translation

translateToFr(item) -> string

Get the french translation for the item provided. Returns a empty string if the id is incorrect.

Exemple:

import { translateToFr } = from "pf2e-database";
let nameFR = await translateToFr("Breath Weapon");
console.log(nameFR);
// 'Arme de souffle'

let nameFR = await translateToFr("foo");
console.log(nameFR);
// ''

Get item (french)

db.getDescriptionFr(id) -> promise

Get the french description for an item by providing its id. Whenever the description makes a reference to another item, the item name and id is provided in the references field. Returns a empty object if the id is incorrect.

Exemple:

import { getDescriptionFr } = from "pf2e-database";
let description = await getDescriptionFr("GUnw9YXaW3YyaCAU");
console.log(description);
/*
{
  nameFR: 'Auto-adaptation',
  descriptionFR: "<p>Vous vous modifiez subtilement pour vous adapter à une situation. Choisissez l'une des options suivantes qui s'applique à vous.</p>\r\n" +
    '<ul>\r\n' +
    "<li>Si vous êtes dans l'eau, vous gagnez une Vitesse de <b>Nage*</b> égale à la moitié de votre Vitesse.</li>\r\n" +
    "<li>Si vous êtes dans l'eau, vous pouvez respirer sous l'eau.</li>\r\n" +
    "<li>S'il fait trop sombre pour que vous puissiez voir, vous obtenez la <b>Vision dans le noir**</b>.</li>\r\n" +
    '<li>Si vous êtes dans un environnement de chaleur ou de froid intense, vous êtes protégé des effets de chaleur ou de froid intense, et le sort dure 10 minutes.</li>\r\n' +
    '</ul>\r\n',
  references: [
    { name: 'Nage', id: '2SWUzp4JuNK5EX0J' },
    { name: 'Vision dans le noir', id: '0gv9D5RlrF5cKA3I' }
  ]
}
*/

let description = await getDescriptionFr("foo");
console.log(description);
/*
{}
*/