// ==UserScript==
// @name HV Keybinds
// @namespace HVKEYBIND
// @version 2.5.0
// @description Adds customized keybinding to HV
// @match
http://hentaiverse.org/*// @include
http://hentaiverse.org/*// ==/UserScript==
var bindings = new Array();
var KEY_A = 65, KEY_B = 66, KEY_C = 67, KEY_D = 68, KEY_E = 69, KEY_F = 70, KEY_G = 71, KEY_H = 72, KEY_I = 73, KEY_J = 74, KEY_K = 75, KEY_L = 76, KEY_M = 77;
var KEY_N = 78, KEY_O = 79, KEY_P = 80, KEY_Q = 81, KEY_R = 82, KEY_S = 83, KEY_T = 84, KEY_U = 85, KEY_V = 86, KEY_W = 87, KEY_X = 88, KEY_Y = 89, KEY_Z = 90;
var KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52, KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56, KEY_9 = 57, KEY_0 = 48;
var KEY_SPACE = 32, KEY_ENTER = 13, KEY_PAGEUP = 33, KEY_PAGEDOWN = 34, KEY_END = 35, KEY_HOME = 36, KEY_UP = 37, KEY_LEFT = 38, KEY_RIGHT = 39, KEY_DOWN = 40;
var KEY_F1 = 112, KEY_F2 = 113, KEY_F3 = 114, KEY_F4 = 115, KEY_F5 = 116, KEY_F6 = 117, KEY_F7 = 118, KEY_F8 = 119, KEY_F9 = 120, KEY_F10 = 121, KEY_F11 = 122, KEY_F12 = 123;
var KEY_COMMA = 188, KEY_PERIOD = 190, KEY_SLASH = 191, KEY_FORWARDSLASH = 191, KEY_GRAVE = 192, KEY_TILDE = 192, KEY_LBRACKET = 219, KEY_BACKSLASH = 220;
var KEY_SEMI = 186, KEY_RBRACKET = 221, KEY_APOSTROPHE = 222;
//For keycodes: [
www.javascripter.net]
http://www.javascripter.net/faq/keycodes.htm// or: [
www.cambiaresearch.com]
http://www.cambiaresearch.com/articles/15/...codes-key-codes// or: Use above codes for most keys.
// Just add this for as many bindings as you want:
// Bind(KeyCode, Modifier, Action);
// KeyCode = From links above
// Modifier = This is OPTIONAL. Valid mods are NoMod, Shift, Ctrl, Alt, CtrlShift, AltShift, CtrlAlt, CtrlAltShift
// Action = Valid actions:
// Cast("Spell Name")
// Spell Name.
// Use("Item Type")
// Valid Item Types are Health, Mana, Spirit, Scroll and Infusion.
// Toggle("Type")
// Focus or Spirit
// Nothing
// Use this to unbind a default key
// Target1 - Target10
// Targets the specified monster.
// PowerupGem
// Uses the powerup gem.
// NextRound
// Enters next round. Using this overrides both Space and Enter for next round. If you still want to use one of those, add it manually.
//
// Examples:
// Bind(KEY_M, Shift, Use("Mana"); -- Shift + M = Use next mana potion
// Bind(KEY_LBRACKET, Cast("WRATH OF THOR")); -- Case insensitive. Key [ = cast Wrath of Thor
// Bind(KEY_A, Nothing); -- You can unbind a default key
// Bind(KEY_I, Use("Infusion of Storms"); -- I uses Infusion of Storms
// Bind(KEY_F, Toggle("Focus")) -- toggle focus
// Bind(KEY_S, Toggle("Spirit")); -- toggle spirit stance
Bind(KEY_S, Toggle("Focus"));
Bind(KEY_F, Nothing);
Bind(KEY_Z, Cast("Imperil"));
Bind(KEY_X, Cast("Confuse"));
Bind(KEY_C, Cast("Sleep"));
Bind(KEY_V, Cast("Silence"));
Bind(KEY_H, Cast("Iris Strike"));
Bind(KEY_J, Cast("Backstab"));
Bind(KEY_K, Cast("Frenzied Blows"));
Bind(KEY_O, Use("Mana"));
Bind(KEY_P, Use("Spirit"));// Don't edit anything below. Unless you want to.
if (document.getElementById('togpane_log')) {
document.addEventListener("keydown", handle, true);
}
function handle(e){
saveKeyDown();
for (i = 0; i < bindings.length ; i++) {
var bind = bindings[i];
if (e.keyCode == bind.keyCode && bind.modifier(e)) {
bind.action();
return;
}
}
loadKeyDown();
}
function saveKeyDown(){
runScript("var oldkeydown = document.onkeydown ? document.onkeydown : oldkeydown; document.onkeydown = null;");
}
function loadKeyDown(){
runScript("document.onkeydown = oldkeydown;")
}
function runScript(code){
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.textContent = code;
document.body.appendChild(scriptElement);
scriptElement.remove();
}
function Bind(key, mod, command) {
if (!command) {
command = mod;
mod = NoMod;
}
if (!command) return;
addKeybind(key, mod, command);
}
function addKeybind(key, mod, command) {
bindings.push(new Keybind(key,mod,command));
}
function getSpell(name){
return document.querySelector('.bts>div[onmouseover *= "'+name+'"]');
}
function Toggle(name){
name = name.toLowerCase();
var state = document.querySelector('#ckey_'+name);
if(!state) return null;
return function(){
state.click();
}
}
function Cast(name) {
var spell = getSpell(name);
if(!spell) return null;
if(spell.id > 1000){
return function(){
if(document.querySelector('#togpane_magico[style="display:none"]')){
document.querySelector('.btpm2>img[onclick]').click();
}
spell.click();
}
}else{
return function(){
if(document.querySelector('#togpane_magict[style="display:none"]')){
document.querySelector('.btpm3>img[onclick]').click();
}
spell.click();
}
}
}
function Use(name){
var item_list = document.querySelectorAll('.bti3>div[onmouseover]>div>div');
if(!item_list) return null;
for(var i=0; i<item_list.length; i++){
var item = item_list[i];
var item_name = item.innerText || item.textContent;
if(item_name.match(name)){
return function(){
item.click();
}
}
}
}
function Keybind(key, mod, action) {
this.keyCode = key;
this.modifier = mod;
this.action = action;
}
function NoMod(e) { return !e.shiftKey && !e.altKey && !e.ctrlKey; }
function CtrlAltShift(e) { return e.shiftKey && e.altKey && e.ctrlKey; }
function CtrlShift(e) { return !e.altKey && e.shiftKey && e.ctrlKey; }
function AltShift(e) { return !e.ctrlKey && e.altKey && e.shiftKey; }
function CtrlAlt(e) { return !e.shiftKey && e.ctrlKey && e.altKey; }
function Ctrl(e) { return e.ctrlKey && !e.shiftKey && !e.altKey; }
function Shift(e) { return e.shiftKey && !e.ctrlKey && !e.altKey; }
function Alt(e) { return e.altKey && !e.shiftKey && !e.ctrlKey; }
function Nothing() {} //for unbinding default keys
function NextRound() {
var roundEnd = document.querySelector('#ckey_continue');
if(roundEnd){
roundEnd.click();
}
}
function TargetMonster(num) {
var monster = document.getElementById("mkey_"+num);
if (monster) {
monster.click();
}
}
function Target1() { TargetMonster(1) }
function Target2() { TargetMonster(2) }
function Target3() { TargetMonster(3) }
function Target4() { TargetMonster(4) }
function Target5() { TargetMonster(5) }
function Target6() { TargetMonster(6) }
function Target7() { TargetMonster(7) }
function Target8() { TargetMonster(8) }
function Target9() { TargetMonster(9) }
function Target10() { TargetMonster(0) }
function PowerupGem() {
var pgem = document.getElementById("ikey_p");
if (pgem) {
pgem.click();
}
}
is that the red part is the only things the author added and the other original hotkeys are remain the same?