cursors.io hack NEW (July 2018)

cursorsio hack, drawing, texting, player ids, & more

当前为 2018-07-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name cursors.io hack NEW (July 2018)
  3. // @namespace q1k
  4. // @version 1.0.5
  5. // @description cursorsio hack, drawing, texting, player ids, & more
  6. // @author q1k
  7. // @match http://cursors.io/
  8. // @grant none
  9. // @run-at document-idle
  10. // ==/UserScript==
  11.  
  12.  
  13. /*
  14. ___ _ _ _ __ ___ ___ _ __ ___ _ ___
  15. / __| | | | `__/ __|/ _ \| `__/ __| | |/ _ \
  16. | (__| |_| | | \__ \ (_) | | \__ \_| | (_) |
  17. \___|\__,_|_| |___/\___/|_| |___(_)_|\___/
  18.  
  19. for a more updated version, go here:
  20. https://greasyfork.org/en/scripts/369975
  21.  
  22. */
  23. /* How to use:
  24. 1. Go to cursors.io, open console (ctrl + shift + j or F12)
  25. and paste this entire script into the console, then hit enter
  26. -if installing as userscript, make sure to block "cursors.io/client_out.js"
  27. 2. To type: type message and hit enter (shift+enter for new row)
  28. -all ascii characters are available
  29. 3. To move your cursor only when clicking: press numpad . OR delete
  30. -Pathfinder will be active in this mode. (CTRL+click to ignore pathfinder)
  31. -try not to use a too low value of the delay, or you may get disconnected on some levels
  32. --make sure 'no cursor lock' is marked so pathfinder works correctly
  33. To move your cursor normally: press numpad . again
  34. 4. To draw a circle: press numpad 0 OR insert
  35. To stop drawing a circle: press numpad 0 again
  36. 5. To draw arrows, use the arrow keys
  37. 6. To draw different images press numpad 1 - numpad 9 keys
  38. 7. To make drawings bigger/smaller use numpad + and -
  39. 8. Reset drawing size with numpad *
  40. 9. To show/hide cursors ids: press F8
  41. 10. Change ids position with: F9
  42. 11. To show this help: press F1
  43. */
  44.  
  45. var A = window;
  46. var E = document;
  47. var posX, posY;
  48. var lastX, lastY;
  49. var serverPosX, serverPosY;
  50. var initialLoad = true;
  51. var clicksCount = 3;
  52. var auraEnabled = false;
  53. var auraTime = 0;
  54. var auraRadius = 10;
  55. var movementEnabled = true;
  56. var imgSizeShow = false;
  57. var showcursorsid = false;
  58. var hideExtraInfo = false;
  59.  
  60. var fontnarrow = false;
  61. var fontSize = 2;
  62. var kerning = 3;
  63. var alphabet = {
  64. 33:[[0,1,1.5,1],[2,1,2.5,1]],//!
  65. 34:[[0,0.5,1,0.5],[0,1.25,1,1.25]],//"
  66. 35:[[0.5,-0.25,0.5,2.3],[1.5,-0.25,1.5,2.3],[-0.25,0.5,2.3,0.5],[-0.25,1.5,2.3,1.5]],//#
  67. 36:[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2],[-0.5,1,0,1],[2,1,2.5,1]],//$
  68. 37:[[1,0,0,0],[0,0,0,1],[0,1,2,1],[2,1,2,2],[2,2,1,2],[1,2,1,0],[2,0,0,2]],//% v1
  69. //37:[[0,0,0,0.75],[0,0.75,0.75,0.75],[0.75,0.75,0.75,0],[0.75,0,0,0],[2,0,0,2],[1.25,1.25,1.25,2],[1.25,2,2,2],[2,2,2,1.25],[2,1.25,1.25,1.25]],//% v2
  70. //37:[[1,0.5,0.5,0],[0.5,0,0,0.5],[0,0.5,0.5,1],[0.5,1,1,0.5],[2,0,0,2],[2,1.5,1.5,1],[1.5,1,1,1.5],[1,1.5,1.5,2],[1.5,2,2,1.5]],//% v3
  71. 38:[[0.5,1,0,1],[0,1,0,0],[0,0,2,0],[2,0,2,0.5],[2,0.5,1,1.5],[1,0,1,0.5],[1,0.5,2,1.5]],//&
  72. 39:[[0,0.5,1,0.5]], // '
  73. 40:[[0,2,0.5,1],[0.5,1,1.5,1],[1.5,1,2,2]],//(
  74. 41:[[0,0,0.5,1],[0.5,1,1.5,1],[1.5,1,2,0]],//)
  75. 42:[[0.5,0,1.5,2],[1.5,0,0.5,2],[0,1,2,1]],//*
  76. 43:[[0,1,2,1],[1,0,1,2]],//+
  77. 44:[[2,0,3,0]],//,
  78. 45:[[0.6,0.3,0.6,1.7]],//-
  79. 46:[[1.5,0,2,0]],//.
  80. 47:[[2,0.4,0,1.6]],// /
  81. 48:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[2,0,0,2]],//0
  82. 49:[[0,1,2,1],[1,0,0,1],[2,0,2,2]],//1
  83. 50:[[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,0,2,0],[2,0,2,2]],//2
  84. 51:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],
  85. 52:[[0,0,1,0],[1,0,1,2],[0,2,2,2]],
  86. 53:[[0,2,0,0],[0,0,1,0],[1,0,1,2],[1,2,2,2],[2,2,2,0]],
  87. 54:[[0,2,0,0],[0,0,2,0],[2,0,2,2],[2,2,1,2],[1,2,1,0]],
  88. 55:[[0,0,0,2],[0,2,2,0]],
  89. 56:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[2,0,0,0],[1,0,1,2]],
  90. 57:[[0,0,1,0],[1,0,1,2],[0,2,2,2],[0,0,0,2],[2,0,2,2]],//9
  91. 58:[[0,1,0.5,1],[1.5,1,2,1]],//:
  92. 59:[[0,1,0.5,1],[2,1,3,1]],//;
  93. 60:[[0,2,1,0],[1,0,2,2]],//<
  94. 61:[[0.5,0,0.5,2],[1.5,0,1.5,2]],//=
  95. 62:[[0,0,1,2],[1,2,2,0]],//>
  96. 63:[[1,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,1],[1,1,1.5,1],[2,1,2.5,1] ],//?
  97. 64:[[2.5,2,2.5,0],[2.5,0,-0.5,0],[-0.5,0,-0.5,2],[-0.5,2,1.5,2],[1.5,2,1.5,1],[1.5,1,0.5,1],[0.5,1,0.5,2]],//@
  98. 91:[[0,1.5,0,0.5],[0,0.5,2,0.5],[2,0.5,2,1.5]],// [
  99. 92:[[0,0.4,2,1.6]],// backslash
  100. 93:[[0,0.5,0,1.5],[0,1.5,2,1.5],[2,1.5,2,0.5]],// ]
  101. 94:[[1.5,0,0,1],[0,1,1.5,2]],//^
  102. 95:[[2,0,2,2] ],//_
  103. 96:[[0,0.5,1,0.5]], // ` display same as 39
  104. 97:[[2,0,0,0],[0,2,0,0],[0,2,2,2],[1,0,1,2]],//a
  105. 98:[[2,0,0,0],[0,0,0,1],[1,0,1,1],[2,0,2,1],[0,1,0.5,2],[0.5,2,1,1],[1,1,1.5,2],[1.5,2,2,1]],//b
  106. 99:[[2,2,2,0],[2,0,0,0],[0,0,0,2]],//c
  107. 100:[[2,0,0,0],[0,0,0,1],[0,1,1,2],[1,2,2,1],[2,1,2,0]],
  108. 101:[[2,2,2,0],[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  109. 102:[[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  110. 103:[[1,1,1,2],[1,2,2,2],[2,2,2,0],[2,0,0,0],[0,0,0,2]],
  111. 104:[[0,0,2,0],[0,2,2,2],[1,0,1,2]],
  112. 105:[[0,0,0,2],[0,1,2,1],[2,0,2,2]],
  113. 106:[[0,0,0,2],[0,1,2,1],[2,0,2,1]],
  114. 107:[[0,0,2,0],[1,0,0,2],[1,0,2,2]],
  115. 108:[[0,0,2,0],[2,0,2,2]],
  116. 109:[[0,0,2,0],[0,0,2,1],[2,1,0,2],[0,2,2,2]],
  117. 110:[[0,0,2,0],[0,0,2,2],[0,2,2,2]],
  118. 111:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]],
  119. 112:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0]],
  120. 113:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,1,2,2]],
  121. 114:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,1,2,2]],
  122. 115:[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2]],
  123. 116:[[0,0,0,2],[0,1,2,1]],
  124. 117:[[0,0,2,0],[0,2,2,2],[2,0,2,2]],
  125. 118:[[0,0,2,1],[0,2,2,1]],
  126. 119:[[0,0,2,0],[0,2,2,2],[2,0,1,1],[2,2,1,1]],
  127. 120:[[0,0,2,2],[2,0,0,2]],
  128. 121:[[0,0,1,1],[0,2,1,1],[2,1,1,1]],
  129. 122:[[0,0,0,2],[0,2,2,0],[2,0,2,2]],//z
  130. 123:[[0,1.5,0,0.5],[0,0.5,0.5,0.5],[0.5,0.5,1,0],[1,0,1.5,0.5],[1.5,0.5,2,0.5],[2,0.5,2,1.5]],// {
  131. 124:[[0,1,2,1]],// |
  132. 125:[[0,0.5,0,1.5],[0,1.5,0.5,1.5],[0.5,1.5,1,2],[1,2,1.5,1.5],[1.5,1.5,2,1.5],[2,1.5,2,0.5]],// }
  133. 126:[[0.5,0,0,0.75],[0,0.75,0.5,1.5],[0.5,1.5,0,2.25]],// ~
  134. };
  135.  
  136. var imageScale = 1.0;
  137. var imgData = [
  138. /* arrow left */
  139. [[0,0,0,9],[0,0,-3,3],[0,0,3,3]],
  140.  
  141. /* arrow up */
  142. [[0,0,9,0],[0,0,3,-3],[0,0,3,3]],
  143.  
  144. /* arrow right */
  145. [[0,0,0,-9],[0,0,-3,-3],[0,0,3,-3]],
  146.  
  147. /* arrow down */
  148. [[0,0,-9,0],[0,0,-3,-3],[0,0,-3,3]],
  149.  
  150. /*star 5*/
  151. [[8,0,8,24],[8,24,24,4],[24,4,0,12],[0,12,24,20],[24,20,8,0]],
  152.  
  153. /* reversed star */
  154. [[0,4,24,12],[24,12,0,20],[0,20,16,0],[16,0,16,24],[16,24,0,4]],
  155.  
  156. /*tictactoe*/
  157. [[72,24,0,24],[0,48,72,48],[24,0,24,72],[48,0,48,72],[0,0,0,72],[0,72,72,72],[72,72,72,0],[72,0,0,0]],
  158.  
  159. /*triforce*/
  160. [[20,0,0,10],[0,10,20,20],[20,20,20,0],[10,5,10,15],[10,15,20,10],[20,10,10,5],[2,9,2,11],[3,9,3,11],[4,8,4,12],[5,8,5,12],[6,7,6,13],[7,7,7,13],[8,6,8,14],[9,6,9,14],[12,4,12,6],[12,14,12,16],[13,4,13,6],[13,14,13,16],[14,3,14,7],[14,13,14,17],[15,3,15,7],[15,13,15,17],[16,2,16,8],[16,12,16,18],[17,2,17,8],[17,12,17,18],[18,1,18,9],[18,11,18,19],[19,1,19,9],[19,11,19,19]],
  161.  
  162. /*pentashot*/
  163. [[50,16,66,17],[66,17,65,32],[51,26,72,36],[65,32,65,33],[72,36,64,52],[49,35,69,58],[69,58,54,71],[54,71,35,48],[49,65,33,70],[33,70,25,49],[16,46,16,63],[16,63,30,63],[50,16,51,19],[51,19,51,26],[51,26,49,35],[49,35,46,40],[46,40,43,43],[43,43,38,47],[38,47,32,49],[32,49,27,49],[27,49,24,49],[24,49,21,48],[21,48,16,46],[16,46,13,44],[13,44,10,41],[10,41,8,38],[8,38,5,32],[5,32,4,24],[4,24,5,18],[5,18,8,11],[8,11,12,7],[12,7,16,4],[16,4,21,2],[21,2,25,1],[25,1,31,1],[31,1,35,2],[35,2,40,4],[40,4,45,8],[45,8,48,13],[48,13,50,16]],
  164.  
  165. /*heart*/
  166. [[9,5,4,0],[4,0,2,0],[2,0,1,1],[4,10,9,5],[1,1,1,3],[1,3,3,5],[3,5,1,7],[1,7,1,9],[1,9,2,10],[2,10,4,10]],
  167.  
  168. /*penrose*/
  169. [[33,34,42,40],[36,36,27,42],[33,38,33,26],[27,22,48,36],[48,36,27,50],[27,50,27,22],[42,40,42,52],[48,36,48,56],[48,56,39,50],[42,48,33,54],[33,54,54,68],[54,68,46,72],[48,28,39,22],[42,20,33,26],[42,24,42,12],[42,12,27,22],[48,28,48,0],[48,0,54,4],[54,4,54,68],[27,42,18,36],[21,38,21,26],[21,34,12,40],[27,50,12,40],[21,26,0,40],[0,40,0,32],[0,32,48,0],[0,40,46,72]],
  170.  
  171. /*boxception*/
  172. [[60,0,0,0],[0,0,0,60],[0,60,60,60],[60,60,60,0],[60,0,0,3],[0,3,3,60],[3,60,60,57],[60,57,57,0],[57,0,0,6],[0,6,6,60],[6,60,60,54],[60,54,54,0],[54,0,0,9],[0,9,9,60],[9,60,60,51],[60,51,51,0],[51,0,0,12],[0,12,12,60],[12,60,60,48],[60,48,48,0],[48,0,0,15],[0,15,15,60],[15,60,60,45],[60,45,45,0],[45,0,0,18],[0,18,18,60],[18,60,60,42],[60,42,42,0],[42,0,0,21],[0,21,21,60],[21,60,60,39],[60,39,39,0],[39,0,0,24],[0,24,24,60],[24,60,60,36],[60,36,36,0],[36,0,0,27],[0,27,27,60],[27,60,60,33],[60,33,33,0],[33,0,0,30],[0,30,30,60],[30,60,60,30],[60,30,30,0],[30,0,0,33],[0,33,33,60],[33,60,60,27],[60,27,27,0],[27,0,0,36],[0,36,36,60],[36,60,60,24],[60,24,24,0],[24,0,0,39],[0,39,39,60],[39,60,60,21],[60,21,21,0],[21,0,0,42],[0,42,42,60],[42,60,60,18],[60,18,18,0],[18,0,0,45],[0,45,48,60],[48,60,60,15],[60,15,15,0],[15,0,0,48],[0,48,51,60],[51,60,60,12],[60,12,12,0],[12,0,0,51],[0,51,54,60],[54,60,60,9],[60,9,9,0],[9,0,0,54],[0,54,57,60],[57,60,60,6],[60,6,6,0],[6,0,0,57],[0,57,60,60],[60,60,60,3],[60,3,3,0],[3,0,0,60],[60,6,3,0]],
  173.  
  174.  
  175. ];
  176.  
  177. function sa(f) {
  178. return f << 1;
  179. }
  180.  
  181. function ta(f) {
  182. return f << 1;
  183. }
  184.  
  185. function U() {
  186. return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y;
  187. }
  188.  
  189. function ba() {
  190. a.fillStyle = "#000000";
  191. a.font = "35px NovaSquare";
  192. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  193. a.font = "16px NovaSquare";
  194. a.fillText("Play http://cursors.io/", 400 - a.measureText("Play http://cursors.io/").width /
  195. 2, 330);
  196. top.location = "http://cursors.io";
  197. throw "Please do not embed our website, thank you.";
  198. }
  199.  
  200. function ua(f) {
  201. V(f);
  202. }
  203.  
  204. function W(f, b) {
  205. J = f;
  206. K = b;
  207. posX = k = v = f;
  208. posY = q = w = b;
  209. B = v << 1;
  210. C = w << 1;
  211. }
  212.  
  213. function unfocus() {
  214. elm.forEach(function(i){ i.blur() });
  215. }
  216.  
  217. window.changedelay = function(d) {
  218. d = Math.floor(parseInt(d));
  219. var dd = document.getElementById('delay');
  220. if (d >= 0) {dd.value = delay = d;}
  221. else dd.value = delay = 0;
  222. }
  223.  
  224. window.changefontsize = function(d) {
  225. d = parseFloat(d);
  226. var dd = document.getElementById('fontsize');
  227. if (d >0) {dd.value = fontSize = d;}
  228. else dd.value = fontSize = 2;
  229. }
  230.  
  231. window.changefontwidth = function(d) {
  232. if (d.checked) { textwidth=2/3; fontnarrow=true; d.blur(); }
  233. else { textwidth=1; fontnarrow=false; d.blur(); }
  234. }
  235.  
  236. window.cmessage = "by q1k";
  237. window.changecmessage = function(d) {
  238. var dd = document.getElementById('cmessage');
  239. cmessage = d;
  240. }
  241.  
  242. window.changeImgSize = function(d) {
  243. d = Math.floor(parseInt(d));
  244. var tmp = d/100;
  245. var dd = document.getElementById('imgsize');
  246. if (d > 0) {
  247. dd.value = d;
  248. imageScale = tmp;
  249. imgSizeDisplay();
  250. }
  251. else {
  252. dd.value = 10;
  253. imageScale = 0.1;
  254. imgSizeDisplay();
  255. }
  256. }
  257.  
  258. window.disablemovement = function(d) {
  259. if (d.checked) { movementEnabled = false; d.blur() }
  260. else { movementEnabled = true; d.blur() }
  261. }
  262.  
  263. window.changeextrainfo = function(d) {
  264. if (d.checked) { hideExtraInfo = true; d.blur(); }
  265. else { hideExtraInfo = false; d.blur(); }
  266. }
  267.  
  268. window.toggler = function() {
  269. var dd = document.getElementById('toggle');
  270. dd.classList.toggle('open');
  271. if (dd.classList.contains('open')) dd.innerHTML = "hide advanced options <span></span>";
  272. else dd.innerHTML = "show advanced options <span></span>";
  273. }
  274.  
  275. var elm=[];
  276. function Ma() {
  277. var el1 = document.querySelectorAll("a[href='https://m28.studio/']");
  278. var par = el1[0].parentElement;
  279. var add = "<label id='help' title='Press F1 for help' onclick='showHelp=!showHelp'><span></span></label>"
  280. +"<div id='options-cont'><label id='toggle' onclick='toggler()'>show advanced options <span></span></label><div id='options'>"
  281. +"<div><label title='Pathfinder delay for each move (in miliseconds)'>delay: <input id='delay' type='number' step='5' min='0' value='"+delay+"' onchange='changedelay(this.value)'></label>"
  282. +"<input id='pathfinder' type='checkbox' title='Pathfinder/Movement (numpad . OR delete)' onclick='disablemovement(this)'><span class='info pf'></span></div>"
  283. +"<div><label title='Size of font (default = 2)'>font size: <input id='fontsize' type='number' step='any' value='"+fontSize+"' onchange='changefontsize(this.value)'></label>"
  284. +"<input id='fontwidth' type='checkbox' title='Narrow text (F10)' onclick='changefontwidth(this)'><span class='info font'></span></div>"
  285. +"<div><label title='Custom message on pressing numpad 9'>message: <input id='cmessage' type='text' value='"+cmessage+"' onchange='changecmessage(this.value)'></label><span class='info msg'></span></div>"
  286. +"<div><label title='Image size in %'>image size: <input id='imgsize' type='number' step='10' min='0' value='"+imgSizePrcnt+"' onchange='changeImgSize(this.value)'></label><span class='info img'></span></div>"
  287. +"<div><label title='On-screen extra information (F11)'>always hide extra labels: <input id='extrainfo' type='checkbox' onclick='changeextrainfo(this)'></label><span class='info einfo'></span></div>"
  288. +"</div></div>";
  289.  
  290. par.appendChild(document.createElement('div')).setAttribute('id','h-options');
  291. document.getElementById('h-options').innerHTML = add;
  292. elm = Array.from(document.querySelectorAll("input"));
  293. }
  294.  
  295. var css = "<style>#options,#options>div{margin-top:.5em;position:relative}#help,#toggle{cursor:pointer}#options,#options>div,#toggle span{position:relative}#help span,#toggle span::after{background-size:100% 100%;width:100%}#options>div span.info::before,#toggle span::after{content:'';background-repeat:no-repeat}a[href*=m28],a[href*=m28]~br,div[style*='height: 90px']{display:none}*{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{opacity:1}#h-options{float:right;margin-bottom:1em}#help{float:right;width:1.75em;height:1.75em}#help span{display:block;background-color:#bfeaf8;background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGQ9Ik01MDAsOTkwQzIyOS44LDk5MCwxMCw3NzAuMiwxMCw1MDBDMTAsMjI5LjgsMjI5LjgsMTAsNTAwLDEwYzI3MC4yLDAsNDkwLDIxOS44LDQ5MCw0OTBDOTkwLDc3MC4yLDc3MC4yLDk5MCw1MDAsOTkweiBNNTAwLDYwLjRDMjU3LjYsNjAuNCw2MC40LDI1Ny42LDYwLjQsNTAwYzAsMjQyLjQsMTk3LjIsNDM5LjYsNDM5LjYsNDM5LjZjMjQyLjQsMCw0MzkuNi0xOTcuMSw0MzkuNi00MzkuNkM5MzkuNiwyNTcuNiw3NDIuNCw2MC40LDUwMCw2MC40eiIvPjxwYXRoIGQ9Ik00NTAuMyw2NTIuNHYtMzIuM2MwLTEzLjYsMS0yNS44LDMtMzYuNWMyLTEwLjcsNS0yMC45LDkuMy0zMC41YzQuMy05LjYsOS45LTE5LDE3LTI4YzcuMS05LjEsMTYtMTguNywyNi43LTI4LjlsMzguMi0zNi41YzEwLjctOS42LDE5LjktMjAuNCwyNy42LTMyLjNjNy43LTExLjksMTEuNS0yNi4zLDExLjUtNDMuM2MwLTIyLjEtNy00MC42LTIwLjgtNTUuNmMtMTMuOS0xNS0zMy42LTIyLjUtNTkuMS0yMi41Yy0xMywwLTI0LjcsMi40LTM1LjIsNy4yYy0xMC40LDQuOC0xOS41LDExLjMtMjcuMSwxOS41Yy03LjcsOC4yLTEzLjUsMTcuNy0xNy40LDI4LjRjLTMuOSwxMC44LTYuMiwyMS44LTYuOCwzMy4xTDMxMi45LDM4NWMzLjMtMjcuMiwxMC42LTUxLjQsMjEuNi03Mi42YzExLTIxLjIsMjUuMy0zOS4yLDQyLjgtNTMuOWMxNy42LTE0LjcsMzcuNy0yNS45LDYwLjMtMzMuNWMyMi42LTcuNyw0Ny0xMS40LDczLTExLjRjMjQuMywwLDQ3LjQsMy42LDY5LjIsMTAuNmMyMS44LDcuMSw0MSwxNy42LDU3LjcsMzEuNGMxNi43LDEzLjgsMjkuOCwzMSwzOS40LDUxLjRjOS42LDIwLjMsMTQuNCw0My45LDE0LjQsNzAuNGMwLDE4LjEtMiwzMy45LTUuOSw0Ny41Yy0zLjksMTMuNi05LjYsMjYtMTcsMzcuNGMtNy4zLDExLjMtMTYuMiwyMi4yLTI2LjcsMzIuNmMtMTAuNCwxMC40LTIyLjIsMjEuNC0zNS4yLDMyLjZjLTExLjMsOS42LTIwLjUsMTguMi0yNy42LDI1LjVjLTcuMSw3LjMtMTIuNywxNC43LTE3LDIyLjFjLTQuMyw3LjMtNy4yLDE1LjItOC45LDIzLjdjLTEuNyw4LjUtMi42LDE4LjktMi42LDMxLjR2MjIuMUg0NTAuM3ogTTQzMy4zLDc3MC4zYzAtMTgsNi42LTMzLjYsMjAtNDYuNmMxMy4yLTEzLDI5LjMtMTkuNSw0Ny45LTE5LjVjMTguMSwwLDM0LDYuMiw0Ny41LDE4LjdjMTMuNiwxMi40LDIwLjQsMjcuNywyMC40LDQ1LjhjMCwxOC4xLTYuNywzMy43LTIwLDQ2LjdjLTEzLjMsMTMtMjkuMywxOS41LTQ4LDE5LjVjLTkuMSwwLTE3LjctMS44LTI1LjktNS4xYy04LjEtMy40LTE1LjQtNy45LTIxLjUtMTMuNmMtNi4yLTUuNi0xMS4yLTEyLjQtMTQuOS0yMC4zQzQzNS4xLDc4Ny44LDQzMy4zLDc3OS4zLDQzMy4zLDc3MC4zeiIvPjwvZz48L3N2Zz4=);border-radius:100%;height:100%}#options,#options::after{border:1px solid #AAA;background-color:#FCFCFC}#options-cont{float:right;text-align:right;margin-right:1.5em}#options{visibility:hidden;opacity:0;transition:all 250ms;text-align:right;display:flex;flex-direction:column;width:auto}#options>div,#toggle,#toggle span{display:inline-block}#options::after{content:'';border-width:1px 0 0 1px;border-radius:0 0 100%;width:8px;height:8px;position:absolute;right:.75em;top:-5px;transform:rotate(45deg)}#options>div{padding-right:1.75em}#options>:first-child{margin-top:0}#options label input:not([type=checkbox]){width:10em}#options #delay,#options #fontsize{width:8.5em}#options #fontwidth,#options #pathfinder{padding:0;margin:0 .1em 0 .4em;width:1em}#toggle.open~#options::after{opacity:1}#toggle.open~#options{visibility:visible;padding:.5em;opacity:1}#toggle{-webkit-appearance:button;-moz-appearance:button;-ms-appearance:button;appearance:button;height:1.25em;line-height:1.25em;padding:.25em .5em}#toggle span{margin-left:.25em;height:0;width:1.125em}#toggle span::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMSAzMSI+PHBvbHlnb24gZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgcG9pbnRzPSIxIDEsMTYgMzAsMzAgMSwxNiAxMCwxIDEiLz48L3N2Zz4=);position:absolute;height:1em;bottom:0;right:0;margin-bottom:-.25em}#toggle.open span::after{transform:rotate(180deg)}#options>div span.info{display:inline-block;position:absolute;width:1.25em;right:0;top:0}#options>div span.info::before{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYwIiB3aWR0aD0iMTYwIiB2ZXJzaW9uPSIxLjAiPjxnIGZpbGw9IiM0YjRiNGIiPjxwYXRoIGQ9Im04MCAxNWMtMzUuODggMC02NSAyOS4xMi02NSA2NXMyOS4xMiA2NSA2NSA2NSA2NS0yOS4xMiA2NS02NS0yOS4xMi02NS02NS02NXptMCAxMGMzMC4zNiAwIDU1IDI0LjY0IDU1IDU1cy0yNC42NCA1NS01NSA1NS01NS0yNC42NC01NS01NSAyNC42NC01NSA1NS01NXoiLz48cGF0aCBkPSJtNTcuMzczIDE4LjIzMWE5LjM4MzQgOS4xMTUzIDAgMSAxIC0xOC43NjcgMCA5LjM4MzQgOS4xMTUzIDAgMSAxIDE4Ljc2NyAweiIgdHJhbnNmb3JtPSJtYXRyaXgoMS4xOTg5IDAgMCAxLjIzNDIgMjEuMjE0IDI4Ljc1KSIvPjxwYXRoIGQ9Im05MC42NjUgMTEwLjk2Yy0wLjA2OSAyLjczIDEuMjExIDMuNSA0LjMyNyAzLjgybDUuMDA4IDAuMXY1LjEyaC0zOS4wNzN2LTUuMTJsNS41MDMtMC4xYzMuMjkxLTAuMSA0LjA4Mi0xLjM4IDQuMzI3LTMuODJ2LTMwLjgxM2MwLjAzNS00Ljg3OS02LjI5Ni00LjExMy0xMC43NTctMy45Njh2LTUuMDc0bDMwLjY2NS0xLjEwNSIvPjwvZz48L3N2Zz4=);background-size:contain;background-position:center right;width:100%;padding-top:80%;position:absolute;top:0;right:0;cursor:help}span.info::after{pointer-events:none;text-align:center;white-space:pre;font-size:85%;font-family:Arial,sans-serif;background-color:#FCFCFC;border:1px solid #AAA;box-shadow:0 0 10px 1px #AAA;padding:.35em;position:absolute;bottom:0;left:50%;transform:translateX(calc(-50% + .125em));z-index:2;display:none}span.info:hover::after{display:block}span.info.pf::after{content:'Enter your prefered delay for the pathfinder.\\A But beware of using too small values,\\A the server may kick you on some levels\\A if you pass a large distance too quickly.\\A\\A Use CTRL+click to ignore pathfinder.\\A Toggle with numpad dot OR delete'}span.info.font::after{content:'Enter font size for writing.\\A\\A Mark the checkbox for narrow text\\A Hotkey: F10'}span.info.msg::after{content:'Enter your own message to spam.\\A\\A Hotkey: numpad 9'}span.info.img::after{content:'Enter image size (%).\\A\\A Draw images with numpad 1 to 9\\A\\A Increase img size: numpad +\\A Descrease img size: numpad -\\A Reset img size: numpad *'}span.info.einfo::after{content:'Hide the top corners indicators\\A of movement/pathfinder and aura\\A\\A Hotkey: F11'}</style>";
  296.  
  297. function va(f) {
  298. if (D) return L = !1, V(f), !1;
  299. U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  300. if (L) L = !1, Q();
  301. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  302. else if (100 < t - ca && v == k && w == q) {
  303. ca = t;
  304. I.push([v << 1, w << 1, t]);
  305. wa(v, w, clicksCount);
  306. var b = [v, w];
  307. N.push(b);
  308. setTimeout(function() {
  309. N.remove(b);
  310. }, 1E3);
  311. }
  312. return !1;
  313. }
  314.  
  315. function xa(f) {
  316. Y = !1;
  317. }
  318.  
  319. function ya() {
  320. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"));
  321. }
  322.  
  323. function V(f) {
  324. if (U()) {
  325. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  326. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  327. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1);
  328. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  329. lastX = posX;
  330. lastY = posY;
  331. posX = k;
  332. posY = q;
  333. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  334. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  335. b = R;
  336. f = S;
  337. var a = k,
  338. d = q;
  339. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  340. var g = new ArrayBuffer(9),
  341. e = new DataView(g);
  342. e.setUint8(0, 3);
  343. e.setUint16(1, b, !0);
  344. e.setUint16(3, f, !0);
  345. e.setUint16(5, a, !0);
  346. e.setUint16(7, d, !0);
  347. u.Send(g);
  348. }
  349. R = k;
  350. S = q;
  351. da = t;
  352. }
  353. }
  354.  
  355. function Z() {
  356. ea(k, q) && Q();
  357. if (z(k, q)) {
  358. var a;
  359. a: {
  360. a = k;
  361. var b = q,
  362. c = [],
  363. d = new Uint8Array(12E4);
  364. c.push([a, b]);
  365. d[a + 400 * b] = 1;
  366. do {
  367. var g = c.shift(),
  368. e = g[0],
  369. g = g[1];
  370. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  371. if (!z(e, g)) {
  372. a = {
  373. x: e,
  374. y: g
  375. };
  376. break a;
  377. }
  378. d[e - 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  379. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  380. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  381. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1);
  382. }
  383. } while (0 < c.length);
  384. a = {
  385. x: a,
  386. y: b
  387. };
  388. }
  389. k = a.x;
  390. q = a.y;
  391. }
  392. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  393. ea(k, q) && Q();
  394. }
  395.  
  396. var countlevels=-2;
  397. function next() {
  398. console.log("Next map");
  399. initialLoad = true;
  400. T.set(za);
  401. r = [];
  402. I = [];
  403. O = [];
  404. countlevels+=1;
  405. }
  406.  
  407. function ga(f) {
  408. a.imageSmoothingEnabled = f;
  409. a.mozImageSmoothingEnabled = f;
  410. a.oImageSmoothingEnabled = f;
  411. a.webkitImageSmoothingEnabled = f;
  412. }
  413.  
  414. function Aa() {
  415. next();
  416. console.log("Connected!");
  417. }
  418.  
  419. function Ba(a) {
  420. next();
  421. console.log("Socket closed: " + a.reason);
  422. }
  423.  
  424. function Ca(a) {
  425. console.log("Socket error");
  426. }
  427.  
  428. function Da(a, b) {
  429. for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0);
  430. 0 != d && (c += String.fromCharCode(d));
  431. return [c, b + 1];
  432. }
  433.  
  434. function Ea(a, b) {
  435. setTimeout(function() {
  436. var c = a.getUint16(b, !0),
  437. d = 0;
  438. a: for (; d < c; d++) {
  439. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  440. var l = N[n];
  441. if (l[0] == g && l[1] == e) {
  442. N.splice(n, 1);
  443. continue a;
  444. }
  445. }
  446. I.push([g << 1, e << 1, t]);
  447. }
  448. }, 100);
  449. return b + 2 + 4 * a.getUint16(b, !0);
  450. }
  451.  
  452. function Fa(a, b) {
  453. !H.checked && setTimeout(function() {
  454. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  455. var g = a.getUint16(b + 2 + 8 * d, !0),
  456. e = a.getUint16(b + 4 + 8 * d, !0),
  457. n = a.getUint16(b + 6 + 8 * d, !0),
  458. l = a.getUint16(b + 8 + 8 * d, !0);
  459. O.push([g << 1, e << 1, n << 1, l << 1, t]);
  460. }
  461. }, 50);
  462. return b + 2 + 8 * a.getUint16(b, !0);
  463. }
  464.  
  465. function Ga(a) {
  466. buttonIndex = 0;
  467. initialLoad = false;
  468. a = a.data;
  469. var b = new DataView(a);
  470. switch (b.getUint8(0)) {
  471. case 0:
  472. ha = b.getUint32(1, !0);
  473. break;
  474. case 1:
  475. var c;
  476. ia = c = b.getUint16(1, !0);
  477. ja = 100 <= c;
  478. var d = [],
  479. g;
  480. for (g in F) F.hasOwnProperty(g) && d.push(g);
  481.  
  482. for (var e =
  483. 0; e < c; e++) {
  484. g = b.getUint32(3 + 8 * e, !0);
  485. var n = b.getUint16(7 + 8 * e, !0),
  486. l = b.getUint16(9 + 8 * e, !0);
  487. if (g != ha) {
  488. if (null != F[g]) {
  489. for (var p = 0; p < d.length; p++)
  490. if (d[p] == g) {
  491. d.splice(p, 1);
  492. break;
  493. }
  494. g = F[g];
  495. g.oldX = g.getX();
  496. g.oldY = g.getY();
  497. g.newX = n;
  498. g.newY = l;
  499. g.time = t;
  500. } else F[g] = new ka(n, l);
  501. } else {
  502. serverPosX = n;
  503. serverPosY = l;
  504. }
  505. }
  506. for (e = 0; e < d.length; e++) delete F[d[e]];
  507. c = Ea(b, 3 + 8 * c);
  508. g = b.getUint16(c, !0);
  509. c += 2;
  510. for (d = 0; d < g; d++) {
  511. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  512. if (r[e].id == n) {
  513. var k = r[e];
  514. if (1 == k.type)
  515. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  516. for (var h =
  517. n; h < n + p; ++h) --T[h + 400 * m];
  518. r.splice(e, 1);
  519. break a;
  520. }c += 4;
  521. }
  522. g = b.getUint16(c, !0);
  523. c += 2;
  524. for (d = 0; d < g; d++) {
  525. a: {
  526. e = b.getUint32(c, !0);
  527. for (n = 0; n < r.length; n++)
  528. if (r[n].id == e) {
  529. e = r[n];
  530. break a;
  531. }
  532. e = {
  533. id: e
  534. };
  535. r.push(e);
  536. }
  537. c += 4;c = la(b, c, e);
  538. }
  539. c = Fa(b, c);
  540. if (a.byteLength < c + 4) break;
  541. aa = b.getUint32(c, !0);
  542. break;
  543. case 4:
  544. next();
  545. W(b.getUint16(1, !0), b.getUint16(3, !0));
  546. g = b.getUint16(5, !0);
  547. c = 7;
  548. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  549. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  550. Z();
  551. break;
  552. case 5:
  553. W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z();
  554. }
  555. }
  556.  
  557. function Q() {
  558. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  559. var a = new ArrayBuffer(9);
  560. b = new DataView(a);
  561. b.setUint8(0, 1);
  562. b.setUint16(1, k, !0);
  563. b.setUint16(3, q, !0);
  564. b.setUint32(5, G, !0);
  565. u.send(a);
  566. J = k;
  567. K = q;
  568. }
  569.  
  570. }
  571.  
  572. function Au() {
  573. Throttler.sendOut();
  574. if (auraEnabled) drawAura(J, K);
  575. }
  576.  
  577. function wa(a, b, numClicks) {
  578. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  579. var c = new ArrayBuffer(9),
  580. d = new DataView(c);
  581. d.setUint8(0, 2);
  582. d.setUint16(1, a, !0);
  583. d.setUint16(3, b, !0);
  584. d.setUint32(5, G, !0);
  585. for (var i = 0; i < numClicks; i++) { u.Send(c); }
  586. }
  587. }
  588.  
  589. function la(f, b, c) {
  590. function d() {
  591. c.x = f.getUint16(b, !0);
  592. b += 2;
  593. c.y = f.getUint16(b, !0);
  594. b += 2;
  595. c.width = f.getUint16(b, !0);
  596. b += 2;
  597. c.height = f.getUint16(b, !0);
  598. b += 2;
  599. }
  600. function g() {
  601. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  602. b += 4;
  603. c.color = "#" + a;
  604. }
  605. var e = f.getUint8(b);
  606. b += 1;
  607. c.type = e;
  608. switch (e) {
  609. case 255:
  610. break;
  611. case 0:
  612. c.x = f.getUint16(b, !0);
  613. b += 2;
  614. c.y = f.getUint16(b, !0);
  615. b += 2;
  616. c.size = f.getUint8(b);
  617. b += 1;
  618. c.isCentered = !!f.getUint8(b);
  619. b += 1;
  620. e = Da(f, b);
  621. c.text = e[0];
  622. b = e[1];
  623. break;
  624. case 1:
  625. d();
  626. var n = !c.color;
  627. g();
  628. var e = c.x | 0,
  629. l = c.y | 0,
  630. p = c.width | 0,
  631. k = c.height | 0;
  632. if (n)
  633. for (n = l; n < l + k; ++n)
  634. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  635. break;
  636. case 2:
  637. d();
  638. c.isBad = !!f.getUint8(b);
  639. b += 1;
  640. break;
  641. case 3:
  642. d();
  643. c.count = f.getUint16(b, !0);
  644. b += 2;
  645. g();
  646. break;
  647. case 4:
  648. d();
  649. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  650. c.count = f.getUint16(b, !0);
  651. b += 2;
  652. g();
  653. break;
  654. case 5:
  655. c.x = f.getUint16(b, !0);
  656. b += 2;
  657. c.y = f.getUint16(b, !0);
  658. b += 2;
  659. c.queue = [ [0, c.x, c.y]];
  660. c.potentialQueue = [];
  661. c.explored = new Uint8Array(12E4);
  662. c.img = a.createImageData(400, 300);
  663. e = E.createElement("canvas");
  664. e.width = 400;
  665. e.height = 300;
  666. c.canvas = e;
  667. c.ctx = c.canvas.getContext("2d");
  668. break;
  669. default:
  670. throw Error("Unknown object type " + e);
  671. }
  672. return b;
  673. }
  674.  
  675. function ea(a, b) {
  676. if (-1 != J && -1 != K) {
  677. var c = fa(J, K, a, b);
  678. if (c.x != a || c.y != b) return !0;
  679. }
  680. for (c = 0; c < r.length; c++) {
  681. var d = r[c];
  682. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0;
  683. }
  684. return !1;
  685. }
  686.  
  687. //var cursorsonline=0;
  688. window.showHelp = false;
  689. function ma() {
  690. a.clearRect(0, 0, a.canvas.width, a.canvas.height);
  691. a.save();
  692. if (null != u && u.readyState != WebSocket.OPEN || L) {
  693. var f;
  694. if (null == u) f = "Click to begin";
  695. else switch (u.readyState) {
  696. case WebSocket.CONNECTING:
  697. f = "Connecting";
  698. break;
  699. case WebSocket.CLOSING:
  700. case WebSocket.CLOSED:
  701. f = "Lost connection to server";
  702. break;
  703. default:
  704. f = "Click to begin";
  705. }
  706. a.font = 60 + "px NovaSquare";
  707. a.fillText(f, 400 - a.measureText(f).width / 2, 300);
  708. a.font = 20 + "px NovaSquare";
  709. f = "-> script remastered by q1k <-";
  710. a.fillText(f, 400 - a.measureText(f).width / 2, 345);
  711. na();
  712. oa(!1);
  713. } else {
  714. a.fillStyle = "#000000";
  715. a.save();
  716. a.globalAlpha = 1;
  717. var typeZeroCount = 0;
  718. var typeOneCount = 0;
  719. var typeTwoCount = 0;
  720. var typeThreeCount = 0;
  721. var typeFourCount = 0;
  722. for (f = 0; f < r.length; f++) {
  723. var b = r[f];
  724. if (0 == b.type) {
  725. a.font = b.size + "px NovaSquare";
  726. var c = b.x << 1,
  727. d = b.y << 1;
  728. b.isCentered && (c -= a.measureText(b.text).width / 2);
  729. a.fillStyle = "#000000";
  730. a.fillText(b.text, c, d);
  731. typeZeroCount++;
  732. } else if (1 == b.type) {
  733. a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1);
  734. a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2;
  735. a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2);
  736. a.globalAlpha = 1;
  737. typeOneCount++;
  738. } else if (2 == b.type) {
  739. a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2;
  740. a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1);
  741. a.globalAlpha = 1;
  742. typeTwoCount++;
  743. } else if (3 == b.type) {
  744. var c = b.x << 1,
  745. d = b.y << 1,
  746. g = b.width << 1,
  747. e = b.height << 1;
  748. a.fillStyle = b.color;
  749. a.globalAlpha = .2;
  750. a.fillRect(c, d, g, e);
  751. a.globalAlpha = .5;
  752. a.fillStyle = "#000000";
  753. if (40 > b.width || 40 > b.height) {
  754. a.font = 30 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10);
  755. } else {
  756. a.font = 60 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20);
  757. };
  758. a.globalAlpha = 1;
  759. typeThreeCount++;
  760. } else if (4 == b.type) {
  761. c = b.x << 1;
  762. d = b.y << 1;
  763. g = b.width << 1;
  764. e = b.height << 1;
  765. a.fillStyle = b.color;
  766. a.strokeStyle = b.color;
  767. a.globalAlpha = 1;
  768. a.fillRect(c, d, g, e);
  769. a.globalAlpha = .2;
  770. a.fillStyle = "#000000";
  771. a.fillRect(c, d, g, e);
  772. a.globalAlpha = 1;
  773. a.fillStyle = b.color;
  774. var n = 150 > t - b.lastClickAt, l = n ? 8 : 12;
  775. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  776. a.strokeStyle = "#000000";
  777. a.globalAlpha = .1;
  778. a.beginPath();
  779. a.moveTo(c, d);
  780. a.lineTo(c + l, d + l);
  781. a.moveTo(c + g, d);
  782. a.lineTo(c + g - l, d + l);
  783. a.moveTo(c, d + e);
  784. a.lineTo(c + l, d + e - l);
  785. a.moveTo(c + g, d + e);
  786. a.lineTo(c + g - l, d + e - l);
  787. a.moveTo(c, d);
  788. a.rect(c, d, g, e);
  789. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  790. a.stroke();
  791. a.fillStyle = "#000000";
  792. a.globalAlpha = .5;
  793. if (50 > b.width || 50 > b.height) {
  794. a.font = 35 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13);
  795. } else {
  796. a.font = 45 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16);
  797. }
  798. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  799. a.globalAlpha = 1;
  800. typeFourCount++;
  801. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600, ga(!0)));
  802. }
  803. if (r.length == 8 && typeZeroCount == 4 && typeOneCount == 3 && typeTwoCount == 1 && typeThreeCount == 0 && typeFourCount == 0) {
  804. a.globalAlpha = 1;
  805. f = "(Or just play cursors.io)", a.font = 15 + "px NovaSquare", a.fillStyle = "#000000";
  806. a.fillText(f, 400 - a.measureText(f).width / 2, 408);
  807. }
  808. a.restore();
  809. if (!D) {
  810. a.font = 12 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5;
  811. f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw";
  812. a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1;
  813. a.fillText(f, 10, 590);
  814. if (aa != 0) {
  815. //f = (cursorsonline+1) + "/" +
  816. f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1;
  817. a.fillText(f, 790 - b, 590);
  818. };
  819. if (!movementEnabled && !hideExtraInfo) {
  820. f = "movement disabled / pathfinder enabled";
  821. a.globalAlpha = .5, a.strokeText(f, 10, 15), a.globalAlpha = 1;
  822. a.fillText(f, 10, 15);
  823. f = "press numpad . OR delete to toggle";
  824. a.globalAlpha = .5, a.strokeText(f, 10, 30), a.globalAlpha = 1;
  825. a.fillText(f, 10, 30);
  826. }
  827. if (auraEnabled && !hideExtraInfo) {
  828. f = "aura enabled", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 15), a.globalAlpha = 1;
  829. a.fillText(f, 790 - b, 15);
  830. f = "press numpad 0 OR insert to disable", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 30), a.globalAlpha = 1;
  831. a.fillText(f, 790 - b, 30);
  832. }
  833. if (imgSizeShow) {
  834. f = "image size: " + imgSizePrcnt + "%"; a.globalAlpha = .5, a.strokeText(f, 10, 560), a.globalAlpha = 1;
  835. a.fillText(f, 10, 560);
  836. //f = "image size: " + imgSizePrcnt + "%", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 560), a.globalAlpha = 1;
  837. //a.fillText(f, 790 - b, 560);
  838. }
  839. if (countlevels>0) {
  840. f = "level: "+countlevels, b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 560), a.globalAlpha = 1;
  841. a.fillText(f, 790 - b, 560);
  842. }
  843. }
  844. na();
  845. if (!H.checked) {
  846. a.save();
  847. a.strokeStyle = "#000000";
  848. a.lineWidth = 1;
  849. t = +new Date;
  850. a.beginPath();
  851. for (f = 0; f < O.length; f++) {
  852. b = O[f];
  853. c = 10 - (t - b[4]) / 1E3;
  854. if (c <= 0) {
  855. O.splice(f, 1),
  856. --f;
  857. } else {
  858. 1 < c && (c = 1), a.globalAlpha = .3 * c;
  859. a.moveTo(b[0] - .5, b[1] - .5);
  860. a.lineTo(b[2] - .5, b[3] - .5);
  861. }
  862. }
  863. a.stroke();
  864. a.restore();
  865. }
  866. a.save();
  867. //for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, scale(sa(F[p].getX()) - 6), scale(ta(F[p].getY()) - 6), scale(P.width), scale(P.height));
  868. //cursorsonline=0;
  869. for (var p in F) {
  870. F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) - 6);
  871. //cursorsonline+=1;
  872. // show ids?
  873. if (showcursorsid) {
  874. if(cursorIDPos==2){
  875. cp=a.measureText(p).width;
  876. a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY );
  877. a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY );
  878. }
  879. else{
  880. a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY );
  881. a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY );
  882. }
  883. }
  884. }
  885. if (showcursorsid) {
  886. if(cursorIDPos==2){
  887. cp=a.measureText(ha).width;
  888. a.globalAlpha = .5; a.strokeText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ;
  889. a.globalAlpha= 1; a.fillText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ;
  890. }
  891. else{
  892. a.globalAlpha = .5; a.strokeText( ha, sa(k) + cursorIDX, ta(q) + cursorIDY ) ;
  893. a.globalAlpha= 1; a.fillText( ha, sa(k) + cursorIDX, ta(q) + cursorIDY ) ;
  894. }
  895. }
  896.  
  897. a.restore();
  898. oa(!0);
  899. if (!D) {
  900. a.font = 15 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5;
  901. if (message.length>0){
  902. b = a.measureText(message).width/2;
  903. a.globalAlpha = .5, a.strokeText(message, 400 - b, 580), a.globalAlpha = 1;
  904. a.fillText(message, 400 - b, 580);
  905. }
  906. for (var i=0; i < messages.length; i++){
  907. b = a.measureText(messages[i]).width/2;
  908. a.globalAlpha = .5, a.strokeText(messages[i], 400 - b, 580 - messages.length*15 + i*15 ), a.globalAlpha = 1;
  909. a.fillText(messages[i], 400 - b, 580 - messages.length*15 + i*15);
  910. }
  911. if (showHelp) {
  912. var oo = a.measureText("->").width;
  913. a.font = 12 + "px NovaSquare";
  914. f = "How to use (press F1 to hide):", a.globalAlpha = .5, a.strokeText(f, 10, 45), a.globalAlpha = 1, a.fillText(f, 10, 45);
  915. f = "-> To type: type message and hit enter (shift+enter for new row)", a.globalAlpha = .5, a.strokeText(f, 10, 60), a.globalAlpha = 1, a.fillText(f, 10, 60);
  916. f = "-> To enable or disable movement: press numpad . OR delete", a.globalAlpha = .5, a.strokeText(f, 10, 75), a.globalAlpha = 1, a.fillText(f, 10, 75);
  917. f = "pathfiner will be active in this mode", a.globalAlpha = .5, a.strokeText(f, 10+oo, 90), a.globalAlpha = 1, a.fillText(f, 10+oo, 90);
  918. f = "-> To start/stop drawing circle: press numpad 0 OR insert", a.globalAlpha = .5, a.strokeText(f, 10, 105), a.globalAlpha = 1, a.fillText(f, 10, 105);
  919. f = "-> To draw arrows, use the arrow keys", a.globalAlpha = .5, a.strokeText(f, 10, 120), a.globalAlpha = 1, a.fillText(f, 10, 120);
  920. f = "-> To draw images: press numpad 1 - numpad 9", a.globalAlpha = .5, a.strokeText(f, 10, 135), a.globalAlpha = 1, a.fillText(f, 10, 135);
  921. f = "-> To make images bigger/smaller use numpad + and -", a.globalAlpha = .5, a.strokeText(f, 10, 150), a.globalAlpha = 1, a.fillText(f, 10, 150);
  922. f = "-> To reset image size press numpad *", a.globalAlpha = .5, a.strokeText(f, 10, 165), a.globalAlpha = 1, a.fillText(f, 10, 165);
  923. f = "-> To show/hide cursors ids: press F8", a.globalAlpha = .5, a.strokeText(f, 10, 180), a.globalAlpha = 1, a.fillText(f, 10, 180);
  924. f = "-> Change ids position: press F9", a.globalAlpha = .5, a.strokeText(f, 10, 195), a.globalAlpha = 1, a.fillText(f, 10, 195);
  925. }
  926. }
  927. }
  928. a.restore();
  929. A.requestAnimationFrame(ma)
  930. }
  931.  
  932. function scale(z) {
  933. return Math.round(z/600*a.canvas.height);
  934. }
  935.  
  936. function na() {
  937. a.save();
  938. a.strokeStyle = "#000000";
  939. t = +new Date;
  940. for (var f = 0; f < I.length; f++) {
  941. var b = I[f],
  942. c = (t - b[2]) / 1E3,
  943. d = 1 - 2 * c;
  944. 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke());
  945. }
  946. a.restore()
  947. }
  948.  
  949. function oa(f) {
  950. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5, P.width, P.height);
  951. else {
  952. var b = 0,
  953. c = 0;
  954. if (v != k || w != q) {
  955. a.save();
  956. if (f) {
  957. a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath();
  958. a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1);
  959. a.fill();
  960. }
  961. a.globalAlpha = .5;
  962. a.drawImage(P, B - 5, C - 5, P.width, P.height);
  963. a.restore();
  964. } else {
  965. b = B & 1, c = C & 1;
  966. }
  967. a.save();
  968. if (f) {
  969. a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath();
  970. a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1);
  971. a.fill();
  972. }
  973. a.globalAlpha = 1;
  974. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5, Ia.width, Ia.height);
  975. if (!movementEnabled) {
  976. a.strokeStyle = "#DD4444", a.lineWidth = 1;
  977. a.beginPath();
  978. a.arc(serverPosX << 1, serverPosY << 1, 4, 0, 2*Math.PI);
  979. a.stroke();
  980. }
  981. }
  982. a.restore();
  983. }
  984.  
  985. function ka(a, b) {
  986. this.oldX = this.newX = a;
  987. this.oldY = this.newY = b;
  988. this.time = t
  989. }
  990.  
  991. function pa(a) {
  992. return a * a * (3 - 2 * a)
  993. }
  994.  
  995. function fa(a, b, c, d) {
  996. a |= 0;
  997. b |= 0;
  998. c |= 0;
  999. d |= 0;
  1000. if (z(a, b)) return {
  1001. x: a,
  1002. y: b
  1003. };
  1004. if (a == c && b == d) return {
  1005. x: c,
  1006. y: d
  1007. };
  1008. var g = a,
  1009. e = b;
  1010. c = c - a | 0;
  1011. d = d - b | 0;
  1012. var n =
  1013. 0,
  1014. l = 0,
  1015. p = 0,
  1016. k = 0;
  1017. 0 > c ? n = -1 : 0 < c && (n = 1);
  1018. 0 > d ? l = -1 : 0 < d && (l = 1);
  1019. 0 > c ? p = -1 : 0 < c && (p = 1);
  1020. var m = Math.abs(c) | 0,
  1021. h = Math.abs(d) | 0;
  1022. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  1023. c = m >> 1;
  1024. for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k);
  1025. return {
  1026. x: g,
  1027. y: e
  1028. }
  1029. }
  1030.  
  1031. function z(a, b) {
  1032. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  1033. }
  1034.  
  1035. function Ja() {
  1036. for (var a = 0; a < r.length; a++) {
  1037. var b = r[a];
  1038. 5 == b.type && Ka(b)
  1039. }
  1040. }
  1041.  
  1042. function Ka(a) {
  1043. function b(a, b, c) {
  1044. e.push([c, a, b]);
  1045. l[a + 400 * b] = !0;
  1046. g(a, b)
  1047. }
  1048.  
  1049. function c(a, b, c) {
  1050. p.push([c,
  1051. a, b
  1052. ]);
  1053. l[a + 400 * b] = !0
  1054. }
  1055.  
  1056. function d(a, b) {
  1057. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  1058. }
  1059.  
  1060. function g(a, b) {
  1061. var c = 4 * (a + 400 * b);
  1062. k[c + 0] = 255;
  1063. k[c + 1] = 153;
  1064. k[c + 2] = 153;
  1065. k[c + 3] = 255
  1066. }
  1067. for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m);
  1068. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  1069. for (r = 0; 50 > r && 0 != e.length; ++r) {
  1070. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  1071. var x = e[m][0];
  1072. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  1073. }
  1074. for (m = 0; m < q.length; ++m) {
  1075. var x = q[m][0],
  1076. h = q[m][1],
  1077. s = q[m][2],
  1078. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  1079. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  1080. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  1081. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  1082. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  1083. 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2));
  1084. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  1085. b(h - 1, s + 1, x + Math.SQRT2));
  1086. 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2));
  1087. 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2))
  1088. }
  1089. }
  1090. a.ctx.putImageData(a.img, 0, 0)
  1091. }
  1092. var y, a, ia = 0,
  1093. Rat = A.devicePixelRatio;
  1094. cp = 0,
  1095. v = 0,
  1096. w = 0,
  1097. B = 0,
  1098. C = 0,
  1099. k = 0,
  1100. q = 0,
  1101. J = -1,
  1102. K = -1,
  1103. M = null,
  1104. H = null,
  1105. P = new Image;
  1106. P.src = "img/cursor.png";
  1107. var Ia = P,
  1108. D = -1 != A.location.search.indexOf("editor"),
  1109. I = [],
  1110. O = [],
  1111. t = 0,
  1112. ca = 0,
  1113. u = null,
  1114. ha = -1,
  1115. F = {},
  1116. aa = 0,
  1117. ja = !1,
  1118. Y = !1,
  1119. R = 0,
  1120. S = 0,
  1121. da = 0,
  1122. X = !1,
  1123. L = !D && !0,
  1124. T = new Uint8Array(12E4),
  1125. r = [],
  1126. N = [];
  1127. Array.prototype.remove =
  1128. function(a) {
  1129. a = this.indexOf(a);
  1130. return -1 != a ? (this.splice(a, 1), !0) : !1
  1131. };
  1132. var G = 0;
  1133. ka.prototype = {
  1134. oldX: 0,
  1135. oldY: 0,
  1136. newX: 0,
  1137. newY: 0,
  1138. time: 0,
  1139. getX: function() {
  1140. var a = this.newX - this.oldX,
  1141. b = (t - this.time) / 100,
  1142. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1143. return this.oldX + b * a
  1144. },
  1145. getY: function() {
  1146. var a = this.newY - this.oldY,
  1147. b = (t - this.time) / 100,
  1148. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1149. return this.oldY + b * a
  1150. }
  1151. };
  1152.  
  1153. var za = new Uint8Array(12E4);
  1154. Array.prototype.remove = function(a) {
  1155. a = this.indexOf(a);
  1156. return -1 != a ? (this.splice(a, 1), !0) : !1
  1157. };
  1158.  
  1159. var imgSizeShowDur;
  1160. var imgSizePrcnt=100;
  1161. function imgSizeDisplay() {
  1162. clearTimeout(imgSizeShowDur);
  1163. imgSizePrcnt = Math.round(imageScale*100);
  1164. imgSizeInput(imgSizePrcnt);
  1165. imgSizeShow = true;
  1166. imgSizeShowDur = setTimeout(function(){ imgSizeShow = false; }, 3000);
  1167. }
  1168.  
  1169. function imgSizeInput(d) {
  1170. var dd = document.getElementById('imgsize');
  1171. dd.value=d;
  1172. }
  1173.  
  1174. function imgSizeUp() {
  1175. imageScale += 0.1;
  1176. imgSizeDisplay();
  1177. }
  1178.  
  1179. function imgSizeDown() {
  1180. if(imageScale > 0.19) imageScale -= 0.1;
  1181. imgSizeDisplay();
  1182. }
  1183.  
  1184. function imgSizeReset() {
  1185. imageScale = 1.0;
  1186. imgSizeDisplay();
  1187. }
  1188.  
  1189. function pathfinderbox() {
  1190. dd = document.getElementById('pathfinder');
  1191. movementEnabled = !movementEnabled;
  1192. if (movementEnabled) dd.checked = false;
  1193. else dd.checked = true;
  1194. }
  1195.  
  1196. function fontwidth() {
  1197. dd = document.getElementById('fontwidth');
  1198. fontnarrow = !fontnarrow;
  1199. if (fontnarrow) { textwidth=2/3; dd.checked = true; }
  1200. else { textwidth=1; dd.checked = false; }
  1201. }
  1202.  
  1203. function hideExtraInfoLbls() {
  1204. dd = document.getElementById('extrainfo');
  1205. hideExtraInfo=!hideExtraInfo;
  1206. if (hideExtraInfo) dd.checked = true;
  1207. else dd.checked = false;
  1208. }
  1209.  
  1210. var taploop, tapchk=false;
  1211. function tap() {// send a click every 3 seconds
  1212. if (tapchk) { clearInterval(taploop); tapchk=false; }
  1213. else { taploop = setInterval(function(){ wa(k,q,1); }, 3000); tapchk=true; }
  1214. }
  1215.  
  1216. var message = new String();
  1217. var messages = new Array();
  1218.  
  1219. function drawM(m,d,x,y){
  1220. setTimeout(function(){
  1221. drawWord(m, x, y );
  1222. }, d);
  1223. }
  1224.  
  1225. function handleKeypress(e) {
  1226. if (e.target.tagName.toUpperCase() == 'INPUT') return;
  1227. if ((e.which >= 32 && e.which <= 64) ||
  1228. (e.which >= 65 && e.which <= 90) ||
  1229. (e.which >= 91 && e.which <= 126) ) {
  1230. e.preventDefault();
  1231. message = message.concat(String.fromCharCode(e.which));
  1232. return;
  1233. }
  1234. switch(e.which) {
  1235. case 13:
  1236. e.preventDefault();
  1237. if (e.shiftKey) { //add new row
  1238. messages.push(message);
  1239. message = "";
  1240. }
  1241. else { //print all rows
  1242. messages.push(message);
  1243. for(var i=0; i < messages.length; i++){
  1244. if (i>0) var del = messages[i-1].length*i*50;
  1245. else var del=0;
  1246. drawM(messages[i],del,k,q+i*kerning*fontSize);//not ideal printing, but better than printing as columns
  1247. }
  1248. message = "";
  1249. messages = [];
  1250. }
  1251.  
  1252. break;
  1253. default:
  1254. return;
  1255. }
  1256. }
  1257.  
  1258. function handleKeydown(e) {
  1259. if (e.target.tagName.toUpperCase() == 'INPUT') return;
  1260. if (e.keyCode == 8 || e.keyCode == 9 || (e.keyCode >=37 && e.keyCode <= 40)
  1261. || (e.keyCode >= 96 && e.keyCode <= 122)
  1262. //|| e.keyCode == 12 || e.keyCode == 45 || (e.keyCode >= 33 && e.keyCode <= 36)
  1263. ) {
  1264. e.preventDefault();
  1265. }
  1266. if (e.keyCode == 8) {
  1267. if (message.length > 0) {
  1268. message = message.substring(0, message.length - 1);
  1269. }
  1270. else if (messages.length > 0) {
  1271. message = messages.pop();
  1272. }
  1273. }
  1274. switch(e.keyCode) {
  1275. case 37: // left arrow
  1276. drawImage(0, posX, posY); // draw arrow pointing left
  1277. break;
  1278. case 38: // up arrow
  1279. drawImage(1, posX, posY); // draw arrow pointing up
  1280. break;
  1281. case 39: // right arrow
  1282. drawImage(2, posX, posY); // draw arrow right
  1283. break;
  1284. case 40: // down arrow
  1285. drawImage(3, posX, posY); // draw arrow down
  1286. break;
  1287. case 106: //numpad *
  1288. imgSizeReset(); // reset drawings size
  1289. break;
  1290. case 107: //numpad +
  1291. imgSizeUp(); // make drawings bigger
  1292. break;
  1293. case 109: //numpad -
  1294. imgSizeDown(); // make drawings smaller
  1295. break;
  1296. case 46: case 110: // numpad .
  1297. pathfinderbox(); // disable/enable movement by click
  1298. break;
  1299. case 45: case 96: // numpad 0
  1300. auraEnabled = !auraEnabled; // start/stop drawing circle
  1301. break;
  1302. case 97: //case 35: // numpad 1
  1303. drawImage(4, posX, posY); // star
  1304. break;
  1305. case 98: //case 40: // numpad 2
  1306. drawImage(5, posX, posY); // reversed star
  1307. break;
  1308. case 99: //case 34: // numpad 3
  1309. drawImage(6, posX, posY); // tictactoe
  1310. break;
  1311. case 100: //case 37: // numpad 4
  1312. drawImage(7, posX, posY); // triforce
  1313. break;
  1314. case 101: //case 12: // numpad 5
  1315. drawImage(8, posX, posY); // cannon - pentashot
  1316. break;
  1317. case 102: //case 39: // numpad 6
  1318. drawImage(9, posX,posY); // heart
  1319. break;
  1320. case 103: //case 36: // numpad 7
  1321. drawImage(10, posX, posY); // penrose
  1322. break;
  1323. case 104: //case 38: // numpad 8
  1324. //imageScale/=2.8;
  1325. drawImage(10, posX, posY); // boxception
  1326. //imageScale*=2.8;
  1327. break;
  1328. case 105: //case 33: // numpad 9
  1329. drawWord(cmessage, posX, posY);
  1330. break;
  1331. case 112: // F1
  1332. showHelp = !showHelp; // show/hide help
  1333. break;
  1334. case 115: // F4
  1335. //tap();
  1336. break;
  1337. case 119: // F8
  1338. showcursorsid = !showcursorsid; // show/hide cursors ids
  1339. break;
  1340. case 120: // F9
  1341. cursorIDPos+=1;
  1342. changeCursorIDpos(cursorIDPos);
  1343. break;
  1344. case 121: // F10
  1345. fontwidth();
  1346. break;
  1347. case 122: // F11
  1348. hideExtraInfoLbls();
  1349. break;
  1350. default:
  1351. return;
  1352. }
  1353. }
  1354.  
  1355. var cursorIDPos=1;
  1356. var cursorIDX=-2;
  1357. var cursorIDY=24;
  1358.  
  1359. function changeCursorIDpos(c) {
  1360. switch(c){
  1361. case 1: cursorIDX=-2; cursorIDY=24; break;
  1362. case 2: cursorIDX=-3; cursorIDY=14; break;
  1363. case 3: cursorIDX=-2; cursorIDY=-3; break;
  1364. case 4: cursorIDX=10; cursorIDY=14; break;
  1365. default: cursorIDX=-2; cursorIDY=24; cursorIDPos=1;
  1366. }
  1367. }
  1368.  
  1369. function drawAura(x, y) {
  1370. var dt = 360/(1000/40)/2;
  1371. if (u != null && u.readyState == WebSocket.OPEN) {
  1372. var g = new ArrayBuffer(9),
  1373. e = new DataView(g);
  1374. e.setUint8(0, 3);
  1375. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  1376. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  1377. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  1378. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  1379. u.Send(g)
  1380. }
  1381.  
  1382. auraTime += dt;
  1383. }
  1384.  
  1385. function drawImage(ind, x, y) {
  1386. if (!imgData[ind]) return;
  1387. for (var i = 0; i < imgData[ind].length; i++) {
  1388. var g = new ArrayBuffer(9),
  1389. e = new DataView(g);
  1390. e.setUint8(0, 3);
  1391. e.setUint16(1, x+imgData[ind][i][1]*imageScale, !0);
  1392. e.setUint16(3, y+imgData[ind][i][0]*imageScale, !0);
  1393. e.setUint16(5, x+imgData[ind][i][3]*imageScale, !0);
  1394. e.setUint16(7, y+imgData[ind][i][2]*imageScale, !0);
  1395. u.Send(g);
  1396. }
  1397. }
  1398.  
  1399. function degToRad(deg) {
  1400. return deg * (Math.PI / 180);
  1401. }
  1402.  
  1403. function radToDeg(rad) {
  1404. return rad * (180 / Math.PI);
  1405. }
  1406.  
  1407. var textwidth = 1; // 1 = full width, 2/3 = narrow text
  1408. function drawLetter(a, x, y) {
  1409. var letter;
  1410. var capital = 1;
  1411. var shift = 0;
  1412. if (alphabet.hasOwnProperty(a)) {
  1413. letter = alphabet[a];
  1414. } else if (a + 32 >= 97 && a + 32 <= 122) {
  1415. capital = 1.5;
  1416. shift = -2;
  1417. letter = alphabet[a + 32];
  1418. } else return;
  1419. for (var i = 0; i < letter.length; i++) {
  1420. var g = new ArrayBuffer(9),
  1421. e = new DataView(g);
  1422. e.setUint8(0, 3);
  1423. e.setUint16(1, x+letter[i][1]*fontSize*textwidth, !0);
  1424. e.setUint16(3, y+letter[i][0]*fontSize*capital + shift, !0);
  1425. e.setUint16(5, x+letter[i][3]*fontSize*textwidth, !0);
  1426. e.setUint16(7, y+letter[i][2]*fontSize*capital + shift, !0);
  1427. u.Send(g);
  1428. }
  1429. }
  1430.  
  1431. function drawWord(s, x, y) {
  1432. if (s == null) return;
  1433. setTimeout(function () {
  1434. if (!z(Math.round(x+fontSize*kerning*textwidth), Math.round(y))) {
  1435. drawLetter(s.charCodeAt(0), x, y);
  1436. if (s.length > 0) drawWord(s.substring(1, s.length), x+fontSize*kerning*textwidth, y);
  1437. }
  1438. }, 1);
  1439. }
  1440. WebSocket.prototype.Send = function(frm) {
  1441. if (u != null && u.readyState == WebSocket.OPEN) {
  1442. if (Throttler.check(frm)) this.send(frm);
  1443. }
  1444. };
  1445.  
  1446. var Throttler = {
  1447. rate: 3,
  1448. per: 150,
  1449. storage: [],
  1450. allowed: 3,
  1451. lastFrameAt: 0,
  1452. sendOut: function() {
  1453. if (this.storage.length != 0) {
  1454. u.Send(this.storage.shift());
  1455. }
  1456. },
  1457. check: function(frm) {
  1458. var now = Date.now();
  1459. var allowance = this.allowed;
  1460. var timeDiff = now - this.lastFrameAt;
  1461. this.lastFrameAt = now;
  1462. allowance += timeDiff*(this.rate/this.per);
  1463. if (allowance > this.rate) allowance = this.rate;
  1464. this.allowed = allowance;
  1465. if (this.allowed < 1) {
  1466. if (this.storage.length < 300) {
  1467. var dv = new DataView(frm);
  1468. if (dv.getUint8(0) == 3) this.storage.push(frm);
  1469. }
  1470. return false;
  1471. }
  1472. this.allowed -= 1;
  1473. return true;
  1474. }
  1475. };
  1476.  
  1477. var ff = navigator.userAgent.indexOf("Chrome") == -1;
  1478.  
  1479. function dos(head) {
  1480. var gridX = 400,
  1481. gridY = 300;
  1482. var grid = [];
  1483. visit = [];
  1484. for (var i = 0; i < gridY; i++) {
  1485. grid[i] = [];
  1486. visit[i] = [];
  1487. for (var j = 0; j < gridX; j++) grid[i][j] = 0, visit[i][j] = 0;
  1488. }
  1489. r.forEach(function(d) {
  1490. if ((d.type == 1) || (d.type == 2 && d.isBad))
  1491. for (var j = 0; j < d.height; j++)
  1492. for (var i = 0; i < d.width; i++) grid[d.y + j][d.x + i] = 3
  1493. });
  1494. var bfs = [head],
  1495. bfs2 = [];
  1496. while (bfs.length) {
  1497. bfs.forEach(function(dat) {
  1498. var x = dat[0],
  1499. y = dat[1];
  1500. if (x == null || y == null) return;
  1501. if (grid[y][x] == 3) return;
  1502. grid[y][x] = 3;
  1503. for (var X = x + 1; X < gridX && !(grid[y][X] & 1); X++) {
  1504. grid[y][X] |= 1;
  1505. if (!visit[y][X]) {
  1506. visit[y][X] = [x, y], bfs2.push([X, y]);
  1507. }
  1508. }
  1509. for (var X = x - 1; X >= 0 && !(grid[y][X] & 1); X--) {
  1510. grid[y][X] |= 1;
  1511. if (!visit[y][X]) {
  1512. visit[y][X] = [x, y], bfs2.push([X, y]);
  1513. }
  1514. }
  1515. for (var Y = y + 1; Y < gridY && !(grid[Y][x] & 2); Y++) {
  1516. grid[Y][x] |= 2;
  1517. if (!visit[Y][x]) {
  1518. visit[Y][x] = [x, y], bfs2.push([x, Y]);
  1519. }
  1520. }
  1521. for (var Y = y - 1; Y >= 0 && !(grid[Y][x] & 2); Y--) {
  1522. grid[Y][x] |= 2;
  1523. if (!visit[Y][x]) {
  1524. visit[Y][x] = [x, y], bfs2.push([x, Y]);
  1525. }
  1526. }
  1527. });
  1528. bfs = bfs2;
  1529. bfs2 = [];
  1530. }
  1531. }
  1532.  
  1533. window.head=[];
  1534. window.delay=30;
  1535. function fm(mov, i=0) {
  1536. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  1537. if (i >= mov.length) {
  1538. var buf = new ArrayBuffer(9),
  1539. q = new DataView(buf);
  1540. q.setUint8(0, 2, 1);
  1541. q.setUint16(1, mov[i-1][0], 1);
  1542. q.setUint16(3, mov[i-1][1], 1);
  1543. q.setInt32(5, -1, 1);
  1544. WebSocket.prototype.send.call(u, buf);
  1545. WebSocket.prototype.send.call(u, buf);
  1546. return;
  1547. }
  1548. var buf = new ArrayBuffer(9),
  1549. q = new DataView(buf);
  1550. q.setUint8(0, 1, 1);
  1551. q.setUint16(1, mov[i][0], 1);
  1552. q.setUint16(3, mov[i][1], 1);
  1553. q.setInt32(5, -1, 1);
  1554. WebSocket.prototype.send.call(u, buf);
  1555. W(mov[i][0], mov[i][1]);
  1556. if(delay == 0) {
  1557. fm(mov,i+1);
  1558. } else {
  1559. setTimeout(function() {
  1560. fm(mov, i + 1)
  1561. }, delay);
  1562. }
  1563. }
  1564. }
  1565.  
  1566. function pf(e) {
  1567. auraEnabled = false;
  1568. unfocus();
  1569. var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0];
  1570. var mov = [];
  1571. if (r && !(xy[0] == head[0] && xy[1] == head[1]) && !e.ctrlKey && !movementEnabled) {
  1572. head = [serverPosX,serverPosY];
  1573. dos(head);
  1574. var xy2 = xy.slice(0);
  1575. while (visit[xy2[1]][xy2[0]]) {
  1576. mov.push(xy2);
  1577. xy2 = visit[xy2[1]][xy2[0]]
  1578. }
  1579. mov = mov.reverse();
  1580. if (mov.length == 0) {
  1581. return;
  1582. }
  1583. else fm(mov);
  1584. } else if (!movementEnabled) {mov.push(xy); fm(mov);}
  1585. else {}
  1586. }
  1587.  
  1588. function connect() {
  1589. if (m28n.findServerPreference) {
  1590. if (!u) m28n.findServerPreference("cursors", function(e,a){
  1591. if (e||0 == a.length) {
  1592. setTimeout(self.connect, 1E3);
  1593. } else {
  1594. var ipv4 = a[0].ipv4;
  1595. var ipv6 = a[0].ipv6;
  1596. var port = a[0].port;
  1597. port = 2828;
  1598. u = new WebSocket("ws://" + (ipv4 || "[" + ipv6 + "]") + ":" + port);
  1599. setHandlers();
  1600. }
  1601. });
  1602. } else {
  1603. if (!u) u = new WebSocket("ws://s1.cursors.io:443/");
  1604. setHandlers();
  1605. }
  1606. function setHandlers() {
  1607. u.binaryType = "arraybuffer";
  1608. u.onopen = Aa, u.onmessage = Ga, u.onclose = Ba, u.onerror = Ca;
  1609. }
  1610. }
  1611.  
  1612. var messageDisplay;
  1613. function doit() {
  1614. //document.body.innerHTML += '<div id="messageDisplay"></div>';
  1615. //messageDisplay = document.getElementById("messageDisplay");
  1616. var el0 = document.getElementById('h-options');
  1617. if (el0 != null) { el0.remove(); }
  1618.  
  1619. document.body.innerHTML += css;
  1620.  
  1621. y = E.getElementById("canvas");
  1622. a = y.getContext("2d");
  1623.  
  1624. try {
  1625. A.top.location.origin != A.location.origin && ba()
  1626. } catch (f) {
  1627. ba()
  1628. }
  1629. y.width = 800 * Rat;
  1630. y.height = 600 * Rat;
  1631. a.scale(Rat, Rat);
  1632. y.onmousemove = ua;
  1633. y.onmousedown = va;
  1634. y.onmouseup = xa;
  1635. y.onclick = pf;
  1636. M = E.getElementById("noCursorLock");
  1637. H = E.getElementById("noDrawings");
  1638. null != localStorage && (Ma(), M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  1639. A.onbeforeunload = ya;
  1640. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  1641. y.style.cursor = "none";
  1642. D || connect();
  1643. setInterval(Q, 40);
  1644. //setInterval(Ja, 40);
  1645. setInterval(Au, 50);
  1646. A.requestAnimationFrame(ma);
  1647.  
  1648. document.onkeypress = handleKeypress;
  1649. document.onkeydown = handleKeydown;
  1650. }
  1651. doit();
  1652.  
  1653.  
  1654. /*
  1655. ___ _ _ _ __ ___ ___ _ __ ___ _ ___
  1656. / __| | | | `__/ __|/ _ \| `__/ __| | |/ _ \
  1657. | (__| |_| | | \__ \ (_) | | \__ \_| | (_) |
  1658. \___|\__,_|_| |___/\___/|_| |___(_)_|\___/
  1659.  
  1660. for a more updated version, go here:
  1661. https://greasyfork.org/en/scripts/369975
  1662.  
  1663. How to use:
  1664. -> Go to cursors.io, open console (ctrl + shift + j or F12)
  1665. and paste this entire script into the console, then hit enter
  1666. -if installing as userscript, make sure to block "cursors.io/client_out.js"
  1667. -> To type: type message and hit enter; shift+enter for new row;
  1668. -all ascii characters are available
  1669. -> To move your cursor only when clicking: press numpad . OR delete
  1670. -Pathfinder will be active in this mode (CTRL+click to ignore pathfinder)
  1671. -try not to use a too low value of the delay, or you may get disconnected on some levels
  1672. --make sure 'no cursor lock' is marked so pathfinder works correctly
  1673. -> To move your cursor normally: press numpad . again
  1674. -> To draw a circle: press numpad 0 OR insert
  1675. -> To stop drawing a circle: press numpad 0 again
  1676. -> To draw arrows, use the arrow keys
  1677. -> To draw different images: press numpad 1 - numpad 9 keys
  1678. -> To make drawings bigger/smaller use numpad + and -
  1679. -> Reset drawing size with numpad *
  1680. -> To show/hide cursors ids: press F8
  1681. -> Change ids position with: F9
  1682. -> To show this help: press F1
  1683. */
  1684.