Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. // ==UserScript==
  2. // @name HV - Altless Casting
  3. // @namespace hentaiverse.org/
  4. // @match *://*.hentaiverse.org/*
  5. // @version 1
  6. // @run-at document-start
  7. // @grant none
  8. // ==/UserScript==
  9. 'use strict';
  10.  
  11. // mon,qb
  12. var settings = {
  13. row:'qb',
  14. rowCtrl: null,
  15. rowAlt: null,
  16. rowShift: null,
  17. rowCtrlAlt: null,
  18. pad: '5',
  19. padAlt: null,
  20. padCtrl: null,
  21. padCtrlAlt: null,
  22. };
  23.  
  24. window.addEventListener('keydown', keyDownCb, true);
  25.  
  26. function keyDownCb(e) {
  27. //console.log(e);
  28. var mods, key, id, el;
  29. var spell = null;
  30. var target = null;
  31. if(48 <= e.keyCode && e.keyCode <= 57) {
  32. mods = 'row';
  33. } else if(96 <= e.keyCode && e.keyCode <= 105) {
  34. mods = 'pad';
  35. } else {
  36. return;
  37. }
  38. e.stopPropagation();
  39. //e.preventDefault();
  40. //if(mods === 'pad') { return; }
  41. key = e.keyCode % 48;
  42. if(e.ctrlKey) {
  43. mods += 'Ctrl';
  44. }
  45. if(e.altKey) {
  46. mods += 'Alt';
  47. }
  48. var act = settings[mods];
  49. switch(act) {
  50. case 'qb':
  51. if(key === 0) {
  52. key = 10;
  53. }
  54. spell = 'qb' + key;
  55. break;
  56. case '0': case '1': case '2': case '3': case '4':
  57. case '5': case '6': case '7': case '8': case '9':
  58. spell = 'qb' + act;
  59. target = 'mkey_' + key % 10;
  60. break;
  61. case 'mon':
  62. target = 'mkey_' + key % 10;
  63. break;
  64. default:
  65. return;
  66. }
  67. if(spell) {
  68. el = document.getElementById(spell);
  69. if(el && el.onclick) {
  70. if(el.onmouseover) {
  71. el.onmouseover();
  72. }
  73. el.onclick();
  74. el = document.getElementById(target);
  75. if(el && el.onclick) {
  76. el.onclick();
  77. }
  78. }
  79. } else {
  80. el = document.getElementById(target);
  81. if(el && el.onclick) {
  82. el.onclick();
  83. }
  84. }
  85. }
  86.  
  87. function getSpellEl(name) {
  88. return document.querySelector('[onmouseover^="battle.set_infopane_spell(\''+name+'\'"]');
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement