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

battlegrounds-revisited

v1.5.5

Published

PUBG Web API wrapper for nodejs

Downloads

2

Readme

PUBG Web API wrapper for node.js

Todo

  • Telemetry
    • Object class
    • Applied Player class
  • Spectators class (not yet introduced in API)
  • Rounds class (not yet introduced in API)
  • Tournaments

Install

Install via npm:

npm install battlegrounds-revisited

Usage

Requiring a module returns API class:

const battlegrounds = require('battlegrounds-revisited')

const api = new battlegrounds(APIKEY)

// Get a player
const res = await api.getPlayers({ names: ['shroud'] })

Description

The main focus of this module is it's ease of use.

For example, getting a player returns its class that contains other properties methods of which can be used:

const res = await api.getPlayers({ names: ['shroud'] })

// Is a member of Player class
const player = res[0]

// Get first match. Match class is returned
const match = player.matches[0].get()

Classes

List of all classes returned by a module

API(apikey[, platform])

Is returned by module when required

  • apikey - your apikey (you can get it here)
  • platform (optional) - default platform id to be included as a parameter in every method. Full list here)

API.getSamples(params)

Returns a Sample class

  • date (optional) - an instance of Date class. Has to be at least 24hrs in the past. Default value is 24 hours ago.

API.getMatch(params)

Returns a Match class

Note: currently it is not possible to get custom Matches.

API.getPlayers(params)

Returns a list of Player classes

  • ids (optional) - An array of Player ids
  • names (optional) - An array of Player names

Note: at least one of those parameters have to be provided, in other cases "MissingParameter" error will be thrown

API.getPlayer(params)

Returns a Player class

API.getSeasons(params)

Returns a list of Season classes

API.getPlayerSeason(params)

Returns a PlayerSeason classes

Player

Represents a Player. If only contains its id, get method has to be called to get full info about itself.

  • id - Player id. Has a format of account.x where x - 32 char hex
  • attributes
    • Name - Player name
    • shardId - platform id (full list here))
    • patchVersion
    • titleId
  • matches - An array of Player Matches
  • assets - An array of Player Assets

Player.get()

Calls an API to get Player's full info and returns itself.

Match

Represents a Match. If only contains its id, get method has to be called to get full info about itself.

  • id - Match id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • isCustomMatch
    • createdAt - date when the object was created
    • duration - duration time in seconds
    • gameMode - game mode (for ex duo-fpp, squad-tpp, etc)
    • patchVersion
    • shardId - platform id (full list here)
    • stats
    • tags
    • titleId - tournament title. For regular matches will be bluehole-pubg
  • rosters - An array of Rosters
  • assets - An array of Assets
  • rounds - An array of Rounds
  • spectators - An array of Spectators
  • participants - An array of Participants

Match.get()

Calls an API to get Match's full info and returns itself.

Participant

Represents a Match Participant.

  • id - Participant id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • actor
    • shardId - platform id (full list here))
    • stats
      • swimDistance
      • DBNOs
      • assists - assists
      • boosts - boosts used
      • damageDealt - damage dealt to others
      • deathType - death type. Can be byplayer or suicide
      • headshotKills - headshot kills
      • heals - heals
      • killPlace - place by kills
      • killPoints - kill points
      • killPointsDelta
      • killStreaks
      • kills - kills
      • lastKillPoints
      • lastWinPoints
      • longestKill
      • mostDamage
      • playerId - Player id. Has a format of account.x where x - 32 char hex
      • revives - revives
      • rideDistance - distance driven on a vehicle
      • roadKills - kills by vehicle
      • teamKills - team kills
      • timeSurvived - total time survived in seconds
      • vehicleDestroys - vehicles destroyed
      • walkDistance - distance a Player has walked
      • weaponsAcquired
      • winPlace - win place
      • winPoints - total win points
      • winPointsDelta

Roster

Represents a team of Participants in a Match

  • id - Roster id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • shardId - platform id (full list here))
    • won - Boolean. Whenever Roster won or not
    • stats
      • rank - Roster rank
      • teamId - Roster team number in Match in order of joining
  • participants - Roster Participants

Asset

Represents an Asset with an attached resource

  • id - Asset id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • URL - resource url. You can download it using fetch method
    • createdAt - date when the object was created
    • description
    • name - for Match Assets will be telemetry

Asset.fetch()

Fetches Asset content from URL. Returns different objects depending on type (name) of an Asset:

Sample

Represents a list of Matches

  • id - Asset id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • createdAt - date when the object was created
    • shardId - platform id (full list here))
    • titleId - tournament title. For regular matches will be bluehole-pubg
  • matches - an array of Matches

Season

Represents a game Season

  • id - Asset id. Has a format of a-b-b-b-c where a - 8 char hex, b - 4 char hex, c - 12 char hex
  • attributes
    • isCurrentSeason - boolean that indicates if season is active or not
    • isOffseason - boolean, true if season is not active

Season.get()

Queries all Seasons and finds needed one by id. Returns updated Season class

PlayerSeason

Represents Player Season stats

  • attributes
    • assists - Number of enemy players this player damaged that were killed by teammates
    • boosts - Number of boost items used
    • dBNOs - Number of enemy players knocked
    • dailyKills
    • damageDealt - Total damage dealt. Note: Self inflicted damage is subtracted
    • days
    • headshotKills - Number of enemy players killed with headshots
    • heals - Number of healing items used
    • killPoints - Points based on how many kills this player had
    • kills - Number of enemy players killed
    • longestKill
    • longestTimeSurvived - Longest time survived in a match
    • losses - Number of matches lost
    • maxKillStreaks -
    • mostSurvivalTime - Longest time survived in a match
    • revives - Number of times this player revived teammates
    • rideDistance - Total distance traveled in vehicles measured in meters
    • roadKills - Number of kills while in a vehicle
    • roundMostKills - Highest number of kills in a single match
    • roundsPlayed - Number of matches played
    • suicides - Number of self-inflicted deaths
    • teamKills - Number of times this player killed a teammate
    • timeSurvived - Total time survived
    • top10s - Number of times this player made it to the top 10 in a match
    • vehicleDestroys - Number of vehicles destroyed
    • walkDistance - Total distance traveled on foot measured in meters
    • weaponsAcquired - Number of weapons picked up
    • weeklyKills
    • winPoints
    • wins - Number of matches won
  • matchesSolo - solo tpp Match array
  • matchesSoloFPP - solo fpp Match array
  • matchesDuo - duo tpp Match array
  • matchesDuoFPP - duo fpp Match array
  • matchesSquad - squad tpp Match array
  • matchesSquadFPP - squad fpp Match array
  • season - Season
  • player - Player