Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name HV - Altless Casting
- // @namespace hentaiverse.org/
- // @match *://*.hentaiverse.org/*
- // @version 1
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- 'use strict';
- // mon,qb
- var settings = {
- row:'qb',
- rowCtrl: null,
- rowAlt: null,
- rowShift: null,
- rowCtrlAlt: null,
- pad: '5',
- padAlt: null,
- padCtrl: null,
- padCtrlAlt: null,
- };
- window.addEventListener('keydown', keyDownCb, true);
- function keyDownCb(e) {
- //console.log(e);
- var mods, key, id, el;
- var spell = null;
- var target = null;
- if(48 <= e.keyCode && e.keyCode <= 57) {
- mods = 'row';
- } else if(96 <= e.keyCode && e.keyCode <= 105) {
- mods = 'pad';
- } else {
- return;
- }
- e.stopPropagation();
- //e.preventDefault();
- //if(mods === 'pad') { return; }
- key = e.keyCode % 48;
- if(e.ctrlKey) {
- mods += 'Ctrl';
- }
- if(e.altKey) {
- mods += 'Alt';
- }
- var act = settings[mods];
- switch(act) {
- case 'qb':
- if(key === 0) {
- key = 10;
- }
- spell = 'qb' + key;
- break;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- spell = 'qb' + act;
- target = 'mkey_' + key % 10;
- break;
- case 'mon':
- target = 'mkey_' + key % 10;
- break;
- default:
- return;
- }
- if(spell) {
- el = document.getElementById(spell);
- if(el && el.onclick) {
- if(el.onmouseover) {
- el.onmouseover();
- }
- el.onclick();
- el = document.getElementById(target);
- if(el && el.onclick) {
- el.onclick();
- }
- }
- } else {
- el = document.getElementById(target);
- if(el && el.onclick) {
- el.onclick();
- }
- }
- }
- function getSpellEl(name) {
- return document.querySelector('[onmouseover^="battle.set_infopane_spell(\''+name+'\'"]');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement