5th

0.3.0 • Public • Published

5th

This project creates objects which anyone can use with another JavaScript-based 5th edition application to handle common use cases, like making a character, handling combat or even planning an encounter.

Usage

To use this library in your application, simply include it with npm:

npm i --save 5th

You will need to provide your own response handler, handler factory, entity gateway and gateway factory objects if required. They will need to respond to a specific set of methods. We will denote details here later.

Handler Factory

You must implement a single object in your codebase with a "make" method which takes a string and generates an object with a "handle" method which takes an object and operates on it. An example:

// HandlerFactory.js
const handlers = {
  'select race': {
    handle({ character }) {
      // do something with the character and its newly created race
    }
  }
}

module.exports = class {
  make(type) {
    if (!handlers.hasOwnProperty(type)) {
      // throw an error of some sort
    }
    return handlers[type]
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i 5th

Weekly Downloads

1

Version

0.3.0

License

GPL-3.0

Last publish

Collaborators

  • ryayak1460