Git Product home page Git Product logo

aof-file-parser's Introduction

#aof-file-parser

A module to read and write .aof files. The aof file format is used by the website aof.gg (AnalyzeOrFeed) to store League of Legends replays and some additional metadata.

Install

npm install --save https://github.com/AnalyzeOrFeed/aof-file-parser

Example

let aofParser = require('aof-file-parser');

let game = {
    // insert game data here
};

// to write a file
aofParser.save(game, 'replay-euw-123', (result) => {
    if (!result.success) {
        console.log(result.error); // Error, file has not been saved
    } else {
        // File has been saved!
        console.log(result.warnings); // If there were warnings, print them
    }
});

// read a file
aofParser.load('replay-euw-123.aof', (result, replayMetadata, replayData) => {
    if (!result.success) {
        console.log(result.error);
    } else {
        // Replay has been loaded
    }
});

Usage

.save(game, filename, callback)

game: game

Contains all the necessary information about the game.

filename: string

The location of the aof file (without .aof ending).

callback: (result: {success: boolean, error: string, warnings: Array}) => any

The callback that will be called in case of an error or when the file has been saved successfully.

  • If success is false, result.error will contain the error message
  • If success is true, result.warnings can contain warnings, but the file will still have been saved

.load(file, callback)

file: string

Location of the .aof file.

callback: (result: {success: boolean, error: string}, replayMetadata: replayMetadata, replayData: replayData) => any

The callback that will be called in case of an error or when the file has been parsed successfully.

Objects

game

var game = {
    regionId: number; // Region id: Can be obtained using our API: https://api.aof.gg/v2/data/static
    gameId: number;
    riotVersion: string; // Version of the current patch. For example: 6.9.1 Can be obtained using our API: https://api.aof.gg/v2/data/static
    key: string; // Encryption key provided by the Riot API
    endStartupChunkId: number;
    startGameChunkId: number;
    players: Array<Players>;
    keyframes: Array<Keyframes>;
    chunks: Array<Chunks>;
}

players

var players = {
    id: number; // Summoner ID
    summonerName: string;
    teamNr: number; // 0 for blue or 1 red team
    leagueId: number;
    leagueRank: number;
    championId: number;
    dId: number; // ID of the summoner spell on d
    fId: number; // ID of the summoner spell on f
}

replayMetadata

var replayMetadata = {
    version: number; // Version of the .aof file format
    regionId: number;
    gameId: number;
    riotVersion: string;
    key: string;
    endStartupChunkId: number;
    startGameChunkId: number;
    players: Array<Players>;
}

replayData

var replayData = {
    keyframes: [{
        id: number; // Keyframe ID
        data: binary; // Keyframe data
    }],
    chunks: [{
        id: number; // Chunk ID
        data: binary; // Chunk data
    }]
}

aof-file-parser's People

Contributors

andreasgassmann avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aof-file-parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.