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 🙏

© 2026 – Pkg Stats / Ryan Hefner

bbreplay

v0.4.4

Published

module to read blood bowl replay files

Readme

BBReplay

A nodejs module that reads Blood Bowl replay files

Installation

Simplest way to install bbreplay is to use npm, just npm install bbreplay which will download bbreplay and all dependencies.

Usage

var bbreplay = require('bbreplay');
var file = 'path to your BB2 replay file';

bbreplay.getBB2replay(file)
    .then(function (result) {
        console.log(result);
    })
    .catch(function (err) {
        console.log(err);
    });

Documentation

bbreplay.getBB2replay(file)

Arguments

  • file - path to the BB2 replay file.

Returned object

{
    gameDetails: {
        fileName: replay file name,
        leagueName: league name,
        competitionName:  competition name,
        stadiumName: stadium name,
        finished: game end date and hour,
        homeTeam: {
            data: {
                coachName: home team coach name,
                coachid: home team coach id,
                teamName: home team name,
                raceId: home team race id,
                value: home team TV,
                popularity: home team popularity,
                treasury: home team treasury,
                apothecary: home team apothecary,
                reroll: home team reroll,
                logo: home team logo,
                teamId: home team id
            },
            result: {
                score: home team score,
                nbsupporters: home team supporters,
                fame: home team fame,
                winningsdice: home team winningdice,
                cashearned: home team cash earned,
                popularitygain: home team popularity gain
            },
            stats: {
                imvp: nb of MVP,
                inflictedpasses: nb of inflicted passes,
                inflictedcatches: nb of inflicted catches,
                inflictedinterceptions: nb of inflicted interceptions,
                inflictedcasualties: nb of inflicted casualties,
                inflictedtackles: nb of inflicted tackles,
                inflictedpushouts: nb of inflicted pushouts,
                inflictedstuns: nb of inflicted stuns,
                inflictedko: nb of inflicted ko,
                inflictedinjuries: nb of inflicted injuries,
                inflicteddead: nb of inflicted dead,
                inflictedmetersrunning: run meters,
                inflictedmeterspassing: nb of meters through pass,
                inflictedpossessionball: % of ball possession,
                sustainedinterceptions: nb of sustained interceptions,
                sustainedcasualties: nb of sustained casualties,
                sustainedtackles: nb of sustained tackles,
                sustainedstuns: nb of sustained stuns,
                sustainedko: nb of sustained ko,
                sustainedinjuries: nb of sustained injuries,
                sustaineddead: nb of sustained dead,
                occupationtheir: % of time in opposite side,
                occupationown: % of time in own side
            }
        },
        awayTeam: {
            data: {
                coachName: away team coach name,
                coachid: away team coach id,
                teamName: away team name,
                raceId: away team race id,
                value: away team TV,
                popularity: away team popularity,
                treasury: away team treasury,
                apothecary: away team apothecary,
                reroll: away team reroll,
                logo: away team logo,
                teamId: away team id
            },
            result: {
                score: away team score,
                nbsupporters: away team supporters,
                fame: away team fame,
                winningsdice: away team winningdice,
                cashearned: away team cash earned,
                popularitygain: away team popularity gain
            },
            stats: {
                imvp: nb of MVP,
                inflictedpasses: nb of inflicted passes,
                inflictedcatches: nb of inflicted catches,
                inflictedinterceptions: nb of inflicted interceptions,
                inflictedcasualties: nb of inflicted casualties,
                inflictedtackles: nb of inflicted tackles,
                inflictedpushouts: nb of inflicted pushouts,
                inflictedstuns: nb of inflicted stuns,
                inflictedko: nb of inflicted ko,
                inflictedinjuries: nb of inflicted injuries,
                inflicteddead: nb of inflicted dead,
                inflictedmetersrunning: run meters,
                inflictedmeterspassing: nb of meters through pass,
                inflictedpossessionball: % of ball possession,
                sustainedinterceptions: nb of sustained interceptions,
                sustainedcasualties: nb of sustained casualties,
                sustainedtackles: nb of sustained tackles,
                sustainedstuns: nb of sustained stuns,
                sustainedko: nb of sustained ko,
                sustainedinjuries: nb of sustained injuries,
                sustaineddead: nb of sustained dead,
                occupationtheir: % of time in opposite side,
                occupationown: % of time in own side
            }
        }
    },
    playerDetails: { //one line per player
        '1': { // id used in actions
            team: team index, // 0: home, 1:away
            name: player name,
            id: player id used in actions,
            number: player number,
            ma: player MA,
            st: player ST,
            ag: player AG,
            av: player AV,
            type: player type id,
            level: player level,
            xp: player XP,
            skills: array of skill id,
            casualty: array of casualty id ,
            stats: { // game player statistics
                acquiredxp: acquired experience during the game,
                casualty: game casualty,
                inflictedtackles: 1, // stats keys depends of player performances
                sustainedtackles: 3,
                sustainedinjuries: 1,
                matchplayed: 1,
                idplayerlisting: player id
            }
        }
    },
    actions: [ // array of actions
        { team: 0(home)-1(away), 
            turn: 0, // match turn
            player: 43, // player id
            rollType: -2, // roll Type see below
            dice: [array of dice roll] },
    ],
    results: {
        match row information
    },
    bbReplayVersion: version of bbrepplay that generates the data
}  

Roll Type

  • -2 - Kickoff Scatter if 2 dices (D6 + D6)
  • -2 - Pass Scatter if 3 dices (D8 + D6 + D6)
  • -1 - Kickoff (D6 + D6)
  • 1 - GFI (D6)
  • 2 - Dodge (D6)
  • 3 - Armour (D6)
  • 4 - Injury (D6)
  • 5 - Block (Block Dice)
  • 6 - Stand up (D6)
  • 7 - Pickup (D6)
  • 8 - Casualty (D6)
  • 9 - Catch (D6)
  • 10 - Scatter (D8)
  • 11 - Throw in (D6)
  • 12 - Pass (D6)
  • 16 - Intercept (D6)
  • 17 - Wake-Up After KO (D6)
  • 20 - Bone-Head (D6
  • 21 - Really Stupid (D6)
  • 22 - Wild Animal (D6)
  • 23 - Loner (D6)
  • 24 - Landing (D6)
  • 26 - Inaccurate Pass Scatter (D8)
  • 27 - Always Hungry (D6)
  • 29 - Dauntless (D6)
  • 31 - Jump Up (D6)
  • 34 - Stab (D6)
  • 36 - Leap (D6)
  • 37 - Foul Appearance (D6)
  • 40 - Take Root (D6)
  • 42 - Hail Mary Pass (D6)
  • 46 - Hypnotic Gaze (D6)
  • 54 - Fireball (D6)
  • 55 - Lightning Bolt (D6)
  • 56 - Throw Team-Mate (D6)
  • 58 - Kickoff Gust (D6)
  • 59 - Armour (D6) // pre-piling on roll
  • 60 - Injury (D6) // pre-piling on roll

Examples

var file = 'file.bbrz';

bbreplay.getBB2replay(file)
    .then(function (result) {
        // results is an object with match data
        console.log(result);
    })
    .catch(function(err) {
        console.log(err);
    });
});

Acknowledgments

Part of the code, especially replay file decoding, is inspired by [bonnici] (https://www.reddit.com/user/bonnici) and its [onesandskulls] (http://onesandskulls.com/) web site.

Versions

version 0.4.4 : Modify coachId and teamId
version 0.4.3 : Add file name
version 0.4.2 : Add level into player object
version 0.4.1 : Add team info into player object
version 0.4.0 : Include team and player statistics in the returned object
version 0.3.0 : Use promise instead of asynchrone function with callback
version 0.2.0 : Code refactoring
version 0.1.0 : First implementation of the library with one function 'getMatchResults' that returns BB2 match result as json object

Getting support

Please, if you have a problem with the library, first make sure you read this README. If you read this far, thanks, then please make sure your problem really is with bbreplay. It is? Okay, then open an issue.