0.2.2 • Published 7 years ago
@scriptstone/parser v0.2.2
Scriptstone Parser
A regex-based parser for extracting game state from Hearthstone's
Power.logfile and emitting game events in real-time using Node Events.
Install
npm i @scriptstone/parserEnable 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=falseUsage
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.