0.2.2 • Published 6 years ago

@scriptstone/parser v0.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Scriptstone Parser

A regex-based parser for extracting game state from Hearthstone's Power.log file and emitting game events in real-time using Node Events.

Install

npm i @scriptstone/parser

Enable Logging

Before the parser can be used, the Power.log must be enabled. This can be done by creating a log.config file in one of the following locations:

  • C:\Users\{USERNAME}\AppData\Local\Blizzard\Hearthstone (Windows)
  • %LOCALAPPDATA%/Blizzard/Hearthstone (Windows)
  • ~/Library/Preferences/Blizzard/Hearthstone (macOS)

Then, put the following text in the file:

[Power]
LogLevel=1
FilePrinting=true
ConsolePrinting=true
ScreenPrinting=false

Usage

const Parser = require('scriptstone-parser');

// Emits 'gameStart' event at the beginning
// of a new Hearthstone game.
parser.on('gameStart', function () {
    // Output the game state.
    console.log(Parser.state);
});

See source/test.js to see more examples.

Emitters

List of implemented events: gameStart, mulligan, turnChange, powerEvent, tagChange.