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

whitehack-char-gen

v1.1.7

Published

A class for generating and updating characters in Christian Mehrstam's Whitehack RPG.

Downloads

1

Readme

Whitehack Character Generator

A JavaScript class for randomly generating characters for Whitehack 2nd Edition.

Installation

npm i whitehack-char-gen

Usage

Import

After installing with npm, import the character class with import Character from 'whitehack-char-gen';.

Examples

Create a new character

myChar = new Character(1, 'Deft');

Level up an existing character

myChar.increaseLevel();

Manually update an attribute

myChar.attributes.intelligence.score = 13;

Choose new groups

myChar.generateGroups();

Choose new slots

myChar.generateSlots();

Configuration

Configuration options can be passed as an optional object argument into the Character class to change how characters are generated.

myChar = new Character(1, 'Deft', config);

For example, you can override the available languages by passing an array to the languages property of the config argument:

myChar = new Character(1, 'Deft', {
    languages: [
        'Dwarvish',
        'Elvish',
        'Orcish',
    ]
});

Available configuration options are as follows:

nonDefaultSpeciesChance

Percent chance [0, 1] of generating a character with a species other than the default.

hybridSpeciesChance

Percent chance [0, 1] of generating a character with species group attached only to a single attribute, rather than two, if they are of a non-default species. This represents characters who are hybrids of the default species and a non-default species, e.g. half-elves.

defaultSpecies

Object of the form { name: 'Species Name', language: 'Species Language' }, representing the standard species of your setting. The default is { name: 'Human', language: 'Common' }.

otherSpecies

Array of objects of the same form as defaultSpecies.

languages

Array of strings representing languages available for characters to learn. This should have at least 2 unique entries, excluding any overlap with species-specific languages, to account for high-intelligence characters.

affiliations

Array of strings representing available affiliation groups. Should have at least 10 unique entries.

attunements

Array of objects with properties name, category, and isItem. Deft slots are randomly selected from this array, excluding elements of a category that has already been selected. If an element has isItem = true, it will be added to the Deft's inventory. Should have entries from at least 8 unique categories. However, see config option preventDuplicateAttunementCategories for an alternative.

preventDuplicateAttunementCategories

Boolean, by default true. When true, prevents attunements from the same category being assigned. When false, attunements from the same category can be assigned, so attunements need only have 8 unique entries, not 8 unique categories.

abilities

Array of strings representing available Strong abilities. Should have at least 4 unique entries.

miracles

Array of strings representing available Wise miracles. Should have at least 12 unique entries.

vocations

Array of strings representing available vocations.

defaultInventory

Array of strings representing the items that every character has.

names

Object with three properties: prefixes, primaries, and suffixes, each of which is an array of strings. Generated names can be of one of the following forms:

  • primary
  • prefix + ' ' + primary
  • primary + ' ' + suffix

descriptors

Array of objects with properties category and value. These are used to add quirks to the character, such as { category: 'personality', value: 'Quick to forgive'}. By default, 3 descriptors are generated for each character, and they are of unique categories, so this should have entries of at least 3 unique categories. However, see config option preventDuplicateDescriptorCategories for an alternative.

preventDuplicateAttunementCategories

Boolean, by default true. When true, prevents descriptors from the same category being assigned. When false, descriptors from the same category can be assigned, so descriptors need only have 3 unique entries, not 3 unique categories.

descriptorsCount

Integer, by default 3. Number of descriptors to generate.

License

Whitehack 2nd Edition is copyright 2015 Christian Merhstam. Its mechanisms are Open Game Content.