Advertisement
Guest User

squirtle cursors.io hack MOD

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