Advertisement
icefireAlan6

script draw [it was old]

Jan 19th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*                                                      
  2.    ___ _   _ _ __ ___  ___  _ __ ___   _ __ ___   ___  
  3.   / __| | | | '__/ __|/ _ \| '__/ __| | '_ ` _ \ / _ \
  4.  | (__| |_| | |  \__ \ (_) | |  \__ \_| | | | | |  __/
  5.   \___|\__,_|_|  |___/\___/|_|  |___(_)_| |_| |_|\___|
  6.                                                        
  7.  
  8.        script for texting and drawing in cursors.io
  9.             hello people,today me make a script but it draw very nice
  10.        good luck =]
  11. */
  12. /*  How to use:
  13.     1.  Go to cursors.io, open console (ctrl + shift + j or F12)
  14.         and paste this entire script into the console, then hit enter.
  15.     2.  To type: type message and hit enter
  16.     3.  To move your cursor only when clicking: press F1
  17.         Use it to pass red walls levels ;)
  18.         To move your cursor normally: press F1 again
  19.     4.  To draw a circle: press F2
  20.         To stop drawing a circle: press F2 again
  21.     5.  To draw different images press F3 - F7 keys
  22.     6.  To show this help: press F11
  23. */
  24.  
  25. var A = window;
  26. var E = document;
  27. var posX, posY;
  28. var lastX, lastY;
  29. var serverPosX, serverPosY;
  30. var initialLoad = true;
  31. var clicksCount = 3;
  32. var auraEnabled = false;
  33. var auraTime = 0;
  34. var auraRadius = 10;
  35. var movementEnabled = true;
  36.  
  37. var fontSize = 2;
  38. var kerning = 3;
  39. var alphabet = {
  40.     39:[[0,0.5,1,0.5]],
  41.     40:[[0,2,0.5,1],[0.5,1,1.5,1],[1.5,1,2,2]],
  42.     41:[[0,0,0.5,1],[0.5,1,1.5,1],[1.5,1,2,0]],
  43.     44:[[2.5,0,3.5,0]],
  44.     46:[[2,0,1.5,0]],
  45.     48:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]],
  46.     49:[[0,1,2,1],[1,0,0,1],[2,0,2,2]],
  47.     50:[[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,0,2,0],[2,0,2,2]],
  48.     51:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],
  49.     52:[[0,0,1,0],[1,0,1,2],[0,2,2,2]],
  50.     53:[[0,2,0,0],[0,0,1,0],[1,0,1,2],[1,2,2,2],[2,2,2,0]],
  51.     54:[[0,2,0,0],[0,0,2,0],[2,0,2,2],[2,2,1,2],[1,2,1,0]],
  52.     55:[[0,0,0,2],[0,2,2,0]],
  53.     56:[[0,0,0,2],[0,2,2,2],[2,2,2,0],[2,0,0,0],[1,0,1,2]],
  54.     57:[[0,0,1,0],[1,0,1,2],[0,2,2,2],[0,0,0,2],[2,0,2,2]],
  55.     58:[[0,0,0,1],[2,0,2,1]],
  56.     59:[[0,0,0,1],[2,0,2,1]],
  57.     63:[[1,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,1],[1,1,2,1]],
  58.     97:[[2,0,0,0],[0,2,0,0],[0,2,2,2],[1,0,1,2]],
  59.     98:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],
  60.     99:[[2,2,2,0],[2,0,0,0],[0,0,0,2]],
  61.     100:[[2,0,0,0],[0,0,0,1],[0,1,1,2],[1,2,2,1],[2,1,2,0]],
  62.     101:[[2,2,2,0],[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  63.     102:[[2,0,0,0],[0,0,0,2],[1,0,1,2]],
  64.     103:[[1,1,1,2],[1,2,2,2],[2,2,2,0],[2,0,0,0],[0,0,0,2]],
  65.     104:[[0,0,2,0],[0,2,2,2],[1,0,1,2]],
  66.     105:[[0,0,0,2],[0,1,2,1],[2,0,2,2]],
  67.     106:[[0,0,0,2],[0,1,2,1],[2,0,2,1]],
  68.     107:[[0,0,2,0],[1,0,0,2],[1,0,2,2]],
  69.     108:[[0,0,2,0],[2,0,2,2]],
  70.     109:[[0,0,2,0],[0,0,2,1],[2,1,0,2],[0,2,2,2]],
  71.     110:[[0,0,2,0],[0,0,2,2],[0,2,2,2]],
  72.     111:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]],
  73.     112:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0]],
  74.     113:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,1,2,2]],
  75.     114:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,1,2,2]],
  76.     115:[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2]],
  77.     116:[[0,0,0,2],[0,1,2,1]],
  78.     117:[[0,0,2,0],[0,2,2,2],[2,0,2,2]],
  79.     118:[[0,0,2,1],[0,2,2,1]],
  80.     119:[[0,0,2,0],[0,2,2,2],[2,0,1,1],[2,2,1,1]],
  81.     120:[[0,0,2,2],[2,0,0,2]],
  82.     121:[[0,0,1,1],[0,2,1,1],[2,1,1,1]],
  83.     122:[[0,0,0,2],[0,2,2,0],[2,0,2,2]],
  84. };
  85.  
  86. var imageScale = 1.0;
  87. var imgData = [
  88.     /*star 5*/
  89.     [[0,5,30,15],[30,15,0,25],[0,25,20,0],[20,0,20,30],[20,30,0,5]],
  90.  
  91.     /*tictactoe*/
  92.     [[90,30,0,30],[0,60,90,60],[30,0,30,90],[60,0,60,90],[0,0,0,90],[0,90,90,90],[90,90,90,0],[90,0,0,0]],
  93.  
  94.     /*pentashot*/
  95.     [[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]],
  96.  
  97.     /*triforce*/
  98.     [[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]],
  99. ];
  100.  
  101. function sa(f) {
  102.     return f << 1;
  103. }
  104.  
  105. function ta(f) {
  106.     return f << 1;
  107. }
  108.  
  109. function U() {
  110.     return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y;
  111. }
  112.  
  113. function ba() {
  114.     a.fillStyle = "#000000";
  115.     a.font = "35px NovaSquare";
  116.     a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  117.     a.font = "16px NovaSquare";
  118.     a.fillText("Play http://cursors.me/", 400 - a.measureText("Play http://cursors.me/").width /
  119.         2, 330);
  120.     top.location = "http://cursors.io";
  121.     throw "Please do not embed our website, thank you.";
  122. }
  123.  
  124. function ua(f) {
  125.     V(f);
  126. }
  127.  
  128. function W(f, b) {
  129.     J = f;
  130.     K = b;
  131.     k = v = f;
  132.     q = w = b;
  133.     B = v << 1;
  134.     C = w << 1;
  135. }
  136.  
  137. function Ma() {
  138.     var eng = document.body.childNodes[1].getElementsByTagName("a")[0];
  139.     eng.href = "http://cursors.me/";
  140.     eng.target = "_blank";
  141.     eng.innerHTML = "More levels!";
  142. }
  143.  
  144. function va(f) {
  145.     if (D) return L = !1, V(f), !1;
  146.     U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  147.     if (L) L = !1, Q();
  148.     else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  149.     else if (100 < t - ca && v == k && w == q) {
  150.         ca = t;
  151.         I.push([v << 1, w << 1, t]);
  152.         wa(v, w, clicksCount);
  153.         var b = [v, w];
  154.         N.push(b);
  155.         setTimeout(function() {
  156.             N.remove(b);
  157.         }, 1E3);
  158.     }
  159.     return !1;
  160. }
  161.  
  162. function xa(f) {
  163.     Y = !1;
  164. }
  165.  
  166. function ya() {
  167.     A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"));
  168. }
  169.  
  170. function V(f) {
  171.     if (U()) {
  172.         var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  173.         f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  174.         300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1);
  175.     } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  176.     lastX = posX;
  177.     lastY = posY;
  178.     posX = k;
  179.     posY = q;
  180.     if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  181.             w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  182.         b = R;
  183.         f = S;
  184.         var a = k,
  185.             d = q;
  186.         if (!D && null != u && u.readyState == WebSocket.OPEN) {
  187.             var g = new ArrayBuffer(9),
  188.                 e = new DataView(g);
  189.             e.setUint8(0, 3);
  190.             e.setUint16(1, b, !0);
  191.             e.setUint16(3, f, !0);
  192.             e.setUint16(5, a, !0);
  193.             e.setUint16(7, d, !0);
  194.             u.Send(g);
  195.         }
  196.         R = k;
  197.         S = q;
  198.         da = t;
  199.     }
  200. }
  201.  
  202. function Z() {
  203.     ea(k, q) && Q();
  204.     if (z(k, q)) {
  205.         var a;
  206.         a: {
  207.             a = k;
  208.             var b = q,
  209.                 c = [],
  210.                 d = new Uint8Array(12E4);
  211.             c.push([a, b]);
  212.             d[a + 400 * b] = 1;
  213.             do {
  214.                 var g = c.shift(),
  215.                     e = g[0],
  216.                     g = g[1];
  217.                 if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  218.                     if (!z(e, g)) {
  219.                         a = {
  220.                             x: e,
  221.                             y: g
  222.                         };
  223.                         break a;
  224.                     }
  225.                     d[e - 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  226.                     d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  227.                     d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  228.                     d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1);
  229.                 }
  230.             } while (0 < c.length);
  231.             a = {
  232.                 x: a,
  233.                 y: b
  234.             };
  235.         }
  236.         k = a.x;
  237.         q = a.y;
  238.     }
  239.     if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  240.     ea(k, q) && Q();
  241. }
  242.  
  243. function $() {
  244.     console.log("Next map");
  245.     initialLoad = true;
  246.     T.set(za);
  247.     r = [];
  248.     I = [];
  249.     O = [];
  250. }
  251.  
  252. function ga(f) {
  253.     a.imageSmoothingEnabled = f;
  254.     a.mozImageSmoothingEnabled = f;
  255.     a.oImageSmoothingEnabled = f;
  256.     a.webkitImageSmoothingEnabled = f;
  257. }
  258.  
  259. function Aa() {
  260.     $();
  261.     console.log("Connected!");
  262. }
  263.  
  264. function Ba(a) {
  265.     $();
  266.     console.log("Socket closed: " + a.reason);
  267. }
  268.  
  269. function Ca(a) {
  270.     console.log("Socket error");
  271. }
  272.  
  273. function Da(a, b) {
  274.     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);
  275.     0 != d && (c += String.fromCharCode(d));
  276.     return [c, b + 1];
  277. }
  278.  
  279. function Ea(a, b) {
  280.     setTimeout(function() {
  281.         var c = a.getUint16(b, !0),
  282.             d = 0;
  283.         a: for (; d < c; d++) {
  284.             for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  285.                 var l = N[n];
  286.                 if (l[0] == g && l[1] == e) {
  287.                     N.splice(n, 1);
  288.                     continue a;
  289.                 }
  290.             }
  291.             I.push([g << 1, e << 1, t]);
  292.         }
  293.     }, 100);
  294.     return b + 2 + 4 * a.getUint16(b, !0);
  295. }
  296.  
  297. function Fa(a, b) {
  298.     !H.checked && setTimeout(function() {
  299.         for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  300.             var g = a.getUint16(b + 2 + 8 * d, !0),
  301.                 e = a.getUint16(b + 4 + 8 * d, !0),
  302.                 n = a.getUint16(b + 6 + 8 * d, !0),
  303.                 l = a.getUint16(b + 8 + 8 * d, !0);
  304.             O.push([g << 1, e << 1, n << 1, l << 1, t]);
  305.         }
  306.     }, 50);
  307.     return b + 2 + 8 * a.getUint16(b, !0);
  308. }
  309.  
  310. function Ga(a) {
  311.     buttonIndex = 0;
  312.     initialLoad = false;
  313.     a = a.data;
  314.     var b = new DataView(a);
  315.     switch (b.getUint8(0)) {
  316.         case 0:
  317.             ha = b.getUint32(1, !0);
  318.             break;
  319.         case 1:
  320.             var c;
  321.             ia = c = b.getUint16(1, !0);
  322.             ja = 100 <= c;
  323.             var d = [],
  324.                 g;
  325.             for (g in F) F.hasOwnProperty(g) && d.push(g);
  326.             for (var e =
  327.                     0; e < c; e++) {
  328.                 g = b.getUint32(3 + 8 * e, !0);
  329.                 var n = b.getUint16(7 + 8 * e, !0),
  330.                     l = b.getUint16(9 + 8 * e, !0);
  331.                 if (g != ha) {
  332.                     if (null != F[g]) {
  333.                         for (var p = 0; p < d.length; p++)
  334.                             if (d[p] == g) {
  335.                                 d.splice(p, 1);
  336.                                 break;
  337.                             }
  338.                         g = F[g];
  339.                         g.oldX = g.getX();
  340.                         g.oldY = g.getY();
  341.                         g.newX = n;
  342.                         g.newY = l;
  343.                         g.time = t;
  344.                     } else F[g] = new ka(n, l);
  345.                 } else {
  346.                     serverPosX = n;
  347.                     serverPosY = l;
  348.                 }
  349.             }
  350.             for (e = 0; e < d.length; e++) delete F[d[e]];
  351.             c = Ea(b, 3 + 8 * c);
  352.             g = b.getUint16(c, !0);
  353.             c += 2;
  354.             for (d = 0; d < g; d++) {
  355.                 a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  356.                     if (r[e].id == n) {
  357.                         var k = r[e];
  358.                         if (1 == k.type)
  359.                             for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  360.                                 for (var h =
  361.                                         n; h < n + p; ++h) --T[h + 400 * m];
  362.                         r.splice(e, 1);
  363.                         break a;
  364.                     }c += 4;
  365.             }
  366.             g = b.getUint16(c, !0);
  367.             c += 2;
  368.             for (d = 0; d < g; d++) {
  369.                 a: {
  370.                     e = b.getUint32(c, !0);
  371.                     for (n = 0; n < r.length; n++)
  372.                         if (r[n].id == e) {
  373.                             e = r[n];
  374.                             break a;
  375.                         }
  376.                     e = {
  377.                         id: e
  378.                     };
  379.                     r.push(e);
  380.                 }
  381.                 c += 4;c = la(b, c, e);
  382.             }
  383.             c = Fa(b, c);
  384.             if (a.byteLength < c + 4) break;
  385.             aa = b.getUint32(c, !0);
  386.             break;
  387.         case 4:
  388.             $();
  389.             W(b.getUint16(1, !0), b.getUint16(3, !0));
  390.             g = b.getUint16(5, !0);
  391.             c = 7;
  392.             for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  393.             a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  394.             Z();
  395.             break;
  396.         case 5:
  397.             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();
  398.     }
  399. }
  400.  
  401. function Q() {
  402.     if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  403.         var a = new ArrayBuffer(9);
  404.             b = new DataView(a);
  405.         b.setUint8(0, 1);
  406.         b.setUint16(1, k, !0);
  407.         b.setUint16(3, q, !0);
  408.         b.setUint32(5, G, !0);
  409.         u.send(a);
  410.         J = k;
  411.         K = q;
  412.     }
  413.  
  414.     Throttler.sendOut();
  415.     if (auraEnabled) drawAura(J, K);
  416. }
  417.  
  418. function wa(a, b, numClicks) {
  419.     if (!D && null != u && u.readyState == WebSocket.OPEN) {
  420.         var c = new ArrayBuffer(9),
  421.             d = new DataView(c);
  422.         d.setUint8(0, 2);
  423.         d.setUint16(1, a, !0);
  424.         d.setUint16(3, b, !0);
  425.         d.setUint32(5, G, !0);
  426.         for (var i = 0; i < numClicks; i++) { u.Send(c); }
  427.     }
  428. }
  429.  
  430. function la(f, b, c) {
  431.     function d() {
  432.         c.x = f.getUint16(b, !0);
  433.         b += 2;
  434.         c.y = f.getUint16(b, !0);
  435.         b += 2;
  436.         c.width = f.getUint16(b, !0);
  437.         b += 2;
  438.         c.height = f.getUint16(b, !0);
  439.         b += 2;
  440.     }
  441.     function g() {
  442.         for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  443.         b += 4;
  444.         c.color = "#" + a;
  445.     }
  446.     var e = f.getUint8(b);
  447.     b += 1;
  448.     c.type = e;
  449.     switch (e) {
  450.         case 255:
  451.             break;
  452.         case 0:
  453.             c.x = f.getUint16(b, !0);
  454.             b += 2;
  455.             c.y = f.getUint16(b, !0);
  456.             b += 2;
  457.             c.size = f.getUint8(b);
  458.             b += 1;
  459.             c.isCentered = !!f.getUint8(b);
  460.             b += 1;
  461.             e = Da(f, b);
  462.             c.text = e[0];
  463.             b = e[1];
  464.             break;
  465.         case 1:
  466.             d();
  467.             var n = !c.color;
  468.             g();
  469.             var e = c.x | 0,
  470.                 l = c.y | 0,
  471.                 p = c.width | 0,
  472.                 k = c.height | 0;
  473.             if (n)
  474.                 for (n = l; n < l + k; ++n)
  475.                     for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  476.             break;
  477.         case 2:
  478.             d();
  479.             c.isBad = !!f.getUint8(b);
  480.             b += 1;
  481.             break;
  482.         case 3:
  483.             d();
  484.             c.count = f.getUint16(b, !0);
  485.             b += 2;
  486.             g();
  487.             break;
  488.         case 4:
  489.             d();
  490.             c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  491.             c.count = f.getUint16(b, !0);
  492.             b += 2;
  493.             g();
  494.             break;
  495.         case 5:
  496.             c.x = f.getUint16(b, !0);
  497.             b += 2;
  498.             c.y = f.getUint16(b, !0);
  499.             b += 2;
  500.             c.queue = [ [0, c.x, c.y]];
  501.             c.potentialQueue = [];
  502.             c.explored = new Uint8Array(12E4);
  503.             c.img = a.createImageData(400, 300);
  504.             e = E.createElement("canvas");
  505.             e.width = 400;
  506.             e.height = 300;
  507.             c.canvas = e;
  508.             c.ctx = c.canvas.getContext("2d");
  509.             break;
  510.         default:
  511.             throw Error("Unknown object type " + e);
  512.     }
  513.     return b;
  514. }
  515.  
  516. function ea(a, b) {
  517.     if (-1 != J && -1 != K) {
  518.         var c = fa(J, K, a, b);
  519.         if (c.x != a || c.y != b) return !0;
  520.     }
  521.     for (c = 0; c < r.length; c++) {
  522.         var d = r[c];
  523.         if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0;
  524.     }
  525.     return !1;
  526. }
  527.  
  528. var showHelp = false;
  529. function ma() {
  530.     a.clearRect(0, 0, a.canvas.width, a.canvas.height);
  531.     a.save();
  532.     if (null != u && u.readyState != WebSocket.OPEN || L) {
  533.         var f;
  534.         if (null == u) f = "Click to begin";
  535.         else switch (u.readyState) {
  536.             case WebSocket.CONNECTING:
  537.                 f = "Connecting";
  538.                 break;
  539.             case WebSocket.CLOSING:
  540.             case WebSocket.CLOSED:
  541.                 f = "Lost connection to server";
  542.                 break;
  543.             default:
  544.                 f = "Click to begin";
  545.         }
  546.         a.font = scale(60) + "px NovaSquare";
  547.         a.fillText(f, scale(400) - a.measureText(f).width / 2, scale(300));
  548.         a.font = scale(20) + "px NovaSquare";
  549.         f = "-> Texting and drawing script <-";
  550.         a.fillText(f, scale(400) - a.measureText(f).width / 2, scale(345));
  551.         na();
  552.         oa(!1);
  553.     } else {
  554.         a.fillStyle = "#000000";
  555.         a.save();
  556.         a.globalAlpha = 1;
  557.         var typeZeroCount = 0;
  558.         var typeOneCount = 0;
  559.         var typeTwoCount = 0;
  560.         var typeThreeCount = 0;
  561.         var typeFourCount = 0;
  562.         for (f = 0; f < r.length; f++) {
  563.             var b = r[f];
  564.             if (0 == b.type) {
  565.                 a.font = scale(b.size) + "px NovaSquare";
  566.                 var c = scale(b.x << 1),
  567.                     d = b.y << 1;
  568.                 b.isCentered && (c -= a.measureText(b.text).width / 2);
  569.                 a.fillStyle = "#000000";
  570.                 a.fillText(b.text, c, scale(d));
  571.                 typeZeroCount++;
  572.             } else if (1 == b.type) {
  573.                 a.fillStyle = b.color, a.fillRect(scale(b.x << 1), scale(b.y << 1), scale(b.width << 1), scale(b.height << 1));
  574.                 a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = scale(2);
  575.                 a.strokeRect(scale((b.x << 1) + 1), scale((b.y << 1) + 1), scale((b.width << 1) - 2), scale((b.height << 1) - 2));
  576.                 a.globalAlpha = 1;
  577.                 typeOneCount++;
  578.             } else if (2 == b.type) {
  579.                 a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2;
  580.                 a.fillRect(scale(b.x << 1), scale(b.y << 1), scale(b.width << 1), scale(b.height << 1));
  581.                 a.globalAlpha = 1;
  582.                 typeTwoCount++;
  583.             } else if (3 == b.type) {
  584.                 var c = b.x << 1,
  585.                     d = b.y << 1,
  586.                     g = b.width << 1,
  587.                     e = b.height << 1;
  588.                 a.fillStyle = b.color;
  589.                 a.globalAlpha = .2;
  590.                 a.fillRect(scale(c), scale(d), scale(g), scale(e));
  591.                 a.globalAlpha = .5;
  592.                 a.fillStyle = "#000000";
  593.                 if (40 > b.width || 40 > b.height) {
  594.                     a.font = scale(30) + "px NovaSquare", a.fillText(b.count,  scale(c + g / 2) - a.measureText(b.count).width / 2,  scale(d + e / 2 + 10));
  595.                 } else {
  596.                     a.font = scale(60) + "px NovaSquare", a.fillText(b.count,  scale(c + g / 2) - a.measureText(b.count).width / 2,  scale(d + e / 2 + 20));
  597.                 };
  598.                 a.globalAlpha = 1;
  599.                 typeThreeCount++;
  600.             } else if (4 == b.type) {
  601.                 c = b.x << 1;
  602.                 d = b.y << 1;
  603.                 g = b.width << 1;
  604.                 e = b.height << 1;
  605.                 a.fillStyle = b.color;
  606.                 a.strokeStyle = b.color;
  607.                 a.globalAlpha = 1;
  608.                 a.fillRect(scale(c), scale(d), scale(g), scale(e));
  609.                 a.globalAlpha = .2;
  610.                 a.fillStyle = "#000000";
  611.                 a.fillRect(scale(c), scale(d), scale(g), scale(e));
  612.                 a.globalAlpha = 1;
  613.                 a.fillStyle = b.color;
  614.                 var n = 150 > t - b.lastClickAt, l = n ? 8 : 12;
  615.                 a.fillRect(scale(c + l), scale(d + l), scale(g - 2 * l), scale(e - 2 * l));
  616.                 a.strokeStyle = "#000000";
  617.                 a.globalAlpha = .1;
  618.                 a.beginPath();
  619.                 a.moveTo(scale(c), scale(d));
  620.                 a.lineTo(scale(c + l), scale(d + l));
  621.                 a.moveTo(scale(c + g), scale(d));
  622.                 a.lineTo(scale(c + g - l), scale(d + l));
  623.                 a.moveTo(scale(c), scale(d + e));
  624.                 a.lineTo(scale(c + l), scale(d + e - l));
  625.                 a.moveTo(scale(c + g), scale(d + e));
  626.                 a.lineTo(scale(c + g - l), scale(d + e - l));
  627.                 a.moveTo(scale(c), scale(d));
  628.                 a.rect(scale(c), scale(d), scale(g), scale(e));
  629.                 a.rect(scale(c + l), scale(d + l), scale(g - 2 * l), scale(e - 2 * l));
  630.                 a.stroke();
  631.                 a.fillStyle = "#000000";
  632.                 a.globalAlpha = .5;
  633.                 if (50 > b.width || 50 > b.height) {
  634.                     a.font = scale(35) + "px NovaSquare", a.fillText(b.count, scale(c + g / 2) - a.measureText(b.count).width / 2, scale(d + e / 2 + 13));
  635.                 } else {
  636.                     a.font = scale(45) + "px NovaSquare", a.fillText(b.count, scale(c + g / 2) - a.measureText(b.count).width / 2, scale(d + e / 2 + 16));
  637.                 }
  638.                 n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(scale(c + l), scale(d + l), scale(g - 2 * l), scale(e - 2 * l)));
  639.                 a.globalAlpha = 1;
  640.                 typeFourCount++;
  641.             } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, scale(400), scale(300), 0, 0, scale(800), scale(600), ga(!0)));
  642.         }
  643.         if (r.length == 8 && typeZeroCount == 4 && typeOneCount == 3 && typeTwoCount == 1 && typeThreeCount == 0 && typeFourCount == 0) {
  644.             a.globalAlpha = 1;
  645.             f = "(Or just play cursors.me)", a.font = scale(15) + "px NovaSquare", a.fillStyle = "#000000";
  646.             a.fillText(f, scale(400) - a.measureText(f).width / 2, scale(408));
  647.         }
  648.         a.restore();
  649.         if (!D) {
  650.             a.font = scale(12) + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = scale(2.5);
  651.             f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw";
  652.             a.globalAlpha = .5, a.strokeText(f, scale(10), scale(590)), a.globalAlpha = 1;
  653.             a.fillText(f, scale(10), scale(590));
  654.             if (aa != 0) {
  655.                 f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, scale(790) - b, scale(590)), a.globalAlpha = 1;
  656.                 a.fillText(f, scale(790) - b, scale(590));
  657.             };
  658.             if (!movementEnabled) {
  659.                 f = "movement disabled";
  660.                 a.globalAlpha = .5, a.strokeText(f, scale(10), scale(15)), a.globalAlpha = 1;
  661.                 a.fillText(f, scale(10), scale(15));
  662.                 f = "press F1 to enable";
  663.                 a.globalAlpha = .5, a.strokeText(f, scale(10), scale(30)), a.globalAlpha = 1;
  664.                 a.fillText(f, scale(10), scale(30));
  665.             }
  666.         }
  667.         na();
  668.         if (!H.checked) {
  669.             a.save();
  670.             a.strokeStyle = "#000000";
  671.             a.lineWidth = scale(1);
  672.             t = +new Date;
  673.             a.beginPath();
  674.             for (f = 0; f < O.length; f++) {
  675.                 b = O[f];
  676.                 c = 10 - (t - b[4]) / 1E3;
  677.                 if (c <= 0) {
  678.                     O.splice(f, 1),
  679.                     --f;
  680.                 } else {
  681.                     1 < c && (c = 1), a.globalAlpha = .3 * c;
  682.                     a.moveTo(scale(b[0] - .5), scale(b[1] - .5));
  683.                     a.lineTo(scale(b[2] - .5), scale(b[3] - .5));
  684.                 }
  685.             }
  686.             a.stroke();
  687.             a.restore();
  688.         }
  689.         a.save();
  690.         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));
  691.         a.restore();
  692.         oa(!0);
  693.         if (!D) {
  694.             a.font = scale(15) + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = scale(2.5);
  695.             b = a.measureText(message).width/2;
  696.             a.globalAlpha = .5, a.strokeText(message, scale(400) - b, scale(580)), a.globalAlpha = 1;
  697.             a.fillText(message, scale(400) - b, scale(580));
  698.             if (showHelp) {
  699.                 a.font = scale(12) + "px NovaSquare";
  700.                 f = "How to use (press F11 to hide):", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(60)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(60));
  701.                 f = "-> To type: type message and hit enter;", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(75)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(75));
  702.                 f = "-> To enable or disable movement: press F1;", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(90)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(90));
  703.                 f = "-> To draw a circle: press F2;", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(105)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(105));
  704.                 f = "-> To draw images: press F3 - F7;", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(120)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(120));
  705.                 f = "->> for more stuff visit cursors.me <<-", a.globalAlpha = .5, a.strokeText(f, scale(10), scale(135)), a.globalAlpha = 1, a.fillText(f, scale(10), scale(135));
  706.             }
  707.         }
  708.     }
  709.     a.restore();
  710.     A.requestAnimationFrame(ma)
  711. }
  712.  
  713. function scale(z) {
  714.     return Math.round(z/600*a.canvas.height);
  715. }
  716.  
  717. function na() {
  718.     a.save();
  719.     a.strokeStyle = "#000000";
  720.     t = +new Date;
  721.     for (var f = 0; f < I.length; f++) {
  722.         var b = I[f],
  723.             c = (t - b[2]) / 1E3,
  724.             d = 1 - 2 * c;
  725.         0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(scale(b[0]), scale(b[1]), scale(c), 0, 2 * Math.PI, !1), a.stroke());
  726.     }
  727.     a.restore()
  728. }
  729.  
  730. function oa(f) {
  731.     if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, scale(B - 5), scale(C - 5), scale(P.width), scale(P.height));
  732.     else {
  733.         var b = 0,
  734.             c = 0;
  735.         if (v != k || w != q) {
  736.             a.save();
  737.             if (f) {
  738.                 a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath();
  739.                 a.arc(scale(B + 2), scale(C + 8), scale(20), 0, 2 * Math.PI, !1);
  740.                 a.fill();
  741.             }
  742.             a.globalAlpha = .5;
  743.             a.drawImage(P, scale(B - 5), scale(C - 5), scale(P.width), scale(P.height));
  744.             a.restore();
  745.         } else {
  746.             b = B & 1, c = C & 1;
  747.         }
  748.         a.save();
  749.         if (f) {
  750.             a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath();
  751.             a.arc(scale((k << 1) + b + 2), scale((q << 1) + c + 8), scale(20), 0, 2 * Math.PI, !1);
  752.             a.fill();
  753.         }
  754.         a.globalAlpha = 1;
  755.         a.drawImage(Ia, scale((k << 1) + b - 5), scale((q << 1) + c - 5), scale(Ia.width), scale(Ia.height));
  756.         if (!movementEnabled) {
  757.             a.strokeStyle = "#DD4444", a.lineWidth = scale(1);
  758.             a.beginPath();
  759.             a.arc(scale(serverPosX << 1), scale(serverPosY << 1), scale(4), 0, 2*Math.PI);
  760.             a.stroke();
  761.         }
  762.     }
  763.     a.restore();
  764. }
  765.  
  766. function ka(a, b) {
  767.     this.oldX = this.newX = a;
  768.     this.oldY = this.newY = b;
  769.     this.time = t
  770. }
  771.  
  772. function pa(a) {
  773.     return a * a * (3 - 2 * a)
  774. }
  775.  
  776. function fa(a, b, c, d) {
  777.     a |= 0;
  778.     b |= 0;
  779.     c |= 0;
  780.     d |= 0;
  781.     if (z(a, b)) return {
  782.         x: a,
  783.         y: b
  784.     };
  785.     if (a == c && b == d) return {
  786.         x: c,
  787.         y: d
  788.     };
  789.     var g = a,
  790.         e = b;
  791.     c = c - a | 0;
  792.     d = d - b | 0;
  793.     var n =
  794.         0,
  795.         l = 0,
  796.         p = 0,
  797.         k = 0;
  798.     0 > c ? n = -1 : 0 < c && (n = 1);
  799.     0 > d ? l = -1 : 0 < d && (l = 1);
  800.     0 > c ? p = -1 : 0 < c && (p = 1);
  801.     var m = Math.abs(c) | 0,
  802.         h = Math.abs(d) | 0;
  803.     m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  804.     c = m >> 1;
  805.     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);
  806.     return {
  807.         x: g,
  808.         y: e
  809.     }
  810. }
  811.  
  812. function z(a, b) {
  813.     return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  814. }
  815.  
  816. function Ja() {
  817.     for (var a = 0; a < r.length; a++) {
  818.         var b = r[a];
  819.         5 == b.type && Ka(b)
  820.     }
  821. }
  822.  
  823. function Ka(a) {
  824.     function b(a, b, c) {
  825.         e.push([c, a, b]);
  826.         l[a + 400 * b] = !0;
  827.         g(a, b)
  828.     }
  829.  
  830.     function c(a, b, c) {
  831.         p.push([c,
  832.             a, b
  833.         ]);
  834.         l[a + 400 * b] = !0
  835.     }
  836.  
  837.     function d(a, b) {
  838.         return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  839.     }
  840.  
  841.     function g(a, b) {
  842.         var c = 4 * (a + 400 * b);
  843.         k[c + 0] = 255;
  844.         k[c + 1] = 153;
  845.         k[c + 2] = 153;
  846.         k[c + 3] = 255
  847.     }
  848.     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);
  849.     for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  850.     for (r = 0; 50 > r && 0 != e.length; ++r) {
  851.         for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  852.             var x = e[m][0];
  853.             .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  854.         }
  855.         for (m = 0; m < q.length; ++m) {
  856.             var x = q[m][0],
  857.                 h = q[m][1],
  858.                 s = q[m][2],
  859.                 qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  860.             0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  861.             0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  862.             400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  863.             300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  864.             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));
  865.             0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  866.                 b(h - 1, s + 1, x + Math.SQRT2));
  867.             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));
  868.             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))
  869.         }
  870.     }
  871.     a.ctx.putImageData(a.img, 0, 0)
  872. }
  873. var y, a, ia = 0,
  874.     v = 0,
  875.     w = 0,
  876.     B = 0,
  877.     C = 0,
  878.     k = 0,
  879.     q = 0,
  880.     J = -1,
  881.     K = -1,
  882.     M = null,
  883.     H = null,
  884.     P = new Image;
  885. P.src = "img/cursor.png";
  886. var Ia = P,
  887.     D = -1 != A.location.search.indexOf("editor"),
  888.     I = [],
  889.     O = [],
  890.     t = 0,
  891.     ca = 0,
  892.     u = null,
  893.     ha = -1,
  894.     F = {},
  895.     aa = 0,
  896.     ja = !1,
  897.     Y = !1,
  898.     R = 0,
  899.     S = 0,
  900.     da = 0,
  901.     X = !1,
  902.     L = !D && !0,
  903.     T = new Uint8Array(12E4),
  904.     r = [],
  905.     N = [];
  906. Array.prototype.remove =
  907.     function(a) {
  908.         a = this.indexOf(a);
  909.         return -1 != a ? (this.splice(a, 1), !0) : !1
  910.     };
  911. var G = 0;
  912. ka.prototype = {
  913.     oldX: 0,
  914.     oldY: 0,
  915.     newX: 0,
  916.     newY: 0,
  917.     time: 0,
  918.     getX: function() {
  919.         var a = this.newX - this.oldX,
  920.             b = (t - this.time) / 100,
  921.             b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  922.         return this.oldX + b * a
  923.     },
  924.     getY: function() {
  925.         var a = this.newY - this.oldY,
  926.             b = (t - this.time) / 100,
  927.             b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  928.         return this.oldY + b * a
  929.     }
  930. };
  931.  
  932. var za = new Uint8Array(12E4);
  933. Array.prototype.remove = function(a) {
  934.     a = this.indexOf(a);
  935.     return -1 != a ? (this.splice(a, 1), !0) : !1
  936. };
  937.  
  938. var message = new String();
  939. function handleKeypress(e) {
  940.     if ((e.keyCode >= 39 && e.keyCode <= 41) ||
  941.          e.keyCode == 44 || e.keyCode == 46 ||
  942.         (e.keyCode >= 48 && e.keyCode <= 59) ||
  943.         (e.keyCode >= 65 && e.keyCode <= 90) ||
  944.         (e.keyCode >= 97 && e.keyCode <= 122) ||
  945.          e.keyCode == 32 || e.keyCode == 63) {
  946.         message = message.concat(String.fromCharCode(e.keyCode));
  947.         return;
  948.     }
  949.     switch(e.keyCode) {
  950.         case 13:
  951.             drawWord(message, posX, posY);
  952.             message = "";
  953.             e.preventDefault();
  954.             break;    
  955.         default:
  956.             return;
  957.     }
  958. }
  959.  
  960. function handleKeydown(e) {
  961.     if (e.keyCode == 8 || e.keyCode == 9 || (e.keyCode >= 112 && e.keyCode <= 122)) {
  962.         e.preventDefault();
  963.     }
  964.     if (e.keyCode == 8) {
  965.         if (message.length > 0) {
  966.             message = message.substring(0, message.length - 1);
  967.         }
  968.     }
  969.     switch(e.keyCode) {
  970.         case 112: // F1
  971.             movementEnabled = !movementEnabled;
  972.             break;
  973.         case 113: // F2
  974.             auraEnabled = !auraEnabled;
  975.             break;
  976.         case 114: // F3
  977.             drawImage(0, posX, posY);
  978.             break;
  979.         case 115: // F4
  980.             drawImage(1, posX, posY);
  981.             break;
  982.         case 116: // F5
  983.             drawImage(2, posX, posY);
  984.             break;
  985.         case 117: // F6
  986.             drawImage(3, posX, posY);
  987.             break;
  988.         case 118: // F7
  989.             drawWord("cursors.me", posX, posY);
  990.             break;
  991.         case 119: // F8
  992.            
  993.             break;
  994.         case 120: // F9
  995.            
  996.             break;
  997.         case 121: // F10
  998.            
  999.             break;
  1000.         case 122: // F11
  1001.             showHelp = !showHelp;
  1002.             break;
  1003.         default:
  1004.             return;
  1005.     }
  1006. }
  1007.  
  1008. function drawAura(x, y) {
  1009.     var dt = 360/(1000/40)/2;
  1010.     if (u != null && u.readyState == WebSocket.OPEN) {
  1011.         var g = new ArrayBuffer(9),
  1012.             e = new DataView(g);
  1013.         e.setUint8(0, 3);
  1014.         e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  1015.         e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  1016.         e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  1017.         e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  1018.         u.Send(g)
  1019.     }
  1020.  
  1021.     auraTime += dt;
  1022. }
  1023.  
  1024. function drawImage(ind, x, y) {
  1025.     if (!imgData[ind]) return;
  1026.     for (var i = 0; i < imgData[ind].length; i++) {
  1027.         var g = new ArrayBuffer(9),
  1028.             e = new DataView(g);
  1029.         e.setUint8(0, 3);
  1030.         e.setUint16(1, x+imgData[ind][i][1]*imageScale, !0);
  1031.         e.setUint16(3, y+imgData[ind][i][0]*imageScale, !0);
  1032.         e.setUint16(5, x+imgData[ind][i][3]*imageScale, !0);
  1033.         e.setUint16(7, y+imgData[ind][i][2]*imageScale, !0);
  1034.         u.Send(g);
  1035.     }
  1036. }
  1037.  
  1038. function degToRad(deg) {
  1039.     return deg * (Math.PI / 180);
  1040. }
  1041.  
  1042. function radToDeg(rad) {
  1043.     return rad * (180 / Math.PI);
  1044. }
  1045.  
  1046. function drawLetter(a, x, y) {
  1047.     var letter;
  1048.     var capital = 1;
  1049.     var shift = 0;
  1050.     if (alphabet.hasOwnProperty(a)) {
  1051.         letter = alphabet[a];
  1052.     } else if (a + 32 >= 97 && a + 32 <= 122) {
  1053.         capital = 1.5;
  1054.         shift = -2;
  1055.         letter = alphabet[a + 32];
  1056.     } else return;
  1057.     for (var i = 0; i < letter.length; i++) {
  1058.         var g = new ArrayBuffer(9),
  1059.             e = new DataView(g);
  1060.         e.setUint8(0, 3);
  1061.         e.setUint16(1, x+letter[i][1]*fontSize, !0);
  1062.         e.setUint16(3, y+letter[i][0]*fontSize*capital + shift, !0);
  1063.         e.setUint16(5, x+letter[i][3]*fontSize, !0);
  1064.         e.setUint16(7, y+letter[i][2]*fontSize*capital + shift, !0);
  1065.         u.Send(g);
  1066.     }
  1067. }
  1068.  
  1069. function drawWord(s, x, y) {
  1070.     if (s == null) return;
  1071.     setTimeout(function () {
  1072.         if (!z(Math.round(x+fontSize*kerning), Math.round(y)))  {
  1073.             drawLetter(s.charCodeAt(0), x, y);
  1074.             if (s.length > 0) drawWord(s.substring(1, s.length), x+fontSize*kerning, y);
  1075.         }
  1076.     }, 20);
  1077. }
  1078.  
  1079. WebSocket.prototype.Send = function(frm) {
  1080.     if (u != null && u.readyState == WebSocket.OPEN) {
  1081.         if (Throttler.check(frm)) this.send(frm);
  1082.     }
  1083. };
  1084. var Throttler = {
  1085.     rate: 3,
  1086.     per: 150,
  1087.     storage: [],
  1088.     allowed: 3,
  1089.     lastFrameAt: 0,
  1090.     sendOut: function() {
  1091.         if (this.storage.length != 0) {
  1092.             u.Send(this.storage.shift());
  1093.         }
  1094.     },
  1095.     check: function(frm) {
  1096.         var now = Date.now();
  1097.         var allowance = this.allowed;
  1098.         var timeDiff = now - this.lastFrameAt;
  1099.         this.lastFrameAt = now;
  1100.         allowance += timeDiff*(this.rate/this.per);
  1101.         if (allowance > this.rate) allowance = this.rate;
  1102.         this.allowed = allowance;
  1103.         if (this.allowed < 1) {
  1104.             if (this.storage.length < 200)  {
  1105.                 var dv = new DataView(frm);
  1106.                 if (dv.getUint8(0) == 3) this.storage.push(frm);
  1107.             }
  1108.             return false;
  1109.         }
  1110.         this.allowed -= 1;
  1111.         return true;
  1112.     }
  1113. };
  1114.  
  1115. function connect() {
  1116.     if (m28n.findServerPreference) {
  1117.          if (!u) m28n.findServerPreference("cursors", function(e,a){
  1118.             if (e||0 == a.length) {
  1119.                 setTimeout(self.connect, 1E3);
  1120.             } else {
  1121.                 var ipv4 = a[0].ipv4;
  1122.                 var ipv6 = a[0].ipv6;
  1123.                 var port = a[0].port;
  1124.                 port = 2828;
  1125.                 u = new WebSocket("ws://" + (ipv4 || "[" + ipv6 + "]") + ":" + port);
  1126.                 setHandlers();
  1127.             }
  1128.         });
  1129.     } else {
  1130.         if (!u) u = new WebSocket("ws://s1.cursors.io:443/");
  1131.         setHandlers();
  1132.     }
  1133.     function setHandlers() {
  1134.         u.binaryType = "arraybuffer";
  1135.         u.onopen = Aa, u.onmessage = Ga, u.onclose = Ba, u.onerror = Ca;
  1136.     }
  1137. }
  1138.  
  1139. var messageDisplay;
  1140. function doit() {
  1141.     document.body.innerHTML += '<div id="messageDisplay"></div>';
  1142.     messageDisplay = document.getElementById("messageDisplay");
  1143.  
  1144.     y = E.getElementById("canvas");
  1145.     a = y.getContext("2d");
  1146.    
  1147.     try {
  1148.         A.top.location.origin != A.location.origin && ba()
  1149.     } catch (f) {
  1150.         ba()
  1151.     }
  1152.     y.onmousemove = ua;
  1153.     y.onmousedown = va;
  1154.     y.onmouseup = xa;
  1155.     M = E.getElementById("noCursorLock");
  1156.     H = E.getElementById("noDrawings");
  1157.     null != localStorage && (Ma(), M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  1158.     A.onbeforeunload = ya;
  1159.     y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  1160.     y.style.cursor = "none";
  1161.     D || connect();
  1162.     setInterval(Q, 50);
  1163.     setInterval(Ja, 40);
  1164.     A.requestAnimationFrame(ma)
  1165.  
  1166.     document.onkeypress = handleKeypress;
  1167.     document.onkeydown = handleKeydown;
  1168. }
  1169. doit();
  1170. /*                                                      
  1171.    ___ _   _ _ __ ___  ___  _ __ ___   _ __ ___   ___  
  1172.   / __| | | | '__/ __|/ _ \| '__/ __| | '_ ` _ \ / _ \
  1173.  | (__| |_| | |  \__ \ (_) | |  \__ \_| | | | | |  __/
  1174.   \___|\__,_|_|  |___/\___/|_|  |___(_)_| |_| |_|\___|
  1175.                                                        
  1176.        it was all me do,it use for draw
  1177.               made by icefireAlan,vnx,_Locked [youtuber],algiuxas
  1178.              
  1179.     How to use:
  1180.     -> To type: type message and hit enter;
  1181.     -> To move your cursor only when clicking: press F1
  1182.        Use it to pass red walls levels ;)
  1183.     -> To move your cursor normally: press F1 again
  1184.     -> To draw a circle: press F2
  1185.     -> To stop drawing a circle: press F2 again
  1186.     -> To draw different images: press F3 - F7 keys
  1187.     -> To show this help: press F11
  1188. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement