All Projects → liamcottle → valorant.js

liamcottle / valorant.js

Licence: other
This is an unofficial NodeJS library for interacting with the VALORANT API used in game.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to valorant.js

WAIUA
"Who Am I Up Against?" (WAIUA) is a Valorant app that lets you see ranks, recent games, skins of players and more, all in and before a live match.
Stars: ✭ 155 (+222.92%)
Mutual labels:  valorant, valorant-api
valorant-skin-manager
better valorant inventory management
Stars: ✭ 111 (+131.25%)
Mutual labels:  valorant, valorant-api
valclient.py
valorant client api wrapper
Stars: ✭ 45 (-6.25%)
Mutual labels:  valorant, valorant-api
unofficial-valorant-api
Unofficial VALORANT API using the VALORANT Ingame API
Stars: ✭ 152 (+216.67%)
Mutual labels:  valorant, valorant-api
Valorant-Zone-Stats
View your VALORANT performance in different areas of every map in the game!
Stars: ✭ 72 (+50%)
Mutual labels:  valorant, valorant-api
valorant-api
A NodeJs wrapper for the Riot VALORANT API
Stars: ✭ 51 (+6.25%)
Mutual labels:  riot, valorant
ValorantStoreChecker-discord-bot
Valorant Utility Bot
Stars: ✭ 154 (+220.83%)
Mutual labels:  valorant, valorant-api
ScrimBot
Discord bot for organizing Valorant custom games.
Stars: ✭ 31 (-35.42%)
Mutual labels:  valorant
fornalder
Visualize long-term trends in collections of Git repositories.
Stars: ✭ 80 (+66.67%)
Mutual labels:  history
awesome-maps-ukraine
A curated list of maps of Ukraine, ukrainian mappers and tools that they use or develop for creating and publish maps
Stars: ✭ 35 (-27.08%)
Mutual labels:  history
osx-callhistory-decryptor
macOS (incl big sur) call history decryptor/converter to CSV format.
Stars: ✭ 19 (-60.42%)
Mutual labels:  history
WorldSim
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
Stars: ✭ 19 (-60.42%)
Mutual labels:  history
Valorant-External-Cheat
[ DEDECTED ] Valorant trigger bot with python pillow library.
Stars: ✭ 45 (-6.25%)
Mutual labels:  valorant
ofxHistoryPlot
Visualize value history on a configurable graph
Stars: ✭ 40 (-16.67%)
Mutual labels:  history
Coloraimbot-CSharp
A simple Coloraimbot for any Game coded in C# - with additional features
Stars: ✭ 81 (+68.75%)
Mutual labels:  valorant
react-redux-starter-kit
Get started with React, Redux, Webpack and eslint
Stars: ✭ 29 (-39.58%)
Mutual labels:  history
UndoRedo.js
A powerful and simple JavaScript library provides a history for undo/redo functionality. Just like a time machine! 🕐
Stars: ✭ 19 (-60.42%)
Mutual labels:  history
mongoose-slug-plugin
Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
Stars: ✭ 21 (-56.25%)
Mutual labels:  history
rafagas
Daily geospatial links curated by Raf Roset
Stars: ✭ 17 (-64.58%)
Mutual labels:  history
binance-profit-calculator
Just some Trade History import tool to see how much profit you made. If you have bags (unsold coins) it tries to take those into account as well.
Stars: ✭ 30 (-37.5%)
Mutual labels:  history

npm discord twitter
donate on ko-fi donate bitcoin

This is an unofficial NodeJS library for interacting with the VALORANT APIs used in game. It also serves as a wrapper around third party APIs that provide game content such as maps, player cards and weapons.

Install

To use this library in your own NodeJS app, you can install it via npm.

npm install @liamcottle/valorant.js

Usage

First, Create a new Valorant.API instance with the region associated with your player data.

const Valorant = require('@liamcottle/valorant.js');
const valorantApi = new Valorant.API(Valorant.Regions.AsiaPacific);

If your region is not available in the Valorant.Regions class, but you know your region code, you can pass it in directly:

const valorantApi = new Valorant.API('NA');

Once you have a Valorant.API instance, you need to obtain an access_token and entitlements_token which are used for authorization when making requests to the Valorant APIs.

valorantApi.authorize('username', 'password').then(() => {
    // auth was successful, go make some requests!
}).catch((error) => {
    console.log(error);
});

Note that the access_token and entitlements_token do expire after some time. So you will need to authorize again once they expire.

Alternatively, if you already have your access_token and entitlements_token you can set them like so:

// use saved authorization details
valorantApi.username = 'username';
valorantApi.user_id = 'uuid',
valorantApi.access_token = 'eyJ...';
valorantApi.entitlements_token = 'eyJ...';

Example

const Valorant = require('@liamcottle/valorant.js');
const valorantApi = new Valorant.API(Valorant.Regions.AsiaPacific);

// auth with valorant apis
valorantApi.authorize('username', 'password').then(() => {

    // log auth data
    console.log({
        username: valorantApi.username,
        user_id: valorantApi.user_id,
        access_token: valorantApi.access_token,
        entitlements_token: valorantApi.entitlements_token,
    });

    // log wallet balances
    valorantApi.getPlayerWallet(valorantApi.user_id).then((response) => {
        console.log(response.data);
    });

    // log competitive history
    valorantApi.getPlayerCompetitiveHistory(valorantApi.user_id).then((response) => {
        console.log(response.data);
    });

}).catch((error) => {
    console.log(error);
});

View Competitive Rank and Elo

If you're interested in getting information about your current rank and how long until you rank up, you could do something like this:

const Valorant = require('@liamcottle/valorant.js');
const valorantApi = new Valorant.API(Valorant.Regions.AsiaPacific);

function calculateElo(tier, progress) {
    if(tier >= 21) {
        return 1800 + progress
    } else {
        return ((tier * 100) - 300) + progress;
    }
}

// auth with valorant apis
valorantApi.authorize('username', 'password').then(() => {

    // get player mmr
    valorantApi.getPlayerMMR(valorantApi.user_id).then((response) => {

        if(response.data.LatestCompetitiveUpdate){
            const update = response.data.LatestCompetitiveUpdate;
            var elo = calculateElo(update.TierAfterUpdate, update.RankedRatingAfterUpdate);
            console.log(`Movement: ${update.CompetitiveMovement}`);
            console.log(`Current Tier: ${update.TierAfterUpdate} (${Valorant.Tiers[update.TierAfterUpdate]})`);
            console.log(`Current Tier Progress: ${update.RankedRatingAfterUpdate}/100`);
            console.log(`Total Elo: ${elo}`);
        } else {
            console.log("No competitive update available. Have you played a competitive match yet?");
        }

    });

}).catch((error) => {
    console.log(error);
});

Which will output something like these:

Movement: DEMOTED
Current Tier: 11 (Silver 3)
Current Tier Progress: 72/100
Total ELO: 872
Movement: MAJOR_INCREASE
Current Tier: 12 (Gold 1)
Current Tier Progress: 42/100
Total Elo: 942

View Competitive Leaderboard

If you're interested in getting the current competitive leaderboards shown in game, you can request them like so:

const Valorant = require('@liamcottle/valorant.js');
const valorantApi = new Valorant.API(Valorant.Regions.AsiaPacific);

// auth with valorant apis
valorantApi.authorize('username', 'password').then(() => {
    
    // episode 2, act 1
    var seasonId = '97b6e739-44cc-ffa7-49ad-398ba502ceb0';
    
    // get competitive leaderboard
    valorantApi.getCompetitiveLeaderboard(seasonId).then((response) => {
        console.log(response.data);
    });

}).catch((error) => {
    console.log(error);
});

Which will output something like this: (I have blanked out the player IDs)

{
  Deployment: 'ap-glz-ap-1',
  QueueID: 'competitive',
  SeasonID: '97b6e739-44cc-ffa7-49ad-398ba502ceb0',
  Players: [
    {
      Subject: '00000000-0000-0000-0000-000000000000',
      GameName: 'username1',
      TagLine: 'tag1',
      LeaderboardRank: 1,
      RankedRating: 123,
      NumberOfWins: 123,
      PlayerCardID: '00000000-0000-0000-0000-000000000000',
      TitleID: '00000000-0000-0000-0000-000000000000',
      IsBanned: false,
      IsAnonymized: false
    },
    {
      Subject: '00000000-0000-0000-0000-000000000000',
      GameName: 'username2',
      TagLine: 'tag2',
      LeaderboardRank: 2,
      RankedRating: 123,
      NumberOfWins: 123,
      PlayerCardID: '00000000-0000-0000-0000-000000000000',
      TitleID: '00000000-0000-0000-0000-000000000000',
      IsBanned: false,
      IsAnonymized: false
    },
  ]
}

Implemented API Calls

Below is a list of API calls that are implemented in this library.

  • authorize(username, password)
  • getConfig(region)
  • getContent()
  • getCompetitiveLeaderboard(seasonId)
  • getMatch(matchId)
  • getParty(partyId)
  • getPartyByPlayer(playerId)
  • getPlayerLoadout(playerId)
  • getPlayerMMR(playerId)
  • getPlayerMatchHistory(playerId, startIndex, endIndex)
  • getPlayerCompetitiveHistory(playerId, startIndex, endIndex)
  • getPlayerWallet(playerId)
  • getPlayerStoreFront(playerId)
  • getPlayers(playerIds)
  • getStoryContractDefinitions()

Content API

Check out the Content API Docs if you're wanting to fetch game assets such as Maps, Player Cards and Weapons.

Local Riot Client API

If you're looking for information on how to interact with RiotClientServices.exe, such as intercepting requests, take a look at the documentation in RiotClientServices.md

A wrapper class exists in this repo, and can be used like so:

// init from your local lock file
const localRiotClientApi = Valorant.LocalRiotClientAPI.initFromLockFile();

// or, init with known credentials and port
const localRiotClientApi = new Valorant.LocalRiotClientAPI('127.0.0.1', 'port', 'riot', 'yourtoken');`

Support

  • If you need any help, feel free to Join the Discord.
  • If you find a bug, feel free to open an issue or submit a pull request.

In some cases, you might receive an HTTP 404 error when using some in-game APIs. It's likely that the client_version we are using is outdated.

You can find the latest client_version here listed as riotClientVersion and you can manually set the client_version used in this library like so:

const Valorant = require('@liamcottle/valorant.js');
const valorantApi = new Valorant.API(Valorant.Regions.AsiaPacific);
valorantApi.client_version = "...";

License

MIT

Legal

Riot Games, VALORANT, and any associated logos are trademarks, service marks, and/or registered trademarks of Riot Games, Inc.

This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by Riot Games, Inc or any of its affiliates or subsidiaries.

I, the project owner and creator, am not responsible for any legalities that may arise in the use of this project. Use at your own risk.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].