CellCraftX

for AEA clan, not u homie

  1. // ==UserScript==
  2. // @name CellCraftX
  3. // @namespace http://tampermonkey.net/
  4. // @version 4.5.1
  5. // @description for AEA clan, not u homie
  6. // @author SuiX
  7. // @match http://cellcraft.io/*
  8. // @grant none
  9. // @run-at document-end
  10. // ==/UserScript==
  11.  
  12. document.getElementById("instructions").innerHTML += "<center><span class='text-muted'><span data-itr='instructions_e'> Macro by<b>__JaZzY!</b></span></span></center>";
  13.  
  14. window.addEventListener('keydown', keydown);
  15. window.addEventListener('keyup', keyup);
  16.  
  17. var SplitDown = false;
  18. var EjectDown = false;
  19. var speed = 0;
  20. var speed2 = 100;
  21.  
  22. function keydown(event) {
  23. if (event.keyCode == 87 && EjectDown === false) {
  24. EjectDown = true;
  25. setTimeout(eject, speed);
  26. }
  27. if (event.keyCode == 65 && SplitDown === false) {
  28. SplitDown = true;
  29. setTimeout(split2, speed);
  30. }
  31. if (event.keyCode == 68) {
  32. split();
  33. setTimeout(split, speed2);
  34. }
  35. }
  36.  
  37. function keyup(event) {
  38. if (event.keyCode == 87) {
  39. EjectDown = false;
  40. }
  41. if (event.keyCode == 65) {
  42. SplitDown = false;
  43. }
  44. }
  45.  
  46. function eject() {
  47. if (EjectDown) {
  48. window.onkeydown({keyCode: 87});
  49. window.onkeyup({keyCode: 87});
  50. setTimeout(eject, speed);
  51. }
  52. }
  53.  
  54. function split2() {
  55. if (SplitDown) {
  56. $("body").trigger($.Event("keydown", { keyCode: 32}));
  57. $("body").trigger($.Event("keyup", { keyCode: 32}));
  58. setTimeout(split2, speed);
  59. }
  60. }
  61.  
  62. function split() {
  63. $("body").trigger($.Event("keydown", { keyCode: 32}));
  64. $("body").trigger($.Event("keyup", { keyCode: 32}));
  65. }
  66.  
  67.  
  68. // DELETE THE BELOW LINES IF YOU DO NOT WANT MOUSE CONTROLS!
  69.  
  70.  
  71. (function(Mouse) {
  72. document.getElementById("canvas").addEventListener("mousedown", function(event) {
  73. if (event.which == 1) { //Switch with the below "2" if left mouse doublepslits.
  74. split();
  75. }
  76. else if (event.which == 2) { //Switch with the above "1" if middle mouse click splits once.
  77. split();
  78. setTimeout(split, Speed);
  79. }
  80. else if (event.which == 3) {
  81. EjectDown = true;
  82. setTimeout(eject, Speed2);
  83. }
  84. });
  85.  
  86. document.getElementById("canvas").addEventListener("mouseup", function(event) {
  87. if (event.which == 3) {
  88. EjectDown = false;
  89. }
  90. });
  91. $('#canvas').bind('contextmenu', function(e) {
  92. e.preventDefault();
  93. });
  94. }());