cursors.io hack NEW (July 2018)

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

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

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