2.0.1 • Published 4 years ago

shitty-swgoh-stats v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

SWGOH Unit-stats Calculator

Unit stats and Galactic Power calculator for raw player data

npm i shitty-swgoh-stats

Initializing the class

Initialize with an existing crinolo_core

const Stats = require(`shitty-swgoh-stats`)
const stats = new Stats( crinolo_core )

Initialize and fetch/update crinolo core

For shittybots api token, see: https://swgoh.shittybots.me/register

Note: "update" will update the class and return you the updated gamedata

const Stats = require(`shitty-swgoh-stats`)
const stats = new Stats()

const token = "your_shittybots_api_token"
const crinolo_core = await stats.update( token )

Calculate stats

Units-in are modified with stats and gp attached

Returns a Map of all players, keyed by playerId

Each player is a Map of roster units keyed by baseId

//Requires player's rosterUnitList
const rosterMap = stats.calcRosterStats( player.roserUnitsList )
/*
Map {
  'unit_baseId' => { stats:{ final:<Object>, mods:<Object>, crew:<Object> }, gp:<Integer> },
  ...
}
*/
//Accepts a single or array of players
const playerMap = stats.calcPlayerStats( players )
/*
Map { 
  'playerId' => Map {
    'unit_baseId' => { stats:{ final:<Object>, mods:<Object>, crew:<Object> }, gp:<Integer> },
    ...
  },
  ...
}
*/
2.0.1

4 years ago

2.0.0

4 years ago