Heroes.StormReplayParser 2.2.1

dotnet add package Heroes.StormReplayParser --version 2.2.1                
NuGet\Install-Package Heroes.StormReplayParser -Version 2.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Heroes.StormReplayParser" Version="2.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Heroes.StormReplayParser --version 2.2.1                
#r "nuget: Heroes.StormReplayParser, 2.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Heroes.StormReplayParser as a Cake Addin
#addin nuget:?package=Heroes.StormReplayParser&version=2.2.1

// Install Heroes.StormReplayParser as a Cake Tool
#tool nuget:?package=Heroes.StormReplayParser&version=2.2.1                

Heroes Storm Replay Parser

Build Release NuGet

Heroes Storm Replay Parser is a .NET library that parses the Heroes of the Storm replay files (.StormReplay) and can also be used to parse .battlelobby files.

To see this library in action check out Heroes Decode.

This library is based on Heroes.ReplayParser.

Replay File Usage

To parse a replay file use StormReplay.Parse(string fileName) by providing the .StormReplay file. It will return a StormReplayResult object that will have the result of the parsing as well as the StormReplay object that will contain all the data parsed.

Example:

// parse the replay file
StormReplayResult stormReplayResult = StormReplay.Parse(@"C:\<USER PATH>\Replays\Multiplayer\2020-06-29 20.08.13 Garden of Terror.StormReplay");

// get the result of the parsing
StormReplayParseStatus status = stormReplayResult.Status;

// check if it succeeded
if (status == StormReplayParseStatus.Success)
{
    // get the replay object
    StormReplay replay = stormReplayResult.Replay;

    // version of the replay
    StormReplayVersion version = replay.ReplayVersion;

    // player data
    IEnumerable<StormPlayer> players = replay.StormPlayers;
}
else
{
    // check if the status is an exception
    if (status == StormReplayParseStatus.Exception)
    {
        // the exception
        StormParseException? stormParseException = stormReplayResult.Exception;
    }
}

Parsing Options

Besides providing the file name of the replay, ParseOptions() may also be passed in. This defines how much of the replay to parse. By default tracker, game, and message events are enabled and PTR parsing is disabled. Parsing a PTR replay will result in a StormReplayParseStatus of PTRRegion.

Game Event parsing provides the following:

  • Hero names (localized)
  • Talent timestamps
  • Player disconnects

Tracker Event parsing provides the following:

  • Hero unit ids
  • Map id name
  • Team levels
  • Team xp breakdown
  • Draft picks
  • Talent ids
  • Player end of game score results
  • Player end of game match awards

Message Events provides the following:

  • All message types (chat, ping, player announce messages, etc...)

The above provided are properties of classes that are automatically parsed out. GameEvents, TrackerEvents, and Messages are also properties that are available that can be used for obtaining specific data.

BattleLobby File Usage

replay.server.battlelobby files can also be parsed to obtain data for pregame analysis tools. The .battlelobby file is created at the start of the loading screen.

On Windows, the default location is C:\<USER PATH>\AppData\Local\Temp\Heroes of the Storm\TempWriteReplayP1\replay.server.battlelobby. The Temp\Heroes of the Storm directory is deleted after the game (not the match) has closed.

To parse a battlelobby file use StormReplayPregame.Parse(string fileName) by providing the .battlelobby file. It will return a StormReplayPregameResult object that will have the result of the parsing as well as the StormReplayPregame object that will contain all the data parsed.

Example:

// parse the battlelobby file
StormReplayPregameResult stormReplayPregameResult = StormReplayPregame.Parse(@"C:\<USER PATH>\AppData\Local\Temp\Heroes of the Storm\TempWriteReplayP1\replay.server.battlelobby");

// get the result of the parsing
StormReplayPregameParseStatus status = stormReplayPregameResult.Status;

// check if it succeeded
if (status == StormReplayPregameParseStatus.Success)
{
    // get the replay object
    StormReplayPregame replay = stormReplayPregameResult.ReplayBattleLobby;

    // version of the replay
    int buildVersion = replay.ReplayBuild;

    // player data
    IEnumerable<PregameStormPlayer> players = replay.StormPlayers;
}
else
{
    // check if the status is an exception
    if (status == StormReplayPregameParseStatus.Exception)
    {
        // the exception
        StormParseException? stormParseException = stormReplayPregameResult.Exception;
    }
}

Parsing Options

Besides providing the file name of the replay, ParsePregameOptions() may also be passed in. By default PTR parsing is enabled. Parsing a PTR battlelobby will result in a StormReplayParseStatus of PTRRegion.

Data References

Some data returned will be references to the game data, such as PlayerHero.HeroAttributeId. Such data can be obtained from HeroesDataParser. From there other resource links can be found.

Developing

To build and compile the code, it is recommended to use the latest version of Visual Studio 2022 or Visual Studio Code.

Another option is to use the dotnet CLI tools from the .NET 8.0 SDK.

License

MIT license

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.