1.0.0 • Published 7 years ago
genie-hki v1.0.0
genie-hki
read/write hotkey files for Age of Empires II
Install - Usage - License: Apache-2.0
Install
npm install genie-hkiUsage
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 objectsAPI
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 objectshotkey = group[hotkeyId]
A hotkey object with properties:
hotkey.key- vkey ID, you can use thevkeypackage to get the associated name (likeCfor 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])License
1.0.0
7 years ago