SHARE
TWEET

cursor.io

raelyn08 Feb 16th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ___ _   _ _ __ ___  ___  _ __ ___   _  ___
  2.   / __| | | | `__/ __|/ _ \| `__/ __| | |/ _ \
  3.  | (__| |_| | |  \__ \ (_) | |  \__ \_| | (_) |
  4.   \___|\__,_|_|  |___/\___/|_|  |___(_)_|\___/
  5.  
  6. for a more updated version, go here:
  7. https://greasyfork.org/en/scripts/369975
  8.  
  9. */
  10. /*  How to use:
  11.     1.  Go to cursors.io, open console (ctrl + shift + j or F12)
  12.         and paste this entire script into the console, then hit enter
  13.         -if installing as userscript, make sure to block "cursors.io/client_out.js"
  14.     2.  To type: type message and hit enter (shift+enter for new row)
  15.         -all ascii characters are available
  16.     3.  To move your cursor only when clicking: press numpad . OR delete
  17.         -Pathfinder will be active in this mode. (CTRL+click to ignore pathfinder)
  18.         -try not to use a too low value of the delay, or you may get disconnected on some levels
  19.         --make sure 'no cursor lock' is marked so pathfinder works correctly
  20.         To move your cursor normally: press numpad . again
  21.     4.  To draw a circle: press numpad 0 OR insert
  22.         To stop drawing a circle: press numpad 0 again
  23.     5.  To draw arrows, use the arrow keys
  24.     6.  To draw different images press numpad 1 - numpad 9 keys
  25.     7.  To make drawings bigger/smaller use numpad + and -
  26.     8.  Reset drawing size with numpad *
  27.     9.  To show/hide cursors ids: press F8
  28.     10. Change ids position with: F9
  29.     11. To show this help: press F1
  30. */
  31.  
  32. var A = window;
  33. var E = document;
  34. var posX, posY;
  35. var lastX, lastY;
  36. var serverPosX, serverPosY;
  37. var initialLoad = true;
  38. var clicksCount = 3;
  39. var auraEnabled = false;
  40. var auraTime = 0;
  41. var auraRadius = 10;
  42. var movementEnabled = true;
  43. var imgSizeShow = false;
  44. var showcursorsid = false;
  45. var hideExtraInfo = false;
  46.  
  47. var fontnarrow = false;
  48. var fontSize = 2;
  49. var kerning = 3;
  50. var alphabet = {
  51.     33:[[0,1,1.5,1],[2,1,2.5,1]],//!
  52.     34:[[0,0.5,1,0.5],[0,1.25,1,1.25]],//"
  53.     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]],//#
  54.     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]],//$
  55.     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
  56.     //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
  57.     //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
  58.     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]],//&
  59.     39:[[0,0.5,1,0.5]], // '
  60.     40:[[0,2,0.5,1],[0.5,1,1.5,1],[1.5,1,2,2]],//(
  61.     41:[[0,0,0.5,1],[0.5,1,1.5,1],[1.5,1,2,0]],//)
  62.     42:[[0.5,0,1.5,2],[1.5,0,0.5,2],[0,1,2,1]],//*
  63.     43:[[0,1,2,1],[1,0,1,2]],//+
  64.     44:[[2,0,3,0]],//,
  65.     45:[[0.6,0.3,0.6,1.7]],//-
  66.     46:[[1.5,0,2,0]],//.
  67.     47:[[2,0.4,0,1.6]],//  /
  68.     48:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[2,0,0,2]],//0
  69.     49:[[0,1,2,1],[1,0,0,1],[2,0,2,2]],//1
  70.     50:[[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,0,2,0],[2,0,2,2]],//2
  71.     51:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],
  72.     52:[[0,0,1,0],[1,0,1,2],[0,2,2,2]],
  73.     53:[[0,2,0,0],[0,0,1,0],[1,0,1,2],[1,2,2,2],[2,2,2,0]],
  74.     54:[[0,2,0,0],[0,0,2,0],[2,0,2,2],[2,2,1,2],[1,2,1,0]],
  75.     55:[[0,0,0,2],[0,2,2,0]],
  76.     56:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[2,0,0,0],[1,0,1,2]],
  77.     57:[[0,0,1,0],[1,0,1,2],[0,2,2,2],[0,0,0,2],[2,0,2,2]],//9
  78.     58:[[0,1,0.5,1],[1.5,1,2,1]],//:
  79.     59:[[0,1,0.5,1],[2,1,3,1]],//;
  80.     60:[[0,2,1,0],[1,0,2,2]],//<
  81.     61:[[0.5,0,0.5,2],[1.5,0,1.5,2]],//=
  82.     62:[[0,0,1,2],[1,2,2,0]],//>
  83.     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]  ],//?
  84.     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]],//@
  85.     91:[[0,1.5,0,0.5],[0,0.5,2,0.5],[2,0.5,2,1.5]],// [
  86.     92:[[0,0.4,2,1.6]],// backslash
  87.     93:[[0,0.5,0,1.5],[0,1.5,2,1.5],[2,1.5,2,0.5]],// ]
  88.     94:[[1.5,0,0,1],[0,1,1.5,2]],//^
  89.     95:[[2,0,2,2] ],//_
  90.     96:[[0,0.5,1,0.5]], // ` display same as 39
  91.     97:[[2,0,0,0],[0,2,0,0],[0,2,2,2],[1,0,1,2]],//a
  92.     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
  93.     99:[[2,2,2,0],[2,0,0,0],[0,0,0,2]],//c
  94.     100:[[2,0,0,0],[0,0,0,1],[0,1,1,2],[1,2,2,1],[2,1,2,0]],
  95.     101:[[2,2,2,0],[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  96.     102:[[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  97.     103:[[1,1,1,2],[1,2,2,2],[2,2,2,0],[2,0,0,0],[0,0,0,2]],
  98.     104:[[0,0,2,0],[0,2,2,2],[1,0,1,2]],
  99.     105:[[0,0,0,2],[0,1,2,1],[2,0,2,2]],
  100.     106:[[0,0,0,2],[0,1,2,1],[2,0,2,1]],
  101.     107:[[0,0,2,0],[1,0,0,2],[1,0,2,2]],
  102.     108:[[0,0,2,0],[2,0,2,2]],
  103.     109:[[0,0,2,0],[0,0,2,1],[2,1,0,2],[0,2,2,2]],
  104.     110:[[0,0,2,0],[0,0,2,2],[0,2,2,2]],
  105.     111:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]],
  106.     112:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0]],
  107.     113:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,1,2,2]],
  108.     114:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,1,2,2]],
  109.     115:[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2]],
  110.     116:[[0,0,0,2],[0,1,2,1]],
  111.     117:[[0,0,2,0],[0,2,2,2],[2,0,2,2]],
  112.     118:[[0,0,2,1],[0,2,2,1]],
  113.     119:[[0,0,2,0],[0,2,2,2],[2,0,1,1],[2,2,1,1]],
  114.     120:[[0,0,2,2],[2,0,0,2]],
  115.     121:[[0,0,1,1],[0,2,1,1],[2,1,1,1]],
  116.     122:[[0,0,0,2],[0,2,2,0],[2,0,2,2]],//z
  117.     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]],// {
  118.     124:[[0,1,2,1]],// |
  119.     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]],// }
  120.     126:[[0.5,0,0,0.75],[0,0.75,0.5,1.5],[0.5,1.5,0,2.25]],// ~
  121. };
  122.  
  123. var imageScale = 1.0;
  124. var imgData = [
  125.     /* arrow left */
  126.     [[0,0,0,9],[0,0,-3,3],[0,0,3,3]],
  127.  
  128.     /* arrow up */
  129.     [[0,0,9,0],[0,0,3,-3],[0,0,3,3]],
  130.  
  131.     /* arrow right */
  132.     [[0,0,0,-9],[0,0,-3,-3],[0,0,3,-3]],
  133.  
  134.     /* arrow down */
  135.     [[0,0,-9,0],[0,0,-3,-3],[0,0,-3,3]],
  136.  
  137.     /*star 5*/
  138.     [[8,0,8,24],[8,24,24,4],[24,4,0,12],[0,12,24,20],[24,20,8,0]],
  139.  
  140.     /* reversed star */
  141.     [[0,4,24,12],[24,12,0,20],[0,20,16,0],[16,0,16,24],[16,24,0,4]],
  142.  
  143.     /*tictactoe*/
  144.     [[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]],
  145.  
  146.     /*triforce*/
  147.     [[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]],
  148.  
  149.     /*pentashot*/
  150.     [[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]],
  151.  
  152.     /*heart*/
  153.     [[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]],
  154.  
  155.  
  156. ];
  157.  
  158. function sa(f) {
  159.     return f << 1;
  160. }
  161.  
  162. function ta(f) {
  163.     return f << 1;
  164. }
  165.  
  166. function U() {
  167.     return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y;
  168. }
  169.  
  170. function ba() {
  171.     a.fillStyle = "#000000";
  172.     a.font = "35px NovaSquare";
  173.     a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  174.     a.font = "16px NovaSquare";
  175.     a.fillText("Play http://cursors.io/", 400 - a.measureText("Play http://cursors.io/").width /
  176.         2, 330);
  177.     top.location = "http://cursors.io";
  178.     throw "Please do not embed our website, thank you.";
  179. }
  180.  
  181. function ua(f) {
  182.     V(f);
  183. }
  184.  
  185. function W(f, b) {
  186.     J = f;
  187.     K = b;
  188.     posX = k = v = f;
  189.     posY = q = w = b;
  190.     B = v << 1;
  191.     C = w << 1;
  192. }
  193.  
  194. function unfocus() {
  195.     elm.forEach(function(i){ i.blur() });
  196. }
  197.  
  198. window.changedelay = function(d) {
  199.     d = Math.floor(parseInt(d));
  200.     var dd = document.getElementById('delay');
  201.     if (d >= 0) {dd.value = delay = d;}
  202.     else dd.value = delay = 0;
  203. }
  204.  
  205. window.changefontsize = function(d) {
  206.     d = parseFloat(d);
  207.     var dd = document.getElementById('fontsize');
  208.     if (d >0) {dd.value = fontSize = d;}
  209.     else dd.value = fontSize = 2;
  210. }
  211.  
  212. window.changefontwidth = function(d) {
  213.     if (d.checked) { textwidth=2/3; fontnarrow=true; d.blur(); }
  214.     else { textwidth=1; fontnarrow=false; d.blur(); }
  215. }
  216.  
  217. window.cmessage = "by q1k";
  218. window.changecmessage = function(d) {
  219.     var dd = document.getElementById('cmessage');
  220.     cmessage = d;
  221. }
  222.  
  223. window.changeImgSize = function(d) {
  224.     d = Math.floor(parseInt(d));
  225.     var tmp = d/100;
  226.     var dd = document.getElementById('imgsize');
  227.     if (d > 0) {
  228.         dd.value = d;
  229.         imageScale = tmp;
  230.         imgSizeDisplay();
  231.     }
  232.     else {
  233.         dd.value = 10;
  234.         imageScale = 0.1;
  235.         imgSizeDisplay();
  236.     }
  237. }
  238.  
  239. window.disablemovement = function(d) {
  240.     if (d.checked) { movementEnabled = false; d.blur() }
  241.     else { movementEnabled = true; d.blur() }
  242. }
  243.  
  244. window.changeextrainfo = function(d) {
  245.     if (d.checked) { hideExtraInfo = true; d.blur(); }
  246.     else { hideExtraInfo = false; d.blur(); }
  247. }
  248.  
  249. window.toggler = function() {
  250.     var dd = document.getElementById('toggle');
  251.     dd.classList.toggle('open');
  252.     if (dd.classList.contains('open')) dd.innerHTML = "hide advanced options <span></span>";
  253.     else dd.innerHTML = "show advanced options <span></span>";
  254. }
  255.  
  256. var elm=[];
  257. function Ma() {
  258.     var el1 = document.querySelectorAll("a[href='https://m28.studio/']");
  259.     var par = el1[0].parentElement;
  260.     var add = "<label id='help' title='Press F1 for help' onclick='showHelp=!showHelp'><span></span></label>"
  261.         +"<div id='options-cont'><label id='toggle' onclick='toggler()'>show advanced options <span></span></label><div id='options'>"
  262.         +"<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>"
  263.         +"<input id='pathfinder' type='checkbox' title='Pathfinder/Movement (numpad .)' onclick='disablemovement(this)'><span class='info pf'></span></div>"
  264.         +"<div><label title='Size of font (default = 2)'>font size: <input id='fontsize' type='number' step='any' value='"+fontSize+"' onchange='changefontsize(this.value)'></label>"
  265.         +"<input id='fontwidth' type='checkbox' title='Narrow text (F10)' onclick='changefontwidth(this)'><span class='info font'></span></div>"
  266.         +"<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>"
  267.         +"<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>"
  268.         +"<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>"
  269.         +"</div></div>";
  270.  
  271.     par.appendChild(document.createElement('div')).setAttribute('id','h-options');
  272.     document.getElementById('h-options').innerHTML = add;
  273.     elm = Array.from(document.querySelectorAll("input"));
  274. }
  275.  
  276. 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>";
  277.  
  278. function va(f) {
  279.     if (D) return L = !1, V(f), !1;
  280.     U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  281.     if (L) L = !1, Q();
  282.     else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  283.     else if (100 < t - ca && v == k && w == q) {
  284.         ca = t;
  285.         I.push([v << 1, w << 1, t]);
  286.         wa(v, w, clicksCount);
  287.         var b = [v, w];
  288.         N.push(b);
  289.         setTimeout(function() {
  290.             N.remove(b);
  291.         }, 1E3);
  292.     }
  293.     return !1;
  294. }
  295.  
  296. function xa(f) {
  297.     Y = !1;
  298. }
  299.  
  300. function ya() {
  301.     A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"));
  302. }
  303.  
  304. function V(f) {
  305.     if (U()) {
  306.         var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  307.         f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  308.         300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1);
  309.     } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  310.     lastX = posX;
  311.     lastY = posY;
  312.     posX = k;
  313.     posY = q;
  314.     if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  315.             w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  316.         b = R;
  317.         f = S;
  318.         var a = k,
  319.             d = q;
  320.         if (!D && null != u && u.readyState == WebSocket.OPEN) {
  321.             var g = new ArrayBuffer(9),
  322.                 e = new DataView(g);
  323.             e.setUint8(0, 3);
  324.             e.setUint16(1, b, !0);
  325.             e.setUint16(3, f, !0);
  326.             e.setUint16(5, a, !0);
  327.             e.setUint16(7, d, !0);
  328.             u.Send(g);
  329.         }
  330.         R = k;
  331.         S = q;
  332.         da = t;
  333.     }
  334. }
  335.  
  336. function Z() {
  337.     ea(k, q) && Q();
  338.     if (z(k, q)) {
  339.         var a;
  340.         a: {
  341.             a = k;
  342.             var b = q,
  343.                 c = [],
  344.                 d = new Uint8Array(12E4);
  345.             c.push([a, b]);
  346.             d[a + 400 * b] = 1;
  347.             do {
  348.                 var g = c.shift(),
  349.                     e = g[0],
  350.                     g = g[1];
  351.                 if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  352.                     if (!z(e, g)) {
  353.                         a = {
  354.                             x: e,
  355.                             y: g
  356.                         };
  357.                         break a;
  358.                     }
  359.                     d[e - 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  360.                     d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  361.                     d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  362.                     d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1);
  363.                 }
  364.             } while (0 < c.length);
  365.             a = {
  366.                 x: a,
  367.                 y: b
  368.             };
  369.         }
  370.         k = a.x;
  371.         q = a.y;
  372.     }
  373.     if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  374.     ea(k, q) && Q();
  375. }
  376.  
  377. function next() {
  378.     console.log("Next map");
  379.     initialLoad = true;
  380.     T.set(za);
  381.     r = [];
  382.     I = [];
  383.     O = [];
  384. }
  385.  
  386. function ga(f) {
  387.     a.imageSmoothingEnabled = f;
  388.     a.mozImageSmoothingEnabled = f;
  389.     a.oImageSmoothingEnabled = f;
  390.     a.webkitImageSmoothingEnabled = f;
  391. }
  392.  
  393. function Aa() {
  394.     next();
  395.     console.log("Connected!");
  396. }
  397.  
  398. function Ba(a) {
  399.     next();
  400.     console.log("Socket closed: " + a.reason);
  401. }
  402.  
  403. function Ca(a) {
  404.     console.log("Socket error");
  405. }
  406.  
  407. function Da(a, b) {
  408.     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);
  409.     0 != d && (c += String.fromCharCode(d));
  410.     return [c, b + 1];
  411. }
  412.  
  413. function Ea(a, b) {
  414.     setTimeout(function() {
  415.         var c = a.getUint16(b, !0),
  416.             d = 0;
  417.         a: for (; d < c; d++) {
  418.             for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  419.                 var l = N[n];
  420.                 if (l[0] == g && l[1] == e) {
  421.                     N.splice(n, 1);
  422.                     continue a;
  423.                 }
  424.             }
  425.             I.push([g << 1, e << 1, t]);
  426.         }
  427.     }, 100);
  428.     return b + 2 + 4 * a.getUint16(b, !0);
  429. }
  430.  
  431. function Fa(a, b) {
  432.     !H.checked && setTimeout(function() {
  433.         for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  434.             var g = a.getUint16(b + 2 + 8 * d, !0),
  435.                 e = a.getUint16(b + 4 + 8 * d, !0),
  436.                 n = a.getUint16(b + 6 + 8 * d, !0),
  437.                 l = a.getUint16(b + 8 + 8 * d, !0);
  438.             O.push([g << 1, e << 1, n << 1, l << 1, t]);
  439.         }
  440.     }, 50);
  441.     return b + 2 + 8 * a.getUint16(b, !0);
  442. }
  443.  
  444. function Ga(a) {
  445.     buttonIndex = 0;
  446.     initialLoad = false;
  447.     a = a.data;
  448.     var b = new DataView(a);
  449.     switch (b.getUint8(0)) {
  450.         case 0:
  451.             ha = b.getUint32(1, !0);
  452.             break;
  453.         case 1:
  454.             var c;
  455.             ia = c = b.getUint16(1, !0);
  456.             ja = 100 <= c;
  457.             var d = [],
  458.                 g;
  459.             for (g in F) F.hasOwnProperty(g) && d.push(g);
  460.  
  461.             for (var e =
  462.                     0; e < c; e++) {
  463.                 g = b.getUint32(3 + 8 * e, !0);
  464.                 var n = b.getUint16(7 + 8 * e, !0),
  465.                     l = b.getUint16(9 + 8 * e, !0);
  466.                 if (g != ha) {
  467.                     if (null != F[g]) {
  468.                         for (var p = 0; p < d.length; p++)
  469.                             if (d[p] == g) {
  470.                                 d.splice(p, 1);
  471.                                 break;
  472.                             }
  473.                         g = F[g];
  474.                         g.oldX = g.getX();
  475.                         g.oldY = g.getY();
  476.                         g.newX = n;
  477.                         g.newY = l;
  478.                         g.time = t;
  479.                     } else F[g] = new ka(n, l);
  480.                 } else {
  481.                     serverPosX = n;
  482.                     serverPosY = l;
  483.                 }
  484.             }
  485.             for (e = 0; e < d.length; e++) delete F[d[e]];
  486.             c = Ea(b, 3 + 8 * c);
  487.             g = b.getUint16(c, !0);
  488.             c += 2;
  489.             for (d = 0; d < g; d++) {
  490.                 a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  491.                     if (r[e].id == n) {
  492.                         var k = r[e];
  493.                         if (1 == k.type)
  494.                             for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  495.                                 for (var h =
  496.                                         n; h < n + p; ++h) --T[h + 400 * m];
  497.                         r.splice(e, 1);
  498.                         break a;
  499.                     }c += 4;
  500.             }
  501.             g = b.getUint16(c, !0);
  502.             c += 2;
  503.             for (d = 0; d < g; d++) {
  504.                 a: {
  505.                     e = b.getUint32(c, !0);
  506.                     for (n = 0; n < r.length; n++)
  507.                         if (r[n].id == e) {
  508.                             e = r[n];
  509.                             break a;
  510.                         }
  511.                     e = {
  512.                         id: e
  513.                     };
  514.                     r.push(e);
  515.                 }
  516.                 c += 4;c = la(b, c, e);
  517.             }
  518.             c = Fa(b, c);
  519.             if (a.byteLength < c + 4) break;
  520.             aa = b.getUint32(c, !0);
  521.             break;
  522.         case 4:
  523.             next();
  524.             W(b.getUint16(1, !0), b.getUint16(3, !0));
  525.             g = b.getUint16(5, !0);
  526.             c = 7;
  527.             for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  528.             a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  529.             Z();
  530.             break;
  531.         case 5:
  532.             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();
  533.     }
  534. }
  535.  
  536. function Q() {
  537.     if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  538.         var a = new ArrayBuffer(9);
  539.             b = new DataView(a);
  540.         b.setUint8(0, 1);
  541.         b.setUint16(1, k, !0);
  542.         b.setUint16(3, q, !0);
  543.         b.setUint32(5, G, !0);
  544.         u.send(a);
  545.         J = k;
  546.         K = q;
  547.     }
  548.  
  549. }
  550.  
  551. function Au() {
  552.     Throttler.sendOut();
  553.     if (auraEnabled) drawAura(J, K);
  554. }
  555.  
  556. function wa(a, b, numClicks) {
  557.     if (!D && null != u && u.readyState == WebSocket.OPEN) {
  558.         var c = new ArrayBuffer(9),
  559.             d = new DataView(c);
  560.         d.setUint8(0, 2);
  561.         d.setUint16(1, a, !0);
  562.         d.setUint16(3, b, !0);
  563.         d.setUint32(5, G, !0);
  564.         for (var i = 0; i < numClicks; i++) { u.Send(c); }
  565.     }
  566. }
  567.  
  568. function la(f, b, c) {
  569.     function d() {
  570.         c.x = f.getUint16(b, !0);
  571.         b += 2;
  572.         c.y = f.getUint16(b, !0);
  573.         b += 2;
  574.         c.width = f.getUint16(b, !0);
  575.         b += 2;
  576.         c.height = f.getUint16(b, !0);
  577.         b += 2;
  578.     }
  579.     function g() {
  580.         for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  581.         b += 4;
  582.         c.color = "#" + a;
  583.     }
  584.     var e = f.getUint8(b);
  585.     b += 1;
  586.     c.type = e;
  587.     switch (e) {
  588.         case 255:
  589.             break;
  590.         case 0:
  591.             c.x = f.getUint16(b, !0);
  592.             b += 2;
  593.             c.y = f.getUint16(b, !0);
  594.             b += 2;
  595.             c.size = f.getUint8(b);
  596.             b += 1;
  597.             c.isCentered = !!f.getUint8(b);
  598.             b += 1;
  599.             e = Da(f, b);
  600.             c.text = e[0];
  601.             b = e[1];
  602.             break;
  603.         case 1:
  604.             d();
  605.             var n = !c.color;
  606.             g();
  607.             var e = c.x | 0,
  608.                 l = c.y | 0,
  609.                 p = c.width | 0,
  610.                 k = c.height | 0;
  611.             if (n)
  612.                 for (n = l; n < l + k; ++n)
  613.                     for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  614.             break;
  615.         case 2:
  616.             d();
  617.             c.isBad = !!f.getUint8(b);
  618.             b += 1;
  619.             break;
  620.         case 3:
  621.             d();
  622.             c.count = f.getUint16(b, !0);
  623.             b += 2;
  624.             g();
  625.             break;
  626.         case 4:
  627.             d();
  628.             c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  629.             c.count = f.getUint16(b, !0);
  630.             b += 2;
  631.             g();
  632.             break;
  633.         case 5:
  634.             c.x = f.getUint16(b, !0);
  635.             b += 2;
  636.             c.y = f.getUint16(b, !0);
  637.             b += 2;
  638.             c.queue = [ [0, c.x, c.y]];
  639.             c.potentialQueue = [];
  640.             c.explored = new Uint8Array(12E4);
  641.             c.img = a.createImageData(400, 300);
  642.             e = E.createElement("canvas");
  643.             e.width = 400;
  644.             e.height = 300;
  645.             c.canvas = e;
  646.             c.ctx = c.canvas.getContext("2d");
  647.             break;
  648.         default:
  649.             throw Error("Unknown object type " + e);
  650.     }
  651.     return b;
  652. }
  653.  
  654. function ea(a, b) {
  655.     if (-1 != J && -1 != K) {
  656.         var c = fa(J, K, a, b);
  657.         if (c.x != a || c.y != b) return !0;
  658.     }
  659.     for (c = 0; c < r.length; c++) {
  660.         var d = r[c];
  661.         if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0;
  662.     }
  663.     return !1;
  664. }
  665.  
  666. window.showHelp = false;
  667. function ma() {
  668.     a.clearRect(0, 0, a.canvas.width, a.canvas.height);
  669.     a.save();
  670.     if (null != u && u.readyState != WebSocket.OPEN || L) {
  671.         var f;
  672.         if (null == u) f = "Click to begin";
  673.         else switch (u.readyState) {
  674.             case WebSocket.CONNECTING:
  675.                 f = "Connecting";
  676.                 break;
  677.             case WebSocket.CLOSING:
  678.             case WebSocket.CLOSED:
  679.                 f = "Lost connection to server";
  680.                 break;
  681.             default:
  682.                 f = "Click to begin";
  683.         }
  684.         a.font = 60 + "px NovaSquare";
  685.         a.fillText(f, 400 - a.measureText(f).width / 2, 300);
  686.         a.font = 20 + "px NovaSquare";
  687.         f = "-> script remastered by q1k <-";
  688.         a.fillText(f, 400 - a.measureText(f).width / 2, 345);
  689.         na();
  690.         oa(!1);
  691.     } else {
  692.         a.fillStyle = "#000000";
  693.         a.save();
  694.         a.globalAlpha = 1;
  695.         var typeZeroCount = 0;
  696.         var typeOneCount = 0;
  697.         var typeTwoCount = 0;
  698.         var typeThreeCount = 0;
  699.         var typeFourCount = 0;
  700.         for (f = 0; f < r.length; f++) {
  701.             var b = r[f];
  702.             if (0 == b.type) {
  703.                 a.font = b.size + "px NovaSquare";
  704.                 var c = b.x << 1,
  705.                     d = b.y << 1;
  706.                 b.isCentered && (c -= a.measureText(b.text).width / 2);
  707.                 a.fillStyle = "#000000";
  708.                 a.fillText(b.text, c, d);
  709.                 typeZeroCount++;
  710.             } else if (1 == b.type) {
  711.                 a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1);
  712.                 a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2;
  713.                 a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2);
  714.                 a.globalAlpha = 1;
  715.                 typeOneCount++;
  716.             } else if (2 == b.type) {
  717.                 a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2;
  718.                 a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1);
  719.                 a.globalAlpha = 1;
  720.                 typeTwoCount++;
  721.             } else if (3 == b.type) {
  722.                 var c = b.x << 1,
  723.                     d = b.y << 1,
  724.                     g = b.width << 1,
  725.                     e = b.height << 1;
  726.                 a.fillStyle = b.color;
  727.                 a.globalAlpha = .2;
  728.                 a.fillRect(c, d, g, e);
  729.                 a.globalAlpha = .5;
  730.                 a.fillStyle = "#000000";
  731.                 if (40 > b.width || 40 > b.height) {
  732.                     a.font = 30 + "px NovaSquare", a.fillText(b.count,  c + g / 2 - a.measureText(b.count).width / 2,  d + e / 2 + 10);
  733.                 } else {
  734.                     a.font = 60 + "px NovaSquare", a.fillText(b.count,  c + g / 2 - a.measureText(b.count).width / 2,  d + e / 2 + 20);
  735.                 };
  736.                 a.globalAlpha = 1;
  737.                 typeThreeCount++;
  738.             } else if (4 == b.type) {
  739.                 c = b.x << 1;
  740.                 d = b.y << 1;
  741.                 g = b.width << 1;
  742.                 e = b.height << 1;
  743.                 a.fillStyle = b.color;
  744.                 a.strokeStyle = b.color;
  745.                 a.globalAlpha = 1;
  746.                 a.fillRect(c, d, g, e);
  747.                 a.globalAlpha = .2;
  748.                 a.fillStyle = "#000000";
  749.                 a.fillRect(c, d, g, e);
  750.                 a.globalAlpha = 1;
  751.                 a.fillStyle = b.color;
  752.                 var n = 150 > t - b.lastClickAt, l = n ? 8 : 12;
  753.                 a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  754.                 a.strokeStyle = "#000000";
  755.                 a.globalAlpha = .1;
  756.                 a.beginPath();
  757.                 a.moveTo(c, d);
  758.                 a.lineTo(c + l, d + l);
  759.                 a.moveTo(c + g, d);
  760.                 a.lineTo(c + g - l, d + l);
  761.                 a.moveTo(c, d + e);
  762.                 a.lineTo(c + l, d + e - l);
  763.                 a.moveTo(c + g, d + e);
  764.                 a.lineTo(c + g - l, d + e - l);
  765.                 a.moveTo(c, d);
  766.                 a.rect(c, d, g, e);
  767.                 a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  768.                 a.stroke();
  769.                 a.fillStyle = "#000000";
  770.                 a.globalAlpha = .5;
  771.                 if (50 > b.width || 50 > b.height) {
  772.                     a.font = 35 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13);
  773.                 } else {
  774.                     a.font = 45 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16);
  775.                 }
  776.                 n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  777.                 a.globalAlpha = 1;
  778.                 typeFourCount++;
  779.             } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600, ga(!0)));
  780.         }
  781.         if (r.length == 8 && typeZeroCount == 4 && typeOneCount == 3 && typeTwoCount == 1 && typeThreeCount == 0 && typeFourCount == 0) {
  782.             a.globalAlpha = 1;
  783.             f = "(Or just play cursors.io)", a.font = 15 + "px NovaSquare", a.fillStyle = "#000000";
  784.             a.fillText(f, 400 - a.measureText(f).width / 2, 408);
  785.         }
  786.         a.restore();
  787.         if (!D) {
  788.             a.font = 12 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5;
  789.             f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw";
  790.             a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1;
  791.             a.fillText(f, 10, 590);
  792.             if (aa != 0) {
  793.                 f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1;
  794.                 a.fillText(f, 790 - b, 590);
  795.             };
  796.             if (!movementEnabled && !hideExtraInfo) {
  797.                 f = "movement disabled / pathfinder enabled";
  798.                 a.globalAlpha = .5, a.strokeText(f, 10, 15), a.globalAlpha = 1;
  799.                 a.fillText(f, 10, 15);
  800.                 f = "press numpad . OR delete to toggle";
  801.                 a.globalAlpha = .5, a.strokeText(f, 10, 30), a.globalAlpha = 1;
  802.                 a.fillText(f, 10, 30);
  803.             }
  804.             if (auraEnabled && !hideExtraInfo) {
  805.                 f = "aura enabled", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 15), a.globalAlpha = 1;
  806.                 a.fillText(f, 790 - b, 15);
  807.                 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;
  808.                 a.fillText(f, 790 - b, 30);
  809.             }
  810.             if (imgSizeShow) {
  811.                 f = "image size: " + imgSizePrcnt + "%"; a.globalAlpha = .5, a.strokeText(f, 10, 560), a.globalAlpha = 1;
  812.                 a.fillText(f, 10, 560);
  813.                 //f = "image size: " + imgSizePrcnt + "%", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 560), a.globalAlpha = 1;
  814.                 //a.fillText(f, 790 - b, 560);
  815.             }
  816.         }
  817.         na();
  818.         if (!H.checked) {
  819.             a.save();
  820.             a.strokeStyle = "#000000";
  821.             a.lineWidth = 1;
  822.             t = +new Date;
  823.             a.beginPath();
  824.             for (f = 0; f < O.length; f++) {
  825.                 b = O[f];
  826.                 c = 10 - (t - b[4]) / 1E3;
  827.                 if (c <= 0) {
  828.                     O.splice(f, 1),
  829.                     --f;
  830.                 } else {
  831.                     1 < c && (c = 1), a.globalAlpha = .3 * c;
  832.                     a.moveTo(b[0] - .5, b[1] - .5);
  833.                     a.lineTo(b[2] - .5, b[3] - .5);
  834.                 }
  835.             }
  836.             a.stroke();
  837.             a.restore();
  838.         }
  839.         a.save();
  840.         //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));
  841.  
  842.         for (var p in F) {
  843.             F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) - 6);
  844.             // show ids?
  845.             if (showcursorsid) {
  846.                 if(cursorIDPos==2){
  847.                     cp=a.measureText(p).width;
  848.                     a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY );
  849.                     a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY );
  850.                 }
  851.                 else{
  852.                     a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY );
  853.                     a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY );
  854.                 }
  855.             }
  856.         }
  857.         if (showcursorsid) {
  858.             if(cursorIDPos==2){
  859.                 cp=a.measureText(ha).width;
  860.                 a.globalAlpha = .5; a.strokeText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ;
  861.                 a.globalAlpha= 1; a.fillText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ;
  862.             }
  863.             else{
  864.                 a.globalAlpha = .5; a.strokeText( ha, sa(k) + cursorIDX, ta(q) + cursorIDY ) ;
  865.                 a.globalAlpha= 1; a.fillText( ha, sa(k) + cursorIDX, ta(q) + cursorIDY ) ;
  866.             }
  867.         }
  868.  
  869.         a.restore();
  870.         oa(!0);
  871.         if (!D) {
  872.             a.font = 15 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5;
  873.             if (message.length>0){
  874.                 b = a.measureText(message).width/2;
  875.                 a.globalAlpha = .5, a.strokeText(message, 400 - b, 580), a.globalAlpha = 1;
  876.                 a.fillText(message, 400 - b, 580);
  877.             }
  878.             for (var i=0; i < messages.length; i++){
  879.                 b = a.measureText(messages[i]).width/2;
  880.                 a.globalAlpha = .5, a.strokeText(messages[i], 400 - b, 580 - messages.length*15 + i*15 ), a.globalAlpha = 1;
  881.                 a.fillText(messages[i], 400 - b, 580 - messages.length*15 + i*15);
  882.             }
  883.             if (showHelp) {
  884.                 var oo = a.measureText("->").width;
  885.                 a.font = 12 + "px NovaSquare";
  886.                 f = "How to use (press F1 to hide):",                                    a.globalAlpha = .5, a.strokeText(f, 10, 45), a.globalAlpha = 1, a.fillText(f, 10, 45);
  887.                 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);
  888.                 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);
  889.                 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);
  890.                 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);
  891.                 f = "-> To draw arrows, use the arrow keys",                             a.globalAlpha = .5, a.strokeText(f, 10, 120), a.globalAlpha = 1, a.fillText(f, 10, 120);
  892.                 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);
  893.                 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);
  894.                 f = "-> To reset image size press *",                                    a.globalAlpha = .5, a.strokeText(f, 10, 165), a.globalAlpha = 1, a.fillText(f, 10, 165);
  895.                 f = "-> To show/hide cursors ids: press F8",                             a.globalAlpha = .5, a.strokeText(f, 10, 180), a.globalAlpha = 1, a.fillText(f, 10, 180);
  896.                 f = "-> Change ids position: press F9",                                  a.globalAlpha = .5, a.strokeText(f, 10, 195), a.globalAlpha = 1, a.fillText(f, 10, 195);
  897.             }
  898.         }
  899.     }
  900.     a.restore();
  901.     A.requestAnimationFrame(ma)
  902. }
  903.  
  904. function scale(z) {
  905.     return Math.round(z/600*a.canvas.height);
  906. }
  907.  
  908. function na() {
  909.     a.save();
  910.     a.strokeStyle = "#000000";
  911.     t = +new Date;
  912.     for (var f = 0; f < I.length; f++) {
  913.         var b = I[f],
  914.             c = (t - b[2]) / 1E3,
  915.             d = 1 - 2 * c;
  916.         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());
  917.     }
  918.     a.restore()
  919. }
  920.  
  921. function oa(f) {
  922.     if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5, P.width, P.height);
  923.     else {
  924.         var b = 0,
  925.             c = 0;
  926.         if (v != k || w != q) {
  927.             a.save();
  928.             if (f) {
  929.                 a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath();
  930.                 a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1);
  931.                 a.fill();
  932.             }
  933.             a.globalAlpha = .5;
  934.             a.drawImage(P, B - 5, C - 5, P.width, P.height);
  935.             a.restore();
  936.         } else {
  937.             b = B & 1, c = C & 1;
  938.         }
  939.         a.save();
  940.         if (f) {
  941.             a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath();
  942.             a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1);
  943.             a.fill();
  944.         }
  945.         a.globalAlpha = 1;
  946.         a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5, Ia.width, Ia.height);
  947.         if (!movementEnabled) {
  948.             a.strokeStyle = "#DD4444", a.lineWidth = 1;
  949.             a.beginPath();
  950.             a.arc(serverPosX << 1, serverPosY << 1, 4, 0, 2*Math.PI);
  951.             a.stroke();
  952.         }
  953.     }
  954.     a.restore();
  955. }
  956.  
  957. function ka(a, b) {
  958.     this.oldX = this.newX = a;
  959.     this.oldY = this.newY = b;
  960.     this.time = t
  961. }
  962.  
  963. function pa(a) {
  964.     return a * a * (3 - 2 * a)
  965. }
  966.  
  967. function fa(a, b, c, d) {
  968.     a |= 0;
  969.     b |= 0;
  970.     c |= 0;
  971.     d |= 0;
  972.     if (z(a, b)) return {
  973.         x: a,
  974.         y: b
  975.     };
  976.     if (a == c && b == d) return {
  977.         x: c,
  978.         y: d
  979.     };
  980.     var g = a,
  981.         e = b;
  982.     c = c - a | 0;
  983.     d = d - b | 0;
  984.     var n =
  985.         0,
  986.         l = 0,
  987.         p = 0,
  988.         k = 0;
  989.     0 > c ? n = -1 : 0 < c && (n = 1);
  990.     0 > d ? l = -1 : 0 < d && (l = 1);
  991.     0 > c ? p = -1 : 0 < c && (p = 1);
  992.     var m = Math.abs(c) | 0,
  993.         h = Math.abs(d) | 0;
  994.     m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  995.     c = m >> 1;
  996.     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);
  997.     return {
  998.         x: g,
  999.         y: e
  1000.     }
  1001. }
  1002.  
  1003. function z(a, b) {
  1004.     return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  1005. }
  1006.  
  1007. function Ja() {
  1008.     for (var a = 0; a < r.length; a++) {
  1009.         var b = r[a];
  1010.         5 == b.type && Ka(b)
  1011.     }
  1012. }
  1013.  
  1014. function Ka(a) {
  1015.     function b(a, b, c) {
  1016.         e.push([c, a, b]);
  1017.         l[a + 400 * b] = !0;
  1018.         g(a, b)
  1019.     }
  1020.  
  1021.     function c(a, b, c) {
  1022.         p.push([c,
  1023.             a, b
  1024.         ]);
  1025.         l[a + 400 * b] = !0
  1026.     }
  1027.  
  1028.     function d(a, b) {
  1029.         return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  1030.     }
  1031.  
  1032.     function g(a, b) {
  1033.         var c = 4 * (a + 400 * b);
  1034.         k[c + 0] = 255;
  1035.         k[c + 1] = 153;
  1036.         k[c + 2] = 153;
  1037.         k[c + 3] = 255
  1038.     }
  1039.     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);
  1040.     for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  1041.     for (r = 0; 50 > r && 0 != e.length; ++r) {
  1042.         for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  1043.             var x = e[m][0];
  1044.             .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  1045.         }
  1046.         for (m = 0; m < q.length; ++m) {
  1047.             var x = q[m][0],
  1048.                 h = q[m][1],
  1049.                 s = q[m][2],
  1050.                 qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  1051.             0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  1052.             0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  1053.             400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top