read/write hotkey files for Age of Empires II
Install - Usage - License: Apache-2.0
npm install genie-hki
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
Load hotkeys from a Buffer.
Save hotkeys to a Buffer.
Version of the HKI file. 2.0 for recent HD versions, 1.0 otherwise.
Array of hotkey groups.
Array of hotkeys for a group.
groupId
is one of the genieHki.HotkeyGroups
constants:
hki.groups[HotkeyGroups.Villager]
// → array of hotkey objects
A hotkey object with properties:
hotkey.key
- vkey ID, you can use thevkey
package to get the associated name (likeC
for id67
)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 hotkeyhotkey.shift
- whether Shift should be pressed to activate this hotkeyhotkey.alt
- whether Alt should be pressed to activate this hotkeyhotkey.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])