// ==UserScript== // @name XZXZXZ // @namespace http://tampermonkey.net/ // @version 2024-07-16 // @description try to take over the world! // @author You // @match https://agarj.com/ // @icon https://www.google.com/s2/favicons?sz=64&domain=agarj.com // @grant none // ==/UserScript== var port = 1001 , CONNECTION_URL = "agarj.com/" + port , CONNECTION_URL_FIRST = "agarj.com/" , chatConfig = { typeAll: 0, typeTeam: 1, typeClan: 2, typeMegaphone: 3 } , chatType = chatConfig.typeAll , chatSize = 19; let chatFont = "Copperplate" , gameFont = "Copperplate" , LIGHT_THEME_COLOR = { txtScore: { text: lang.text_1, color: "#000000" }, txtMax: { text: lang.text_2, color: "" }, txtCellsLength: { text: lang.text_3, color: "" }, txtShare: { text: lang.text_4, color: "#000000" }, txtGold: { text: "Gold", color: "#ffffff" }, txtPrize: { text: lang.text_11, color: "" }, txtWinnerNickName: { text: lang.leaderBoard_winner_nick, color: "#FFFF00" }, txtPing: { text: "Ping", color: "#000000" }, txtFps: { text: "FPS", color: "#000000" }, txtSpectatorCount: { text: lang.izleyici, color: "#000000" }, txtServerName: { text: lang.serverName, color: "#0000FF" }, txtRecordHolder: { text: lang.record, color: "#FFFF00" }, txtTopMessage: { text: lang.topMessage, color: "#00AA00" } }; const DEFAULT_LIGHT_THEME_COLOR = JSON.stringify(LIGHT_THEME_COLOR); let DARK_THEME_COLOR = { txtScore: { text: lang.text_1, color: "#FFFFFF" }, txtMax: { text: lang.text_2, color: "ffff00" }, txtCellsLength: { text: lang.text_3, color: "" }, txtShare: { text: lang.text_4, color: "#AAAAAA" }, txtGold: { text: "Gold", color: "#FFFF00" }, txtPrize: { text: lang.text_11, color: "" }, txtWinnerNickName: { text: lang.leaderBoard_winner_nick, color: "#FFFF00" }, txtPing: { text: "oc berat", color: "#ffffff" }, txtFps: { text: "FPS", color: "#ffffff" }, txtSpectatorCount: { text: lang.izleyici, color: "#ffffff" }, txtServerName: { text: lang.serverName, color: "#ffffff" }, txtRecordHolder: { text: lang.record, color: "#ffffff" }, txtTopMessage: { text: lang.topMessage, color: "#ffffff" } }; const DEFAULT_DARK_THEME_COLOR = JSON.stringify(DARK_THEME_COLOR) , isJSON = e=>{ try { return JSON.parse(e), !0 } catch (t) { return !1 } } ; function resetColorSettings(e) { if ("light" === e) { for (let t in LIGHT_THEME_COLOR = JSON.parse(DEFAULT_LIGHT_THEME_COLOR)) $(`#light_${t}`).val(LIGHT_THEME_COLOR[t].color); localStorage.lightColors = JSON.stringify(LIGHT_THEME_COLOR), console.log("G\xfcnd\xfcz tema ayarları sıfırlandı.") } else if ("dark" === e) { for (let i in DARK_THEME_COLOR = JSON.parse(DEFAULT_DARK_THEME_COLOR)) $(`#dark_${i}`).val(DARK_THEME_COLOR[i].color); localStorage.darkColors = JSON.stringify(DARK_THEME_COLOR), console.log("Karanlık tema ayarları sıfırlandı.") } else console.log("Ge\xe7ersiz tema.") } function updateLightColors(e, t) { LIGHT_THEME_COLOR[e].color = t, localStorage.lightColors = JSON.stringify(LIGHT_THEME_COLOR) } function updateDarkColors(e, t) { console.log(e, t), DARK_THEME_COLOR[e].color = t, localStorage.darkColors = JSON.stringify(DARK_THEME_COLOR) } $(document).ready(function() { function e(e, t) { let i = localStorage.getItem(e); if (i) try { let n = JSON.parse(i); if (Object.keys(t).every(e=>n.hasOwnProperty(e))) return n } catch (o) { console.error("Error parsing stored colors:", o) } return t } LIGHT_THEME_COLOR = e("lightColors", LIGHT_THEME_COLOR), DARK_THEME_COLOR = e("darkColors", DARK_THEME_COLOR), $.each(LIGHT_THEME_COLOR, function(e, t) { let i = `
`; $("#lightColors").append(i) }), $("#lightColors").append(`
`), $.each(DARK_THEME_COLOR, function(e, t) { let i = `
`; $("#darkColors").append(i) }), $("#darkColors").append(`
`) }); var point2 = function(e, t) { this.x = e, this.y = t }; point2.prototype = { reset: function(e, t) { return this.x = e, this.y = t, this }, set: function(e, t) { this.x = e, this.y = t }, setFrom: function(e) { this.x = e.x, this.y = e.y }, subtract: function(e) { this.x -= e.x, this.y -= e.y }, copyFrom: function(e) { this.x = e.x, this.y = e.y }, minusEq: function(e) { return this.x -= e.x, this.y -= e.y, this } }; var get_ping = 0 , last_ping = 0; !function(e, t) { console.log("ready"), console.log(t), e.setserver = function(e) { if (e != ep && (CONNECTION_URL = e, ep = e, A)) { A.onopen = null, A.onmessage = null, A.onclose = null; try { A.close() } catch (t) {} A = null } } , e.resetChatButtons = function(e) { $("#chatAll").css("font-size", "14px"), $("#chatTeam").css("font-size", "255px"), $("#chatClan").css("font-size", "14px"), $("#chatMegaphone").css("font-size", "14px") } , e.setChatSize = function(e) { chatSize = e, localStorage.chatSize = e } , e.setChatFont = function(e) { chatFont = e, localStorage.chatFont = e } , e.setGameFont = function(e) { gameFont = e, localStorage.gameFont = e } , e.setChatType = function(e) { e != chatType && (resetChatButtons(), e == chatConfig.typeAll ? $("#chatAll").css("font-size", "18px") : e == chatConfig.typeTeam ? $("#chatTeam").css("font-size", "18px") : e == chatConfig.typeClan ? $("#chatClan").css("font-size", "18px") : e == chatConfig.typeClan ? $("#chatClan").css("font-size", "18px") : e == chatConfig.typeMegaphone && $("#chatMegaphone").css("font-size", "18px"), chatType = e) } , e.reportWindow = ()=>{ $("#player").empty(), $.ajax({ url: "/" + language + "/server-players", type: "POST", dataType: "JSON", data: { server: this.gameName }, success: function(e) { 0 == e.length && $("#player").append(``), Object.entries(e).forEach(e=>{ var [t,i] = e; $("#player").append(``) } ), $("#reportPlayerWindow").show() } }) } , e.report = ()=>{ let e = $("#player option:selected").val(); if (0 != e) { if (0 == W.filter(t=>t.userId == e).length) { $("#reportSent").show().text(lang.player_chat_not_found); return } var t = to(5); t.setUint8(0, 41), t.setUint32(1, e, !0), ts(t), $("#player").empty(), $("#reportSent").show().text(lang.report_sent), console.log("Reported: " + e) } } , e._gmActions = function(e) { switch (e) { case 1: !0 == isAdmin && ($("#_changeCountdown").val() > 0 && 60 >= $("#_changeCountdown").val() ? (t_("/countdown " + $("#_changeCountdown").val()), $("#_changeCountdown").val("")) : alert("ge\xe7erli bir değer gir")); break; case 2: (!0 == isAdmin || !0 == isModerator) && !0 == confirm(this.gameName + " Galibiyetini sıfırlamaya emin misin?") && t_("/punishwin"); break; case 3: !0 == isAdmin && (t_("/randomvirus"), alert("\xdcretildi")); break; case 4: !0 == isAdmin && (t_("/clearchat"), alert("Silindi")); break; case 5: !0 == isAdmin && (t_("/clearchat all"), alert("T\xfcm chat silindi")); break; case 6: !0 == isAdmin && ($("#_deleteLastMessage").val() > 0 && 15 >= $("#_deleteLastMessage").val() && W.length > $("#_deleteLastMessage").val() ? (t_("/clearchat " + (W.length - $("#_deleteLastMessage").val())), alert("Son " + $("#_deleteLastMessage").val() + " mesaj silindi")) : alert("ge\xe7erli bir değer gir")); break; case 7: !0 == isAdmin && ("CW-FFA" == this.gameName || "CW-GSZ" == this.gameName ? (t_("/cwstart"), alert("Klan Savaşı Başlatıldı")) : alert("Sadece CW Odalarında klan savaşı başlatabilirsin")); break; case 8: if (!0 == isAdmin && 0 == e6) { var t = 60 * $("#_autoGoldSpendMinute").val(); t > this.countdown && (t = this.countdown - 2), t_("/autogoldspend " + t) } break; case 9: !0 == isAdmin && 1 == e6 && t_("/autogoldspend 0"); break; case 10: !0 == isAdmin && t_("/bonusprize " + Number($("#_bonusGoldPrize").val())); break; case 11: !0 == isAdmin && (t_("/openwar"), alert("WAR-1 başlatıldı.")) } } ; var i, n, o, s, a, r, l, h = "createTouch"in document, c = [], u = -1, f = new point2(0,0), m = new point2(0,0), g = new point2(0,0), _ = 0, x = 0, p = 12.345, y = 100, v = 20, T = "!", F = 0, S = 0, k = 0, w = 0, E = 0, C = !1, b = (e.location.protocol, null), A = null, N = 0, I = 0, O = [], R = [], z = {}, L = [], P = [], U = [], B = "?", M = "?", W = [], H = 0, D = 0, G = -1, K = -1, Y = 0, V = 0, X = 0, Z = 0, q = 1e4, j = 1e4, J = 1, Q = !0, ee = !0, et = !1, ei = !1, en = 0, eo = 0, es = !1, ea = !1, er = !1, el = !1, e$ = !1, eh = !1, ec = !1, eu = !1, ed = .4, ef = !1, em = !1, eg = N = ~~((X + q) / 2), e_ = I = ~~((Z + j) / 2), ex = 1, ep = "", ey = null, ev = !0, e8 = !1, eT = 0, e0 = 0, eF = 0, eS = 0, ek = .5, ew = ("ontouchstart"in e && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), !1); document.createElement("canvas"), e.isSpectating = !1; var eE = [] , eC = [] , eb = Date.now() , eA = 0 , eN = 0 , eI = 0 , e3 = 0 , eO = 0 , eR = 0 , e1 = 0 , ez = 0 , e2 = "" , e4 = "" , eL = 0 , eP = 0 , eU = 0 , eB = 0 , e6 = 0 , eM = 0 , eW = -1 , eH = 0 , eD = 0 , eG = 0 , e7 = 0 , eK = 0 , eY = 0 , e5 = 0; function eV() { var e = document.getElementsByTagName("html")[0].getAttribute("lang"); switch (e) { case "tr": default: return "tr"; case "en": return "en"; case "es": return "es"; case "de": return "de" } } function eX(e, t) { document.getElementById("canvas").style.cursor = "default"; for (var i = 0; i < W.length; i++) if (0 != W[i].userId && void 0 != W[i].userId && e >= W[i].name_x && e <= W[i].name_x + W[i].name_w && t <= W[i].name_y && t >= W[i].name_y - W[i].name_h) { if (0 != chatType && W[i].chatType != chatType) continue; document.getElementById("canvas").style.cursor = "pointer"; break } } function e9(e, t) { return e >= eA && e <= eA + 50 && t >= eN && t <= eN + 50 ? (ti("fast"), document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(), !0) : e >= eI && e <= eI + 50 && t >= e3 && t <= e3 + 50 ? (tp(36), !0) : e >= eO && e <= eO + 50 && t >= eR && t <= eR + 50 ? (tp(22), !0) : !!(e >= e1) && !!(e <= e1 + 50) && !!(t >= ez) && !!(t <= ez + 50) && (tp(17), !0) } function eZ() { return !0 == ("ontouchstart"in window || window.DocumentTouch && document instanceof DocumentTouch) } function eq(e) { h || (h = !0); for (var t = 0; t < e.changedTouches.length; t++) { var i = e.changedTouches[t] , n = !1; !0 == eu && (n = e9(i.clientX, i.clientY)), !1 == n && u < 0 && (u = i.identifier, m.reset(i.clientX, i.clientY), f.copyFrom(m), g.reset(0, 0)) } c = e.touches } function ej(e) { e.preventDefault(); for (var t = 0; t < e.changedTouches.length; t++) { var i = e.changedTouches[t]; i.clientX >= eI && i.clientX <= eI + 50 && i.clientY >= e3 && i.clientY <= e3 + 50 ? tp(36) : i.clientX >= eO && i.clientX <= eO + 50 && i.clientY >= eR && i.clientY <= eR + 50 && tp(22), u == i.identifier && (f.reset(i.clientX, i.clientY), g.copyFrom(f), g.minusEq(m), H = 3 * g.x + r / 2, D = 3 * g.y + l / 2, te(), td()) } c = e.touches } function eJ(e) { c = e.touches; for (var t = 0; t < e.changedTouches.length; t++) { var i = e.changedTouches[t]; if (i.clientX >= eI && i.clientX <= eI + 50 && i.clientY >= e3 && i.clientY <= e3 + 50 ? tp(38) : i.clientX >= eO && i.clientX <= eO + 50 && i.clientY >= eR && i.clientY <= eR + 50 && tp(23), u == i.identifier) { u = -1, g.reset(0, 0); break } } } function eQ(e) { !0 == eh ? (.05 > (ek *= Math.pow(.9, -(e.wheelDelta / 60) || e.detail || 0)) && (ek = .05), ek > 4 / J && (ek = 4 / J)) : (.5 > (ek *= Math.pow(.9, -(e.wheelDelta / 60) || e.detail || 0)) && (ek = .5), ek > 4 / J && (ek = 4 / J)) } function te() { G = (H - r / 2) / J + N, K = (D - l / 2) / J + I } function tt() { ev = !1, t("#overlays").hide() } function ti(e) { ev = !0, t("#overlays").fadeIn(e) } function tn() { sid = Math.floor(1 + 1e6 * Math.random()), wsUrl = "wss://" + CONNECTION_URL, e6 = 0, eM = 0, O = [], R = [], z = {}, L = [], P = [], U = [], B = "?", this.countdown = 3600, o = ey = null, eo = 0, en = 0, eE = [], eC = [], (A = new WebSocket(wsUrl)).binaryType = "arraybuffer", A.onopen = tl, A.onmessage = th, A.onclose = t$, A.onerror = function(e) { console.log("socket error: ", e) } } function to(e) { return new DataView(new ArrayBuffer(e)) } function ts(e) { A.send(e.buffer) } function ta() { (function e() { if (tx()) { var t = to(1); t.setUint8(0, 27), ts(t) } } )(), function e() { var t = document.getElementById("myTeam").value; if (tx() && null != t && t.length > 0) { var i = to(1 + 2 * t.length) , n = 0; i.setUint8(n++, 26); for (var o = 0; o < t.length; ++o) { var s = t.charCodeAt(o); i.setUint16(n, s, !0), n += 2 } ts(i) } }(), function e() { var t = document.getElementById("txtSkin").value.toLowerCase(); if (tx() && null != t) { var i = to(1 + 2 * t.length); i.setUint8(0, 2); for (var n = 0; n < t.length; ++n) i.setUint16(1 + 2 * n, t.charCodeAt(n), !0); ts(i) } }() } function tr() { document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement || (document.documentElement.requestFullscreen ? document.documentElement.requestFullscreen() : document.documentElement.msRequestFullscreen ? document.documentElement.msRequestFullscreen() : document.documentElement.mozRequestFullScreen ? document.documentElement.mozRequestFullScreen() : document.documentElement.webkitRequestFullscreen && document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)) } function tl() { if (console.log("ws open"), W = [], tx()) { var t = to(5); t.setUint8(0, 255), t.setUint32(1, 4747, !0), ts(t), !0 == e.isSpectating ? tp(1) : (tf(), ta(), sendZoom(eh)), eZ() && tr(), fetch("/" + language + "/server-get-clan-id").then(e=>e.json()).then(e=>{ e5 = e.clanId, console.log("clanId: " + e.clanId) } ) } } function t$(t) { console.log("closed:", t), console.log("ws close"), A = null, ti("fast"), e.isSpectating = !1 } function th(e) { try { !function e(t) { function i() { for (var e, i = ""; 0 != (e = t.getUint16(o, !0)); ) o += 2, i += String.fromCharCode(e); return o += 2, i } var n, o = 0, s = !1; switch (240 == t.getUint8(o) && (o += 5), t.getUint8(o++)) { case 16: !function e(t, i) { V = +new Date; var n = Math.random(); ei = !1; var o = t.getUint16(i, !0); for (i += 2, r = 0; r < o; ++r) { var s = z[t.getUint32(i, !0)] , a = z[t.getUint32(i + 4, !0)]; i += 8, s && a && (a.destroy(), a.ox = a.x, a.oy = a.y, a.oSize = a.size, a.nx = s.x, a.ny = s.y, a.nSize = a.size, a.updateTime = V) } for (var r = 0; ; ) { var l = t.getUint32(i, !0); if (i += 4, 0 == l) break; ++r; var h = t.getUint32(i, !0); i += 4; var c, u, f = t.getInt16(i, !0); i += 2, u = t.getInt16(i, !0), i += 2, c = t.getInt16(i, !0), i += 2; for (var m = t.getUint8(i++), g = t.getUint8(i++), _ = t.getUint8(i++), x = (m << 16 | g << 8 | _).toString(16); 6 > x.length; ) x = "0" + x; var p = "#" + x , y = t.getUint8(i++) , v = !!(1 & y) , T = !!(16 & y); 2 & y && (i += 4), 4 & y && (i += 8), 8 & y && (i += 16); for (var F, b = ""; F = t.getUint8(i, !0), i++, 0 != F; ) b += String.fromCharCode(F); for (var A, P = ""; A = t.getUint16(i, !0), i += 2, 0 != A; ) P += String.fromCharCode(A); var U = null; z.hasOwnProperty(l) ? ((U = z[l]).updatePos(), U.ox = U.x, U.oy = U.y, U.oSize = U.size, U.color = p) : (U = new tS(l,f,u,c,p,P), L.push(U), z[l] = U, U.ka = f, U.la = u), U.isVirus = v, U.isAgitated = T, U.nx = f, U.ny = u, U.nSize = c, U.updateCode = n, U.updateTime = V, U.flag = y, P && U.setName(P), U.uId = h, U.lastSkinName != b && (U.setSkinName(b), U.lastSkinName = b), -1 != O.indexOf(l) && -1 == R.indexOf(U) && (document.getElementById("overlays").style.display = "none", R.push(U), 1 == R.length && (tu(), N = U.x, I = U.y, C = !0)) } for (o = t.getUint32(i, !0), i += 4, r = 0; r < o; r++) { var B = t.getUint32(i, !0); i += 4, null != (U = z[B]) && U.destroy() } ei && 0 == R.length && ti("slow"), 0 == R.length && !0 == C && (tu(), w = S, E = k) }(t, o); break; case 17: eg = t.getFloat32(o, !0), o += 4, e_ = t.getFloat32(o, !0), o += 4, ex = t.getFloat32(o, !0), o += 4; break; case 20: R = [], O = []; break; case 21: eT = t.getInt16(o, !0), o += 2, e0 = t.getInt16(o, !0), o += 2, e8 || (e8 = !0, eF = eT, eS = e0); break; case 32: O.push(t.getUint32(o, !0)), o += 4; break; case 48: s = !0, ew = !0; break; case 49: s || (ew = !1), ey = null; var a = t.getUint32(o, !0); for (o += 4, U = [], c = 0; c < a; ++c) { var r = t.getUint32(o, !0); o += 4; var l = t.getUint32(o, !0); o += 4, U.push({ id: r, clanId: l, name: i() }) } tF(); break; case 50: ey = []; var h = t.getUint32(o, !0); o += 4; for (var c = 0; c < h; ++c) ey.push(t.getFloat32(o, !0)), o += 4; tF(); break; case 64: X = t.getFloat64(o, !0), o += 8, Z = t.getFloat64(o, !0), o += 8, q = t.getFloat64(o, !0), o += 8, j = t.getFloat64(o, !0), o += 8, eg = (q + X) / 2, e_ = (j + Z) / 2, ex = 1, 0 == R.length && (N = eg, I = e_, J = ex); break; case 87: for (M = ""; 0 != (n = t.getUint16(o, !0)); ) o += 2, M += String.fromCharCode(n); "Klan Savaşları" == M && (M = lang.cwText); break; case 88: for (eC = []; o < t.byteLength; ) { var u = t.getUint16(o, !0); o += 2; var f = t.getUint16(o, !0); o += 2, eC.push({ x: u, y: f }) } break; case 90: for (eE = []; o < t.byteLength; ) { var u = t.getUint16(o, !0); o += 2; var f = t.getUint16(o, !0); o += 2, eE.push({ x: u, y: f }) } break; case 92: for (this.gameName = ""; 0 != (n = t.getUint16(o, !0)); ) o += 2, this.gameName += String.fromCharCode(n); break; case 94: eL = t.getInt32(o, !0); break; case 96: this.countdown = t.getUint16(o, !0); break; case 97: for (B = ""; 0 != (n = t.getUint16(o, !0)); ) o += 2, B += String.fromCharCode(n); break; case 99: !function e(t, i) { function n() { for (var e, n = ""; 0 != (e = t.getUint16(i, !0)); ) i += 2, n += String.fromCharCode(e); return i += 2, n } var o = t.getUint8(i++); 2 & o && (i += 4), 4 & o && (i += 8), 8 & o && (i += 16); var s = t.getUint8(i++) , a = t.getUint8(i++) , r = (s << 16 | a << 8 | t.getUint8(i++)).toString(16) , l = t.getUint32(i, !0); i += 4; var h = t.getUint32(i, !0); for (i += 4; r.length > 6; ) r = "0" + r; r = "#" + r, W.push({ chatType: l, userId: h, name: n(), color: r, message: n(), time: Date.now(), name_x: 0, name_y: 0, name_w: 0, name_h: 0, msg_x: 0, msg_y: 0, msg_w: 0, msg_h: 0 }), W.length > 13 && W.shift(), eX(0, 0) }(t, o); break; case 101: for (e2 = ""; 0 != (n = t.getUint16(o, !0)); ) o += 2, e2 += String.fromCharCode(n); e2 = tc(e2); break; case 102: for (e4 = ""; 0 != (n = t.getUint16(o, !0)); ) o += 2, e4 += String.fromCharCode(n); e4 = tc(e4); break; case 103: eK = t.getInt32(o, !0); break; case 104: switch (serverMessage = t.getInt32(o, !0), o += 2, serverMessage) { case 0: var m = document.getElementById("nick").value , t = to(2 * m.length + 1); t.setUint8(0, 3); for (var c = 0; c < m.length; ++c) t.setUint16(1 + 2 * c, m.charCodeAt(c), !0); ts(t); break; case 1: last_ping = Date.now() - get_ping; break; case 2: $("#enterPriceConfirmWindow").show(), $("#enterPriceLine1").text($("#enterPriceLine1").text().replace("[GOLD]", eU.dotFormat())); break; case 3: e6 = 1, o += 2, eM = t.getInt32(o, !0); break; case 4: e6 = 0, eM = 0 } break; case 105: switch (errorMessage = t.getInt32(o, !0)) { case 0: user_logout(); break; case 1: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_2); break; case 2: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_4); break; case 3: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_5); break; case 4: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_6); break; case 8: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_9); break; case 9: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_8); break; case 10: $("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_10) } break; case 106: eY = t.getInt32(o, !0); break; case 111: case 111: eW = t.getInt32(o, !0), o += 4, eH = t.getInt32(o, !0); break; case 112: eB = t.getInt32(o, !0), console.log("VS Prize: " + eB); break; case 113: eU = t.getInt32(o, !0), console.log("VS Price: " + eU) } }(new DataView(e.data)) } catch (t) {} } function tc(e) { if (!e.startsWith("trans ")) return e; var t = e.substring(6).split(","); if ("1" == t[0]) { var i = t[1] , n = Number(t[2]).dotFormat() , o = t.slice(3).join(" "); return function e(t, i, n) { switch (eV()) { case "tr": break; case "en": return t + " WINNER IS " + n + " SCORE " + i; case "es": return t + " GANADOR ES " + n + " PUNTUACI\xc3“N " + i; case "de": return t + " GEWINNER " + n + " ERGEBNIS " + i } return t + " KAZANAN " + n + " SKOR " + i }(i, n, o) } if ("2" == t[0]) { var i = t[1] , n = Number(t[2]).dotFormat() , o = t.slice(3).join(" "); return function e(t, i, n) { switch (eV()) { case "tr": break; case "en": return t + " NEW RECORD! " + n + " SCORE " + i; case "es": return t + " NEUVO RECORD! " + n + " PUNTUACI\xc3“N " + i; case "de": return t + " NEUER EINTRAG! " + n + " ERGEBNIS " + i } return t + " REKOR! " + n + " SKOR " + i }(i, n, o) } if ("3" != t[0]) return e; var s, i = t[1]; return function e(t, i, n) { switch (eV()) { case "tr": break; case "en": return "CLAN WAR " + n + " WON! CONGRATULATIONS"; case "es": return "CLAN WAR " + n + " GAN\xd3! FELICITACIONES"; case "de": return "CLAN WAR " + ClanName + " GEWONNEN! GL\xdcCKW\xdcNSCHE" } return "KLAN SAVAŞINI " + n + " KAZANDI! TEBRİKLER" }(i, Number(t[2]).dotFormat(), t.slice(3).join(" ")) } function tu() { eD = 0, eG = 0, e7 = 0 } function td() { var e; if (tx() && 0 == eD) { var t = D - l / 2; 64 <= (e = H - r / 2) * e + t * t && !(.01 > Math.abs(tw - G) && .01 > Math.abs(tE - K)) && (tw = G, tE = K, (e = to(21)).setUint8(0, 16), e.setFloat64(1, G, !0), e.setFloat64(9, K, !0), e.setUint32(17, 0, !0), ts(e)) } } function tf() { if (tx() && null != localStorage.userToken && 44 == localStorage.userToken.length) { var e = to(2 * localStorage.userToken.length + 1); e.setUint8(0, 0); for (var t = 0; t < localStorage.userToken.length; ++t) e.setUint16(1 + 2 * t, localStorage.userToken.charCodeAt(t), !0); ts(e) } } function tm(e) { var t = "" , i = Math.floor(e / 60); i < 10 && (t += "0"), t += i + ":"; var n = e % 60; return n < 10 && (t += "0"), t += n } function tg(e) { return e > 1e6 ? (e / 1e6).toFixed(1) + "M" : e > 1e3 ? (e / 1e3).toFixed(1) + "k" : e.toString() } function t_(e) { if (tx() && e.length < 200 && e.length > 0) { var t = to(2 + 2 * e.length) , i = 0; t.setUint8(i++, 99), t.setUint8(i++, 0); for (var n = 0; n < e.length; ++n) t.setUint16(i, e.charCodeAt(n), !0), i += 2; ts(t) } } function tx() { return null != A && A.readyState == A.OPEN } function tp(e) { if (tx()) { var t = to(1); t.setUint8(0, e), ts(t) } } function ty() { tT(), e.requestAnimationFrame(ty) } function tv() { window.scrollTo(0, 0), r = e.innerWidth, l = e.innerHeight, i.width = r, i.height = l; var n = t("#helloDialog"); n.css("transform", "none"); var o = n.height(); o > l / 1.1 ? n.css("transform", "translate(-50%, -50%) scale(" + l / o / 1.1 + ")") : n.css("transform", "translate(-50%, -50%)"), tT() } function t8() { var e; return (e = Math.max(l / 1080, r / 1920)) * ek } function tT() { var e, t = Date.now(); if (++Y, Date.now() - eb > 50 && (eb = Date.now(), td()), V = t, 0 < R.length) { !function e() { if (0 != R.length) { for (var t = 0, i = 0; i < R.length; i++) t += R[i].size; J = (9 * J + (t = Math.pow(Math.min(64 / t, 1), .4) * t8())) / 10 } }(); for (var i = e = 0, o = 0; o < R.length; o++) R[o].updatePos(), e += R[o].x / R.length, i += R[o].y / R.length; eg = e, e_ = i, ex = J, N = (N + e) / 2, I = (I + i) / 2 } else N = (29 * N + eg) / 30, I = (29 * I + e_) / 30, J = (9 * J + ex * t8()) / 10; !function e() { if (.4 > J) b = null; else { for (var t = Number.POSITIVE_INFINITY, i = Number.POSITIVE_INFINITY, n = Number.NEGATIVE_INFINITY, o = Number.NEGATIVE_INFINITY, s = 0, a = 0; a < L.length; a++) { var h = L[a]; h.shouldRender() && !h.prepareData && 20 < h.size * J && (s = Math.max(h.size, s), t = Math.min(h.x, t), i = Math.min(h.y, i), n = Math.max(h.x, n), o = Math.max(h.y, o)) } for (a = 0, b = tI.init({ minX: t - (s + 100), minY: i - (s + 100), maxX: n + (s + 100), maxY: o + (s + 100), maxChildren: 2, maxDepth: 4 }); a < L.length; a++) if ((h = L[a]).shouldRender() && !(20 >= h.size * J)) for (t = 0; t < h.points.length; ++t) i = h.points[t].x, n = h.points[t].y, i < N - r / 2 / J || n < I - l / 2 / J || i > N + r / 2 / J || n > I + l / 2 / J || b.insert(h.points[t]) } }(), te(), n.fillStyle = es ? "#111111" : "#F2FBFF", n.fillRect(0, 0, r, l), L.sort(function(e, t) { return e.size == t.size ? e.id - t.id : e.size - t.size }), n.save(), n.translate(r / 2, l / 2), n.scale(J, J), n.translate(-N, -I), n.strokeStyle = "#FF0000", n.lineWidth = 10, n.lineCap = "square", n.lineJoin = "square", n.beginPath(), n.moveTo(X, Z), n.lineTo(q, Z), n.lineTo(q, j), n.lineTo(X, j), n.closePath(), n.stroke(), n.strokeStyle = es ? "#AAAAAA" : "#000000", n.globalAlpha = .2, n.lineWidth = 1, n.beginPath(); for (var g = X; g <= q; g += 50) n.moveTo(g, Z), n.lineTo(g, j); for (var F = Z; F <= j; F += 50) n.moveTo(X, F), n.lineTo(q, F); for (n.stroke(), function e() { if (0 != eD) { for (n.beginPath(), n.strokeStyle = es ? "#FFFFFF" : "#000000", n.moveTo(eG - 50, e7 - 50), n.lineTo(eG + 50, e7 + 50), n.moveTo(eG + 50, e7 - 50), n.lineTo(eG - 50, e7 + 50), d = 0; d < R.length; d++) n.moveTo(R[d].x, R[d].y), n.lineTo(eG, e7); n.globalAlpha = 1, n.lineWidth = 10, n.stroke() } }(n), !0 == ef ? n.globalAlpha = .6 : n.globalAlpha = 1, o = 0; o < L.length; o++) L[o].drawOneCell(n); if (el && R.forEach(e=>{ n.save(), n.lineWidth = e.size / 19, n.strokeStyle = es ? "#FFFFFF" : "#000000", n.beginPath(), n.arc(e.x, e.y, e.size + 1, 0, 2 * Math.PI, !1), n.stroke(), n.closePath(), n.restore() } ), e8) { for (eF = (3 * eF + eT) / 4, eS = (3 * eS + e0) / 4, n.save(), n.strokeStyle = "#FFAAAA", n.lineWidth = 10, n.lineCap = "round", n.lineJoin = "round", n.globalAlpha = .5, n.beginPath(), o = 0; o < R.length; o++) n.moveTo(R[o].x, R[o].y), n.lineTo(eF, eS); n.stroke(), n.restore() } if (n.restore(), this.countdown < 3600) { var A = ""; void 0 !== this.gameName && (A += this.gameName + " "), A += "[", A += tm(this.countdown), A += "]"; var O = !0 == eZ() ? "18px" : "30px"; n.font = "bold " + O + " " + gameFont, (!0 == isAdmin || !0 == isModerator) && $("#nowCountdown").text(A); var z = n.measureText(A).width , P = A + " " + M , U = n.measureText(P).width , B = (r - U) * .5; n.globalAlpha = .4, !1 == es ? n.fillStyle = "#000000" : n.fillStyle = "#DDDDDD", n.fillRect(B - 10, 0, U + 20, 40), n.globalAlpha = 1, !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtServerName.color : n.fillStyle = LIGHT_THEME_COLOR.txtServerName.color, n.fillText(A, B, 30), "CW-FFA" == this.gameName || "CW-GSZ" == this.gameName ? n.fillStyle = "#d9d90f" : !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtRecordHolder.color : n.fillStyle = LIGHT_THEME_COLOR.txtRecordHolder.color, n.fillText(" " + M, B + z, 30) } if (n.globalAlpha = 1, !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtGold.color : n.fillStyle = LIGHT_THEME_COLOR.txtGold.color, eZ() ? (n.font = "15px " + gameFont, n.fillText("Gold: " + eL.dotFormat(), 10, 50), n.font = "14px " + gameFont, "KS-FFA" != this.gameName && "KS-GSZ" != this.gameName && n.fillText(lang.text_11 + ": " + eK.dotFormat(), 10, 70), 1 == e6 && n.fillText(lang.text_13 + ": " + tm(eM), 10, 90), "REKABET-1" == this.gameName && this.countdown > 60 && (n.font = "19px " + gameFont, n.fillText("Basılan gold \xf6d\xfcle ekleniyor: " + tm(this.countdown - 60), 10, 115))) : (n.font = "30px " + gameFont, n.fillText("Gold: " + eL.dotFormat(), 10, 270), n.font = "25px " + gameFont, "KS-FFA" != this.gameName && "KS-GSZ" != this.gameName && n.fillText(lang.text_11 + ": " + eK.dotFormat(), 10, 300), 1 == e6 && n.fillText(lang.text_13 + ": " + tm(eM), 10, 330), "REKABET-1" == this.gameName && this.countdown > 60 && (n.font = "18px " + gameFont, n.fillText("Basılan gold \xf6d\xfcle ekleniyor: " + tm(this.countdown - 60), 10, 350))), "VS-FFA" == this.gameName || "VS-GSZ" == this.gameName) { !0 == es ? n.fillStyle = "#FFFF00" : n.fillStyle = "#AAAA00"; var H = !0 == eZ() ? "16px" : "23px"; n.font = H + " " + gameFont, n.globalAlpha = 1, n.fillStyle = "#4646e0", n.fillText(lang.text_12 + ": " + eU.dotFormat(), 10, 350) } n.globalAlpha = 1, !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtTopMessage.color : n.fillStyle = LIGHT_THEME_COLOR.txtTopMessage.color, n.font = "30px " + gameFont, ea = (r - n.measureText(e2).width) * .5, er = 70, n.fillText(e2, ea, er), ea = (r - n.measureText(e4).width) * .5, er = 100, n.fillText(e4, ea, er), tx() && (ea = (r - n.measureText(topMessage3).width) * .5, er = 130, n.fillText(topMessage3, ea, er)), s && s.width && n.drawImage(s, r - s.width - 10, 10), !em && null != a && a.width > 0 && n.drawImage(a, 0, l - a.height - 50), eo = Math.max(eo, en = 0 != eH ? eH : function e() { for (var t = 0, i = 0; i < R.length; i++) t += R[i].getScore(); return t }()), R.length > 0 && (eP = maxCellsLength_2), n.globalAlpha = .8, !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtScore.color : n.fillStyle = LIGHT_THEME_COLOR.txtScore.color; var D = !0 == eZ() ? "15px" : "24px"; if (n.font = D + " " + gameFont, n.fillText(lang.text_1 + ": " + en.dotFormat(), 10, 30), eZ() || (n.fillText(lang.text_2 + ": " + eo.dotFormat(), 10, 56), n.fillText(lang.text_3 + ": " + R.length + "/" + eP, 10, 82)), !eZ()) { n.globalAlpha = .4, !0 == es ? n.fillStyle = "#DDDDDD" : n.fillStyle = "#000000", n.fillRect(10, 93, 100, 100), n.globalAlpha = 1, 0 != w && 0 != E && !0 == C && (!0 == es ? n.fillStyle = "#FF0000" : n.fillStyle = "#990000", n.fillRect(w, E, 5, 5)), n.fillStyle = "#CCCC00"; for (var G = 0; G < eE.length; G++) S = 10 + eE[G].x / q * 100 - 2.5, k = 93 + eE[G].y / j * 100 - 2.5, n.fillRect(S, k, 5, 5); n.fillStyle = "#0000CC"; for (var G = 0; G < eC.length; G++) S = 10 + eC[G].x / q * 100 - 2.5, k = 93 + eC[G].y / j * 100 - 2.5, n.fillRect(S, k, 5, 5); S = 10 + N / q * 100 - 2.5, k = 93 + I / j * 100 - 2.5, n.fillStyle = "#FFFFFF", n.fillRect(S, k, 5, 5), n.globalAlpha = 1, n.font = "16px " + gameFont; var K = Math.round(N / 1e3) + " , " + Math.round(I / 1e3) + " " + lang.text_4; y = n.measureText(K).width, v = 16, T = "*** " + Math.round(N / 1e3) + " , " + Math.round(I / 1e3) + " ***", !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtShare.color : n.fillStyle = LIGHT_THEME_COLOR.txtShare.color, n.fillText(K, 10, 210) } if (function e(t) { if (t.save(), h) for (var i = 0; i < c.length; i++) { var n = c[i]; n.identifier == u ? (t.beginPath(), t.strokeStyle = "#0096ff", t.lineWidth = 6, t.arc(m.x, m.y, 40, 0, 2 * Math.PI, !0), t.stroke(), t.beginPath(), t.strokeStyle = "#0096ff", t.lineWidth = 2, t.arc(m.x, m.y, 60, 0, 2 * Math.PI, !0), t.stroke(), t.beginPath(), t.strokeStyle = "#0096ff", t.arc(f.x, f.y, 40, 0, 2 * Math.PI, !0), t.stroke()) : (t.beginPath(), t.beginPath(), t.strokeStyle = "#0096ff", t.lineWidth = "6", t.arc(n.clientX, n.clientY, 40, 0, 2 * Math.PI, !0), t.stroke()) } t.restore() }(n), !1 == em) { for (var Q = 0, G = W.length - 1; G >= 0; G--) if (0 == chatType || W[G].chatType == chatType || 3 == W[G].chatType) { if (Q++, !0 == eZ()) { if (Q > 5) break } else if (Q > 13) break; var ee = W[G].name.trim(); "" == ee && (ee = BLANK_PLAYER_NAME); var et = " : " + W[G].message.trim() , ei = (W[G].chatType, ""); n.font = ei + chatSize + "px " + chatFont, W[G].name_x = 15, W[G].name_y = l - 60 - 20 * Q, W[G].name_w = n.measureText(ee).width, W[G].name_h = 18, W[G].msg_x = 15 + W[G].name_w, W[G].msg_y = W[G].name_y, W[G].msg_w = n.measureText(et).width, W[G].msg_h = W[G].name_h, n.fillStyle = W[G].color, n.fillText(ee, W[G].name_x, W[G].name_y), 0 == W[G].chatType ? !0 == es ? n.fillStyle = "#FFFFFF" : n.fillStyle = "#000000" : 1 == W[G].chatType ? n.fillStyle = "#CCCC00" : 2 == W[G].chatType ? n.fillStyle = "#0aadff" : 3 == W[G].chatType && (n.fillStyle = "#87CEEB"), n.fillText(et, W[G].msg_x, W[G].msg_y) } } if (!0 == eu && (n.font = "15px Arial", n.globalAlpha = .5, eA = !0 == em ? 10 : 400, eN = l - 50 - 10, n.globalAlpha = .5, n.fillStyle = "#F1C40F", n.fillRect(eA, eN, 50, 50), n.globalAlpha = 1, n.fillStyle = "#000000", n.fillText("Esc", eA + 5, eN + 34), eI = eA + 50 + 10, e3 = eN, n.globalAlpha = .5, n.fillStyle = "#F1C40F", n.fillRect(eI, e3, 50, 50), n.globalAlpha = 1, n.fillStyle = "#000000", n.fillText("X", eI + 5, e3 + 34), eO = eI + 50 + 10, eR = e3, n.globalAlpha = .5, n.fillStyle = "#F1C40F", n.fillRect(eO, eR, 50, 50), n.globalAlpha = 1, n.fillStyle = "#000000", n.fillText("E", eO + 5, eR + 34), e1 = eO + 50 + 10, ez = eR, n.globalAlpha = .5, n.fillStyle = "#F1C40F", n.fillRect(e1, ez, 50, 50), n.globalAlpha = 1, n.fillStyle = "#000000", n.fillText("Space", e1 + 5, ez + 34)), !0 == ec) { !0 == es ? n.fillStyle = DARK_THEME_COLOR.txtFps.color : n.fillStyle = LIGHT_THEME_COLOR.txtSpectatorCount.color; var ea, er, e$, eh = !0 == eZ() ? 12 : 16; n.font = eh + "px " + gameFont; var F = l - 2 * eh; e$ = "Ping: " + last_ping; var ed = n.measureText(e$).width; if (n.fillText(e$, r - ed - 20, F - 15), 0 == x) x = new Date().getTime(); else { var ep = new Date().getTime() - x; ep >= 1e3 ? (p = Math.round(_ / (ep / 1e3) * 1e4) / 1e4, x = new Date().getTime(), _ = 1) : _++ } F += eh, e$ = "FPS: " + Math.floor(p), ed = n.measureText(e$).width, n.fillText(e$, r - ed - 20, F - 10), F += eh, e$ = lang.izleyici + ": " + eY, ed = n.measureText(e$).width, n.fillText(e$, r - ed - 20, F - 5) } var ey = Date.now() - t; ey > 1e3 / 60 ? tC -= .01 : ey < 1e3 / 65 && (tC += .01), .4 > tC && (tC = .4), 1 < tC && (tC = 1) } function t0() { n.fillStyle = es ? "#111111" : "#F2FBFF", n.fillRect(0, 0, r, l), n.save(), n.strokeStyle = es ? "#AAAAAA" : "#000000", n.globalAlpha = .2, n.scale(J, J); for (var e = r / J, t = l / J, i = -.5 + (-N + e / 2) % 50; i < e; i += 50) n.beginPath(), n.moveTo(i, 0), n.lineTo(i, t), n.stroke(); for (i = -.5 + (-I + t / 2) % 50; i < t; i += 50) n.beginPath(), n.moveTo(0, i), n.lineTo(e, i), n.stroke(); n.restore() } function tF() { if (s = null, (null != ey || 0 != U.length) && (null != ey || ee)) { var e, t = (s = document.createElement("canvas")).getContext("2d"), i = 60; i = null == ey ? i + 24 * U.length : i + 180; var n = Math.min(.22 * l, Math.min(250, .3 * r)) / 250; s.width = 250 * n, s.height = i * n, t.scale(n, n), t.globalAlpha = .1, t.fillStyle = "#000000", t.fillRect(0, 0, 250, i), t.globalAlpha = 1; var o = ""; if (null == ey) { for (!0 == es ? t.fillStyle = DARK_THEME_COLOR.txtWinnerNickName.color : t.fillStyle = LIGHT_THEME_COLOR.txtWinnerNickName.color, t.font = "20px " + gameFont, t.fillText(B, 125 - t.measureText(B).width / 2, 40), t.font = "20px " + gameFont, e = 0; e < U.length; ++e) { var a = U[e].name || BLANK_PLAYER_NAME; "" == (a = a.trim()) && (a = BLANK_PLAYER_NAME), ee || (a = BLANK_PLAYER_NAME), o += "

" + (e + 1) + ". " + a + "

", U[e].id == eW ? (t.font = "25px " + gameFont, t.fillStyle = "#c71ab6", ew || (a = e + 1 + ". " + a), t.fillText(a, 125 - t.measureText(a).width / 2, 70 + 24 * e)) : -1 != O.indexOf(U[e].id) ? (R[0].name && (a = R[0].name), t.font = "20px " + gameFont, t.fillStyle = "#FFAAAA", ew || (a = e + 1 + ". " + a), t.fillText(a, 125 - t.measureText(a).width / 2, 70 + 24 * e)) : 0 != U[e].clanId && 0 != e5 && U[e].clanId == e5 ? (t.font = "20px " + gameFont, t.fillStyle = "#4a6df7", ew || (a = e + 1 + ". " + a), t.fillText(a, 125 - t.measureText(a).width / 2, 70 + 24 * e)) : (t.font = "20px " + gameFont, t.fillStyle = "#FFFFFF", ew || (a = e + 1 + ". " + a), t.fillText(a, 125 - t.measureText(a).width / 2, 70 + 24 * e)) } $("#leaderboard-wrapper").html(o) } } } function tS(e, t, i, n, o, s) { this.id = e, this.ox = this.x = t, this.oy = this.y = i, this.oSize = this.size = n, this.color = o, this.points = [], this.pointsAcc = [], this.createPoints(), this.setName(s) } function tk(e, t, i, n) { e && (this._size = e), t && (this._color = t), this._stroke = !!i, n && (this._strokeColor = n) } String.prototype.startsWith || (String.prototype.startsWith = function(e, t) { return t = t || 0, this.substr(t, e.length) === e } ), Number.prototype.dotFormat || (Number.prototype.dotFormat = function() { return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") } ), setInterval(function e() { if (null != A && 1 == A.readyState) { get_ping = Date.now(); var t = to(5); t.setUint8(0, 13), ts(t) } }, 3e3), e.wsClose = function e() { try { A.close() } catch (t) {} return A = null, !0 } , $(e).focus(function() {}), $(e).blur(function() { null != A && A.readyState }), e.sendMouseMove2 = function() { if (tx()) { tw = G, tE = K; var e = to(21); e.setUint8(0, 16), e.setFloat64(1, NaN, !0), e.setFloat64(9, NaN, !0), e.setUint32(17, NaN, !0), ts(e) } } , e.onClickPlay = function() { eW = -1, eH = 0, en = 0, eo = 0, 0 == isLoggedIn && ($("#errorWindow").show(), $("#errorWindowText").html(lang.warning_txt_4)), null == A || 2 == A.readyState || 3 == A.readyState ? (e.isSpectating = !1, tn()) : (!0 == e.isSpectating && (e.isSpectating = !1, tf()), ("CW-FFA" == this.gameName || "CW-GSZ" == this.gameName || "VS-FFA" == this.gameName || "VS-GSZ" == this.gameName && tx() && 0 <= R.length) && tf(), tt(), ta(), eZ() && tr()) } , e.spectate = ()=>{ eW = -1, eH = 0, e.isSpectating = !0, tt(), null == A || 2 == A.readyState || 3 == A.readyState ? tn() : tp(1) } , e.setSkins = e=>{ Q = e, localStorage.showSkin = e } , e.setNames = function(e) { ee = e, localStorage.showName = e } , e.setDarkTheme = e=>{ es = e, localStorage.showDarkTheme = e, !0 == e ? t("#chatButtons").css("color", "white") : t("#chatButtons").css("color", "black") } , e.setNoColor = e=>{ et = e, localStorage.noColor = e } , e.setSmooth = e=>{ ed = e ? 2 : .4, localStorage.smoothRender = e ? 2 : .4 } , e.setTransparent = e=>{ ef = e, localStorage.transparentRender = e } , e.setShowScore = e=>{ ea = e, localStorage.showScore = e } , e.setSimpleGreen = e=>{ er = e, localStorage.simpleGreen = e } , e.setCellEdge = e=>{ el = e, localStorage.cellEdge = e } , e.setMacro = e=>{ e$ = e, localStorage.chcMacro = e } , e.setZoom = e=>{ eh = e, localStorage.opZoom = e, sendZoom(e) } , e.setTouchButtons = e=>{ eu = e, localStorage.touchButtons = e } , e.setHideChat = e=>{ em = e, localStorage.hideChat = e, e ? (t("#chat_textbox").hide(), t("#chatButtons").hide()) : (t("#chat_textbox").show(), t("#chatButtons").show()) } , e.clearChat = ()=>{ W = [] } , e.sendZoom = e=>{ if (!1 == e) { var t = to(5); t.setUint8(0, 50), t.setUint32(1, 0, !0), ts(t) } else { var t = to(5); t.setUint8(0, 50), t.setUint32(1, 1, !0), ts(t) } } , e.setFpsPingSpectator = e=>{ ec = e, localStorage.showFpsPingSpectator = e } ; var tw = -1 , tE = -1 , tC = 1 , tb = {} , tA = {} , tN = ["_canvas'blob"]; tS.prototype = { id: 0, points: null, pointsAcc: null, name: null, nameWidth: 0, skinName: null, lastSkinName: "", hasSkinName: !1, nameCache: null, sizeCache: null, x: 0, y: 0, size: 0, ox: 0, oy: 0, oSize: 0, nx: 0, ny: 0, nSize: 0, scoreWidth: 0, flag: 0, updateTime: 0, updateCode: 0, drawTime: 0, destroyed: !1, isVirus: !1, isAgitated: !1, wasSimpleDrawing: !0, destroy: function() { var e; for (e = 0; e < L.length; e++) if (L[e] == this) { L.splice(e, 1); break } delete z[this.id], -1 != (e = R.indexOf(this)) && (ei = !0, R.splice(e, 1)), -1 != (e = O.indexOf(this.id)) && O.splice(e, 1), this.destroyed = !0, P.push(this) }, getNameSize: function() { return Math.max(~~(.3 * this.size), 24) }, setName: function(e) { (this.name = e) && (null == this.nameCache ? (this.nameCache = new tk(this.getNameSize(),"#FFFFFF",!0,"#000000"), this.nameCache.setValue(this.name)) : (this.nameCache.setSize(this.getNameSize()), this.nameCache.setValue(this.name))) }, calcNameWidth: function(e) { e.font = this.getNameSize() + "px " + gameFont, this.nameWidth = e.measureText(this.name).width }, calcScoreWidth: function(e) { e.font = this.getNameSize() + "px " + gameFont, this.scoreWidth = e.measureText(this.getScore()).width }, setSkinName: function(e) { this.skinName = e }, createPoints: function() { for (var e = this.getNumPoints(); this.points.length > e; ) { var t = ~~(Math.random() * this.points.length); this.points.splice(t, 1), this.pointsAcc.splice(t, 1) } for (0 == this.points.length && 0 < e && (this.points.push({ ref: this, size: this.size, x: this.x, y: this.y }), this.pointsAcc.push(Math.random() - .5)); this.points.length < e; ) { var i = ~~(Math.random() * this.points.length) , n = this.points[i]; this.points.splice(i, 0, { ref: this, size: n.size, x: n.x, y: n.y }), this.pointsAcc.splice(i, 0, this.pointsAcc[i]) } }, getNumPoints: function() { if (0 == this.id) return 16; var e = 10; 20 > this.size && (e = 0), this.isVirus && (e = 30); var t = this.size; return this.isVirus || (t *= J), t *= tC, 32 & this.flag && (t *= .25), ~~Math.max(t, e) }, movePoints: function() { this.createPoints(); for (var e = this.points, t = this.pointsAcc, i = e.length, n = 0; n < i; ++n) { var o = t[(n - 1 + i) % i] , s = t[(n + 1) % i]; t[n] += (Math.random() - .5) * (this.isAgitated ? 3 : 1), t[n] *= .7, 10 < t[n] && (t[n] = 10), -10 > t[n] && (t[n] = -10), t[n] = (o + s + 8 * t[n]) / 10 } for (var a = this, r = this.isVirus ? 0 : (this.id / 1e3 + V / 1e4) % (2 * Math.PI), l = 0; l < i; ++l) { var h = e[l].size , c = e[(l - 1 + i) % i].size , u = e[(l + 1) % i].size; if (15 < this.size && null != b && 20 < this.size * J && 0 != this.id) { var f = !1 , m = e[l].x , g = e[l].y; b.retrieve2(m - 5, g - 5, 10, 10, function(e) { e.ref != a && 25 > (m - e.x) * (m - e.x) + (g - e.y) * (g - e.y) && (f = !0) }), (!f && e[l].x < X || e[l].y < Z || e[l].x > q || e[l].y > j) && (f = !0), f && (0 < t[l] && (t[l] = 0), t[l] -= 1) } 0 > (h += t[l]) && (h = 0), h = this.isAgitated ? (19 * h + this.size) / 20 : (12 * h + this.size) / 13, e[l].size = (c + u + 8 * h) / 10, c = 2 * Math.PI / i, u = this.points[l].size, this.isVirus && 0 == l % 2 && (u += 5), e[l].x = this.x + Math.cos(c * l + r) * u, e[l].y = this.y + Math.sin(c * l + r) * u } }, updatePos: function() { if (0 == this.id) return 1; var e, t = 0 > (e = 0 > (e = (V - this.updateTime) / 60) ? 0 : 1 < e ? 1 : e) ? 0 : 1 < e ? 1 : e; if (this.getNameSize(), this.destroyed && 1 <= t) { var i = P.indexOf(this); -1 != i && P.splice(i, 1) } return this.x = e * (this.nx - this.ox) + this.ox, this.y = e * (this.ny - this.oy) + this.oy, this.size = t * (this.nSize - this.oSize) + this.oSize, t }, shouldRender: function() { return 0 == this.id || !(this.x + this.size + 40 < N - r / 2 / J || this.y + this.size + 40 < I - l / 2 / J || this.x - this.size - 40 > N + r / 2 / J || this.y - this.size - 40 > I + l / 2 / J) }, getScore: function() { return ~~(this.nSize * this.nSize / 100) }, drawOneCell: function(e) { if (this.shouldRender()) { var t = 0 != this.id && !this.isVirus && !this.isAgitated && ed > J; if (5 > this.getNumPoints() && (t = !0), this.wasSimpleDrawing && !t) for (var i = 0; i < this.points.length; i++) this.points[i].size = this.size; if (this.wasSimpleDrawing = t, e.save(), this.drawTime = V, i = this.updatePos(), this.destroyed && (e.globalAlpha *= 1 - i), e.lineWidth = 10, e.lineCap = "round", e.lineJoin = this.isVirus ? "miter" : "round", et ? (e.fillStyle = "#FFFFFF", e.strokeStyle = "#AAAAAA") : (e.fillStyle = this.color, e.strokeStyle = this.color), t || !0 == er) e.beginPath(), e.arc(this.x, this.y, this.size, 0, 2 * Math.PI, !1); else { this.movePoints(), e.beginPath(); var n = this.getNumPoints(); for (e.moveTo(this.points[0].x, this.points[0].y), i = 1; i <= n; ++i) { var o = i % n; e.lineTo(this.points[o].x, this.points[o].y) } } if (e.closePath(), i = null, !this.isAgitated && Q && ":teams" != ep) { if (!0 == this.hasSkinName && (this.skinName = this.name.toLowerCase(), -1 != this.skinName.indexOf("[") || (this.skinName = this.name.toLowerCase(), -1 != this.skinName.indexOf("[")))) { var s = this.skinName.indexOf("[") , a = this.skinName.indexOf("]"); this.skinName = this.skinName.slice(s + 1, a) } "" != this.skinName && null != this.skinName && (tb.hasOwnProperty(this.skinName) || (tb[this.skinName] = new Image, tb[this.skinName].src = "//cdn.agarj.com/skins/" + this.skinName + ".png", tb[this.skinName].onload = function() { tA[this.src] = !0 } ), 0 != tb[this.skinName].width && tb[this.skinName].complete && (i = tb[this.skinName])) } if (i = !!(o = i) && -1 != tN.indexOf(this.skinName), t || e.stroke(), e.fill(), !(null == o || i) && tA.hasOwnProperty(o.src) && (e.save(), e.clip(), e.drawImage(o, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size), e.restore()), (et || 15 < this.size) && !t && (e.strokeStyle = "#000000", e.globalAlpha *= .1, e.stroke()), e.globalAlpha = 1, null != o && i && tA.hasOwnProperty(o.src) && e.drawImage(o, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size), i = -1 != R.indexOf(this), 0 != this.id) { var t = ~~this.y; if ((ee || i) && this.name) { e.fillStyle = "#FFFFFF", e.font = this.getNameSize() + "px " + gameFont, this.calcNameWidth(e); var r = this.x - .5 * this.nameWidth; e.fillText(this.name, r, this.y) } if (this.name && !0 == ea && this.size > 40 && !1 == this.isVirus) { e.fillStyle = "#FFFFFF", e.font = this.getNameSize() + "px " + gameFont, this.calcScoreWidth(e); var l = this.getScore().dotFormat(); r = this.x - .5 * this.scoreWidth, e.fillText(l, r, this.y + this.getNameSize()) } if (isAdmin && this.uId && 0 != this.uId && this.size > 40 && !1 == this.isVirus) { e.fillStyle = "#000000"; let h = this.getNameSize() / 1.75; e.font = h + "px " + gameFont; var c = "uId: " + this.uId , u = e.measureText(c).width , f = this.x - .5 * u; e.fillText(c, f, this.y + 2 * this.getNameSize()) } } e.restore() } } }, tk.prototype = { _value: "", _color: "#000000", _stroke: !1, _strokeColor: "#000000", _size: 16, _canvas: null, _ctx: null, _dirty: !1, _scale: 1, setSize: function(e) { this._size != e && (this._size = e, this._dirty = !0) }, setScale: function(e) { this._scale != e && (this._scale = e, this._dirty = !0) }, setStrokeColor: function(e) { this._strokeColor != e && (this._strokeColor = e, this._dirty = !0) }, setValue: function(e) { e != this._value && (this._value = e, this._dirty = !0) }, render: function() { if (null == this._canvas && (this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d")), this._dirty) { this._dirty = !1; var e = this._canvas , t = this._ctx , i = this._value , n = this._scale , o = this._size , s = o + "px " + gameFont; t.font = s; var a = ~~(.2 * o); e.width = (t.measureText(i).width + 6) * n, e.height = (o + a) * n, t.font = s, t.scale(n, n), t.globalAlpha = 1, t.lineWidth = 3, t.strokeStyle = this._strokeColor, t.fillStyle = this._color, this._stroke && t.strokeText(i, 3, o - a / 2), t.fillText(i, 3, o - a / 2) } return this._canvas }, getWidth: function() { return n.measureText(this._value).width + 6 } }, Date.now || (Date.now = function() { return (new Date).getTime() } ); var tI = { init: function(e) { function t(e, t, i, n, o) { this.x = e, this.y = t, this.w = i, this.h = n, this.depth = o, this.items = [], this.nodes = [] } var i = e.maxChildren || 2 , n = e.maxDepth || 4; t.prototype = { x: 0, y: 0, w: 0, h: 0, depth: 0, items: null, nodes: null, exists: function(e) { for (var t = 0; t < this.items.length; ++t) { var i = this.items[t]; if (i.x >= e.x && i.y >= e.y && i.x < e.x + e.w && i.y < e.y + e.h) return !0 } if (0 != this.nodes.length) { var n = this; return this.findOverlappingNodes(e, function(t) { return n.nodes[t].exists(e) }) } return !1 }, retrieve: function(e, t) { for (var i = 0; i < this.items.length; ++i) t(this.items[i]); if (0 != this.nodes.length) { var n = this; this.findOverlappingNodes(e, function(i) { n.nodes[i].retrieve(e, t) }) } }, insert: function(e) { 0 != this.nodes.length ? this.nodes[this.findInsertNode(e)].insert(e) : this.items.length >= i && this.depth < n ? (this.devide(), this.nodes[this.findInsertNode(e)].insert(e)) : this.items.push(e) }, findInsertNode: function(e) { return e.x < this.x + this.w / 2 ? e.y < this.y + this.h / 2 ? 0 : 2 : e.y < this.y + this.h / 2 ? 1 : 3 }, findOverlappingNodes: function(e, t) { return !!(e.x < this.x + this.w / 2 && (e.y < this.y + this.h / 2 && t(0) || e.y >= this.y + this.h / 2 && t(2)) || e.x >= this.x + this.w / 2 && (e.y < this.y + this.h / 2 && t(1) || e.y >= this.y + this.h / 2 && t(3))) }, devide: function() { var e = this.depth + 1 , i = this.w / 2 , n = this.h / 2; for (this.nodes.push(new t(this.x,this.y,i,n,e)), this.nodes.push(new t(this.x + i,this.y,i,n,e)), this.nodes.push(new t(this.x,this.y + n,i,n,e)), this.nodes.push(new t(this.x + i,this.y + n,i,n,e)), e = this.items, this.items = [], i = 0; i < e.length; i++) this.insert(e[i]) }, clear: function() { for (var e = 0; e < this.nodes.length; e++) this.nodes[e].clear(); this.items.length = 0, this.nodes.length = 0 } }; var o = { x: 0, y: 0, w: 0, h: 0 }; return { root: new t(e.minX,e.minY,e.maxX - e.minX,e.maxY - e.minY,0), insert: function(e) { this.root.insert(e) }, retrieve: function(e, t) { this.root.retrieve(e, t) }, retrieve2: function(e, t, i, n, s) { o.x = e, o.y = t, o.w = i, o.h = n, this.root.retrieve(o, s) }, exists: function(e) { return this.root.exists(e) }, clear: function() { this.root.clear() } } } }; e.onload = function s() { null == localStorage.showSkin && (localStorage.showSkin = !0), Q = "true" === localStorage.showSkin, document.getElementById("noSkin").checked = !Q, null == localStorage.showName && (localStorage.showName = !0), ee = "true" === localStorage.showName, document.getElementById("noNames").checked = !ee, null == localStorage.noColor && (localStorage.noColor = !1), et = "true" === localStorage.noColor, document.getElementById("noColor").checked = et, null == localStorage.showDarkTheme && (localStorage.showDarkTheme = !0), es = "true" === localStorage.showDarkTheme, document.getElementById("darkTheme") && (document.getElementById("darkTheme").checked = es), !0 == es ? t("#chatButtons").css("color", "white") : t("#chatButtons").css("color", "black"), null == localStorage.hideChat && (localStorage.hideChat = !1), em = "true" === localStorage.hideChat, document.getElementById("hideChat").checked = em, em ? (t("#chat_textbox").hide(), t("#chatButtons").hide()) : (t("#chat_textbox").show(), t("#chatButtons").show()), null == localStorage.smoothRender && (localStorage.smoothRender = 2), ed = localStorage.smoothRender, document.getElementById("smoothRender") && (document.getElementById("smoothRender").checked = 2 == ed), null == localStorage.transparentRender && (localStorage.transparentRender = !1), ef = "true" === localStorage.transparentRender, document.getElementById("transparentRender").checked = ef, null == localStorage.showScore && (localStorage.showScore = !0), ea = "true" === localStorage.showScore, document.getElementById("showScore") && (document.getElementById("showScore").checked = ea), null == localStorage.simpleGreen && (localStorage.simpleGreen = !0), er = "true" === localStorage.simpleGreen, document.getElementById("simpleGreen") && (document.getElementById("simpleGreen").checked = er), null == localStorage.cellEdge && (localStorage.cellEdge = !0), el = "true" === localStorage.cellEdge, document.getElementById("cellEdge") && (document.getElementById("cellEdge").checked = el), null == localStorage.chcMacro && (localStorage.chcMacro = !0), e$ = "true" === localStorage.chcMacro, document.getElementById("chcMacro") && (document.getElementById("chcMacro").checked = e$), null == localStorage.opZoom && (localStorage.opZoom = !0), eh = "true" === localStorage.opZoom, document.getElementById("opZoom") && (document.getElementById("opZoom").checked = eh), null == localStorage.showFpsPingSpectator && (localStorage.showFpsPingSpectator = !0), ec = "true" === localStorage.showFpsPingSpectator, document.getElementById("showFpsPingSpectator") && (document.getElementById("showFpsPingSpectator").checked = ec), localStorage.chatSize && Number(localStorage.chatSize) > 0 && (chatSize = localStorage.chatSize, document.getElementById("chatsize").value = localStorage.chatSize), localStorage.chatFont && (chatFont = localStorage.chatFont, document.getElementById("chatFont").value = localStorage.chatFont), localStorage.gameFont && (gameFont = localStorage.gameFont, document.getElementById("gameFont").value = localStorage.gameFont), !0 == eZ() ? (localStorage.touchButtons = "true", t("#labelTouchButtons").show()) : (localStorage.touchButtons = "false", t("#labelTouchButtons").hide()), eu = "true" === localStorage.touchButtons, document.getElementById("touchButtons").checked = eu, document.getElementById("canvas").focus(); var a, r = !1; n = (o = i = document.getElementById("canvas")).getContext("2d"), o.offsetLeft, o.offsetTop; var l = o.getBoundingClientRect(); o.addEventListener("click", function(e) { var t = e.clientX - l.left , i = e.clientY - l.top; for (d = 0; d < L.length; d++) { var o = L[d]; o.shouldRender() && (n.save(), n.beginPath(), n.arc(o.x, o.y, o.size, 0, 2 * Math.PI, !1), n.isPointInPath(t, i) && (n.lineWidth = 10, n.strokeStyle = "red", n.stroke(), console.log("test")), n.restore()) } }), o.onmousemove = function(e) { H = e.clientX, D = e.clientY, te(), eX(H, D) } , o.onmousedown = function(e) { var t = e.clientX , i = e.clientY; new Date().getTime() - F > 5e3 && t >= 10 && t <= 10 + y && i >= 210 - v && i <= 210 && (t_(T), F = new Date().getTime()); for (var n = 0; n < W.length; n++) if (0 != W[n].userId && void 0 != W[n].userId && t >= W[n].name_x && t <= W[n].name_x + W[n].name_w && i <= W[n].name_y && i >= W[n].name_y - W[n].name_h) { if (0 != chatType && W[n].chatType != chatType) continue; console.log(W[n].chatType + " " + W[n].userId + " - " + W[n].message), window.open(SITE_NAME + "/" + eV() + "/user/" + W[n].userId, "_blank").focus(); break } eX(t, i) } , o.addEventListener("touchstart", eq, !1), o.addEventListener("touchmove", ej, !1), o.addEventListener("touchend", eJ, !1), o.onmouseup = function() {} , /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", eQ, !1) : document.body.onmousewheel = eQ, o.onfocus = function() { r = !1 } , document.getElementById("chat_textbox").onblur = function() { r = !1 } , document.getElementById("chat_textbox").onfocus = function() { r = !0 } ; var h = !1 , c = !1 , u = !1 , f = !1 , m = !1 , g = !1 , _ = !1 , x = !1; e.onkeydown = function(e) { var i = t("#overlays").is(":visible"); switch (e.keyCode) { case 32: h || r || !1 != i || (td(), tp(17), h = !0); break; case 81: c || !1 != i || (tp(18), c = !0); break; case 87: u || r || !1 != i || (td(), tp(21), u = !0); break; case 27: !1 == i ? ti("fast") : tx() && (!1 == i ? ti("fast") : tt()); break; case 13: if (r) { if (r = !1, document.getElementById("chat_textbox").blur(), (a = document.getElementById("chat_textbox").value).length > 0) { if (1 == chatType) a = "/team " + a; else if (2 == chatType) a = "/clan " + a; else if (3 == chatType) { if (confirm(lang.megaphone_confirm)) a = "/megaphone " + a; else { a = ""; return } } t_(a) } document.getElementById("chat_textbox").value = "" } else ev || (r = !0); break; case 69: f || r || !1 != i || (f = !0, tp(22)); break; case 65: m || r || !1 != i || (tp(65), m = !0, td()); break; case 83: g || r || !1 != i || (tp(83), g = !0); break; case 84: r || !1 != i || (0 == eD ? (eD = 1, eG = Math.max(eG = Math.min(G, q, j), X, Z), e7 = Math.max(e7 = Math.min(K, q, j), X, Z)) : tu()); break; case 88: _ || r || !1 != i || !e$ || (tp(36), _ = !0); break; case 90: x || r || !1 != i || !e$ || (tp(39), x = !0) } } , e.onkeyup = function(e) { switch (e.keyCode) { case 32: h = !1; break; case 87: u = !1; break; case 81: c && (tp(19), c = !1); break; case 69: f && (f = !1, tp(23)); break; case 65: m = !1; break; case 83: g = !1; break; case 88: _ && (_ = !1, tp(38)); break; case 90: x && (x = !1, tp(40)) } } , e.onblur = function() { u = c = h = !1 } , e.onresize = tv, tv(), e.requestAnimationFrame ? e.requestAnimationFrame(ty) : setInterval(tT, 1e3 / 60), document.getElementById("overlays").style.display = "block", jQuery("#enterPriceYes").click(function() { document.getElementById("enterPriceConfirmWindow").style.display = "none", function e() { if (console.log("vs katıldı"), tx()) { var t = to(1); t.setUint8(0, 10), ts(t) } }() }), jQuery("#enterPriceNo").click(function() { document.getElementById("enterPriceConfirmWindow").style.display = "none", document.getElementById("overlays").style.display = "block" }) } }(window, window.jQuery);