genie-hki
read/write hotkey files for Age of Empires II
Last updated 2 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install genie-hki 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 4
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |