npm.io
5.0.0 • Published 2 months ago

socket-colors-chance

Licence
MIT
Version
5.0.0
Deps
1
Size
12 kB
Vulns
0
Weekly
0

socket-colors-chance

Get the chances of getting specific socket colors on a Path of Exile item.

This was extracted out of chromatic-orb since the math also applies to Vorici's recipes. Formula is based on Siveran's calculator, which is based on Lawphill's calculator.

Example

import { socketColorsChance } from 'socket-colors-chance';

socketColorsChance({
  sockets: 3,
  red: 1,
  green: 1,
  blue: 1
});
// => 0.2222222222222222

Installation

$ npm install socket-colors-chance

API

import { socketColorsChance } from 'socket-colors-chance';
socketColorsChance(opts)

Given opts, an Object, returns the probability of rolling the desired socket colors as a Number.

  • opts.sockets: number of sockets
  • opts.strength: strength requirement
  • opts.dexterity: dexterity requirement
  • opts.intelligence: intelligence requirement
  • opts.red: desired number of red sockets
  • opts.green: desired number of green sockets
  • opts.blue: desired number of blue sockets

opts.sockets and at least one of opts.{red,green,blue} are the only required parameters.

Keywords