Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1. var chrome = {
  2. load: function() {
  3. window.addEventListener("mousemove", function(e) {
  4. chrome.player.mouse.x = e.clientX;
  5. chrome.player.mouse.y = e.clientY;
  6. });
  7. window.addEventListener("keydown", chrome.player.capture_key_press);
  8. window.addEventListener("keyup", chrome.player.capture_key_press);
  9. },
  10. player: {
  11. last_key: "",
  12. capture_key_press(a) {
  13. chrome.player.last_key = a.key;
  14. if (game.chat.info.input.info.state == 0 && game.is_run == true) {
  15. if (chrome.macro[a.key] != undefined) {
  16. if (a.type == "keydown" && chrome.macro[a.key].down == false) {
  17. chrome.macro[a.key].down = true;
  18. chrome.macro[a.key].trigger();
  19. }
  20. if (a.type == "keyup" && chrome.macro[a.key].down == true) {
  21. chrome.macro[a.key].down = false;
  22. }
  23. }
  24. }
  25. },
  26. mouse: {
  27. x: 0,
  28. y: 0
  29. },
  30. scan: function(id) {
  31. //Returns all queen and oib data through data object
  32. let GameOibs = lapa28426mauve.lapa28388mauve;
  33. let queen = new Object();
  34. let oibs = new Array();
  35. let k = 0;
  36. for (k = 0; k < GameOibs.length; k++) {
  37. if (GameOibs[k] != undefined) {
  38. if (GameOibs[k].id == id) {
  39. if (GameOibs[k].queen == true) {
  40. queen = GameOibs[k];
  41. } else {
  42. oibs.push(GameOibs[k]);
  43. }
  44. }
  45. }
  46. }
  47. var data = {
  48. oibs: oibs,
  49. queen: queen
  50. }
  51. return data;
  52. },
  53. sendKey(charCode) {
  54. {
  55. var ev = new KeyboardEvent('keydown', {
  56. 'keyCode': charCode,
  57. 'which': charCode
  58. });
  59. window.dispatchEvent(ev);
  60. ev = new KeyboardEvent('keyup', {
  61. 'keyCode': charCode,
  62. 'which': charCode
  63. });
  64. window.dispatchEvent(ev);
  65. }
  66. }
  67. },
  68. math: {
  69. distance(x1,y1,x2,y2){
  70. var a = x1 - x2;
  71. var b = y1 - y2;
  72. return Math.sqrt( a*a + b*b );
  73. }
  74. },
  75. units: {
  76. move(x, y) {
  77. //Moves selected units to reletive map pos 0,0 = top left
  78. lapa28344mauve[_0xda98("0xd9")]({
  79. x: parseInt(x.toString(), 10),
  80. y: parseInt(y.toString(), 10)
  81. });
  82. },
  83. move_origin_queen(x, y) {
  84. queen = chrome.player.scan(player.id).queen;
  85. //Moves selected units to reletive queen pos 0,0 = queen center
  86. lapa28344mauve[_0xda98("0xd9")]({
  87. x: parseInt((x + queen.x + player.cam.rx).toString(), 10),
  88. y: parseInt((y + queen.y + player.cam.ry).toString(), 10)
  89. });
  90. },
  91. move_origin_mouse(x, y) {
  92. //Moves selected units to reletive mouse pos 0,0 = directly on mouse
  93. lapa28344mauve[_0xda98("0xd9")]({
  94. x: parseInt((x + chrome.player.mouse.x).toString(), 10),
  95. y: parseInt((y + chrome.player.mouse.y).toString(), 10)
  96. });
  97. }
  98. },
  99. macro: {
  100. c: {
  101. inc: 0,
  102. down: false,
  103. trigger:function(){
  104. var queen = chrome.player.scan(player.id).queen;
  105. var oibs = chrome.player.scan(player.id).oibs;
  106. for(var x = 0; x < oibs.length; x++){
  107. player.select.units = [];
  108. player.select.units.push(oibs[x]);
  109. chrome.units.move_origin_queen(Math.sin(x+chrome.macro.c.inc)*60,Math.cos(x+chrome.macro.c.inc)*60);
  110. }
  111. chrome.macro.c.inc+=0.05;
  112. player.select.units.push(queen);
  113. if (chrome.macro.c.down == true) {
  114. setTimeout(() => {
  115. chrome.macro.c.trigger();
  116. }, 17);
  117. }
  118. }
  119. },
  120. h : {
  121. down: false,
  122. trigger: function(){
  123. var oibs = chrome.player.scan(player.id).oibs;
  124. var must_heal = new Array();
  125. for(var x = 0; x < oibs.length; x++){
  126. if((oibs[x].level * lapa28305mauve.LIFE[player.crown])*.6 >= oibs[x].life){
  127. must_heal.push(x);
  128. }
  129. }
  130. for(var x = 1; x < must_heal.length; x+=2){
  131. if(must_heal.length%2 == 0){
  132. player.select.units = [];
  133. player.select.units.push(oibs[must_heal[x]]);
  134. player.select.units.push(oibs[must_heal[x-1]]);
  135. lapa28344mauve.regroup();
  136. }else{
  137. must_heal.splice(must_heal.length-1,1);
  138. }
  139. }
  140. if (chrome.macro.h.down == true) {
  141. setTimeout(() => {
  142. chrome.macro.h.trigger();
  143. }, 17);
  144. }
  145. }
  146. },
  147. e: {
  148. down: false,
  149. trigger: function() {
  150. var queen = chrome.player.scan(player.id).queen;
  151. var oibs = chrome.player.scan(player.id).oibs;
  152. for (var x = 0; x < oibs.length; x++) {
  153. player.select.units = [];
  154. player.select.units.push(oibs[x]);
  155. chrome.units.move_origin_mouse(0,0);
  156. }
  157. player.select.lapa28277mauve()
  158. if (chrome.macro.e.down == true) {
  159. setTimeout(() => {
  160. chrome.macro.e.trigger();
  161. }, 17);
  162. }
  163. }
  164. }
  165. }
  166. }
  167. chrome.load();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement