1.0.2 • Published 5 years ago

@proak/r6s-sdk v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

Rainbow Six Seige SDK

This is an unofficial node SDK for Rainbow Six Seige

Installation

> npm install @proak/r6s-sdk

Usage

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john.doe@example.com', password: '1234589' })

// connect to ubisoft
await auth.connect()

API

Auth

constructor(options)

ParameterRequiredDescription
options.tokenfalseToken to be used when connecting to ubisoft
options.emailfalseEmail to be used when authenticating with ubisoft. This is required along with password if options.token is not passed
options.passwordfalsePassword to be used in authenticating with ubisoft. This is required along with email if options.token is not passed
options.cacheTimefalseTime in milliseconds to keep cache. defaults to 12000
options.maxConnectionRetriesfalseNumber of times to retry failed requests. Defaults to 1
options.appIdfalseid of app. Defaults to 39baebad-39e5-4552-8c25-2c9b919064e2

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({
  cacheTime: 50000,
  maxConnectionRetries: 3,
  email: 'john.doe@example.com',
  password: '5dio80bCIVOW.!bo~?'
})
//=> Auth Instance

connect()

ParameterRequiredDescription

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
await auth.connect()

getPlayer(options)

ParameterRequiredDescription
options.uidfalseUID of player to retrieve. Must not be set at the same time as options.name as search can be done by only one of them
options.namefalsename of player to retrieve. Must not be set at the same time as options.uid as search can be done by only one of them
options.platformtrueplatform type of player

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
await auth.getPlayer({ name: 'JUNE' }) 
// => Player Instance

getOperatorDefinitions()

ParameterRequiredDescription

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
await auth.getOperatorDefinitions() 

getOperatorIndex()

ParameterRequiredDescription
nametrueName of operator to retrieve

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
await auth.getOperatorIndex('smoke')

// Result
{ 
  id: 'smoke',
  index: '2:1',
  category: 'def',
  name: { oasisId: '62253'  },
  ctu: { oasisId: '62015'  },
  figure: { 
    small: 'assets/images/small-smoke.2726e3087231686a.png',
    large: 'assets/images/large-smoke.1bf9006654c09ba6.png' 
  },
  mask: 'assets/images/mask-smoke.c84491688f294f51.png',
  badge: 'assets/images/badge-smoke.874e98880d03a204.png',
  uniqueStatistic: {
    pvp: { 
      statisticId: 'operatorpvp_smoke_poisongaskill:2:1',
      label: { oasisId: '194660'  } 
    },
    pve: { 
      statisticId: 'operatorpve_smoke_poisongaskill:2:1',
      label: { oasisId: '194660'  } 
    } 
  }
} 

getOperatorStatistic()

ParameterRequiredDescription
nametrueName of operator to retrieve statistics

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
const statistic = await auth.getOperatorStatistic('smoke')
//=> operatorpvp_smoke_poisongaskill:2:1

getOperatorBadge()

ParameterRequiredDescription
nametrueName of operator to retrieve badge

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
const badge = await auth.getOperatorBadge('smoke')
//=> assets/images/badge-smoke.874e98880d03a204.png

getObjectIndex()

ParameterRequiredDescription
keytruekey of definition to retrieve object index

Example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
const objectIndex = await auth.getObjectIndex('operatorpve_headshot:5:1')
//=> 5:1

Player

To get a particular player, you need to have have authenticated with ubisoft using the Auth class and returned the auth instance. Then you can call .getPlayer on auth. For example:

const { Auth } = require('@proak/r6s-sdk')

const auth = new Auth({ email: 'john@doe.com', password: 'TGsieo280?!-' })
const player = await auth.getPlayer({ name: 'JUNE.KR' }) 
//=> Player Instance

The player instance has a number of useful member methods. which are described below:

loadLevel()

This method loads the player's Xp and level

ParameterRequiredDescription

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })

await player.loadLevel()
//=> Player { xp: 28402, level: 74 }

checkLevel()

This method checks' the player's XP and level, only loading it if it has not been loaded yet

ParameterRequiredDescription

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })

await player.checkLevel()
//=> Player Instance updated with `xp` and `level`

loadRank()

This method loads a player's rank for a specific region and season

ParameterRequiredDescription
options.regiontrueThe name of the region you want to get the rank for
options.seasonfalseThe season you want to get the rank for. Defaults to -1

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })

await player.loadRank({ region: 'emea' })
//=> Player Instance updated rank details

getRank()

This method checks for a player's rank for a particular region, only loading it if it is not already loaded

ParameterRequiredDescription
options.regiontrueThe name of the region you want to get the rank for
options.seasonfalseThe season you want to get the rank for. Defaults to -1

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })

await player.getRank({ region: 'emea' })
//=> Player Instance updated rank details

loadAllOperators()

This method loads the player stats for all operators

ParameterRequiredDescription

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })
await player.loadAllOperators()
//=> Player instance with all operators stats loaded

getAllOperators()

This method checks player stats for all operators, loading them all again if they are not found.

ParameterRequiredDescription

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })
await player.getAllOperators()
//=> Player instance with all operators stats loaded

loadOperator()

This method loads the player stats for the operator

ParameterRequiredDescription
nametrueThe name of the operator

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })
const operator = await player.loadOperator('smoke')
//=> Operator Instance

getOperator()

This method gets the player stats for the operator, only loading it if it is not already loaded

ParameterRequiredDescription
nametrueThe name of the operator

Example:

const player = await auth.getPlayer({ name: 'JUNE.KR', platform: 'uplay' })
const operator = await player.getOperator('smoke')
//=> Operator Instance