项目作者: Veldrin055

项目描述 :
Elite Dangerous journal reader package
高级语言: TypeScript
项目地址: git://github.com/Veldrin055/edjr.git
创建时间: 2019-08-06T03:48:10Z
项目社区:https://github.com/Veldrin055/edjr

开源协议:MIT License

下载


Elite Dangerous Journal Reader

A Typescript package for scanning a CMDR’s journal directory and emitting events based on journal log messages.

GitHub issues
GitHub license

Install

For yarn…

  1. yarn add edjr

…or for NPM:

  1. npm i --save edjr

How to use it

import or require edjr, create a new instance of Journal and then subscribe to the events that you are interested in.
Bye default, it will read the journal files located at the user home, '~/Saved Games/Frontier Developments/Elite Dangerous'.
It will begin scanning for new messages on the latest file. If you want to scan from the beginning, pass {fromBeginning: true}
as a parameter to the scan() function.

  1. import { Journal, SupercruiseEntryEvent, JournalEvent, } from 'edjr'
  2. const journal = new Journal()
  3. // Listen to a specific event
  4. journal.on('SupercruiseEntry', (evnt: SupercruiseEntryEvent) => {
  5. console.log('entered supercruise', evnt)
  6. })
  7. // Listen to any event
  8. journal.on('*', (evnt: JournalEvent, historical: boolean) => {
  9. if (!historical) { // Only new events (no backfill if fromBeginning = true)
  10. console.log(`${evnt.event} just happened`)
  11. }
  12. })
  13. // Start listening
  14. journal.scan()
  15. /*
  16. entered supercruise { timestamp: 2019-08-06T14:14:24.000Z,
  17. event: 'SupercruiseEntry',
  18. StarSystem: 'Kappa Fornacis',
  19. SystemAddress: 1458309141194 }
  20. entered supercruise { timestamp: 2019-08-07T00:38:43.000Z,
  21. event: 'SupercruiseEntry',
  22. StarSystem: 'Eurybia',
  23. SystemAddress: 1458309141194 }
  24. entered supercruise { timestamp: 2019-08-07T00:41:49.000Z,
  25. event: 'SupercruiseEntry',
  26. StarSystem: 'Yo Mama',
  27. SystemAddress: 1458309141194 }
  28. */

Scan Options

  1. const scanOptions: ScanOptions = {
  2. fromBeginning: false,
  3. dir: "my/journal/dir"
  4. }

To Do

Add more event types.

This library is not an official tool for the game Elite: Dangerous and is not affiliated with Frontier Developments. All information provided is based on publicly available information and may not be entirely accurate.

Elite © 1984 David Braben & Ian Bell. Frontier © 1993 David Braben, Frontier: First Encounters © 1995 David Braben and Elite: Dangerous © 2012, 2013 Frontier Developments plc. All rights reserved. ‘Elite’, the Elite logo, the Elite: Dangerous logo, ‘Frontier’ and the Frontier logo are registered trademarks of Frontier Developments plc. All rights reserved. All other trademarks and copyright are acknowledged as the property of their respective owners.