0.3.2-alpha • Published 7 years ago

overtrack.js v0.3.2-alpha

Weekly downloads
60
License
-
Repository
github
Last release
7 years ago

OverTrack.js

npm GitHub issues

Installing

NOTE

Node 8.x is required

npm install --save overtrack.js

Example

const ot = require('overtrack.js')

ot.player('eeveea')
  .then((games) => console.log(games))
  .catch(console.error)
NOTE

I plan on writing better docs before release.

Methods

NOTE

All methods return Promises

ot.player(key) ot.sr(key[, options]) ot.clientVersion() ot.lastMatch(key)

ot.player(key)

Returns: Simple game object.
Example:
ot.player('eeveea')
  .then((games) => {
    const game = games[0]
    console.log('Simple game object:', game)
    return game.detailed()
  })
  .then((game) => console.log('Detailed game object:', game))
  .catch(console.error)

ot.sr(key[, options])

options
  • multipleAccounts: Boolean Default: false
Returns: Number or Array
  [
    { name: String, sr: Number },
    {...}
  ]
Example:
ot.sr('eeveea')
  .then((sr) => console.log(sr))
  .catch(console.error)

ot.sr('eeveea', { multipleAccounts: true })
  .then((accounts) => {
    const message = accounts
      .map((x) => `${x.name}: ${x.sr}`)
      .join('\n')
    console.log(message)
  })
  .catch(console.error)

ot.clientVersion()

Returns: Object
{
  message: String,
  number: String
}
Example:
ot.clientVersion()
  .then((version) => console.log(version.message))
  .catch(console.error)

ot.lastMatch(key)

NOTE

Some fields may be null.

Returns: Simple game object.
Example:
ot.lastMatch('eeveea')
  .then((game) => {
    console.log('Last match:', game)
    return game.detailed()
  })
  .then((game) => console.log('Detailed game object:', game))
  .catch(console.error)

Objects

simple

detailed

heroStatistics

{
  elims: Number,
  damage: Number,
  objectiveKills: Number,
  healing: Number,
  objectiveTime: Number,
  deaths: Number,
  tabHealth: Number,
  timePlayed: Number,
  specific: [
    { value: Number, name: String },
    {...}
  ]
}

heroesPlayed

[
  { hero: String, percent: Number },
  {...}
]

killfeed

NOTE

There are two different types of objects in the array kills, and resurrects.

  [
    {
      left: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      resurrect: true,
      right: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      timestamp: Number
    },
    {
      assisters: [
        String
      ],
      killicon: {
        hero: String,
        ability: String
      },
      left: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      resurrect: false,
      right: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      timestamp: Number
    },
    {...}
  ]

map

{
  name: String,
  type: String
}

misc

  customGame: Boolean || null,
  key: String || null,
  url: String|| null,
  userId: Number || null,
  user: String || null,
  player: String || null,
  json: String || null,
  viewable: Boolean || null

objectiveStages

This has not been parsed yet and is the raw info form overtarck api

result

{
  blue: {
    score: Number,
    outcome: String
  },
  red: {
    score: Number,
    outcome: String
  }
}

season

{
  name: String,
  number: Number,
  offSeason: Boolean
}

sr

{
  diff: Number,
  end: Number || null,
  name: String,
  start: Number || null
}

teams

{
  blue: {
    sr: Number,
    players: [
      { name: String, rank: String },
      {...}
    ]
  },
  red: {
    sr: Number,
    players: [
      { name: String, rank: String },
      {...}
    ]
  }
}

time

{
  start: Number,
  end: Number || null,
  length: Number
}

Development

Pull requests are welcome.

Linter

JavaScript Standard Style

0.3.2-alpha

7 years ago

0.3.1-alpha

7 years ago

0.3.0-alpha

7 years ago

0.2.3-alpha

7 years ago

0.2.2-alpha

7 years ago

0.2.1-alpha

7 years ago

0.2.0-alpha

7 years ago

0.1.0-alpha

7 years ago

0.0.5-alpha

7 years ago

0.0.4-alpha

7 years ago

0.0.3-alpha

7 years ago

0.0.2-alpha

7 years ago

0.0.1-alpha

7 years ago

0.0.0

7 years ago