genie-hki

1.0.0 • Public • Published

genie-hki

read/write hotkey files for Age of Empires II

Install - Usage - License: Apache-2.0

npm travis standard

Install

npm install genie-hki

Usage

var genieHki = require('genie-hki')
 
var hki = genieHki.load(buffer)
hki.version // 1.0, 2.0 or 3.0
hki.groups // array of arrays of hotkey objects

API

hki = genieHki.load(buffer)

Load hotkeys from a Buffer.

buffer = genieHki.save(hki)

Save hotkeys to a Buffer.

hki.version

Version of the HKI file. 2.0 for recent HD versions, 1.0 otherwise.

hki.groups

Array of hotkey groups.

group = hki.groups[groupId]

Array of hotkeys for a group.

groupId is one of the genieHki.HotkeyGroups constants:

hki.groups[HotkeyGroups.Villager]
// → array of hotkey objects

hotkey = group[hotkeyId]

A hotkey object with properties:

  • hotkey.key - vkey ID, you can use the vkey package to get the associated name (like C for id 67)
  • hotkey.stringId - string ID of the label for this key (eg 6121 for "Create Villager")
  • hotkey.ctrl - whether Ctrl should be pressed to activate this hotkey
  • hotkey.shift - whether Shift should be pressed to activate this hotkey
  • hotkey.alt - whether Alt should be pressed to activate this hotkey
  • hotkey.mouse - whether this is a mouse hotkey, rather than a keyboard one

Index into the array with the appropriate hotkey constants. For example:

var HotkeyGroups = genieHki.HotkeyGroups
var TownCenterHotkeys = genieHki.TownCenterHotkeys
var townCenter = hki.groups[HotkeyGroups.TownCenter]
var createVillager = townCenter[TownCenterHotkeys.CreateVillager]
 
var vkey = require('vkey')
console.log(vkey[createVillager.key])

License

Apache-2.0

Package Sidebar

Install

npm i genie-hki

Weekly Downloads

2

Version

1.0.0

License

Apache-2.0

Unpacked Size

17 kB

Total Files

15

Last publish

Collaborators

  • goto-bus-stop