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

@muxed/rpg-utils

v1.5.0

Published

Utilities for RPG players/masters

Downloads

2

Readme

⚔️ RPG Utils

Utilities to RPG Masters/Users

npm (scoped) npm bundle size (scoped) License GitHub Workflow Status

Discord

🥪 Install

$ npm install @muxed/rpg-utils

🎉 Usage

Import the instaled Package

import { RpgUtils } from '@muxed/rpg-utils'

🎲 Rolling

This class is constructed with a new RpgUtils(). We can pass a parameter to create this pool new RpgUtils(20). The parameter is the Faces of the dice (6 by default).

This class have methods:

let pool = new RpgUtils(10);

pool.cleanPoolOfDices(); // Clean a saved dices in the class

pool.rollDices(4) // Return an Array(4) of random number between 1 and 10 (the Faces)
pool.rollDicesAsync(6) // Return a Promise of Array<numbers>

pool.addNewRolls(3); // Add 3 new rolls to the pool 
pool.addNewRolls(3,20); // Add 3 new rolls of 20 faces to the pool 

pool.sumRolls() // Return the sum of all pool

pool.modifyRoll(3); // Add modifications to the rolls

pool.setCritical(10); // Set the critical hit
pool.setFailure(10); // Set the failure hit

/* ADVANCED */ 
pool.headOrTails(4); // Check a Coin flip (4 times)

pool.checkSuccess(8); // Check if the rolls is Success
pool.checkSuccess(4, 2, true) // Check if roll is success with 2 dices and down success

// We can access to the Faces and number of Dices and set it
pool.faces = 6;
console.log(pool.faces); // 6

// TS support interfaces Dice and ResponseRoll

import { Dice } from '@muxed/rpg-utils'
const dices: Array<Dice> = [];

Structure of a Dice

{
  faces: number,
  roll: number,
  rollModified: number,
  modificator?: number,
  critical?: number,
  failure?:number,
  min: number,
  max: number
}

Structure of a Response for Advanced rolls

{
  rolls: Array<number | string | undefined>,
  modifiedRolls?: Array<number | string | undefined>,
  success:string,
  countSuccess: number,
  countFail: number,
  countCritical?: number,
  countFailure?: number
}

🟢 Testing

Install the Jest dependencies if not in global

$ npm install

Run the tests

$ npm test
$ npm run coverage

🍰 Contributing

Please read CONTRIBUTING for details on our CODE OF CONDUCT, and the process for submitting pull requests.

☕️ Buy Me a Coffee

ko-fi

📑 License

MIT © MuXeD