Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(e, t, o) {
- function a() {}
- function i(e, t, o, a, i) {
- this.id = e, this.nick = t, this.skinID = o, this.skinURL = a, 7 == i.length && (this.color = i)
- }
- function s() {}
- function n() {
- if (document.getElementById("canvas")) {
- var e = document.getElementById("canvas");
- return void e.addEventListener("mousemove", function(e) {
- t.play && t.cursorTracking && t.setCursorPosition && (t.clientX = e.clientX, t.clientY = e.clientY, t.setCursorPosition())
- }, !1)
- }
- setTimeout(n, 50)
- }
- function l() {
- return e.MC && e.MC.showNickDialog ? (e.MC._showNickDialog = e.MC.showNickDialog, e.MC.showNickDialog = function() {
- e.MC._showNickDialog.apply(this, arguments), o("#main-panel").show(), e.onkeydown = function() {}
- }, e.MC._showStatsDialog = e.MC.showStatsDialog, e.MC.showStatsDialog = function() {
- e.MC._showStatsDialog.apply(this, arguments), e.onkeydown = function() {}
- }, e.MC._onPlayerSpawn = e.MC.onPlayerSpawn, e.MC.onPlayerSpawn = function() {
- e.MC._onPlayerSpawn.apply(this, arguments), t.playerColor = null, C && C.onPlayerSpawn()
- }, e.MC._onPlayerDeath = e.MC.onPlayerDeath, e.MC.onPlayerDeath = function() {
- e.MC._onPlayerDeath.apply(this, arguments), C && C.onPlayerDeath()
- }, e.MC._onAgarioCoreLoaded = e.MC.onAgarioCoreLoaded, e.MC.onAgarioCoreLoaded = function() {
- e.MC._onAgarioCoreLoaded.apply(this, arguments), r()
- }, e.MC._wasInitialized = e.MC.wasInitialized, void(e.MC.wasInitialized = function() {
- e.MC._wasInitialized.apply(this, arguments), setTimeout(function() {
- r(), C && C.getDefaultSettings(), o(".btn-spectate").prop("disabled", !1), e.onkeydown = function() {}
- }, 1e3)
- })) : void setTimeout(l, 50)
- }
- function r() {
- var a = 1 * e.innerWidth,
- i = 1 * e.innerHeight,
- s = o("#helloContainer"),
- n = s.innerHeight();
- n > 0 ? t.menuHeight = n : n = t.menuHeight || 570;
- var l = Math.min(1, i / n),
- r = n * l,
- c = Math.round(i / 2 - .5 * r),
- h = "translate(-25%, 0%) scale(" + l + ")";
- s.css("transform", h), s.css("-ms-transform", h), s.css("-webkit-transform", h), s.css("top", "" + c + "px"), t.innerW = a, t.innerH = i
- }
- function c() {
- return t.play ? p[d].exit : void 0
- }
- function h() {}
- "/ogario" == e.location.pathname && e.history && e.history.replaceState && e.history.replaceState({}, e.document.title, "/" + e.location.hash),
- function() {
- e.NREUM && (e.NREUM = null, delete e.NREUM), e.core && (e.core = null, delete e.core), o.ajax("http://agar.io/agario.core.js", {
- success: function(e) {
- var t = e;
- t = t.replace(/(\(function\(([\w$]+)\){)/i, "$1 var ogario=$2.ogario,gameCtx=null;"), t = t.replace(/(([\w$]+)=[\w$]+\.getContext\(\"2d\"\);)/i, 'if($2.id==="canvas"){$1 gameCtx=$2;}else{$1}'), t = t.replace(/(setTarget:function\((\w),(\w)\)\{)([\w$]+\(\w,\w\)})/i, "$1if(ogario.pause){$2=ogario.innerW/2*ogario.canvasScale; $3=ogario.innerH/2*ogario.canvasScale;}$4"), t = t.replace(/(function\s*([\w$]+)\(\w\){return\s*[\w$]+\(\w,\w\)})/i, "$1 ogario.getString=$2;"), t = t.replace(/(\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);)/i, "$1 if(ogario.setMapCoords){ogario.setMapCoords($3,$5,$7,$9,$2,$8);}"), t = t.replace(/if\((\+\w\[\w>>3\])<1\.0\){/i, "if($1<ogario.zoomResetValue){"), t = t.replace(/(\w)(=\+(\w\[\w>>3\])\*\+\w\()(\.\d)(,\+\w\);)/i, "if(!ogario.autoZoom){$3=ogario.zoomValue;} $1$2 (ogario.zoomSpeedValue||0.9) $5 ogario.zoomValue=$1;"), t = t.replace(/(\w=\w\[\w>>2\]\|0;)((\w\[\w>>3\])=(\w);)(\w\[\w>>0\]=a\[\w>>0\];)/i, "$1 if(!ogario.autoZoom){$3=ogario.zoomValue;}else{$2}$5"), t = t.replace(/(do{\w=\+\w\[\(\w\[\w>>2\]\|0\)\+\d+>>2];\w=\w\+\s*)(\+\(~~\+\w\(\+\(\w\*\w\/100\.0\)\)\|0\))(;\w=\w\+4\|0}while\(\(\w\|0\)!=\(\w\|0\)\);(\w)=(\w);)/i, "ogario.playerCellsMass=[]; $1$2; ogario.playerCellsMass.push($2)$3 ogario.playerMass=$5; if(ogario.calculateMass){ogario.calculateMass();}"), t = t.replace(/([\w$]+\(\d+,\w\[\w>>2\]\|0,(\+\w),(\+\w)\)\|0;[\w$]+\(\d+,\w\[\w>>2\]\|0,\+-(\+\w\[\w\+\d+>>3\]),\+-(\+\w\[\w\+\d+>>3\])\)\|0;)/i, "$1 ogario.viewScale=$2; ogario.playerX=$4; ogario.playerY=$5; if(ogario.customDraw){ogario.customDraw(gameCtx);}"), t = t.replace(/(while\(0\);)([\w$]+\(\w,\w\);)([\w$]+\(\w,\w\);)([\w$]+\(\w,\w\);)([\w$]+\(\w,\w\);)(\w\[\w\+\d+>>0\]=1;\w=\w;return})/i, "$1$6"), t = t.replace(/[\w$]+\(\w,\d+,15\);else/i, "{}"), t = t.replace(/(\d\.\d;return}function\s*)([\w$]+\(.,.\)){/i, "$1$2{if(ogario.drawGrid){ogario.drawGrid(gameCtx);} return;"), t = t.replace(/(if\(\(\w\[\d+\]\|0\)!=0\?\(\w\[\d+\]\|\w\[(\w)\+\d+>>0\]\)<<24>>24==0:0\))((\w)=\w\[(\w)\+\d+>>2\]\|0;)else/i, "ogario.cellMemOffset=$2; $1 if(!ogario.vanillaSkins&&ogario.customSkins){$4=0;}else{}else"), t = t.replace(/if\((\(\w\|0\)!=0\?\(\w\[\w\+\d+>>2\]&2\|0\)!=0:0)\){/i, "if(($1)&&!ogario.customSkins){"), t = t.replace(/do\s*if\((\w)\){((\w)=!\((\+\w\[\w>>2\])<=20\.0\);)([\w$]+\(\d+,\w\[\w>>2]\|0\)\|0;[\w$]+\(\d+,\w\[\w>>2]\|0,(\+\(\+\w\[\w>>2\]\)),(\+\(\+\w\[\w>>2\]\)),\+\(\+\w\[\w>>2\])\+5\.0(\),0\.0,6\.283185307179586,0\)\|0;[\w$]+\(\d+,\w\[\w>>2]\|0\)\|0;\w=\w\[\w>>2\]\|0;)if\(\w\){([\w$]+\(\d+,\w\|0,(\w&255\|0),(\w&255\|0),(\w&255\|0)\)\|0;)([\w$]+\(\d+,\w\[\w>>2]\|0\)\|0;)/i, "var nick=null,color=null,skin=null,cellX=null,cellY=null,cellSize=null,isFood=false,isVirus=false,isPlayerCell=false,skipCell=false;do if($1=1,$1){cellSize=$4;$2 if(!$3){isFood=true;if(!ogario.showFood){break;} if(ogario.autoHideFood&&!ogario.foodIsHidden&&ogario.playerMass>1000){ogario.showFood=false;ogario.foodIsHidden=true;} if(!ogario.rainbowFood){ogario.foodCache.push({x:$6,y:$7,size:cellSize});break;}} if(ogario.hideSmallBots&&cellSize<=36){skipCell=true;break;}$5$8 if($3){if(gameCtx){ogario.globalApha=gameCtx.globalAlpha;cellX=$6;cellY=$7;if(gameCtx.lineJoin==='miter'){isVirus=true;if(ogario.setVirusColor&&ogario.setVirusStrokeColor){gameCtx.fillStyle='#333333';gameCtx.strokeStyle='#333333';}else{gameCtx.fillStyle=ogario.virusColor;gameCtx.strokeStyle=ogario.virusStrokeColor;} if(ogario.transparentViruses){gameCtx.globalAlpha*=ogario.virusAlpha;} if(ogario.virusesRange&&ogario.play){ogario.virusesCache.push({x:cellX,y:cellY,size:cellSize});}}else{if(ogario.nameMemOffset&&ogario.cellMemOffset&&ogario.getString){if((a[ogario.cellMemOffset+ogario.nameMemOffset+4>>0]&1)==0|0){nick=ogario.getString(ogario.cellMemOffset+ogario.nameMemOffset+5);}else{nick=ogario.getString(c[ogario.cellMemOffset+ogario.nameMemOffset+12>>2]|0);}} if(ogario.rgb2Hex){color=ogario.rgb2Hex($10,$11,$12);} if(nick&&nick.length>0&&color){if(ogario.showCustomSkins&&ogario.customSkins&&ogario.getCustomSkin){skin=ogario.getCustomSkin(nick,color);}} if(ogario.play){if(ogario.cellMemOffset&&ogario.idOffset&&ogario.idMemOffset){var idA=c[ogario.cellMemOffset+ogario.idOffset>>2]|0;var idB=c[ogario.idMemOffset]|0;var idC=c[ogario.idMemOffset+1]|0;loop:do{if((idB|0)!=(idC|0)){while(true){if((c[idB>>2]|0)==(idA|0)){break loop;}idB=idB+4|0;if((idB|0)==(idC|0)){idB=idC;break;}}}}while(false);isPlayerCell=(idB|0)!=(idC|0);} if(isPlayerCell&&ogario.playerCells){ogario.playerCells.push({x:cellX,y:cellY,size:cellSize});ogario.playerColor=color;} if(((ogario.oppColors&&!ogario.oppRings)||(ogario.myCustomColor&&isPlayerCell))&&ogario.setOppColor){gameCtx.fillStyle=ogario.setOppColor(cellSize,isPlayerCell);}else{$9} if(!isPlayerCell&&(ogario.splitRange||ogario.oppRings)&&ogario.cacheCells){ogario.cacheCells(cellX,cellY,cellSize);}}else{$9} if(ogario.transparentCells){gameCtx.globalAlpha*=ogario.cellsAlpha;}}$13gameCtx.globalAlpha=ogario.globalApha;if(isVirus){gameCtx.stroke();}if(((ogario.transparentSkins||(ogario.play&&ogario.oppColors))&&!(isPlayerCell&&!ogario.myTransparentSkin))||isPlayerCell&&ogario.myTransparentSkin){gameCtx.globalAlpha*=ogario.skinsAlpha;} if(skin){gameCtx.save();gameCtx.clip();gameCtx.drawImage(skin,cellX-cellSize,cellY-cellSize,2*cellSize,2*cellSize);gameCtx.restore();}}else{$9$13}break;"), t = t.replace(/(if\(\(\w\[\w\+\d+>>0\]\|0\)==0\?\(\(\(\(\w\[\w\+\d+>>2\]\|0\)\+\(\w\[\d+\]\|0\)\|0\)>>>0\)%10\|0\|0\)!=0:0\){\w=\w\[\w>>2\]\|0;[\w$]+\(\d+,\w\|0\)\|0;\w=\w;return})([\w$]+\(\w,\w\);)/i, "if(gameCtx&&ogario){gameCtx.globalAlpha=ogario.globalApha; if(ogario.teammatesInd&&ogario.indicator&&skin&&!isPlayerCell&&cellSize<=200){gameCtx.drawImage(ogario.indicator,cellX-45,cellY-cellSize-90);}}$1 if(!(skipCell||(ogario.autoHideCellsInfo&&ogario.setAutoHideCellsInfo&&cellSize&&!isFood&&!isVirus&&!isPlayerCell&&ogario.setAutoHideCellsInfo(cellSize)))){$2}"), t = t.replace(/([\w$]+\(\d+\,\w\[\w>>2\]\|0\)\|0}}while\(0\);do\s*if\()(\w)\)/i, "$1$2&&ogario.vanillaSkins&&!skin)"), t = t.replace(/(\w=0;\w=\w\[\w\+(\d+)>>2\]\|0;\w=\w\[(\d+)\]\|0;\w=\w\[\d+\]\|0;)(\w:do)/i, "$1 ogario.idOffset=$2; ogario.idMemOffset=$3; $4"), t = t.replace(/(\w=\w\+5\+\(\(\w\|0\)\/)2(\|0\)\|0)/i, "$1 1.5 $2"), t = t.replace(/((\w)=\+[\w$]+\(\+\(\+[\w$]+\(\d+\)\*10.0\)\)\/10.0;)/i, "$1 if($2<0.3){$2=0.3}"), t = t.replace(/((\w)=\(\w\|0\)<20\?20.0:\+\(\w\|0\);)/i, "$1 $2*=2;"), t = t.replace(/do\s+if\((\w)\|(\(\w\[\d+\]\|0\)\!=0)\){/i, "do if(($2&&!($1&&ogario.hideMyName))||!ogario.nameMemOffset){"), t = t.replace(/(\w=\w\+(\d+)\|0;\w=~~\(\+\w\[\w\+\d+>>2\]\*\.3\);)/i, "$1 ogario.nameMemOffset=$2;"), t = t.replace(/(if\(\w<=)(20\.0)(\){\w=\w;return})(if\(!(\w)\){if\(\(\w\[\d+\]\|0\)!=\(\w\[\d+\]\|0\)\){\w=\w;return}if\(\(\w\[\w\+\d+>>0\]\|0\)!=0\?\(\w\[\w>>0\]\|0\)==0:0\){\w=\w;return}})((\w\[\w>>2\])=~~\+[\w$]+\(\+\((\w)\*\w\/100\.0\)\);)/i, "$140.0||$5&&ogario.hideMyMass||!$5&&ogario.hideEnemiesMass$3$6");
- var o = document.createElement("script");
- o.textContent = t, o.async = !0, document.body.appendChild(o)
- },
- dataType: "text",
- method: "GET",
- cache: !1,
- crossDomain: !0
- })
- }();
- var d = "en",
- p = {
- en: {
- start: "الرئيسيه",
- settings: "الاعدادات",
- hideMyName: "اخفاء اسمي",
- showMiniMap: "الخريطه",
- showChatroom: "الشات",
- mouseFeed: "التفيد بالماوس",
- rainbowFood: "تصغير حجم الالماس",
- showStatsMass: "عرض الاسكور",
- transparentCells: "نقاط شفافه",
- showBgSectors: "احرف على الماب",
- showStatsFPS: "FPS",
- cursorTracking: "خط للمؤشر",
- autoHideCellsInfo: "اخفاء الاسامي والاسكور",
- autoZoom: "زوم تلقائي",
- autoHideFood: "اخفاء الماس تلقائي",
- hideMyMass: "اخفاء سكوري",
- hideEnemiesMass: "اخفاء سكور الاعداء",
- customSkins: "السكنات",
- myTransparentSkin: "تحويل السكنات لشفاف",
- myCustomColor: "لون سكناتي",
- transparentViruses: "الفايرس شفاف",
- transparentSkins: "السكنات شفافه",
- showGrid: "عرض الخطوط",
- showMapBorders: "اظهار حد للخريطه",
- oppColors: "الوان الخصوم",
- oppRings: "خط عند الانقسام",
- teammatesInd: "خط على التيم بنفس التاق",
- splitRange: "دائره عند الانقسام",
- virusesRange: "دائره عند الفايرس",
- textStroke: "الكتابه",
- mouseSplit: "الانقسام بالماوس",
- mouseInvert: "عكس ازرار الماوس",
- hideChat: "اخفاء الشات",
- showStats: "عرض احصائيات اللعبه",
- showStatsSTE: "STE",
- showStatsN16: "[n/16]",
- hotkeys: "الازرار",
- "hk-inst-assign": "الخطوه الاولى : اضغط على الي تبي تغيره ",
- "hk-inst-delete": "الخطوه الثانيه : اضغط على الزر الجديد",
- "hk-inst-keys": "اضغط زر ديليت لحذف الزر",
- "hk-inst-keys2": "المسموح [CTRL] + 0-9, [ALT] + 0-9,a-z,[ENTER],[SHIFT],[SPACE]",
- "hk-feed": "Feed",
- "hk-macroFeed": "تفييد سريع",
- "hk-split": "انقسام",
- "hk-doubleSplit": "دبل انقسام",
- "hk-split16": "انقسام 16",
- "hk-pause": "توقف عن الحركه",
- "hk-showSplitRange": "عرض/اخفاء دائره الانقسام",
- "hk-showSplitInd": "عرض/اخفاء خط الانقسام",
- "hk-showOppColors": "عرض/اخفاء الوان العدو",
- "hk-showSkins": "عرض/اخفاء السكنات",
- "hk-showStats": "عرض/اخفاء احصائيات اللعبه",
- "hk-toggleCells": "Toggle own cells (smallest/biggest)",
- "hk-showFood": "عرض/اخفاء الالماس",
- "hk-showGrid": "عرض/اخفاء الخطوط",
- "hk-hideChat": "عرض/اخفاء الشات",
- "hk-showHUD": "عرض/اخفاء HUD",
- "hk-copyLb": "نسخ المتصدرين",
- "hk-showLb": "عرض/اخفاء المتصدرين",
- "hk-resetZoom": "اعاده الزوم للوضع الطبيعي",
- "hk-zoomLevel": "مستوى الزوم",
- "hk-toggleDeath": "Toggle death location",
- "hk-clearChat": "عرض/حذف رسائل الشات",
- "hk-showBgSectors": "Show/hide background sectors",
- "hk-hideBots": "Show/hide small bots",
- "hk-showNames": "عرض/اخفاء الاسامي",
- "hk-showMass": "عرض/اخفاء الماس",
- "hk-showMiniMap": "عرض/اخفاء الخريطه",
- "hk-chatMessage": "اكتب رساله",
- "hk-quickResp": "اعاده لعب سريع",
- commands: "Commands",
- comm1: "عطني!",
- comm2: "انقسم علي!",
- comm3: "محتاج فزعه في %currentSector%!",
- comm4: "العدو %currentSector%!",
- comm5: "احتاج تيم!",
- comm6: "فجره!",
- comm7: "كل الفايرس!",
- comm8: "بايت!",
- comm9: "ترك سبلت وهمي!",
- comm0: "ياليل!",
- comm10: "ترك سبلت!",
- comm11: "يسار!",
- comm12: "فوق!",
- comm13: "يمين!",
- comm14: "تحت!",
- saveComm: "حفظ الاعدادات",
- theme: "الثيم",
- themePreset: "Theme preset",
- themeType: "Theme type",
- darkTheme: "ثيم اسود",
- lightTheme: "ثيم ابيض",
- mainColor: "Pellets color",
- bgColor: "Background color",
- bordersColor: "Borders color",
- hideChatMsgA: "الشات ظهر!",
- hideChatMsgB: "الشات مخفي!",
- showSkinsMsgA: "السكنات ظهرت!",
- showSkinsMsgB: "السكنات مخفيه!",
- hideSmallBotsMsgA: "Small bots are visible!",
- hideSmallBotsMsgB: "Small bots are hidden!",
- profile: "Profile",
- saveSett: "حفظ",
- resetSett: "استعاده الاعدادات",
- close: "Cancel",
- enterChatMsg: "اضغط انتر للكتابه",
- activePartys: "Active partys",
- pause: "PAUSE!",
- visit: "Visit",
- exit: "OGARio by szymy: Are you sure you want to quit the game?"
- }
- },
- m = {
- comm1: p[d].comm1,
- comm2: p[d].comm2,
- comm3: p[d].comm3,
- comm4: p[d].comm4,
- comm5: p[d].comm5,
- comm6: p[d].comm6,
- comm7: p[d].comm7,
- comm8: p[d].comm8,
- comm9: p[d].comm9,
- comm0: p[d].comm0,
- comm10: p[d].comm10,
- comm11: p[d].comm11,
- comm12: p[d].comm12,
- comm13: p[d].comm13,
- comm14: p[d].comm14
- },
- u = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- "/": "/"
- },
- f = {},
- y = {
- preset: "ogario-orange",
- fpsAtTop: !0,
- miniMapGrid: !1,
- darkTheme: !0,
- mainColor: "#31a8f0",
- bgColor: "#000000",
- bordersColor: "#ffffff",
- sectorsX: 5,
- sectorsY: 5,
- bordersWidth: 20,
- sectorsWidth: 40,
- cellsAlpha: .9,
- skinsAlpha: .7,
- virusAlpha: .6
- };
- a.prototype = {
- customStyle: null,
- loadThemeSettings: function() {
- var o = null;
- null !== e.localStorage.getItem("ogarioThemeSettings") && (o = JSON.parse(e.localStorage.getItem("ogarioThemeSettings")));
- for (var a in y) y.hasOwnProperty(a) && (o && o.hasOwnProperty(a) && (y[a] = o[a]), t.hasOwnProperty(a) && (t[a] = y[a]))
- },
- saveThemeSettings: function() {
- e.localStorage.setItem("ogarioTheme", JSON.stringify(y))
- },
- setThemeMenu: function() {
- var e = this;
- o("#theme").append('<div class="color-box"><span class="title">' + p[d].mainColor + '</span><div class="input-group main-color-picker"><input type="text" value="' + y.mainColor + '" id="mainColor" class="form-control" /><span class="input-group-addon"><i></i></span></div></div> <div class="color-box"><span class="title">' + p[d].bgColor + '</span><div class="input-group background-color-picker"><input type="text" value="' + y.bgColor + '" id="bgColor" class="form-control" /><span class="input-group-addon"><i></i></span></div></div> <div class="color-box"><span class="title">' + p[d].bordersColor + '</span><div class="input-group borders-color-picker"><input type="text" value="' + y.bordersColor + '" id="bordersColor" class="form-control" /><span class="input-group-addon"><i></i></span></div></div>'), o("#theme .main-color-picker").colorpicker({
- format: "hex"
- }).on("changeColor.colorpicker", function(t) {
- y.mainColor = t.color.toHex(), e.setMainColor(), saveThemeSettings(), drawpellets()
- }), o("#theme .background-color-picker").colorpicker({
- format: "hex"
- }).on("changeColor.colorpicker", function(e) {
- y.bgColor = e.color.toHex(), saveThemeSettings(), o("body").css("background-color", y.bgColor)
- }), o("#theme .borders-color-picker").colorpicker({
- format: "hex"
- }).on("changeColor.colorpicker", function(e) {
- y.bordersColor = e.color.toHex(), saveThemeSettings()
- }), o("#theme").append(), o("#theme").append(""), o(".skin").colorpicker({
- format: "hex",
- input: "#color"
- })
- },
- setMainColor: function() {
- this.customStyle || (this.customStyle = o("<style type='text/css'>").appendTo("head")), this.customStyle.html(".main-color, center, #cancel-party-btn { color: " + y.mainColor + "; } .agario-side-panel { border-color: " + y.mainColor + "; }")
- },
- changeThemePreset: function(e) {
- if (f[e]) {
- y.preset = e;
- var e = f[e];
- for (var a in e) e.hasOwnProperty(a) && y.hasOwnProperty(a) && (y[a] = e[a], t.hasOwnProperty(a) && (t[a] = y[a]));
- this.setTheme(), o("#theme .main-color-picker").colorpicker("setValue", y.mainColor), o("#theme .background-color-picker").colorpicker("setValue", y.bgColor), o("#theme .borders-color-picker").colorpicker("setValue", y.bordersColor), o("#theme .text-color-picker").colorpicker("setValue", y.commandsTextColor)
- }
- },
- setTheme: function() {
- this.setMainColor(), C && C.resetMiniMapSectors(), o("body").css("background-color", y.bgColor), o("body").css("background-image", "url(" + y.customBackground + ")"), y.darkTheme ? (o("#minimap-sectors").css("opacity", "0.1"), o("#lightTheme").closest("label").removeClass("active"), o("#darkTheme").closest("label").addClass("active")) : (o("#minimap-sectors").css("opacity", "0.25"), o("#darkTheme").closest("label").removeClass("active"), o("#lightTheme").closest("label").addClass("active"))
- },
- init: function() {
- this.loadThemeSettings()
- }
- };
- var g = new a;
- g.init(), e.setThemeSettings = function(e, t) {
- y.hasOwnProperty(e) && null !== t && (y[e] = t, e)
- }, e.saveThemeSettings = function() {
- C && C.saveSettings(y, "ogarioThemeSettings")
- }, e.drawpellets = function() {
- C && C.drawPellet()
- };
- var k = [],
- w = {},
- v = {
- nick: "",
- clanTag: "",
- skinURL: "",
- color: y.mainColor
- },
- S = {
- autoZoom: !1,
- autoHideCellsInfo: !0,
- autoHideFood: !1,
- hideMyName: !0,
- hideMyMass: !0,
- hideEnemiesMass: !0,
- customSkins: !0,
- myTransparentSkin: !1,
- myCustomColor: !1,
- transparentCells: !1,
- transparentViruses: !0,
- transparentSkins: !1,
- showGrid: !1,
- showBgSectors: !1,
- showMapBorders: !0,
- showMiniMap: !0,
- showChatroom: !0,
- rainbowFood: !1,
- oppColors: !1,
- oppRings: !1,
- showSplitInd: !1,
- splitRange: !1,
- virusesRange: !1,
- textStroke: !1,
- cursorTracking: !1,
- mouseSplit: !1,
- mouseFeed: !1,
- mouseInvert: !1,
- hideChat: !1,
- showStats: !0,
- showStatsMass: !1,
- showStatsSTE: !0,
- showStatsN16: !0,
- showStatsFPS: !0,
- zoomSpeedValue: .9,
- streamMode: !1,
- hideSkinUrl: !1
- };
- i.prototype = {
- id: 0,
- skinID: "",
- x: 0,
- y: 0,
- lastX: 0,
- lastY: 0,
- mass: 0,
- nick: "",
- clanTag: "",
- skinURL: "",
- color: y.mainColor,
- alive: !1,
- updateTime: null,
- pi2: 2 * Math.PI,
- drawPosition: function(e, t, o) {
- if (this.alive) {
- this.lastX = (29 * this.lastX + this.x) / 30, this.lastY = (29 * this.lastY + this.y) / 30;
- var a = (this.lastX + t) * o,
- i = (this.lastY + t) * o;
- this.nick.length > 0 && (e.fillStyle = "#FFFFFF", e.font = "10px Ubuntu", e.textAlign = "center", e.fillText(this.nick, a, i - 12)), e.beginPath(), e.arc(a, i, 4.5, 0, this.pi2, !1), e.closePath(), e.fillStyle = "#1539ee", e.strokeStyle = "rgba(51,51,51,0.5)", e.lineWidth = 1, e.fill(), e.stroke()
- }
- }
- }, s.prototype = {
- name: "SikaPlus",
- version: "v2.1.2",
- privateMode: !1,
- publicIP: "ws://164.132.227.101:3000",
- privateIP: null,
- updateInterval: 1e3,
- updateTick: 0,
- updateMaxTick: 2,
- currentSector: "",
- miniMap: null,
- miniMapCtx: null,
- miniMapSectors: null,
- pi2: 2 * Math.PI,
- socket: null,
- teamPlayers: [],
- partys: [],
- chatHistory: [],
- customSkinsCache: {},
- customSkinsMap: {},
- deathLocations: [],
- playerID: null,
- playerMass: 0,
- selectedProfile: 0,
- lastDeath: 0,
- gameMode: "",
- partyToken: "",
- lastSentNick: "",
- lastSentClanTag: null,
- lastSentSkinURL: "",
- lastSentCustomColor: "",
- lastSentPartyToken: "",
- lastMessageSentTime: Date.now(),
- rFps: 0,
- renderedFrames: 0,
- fpsLastRequest: null,
- statsHUD: null,
- leaderboardPositionsHUD: null,
- activePartys: null,
- top5HUD: null,
- timeHUD: null,
- retryResp: 0,
- token: "b2dhcmlvLm92aA==",
- canvasScale: 1,
- selectBiggestCell: !0,
- noSkins: !1,
- noNames: !1,
- noColors: !1,
- showMass: !0,
- skipStats: !1,
- showSplitInd: !1,
- pause: !1,
- feedInterval: null,
- getPlayerX: function() {
- return t.playerX + t.mapOffsetX
- },
- getPlayerY: function() {
- return t.playerY + t.mapOffsetY
- },
- getOppPlayerX: function(e) {
- return e + t.mapOffsetX
- },
- getOppPlayerY: function(e) {
- return e + t.mapOffsetY
- },
- feed: function() {
- e.core && e.core.eject && e.core.eject()
- },
- macroFeed: function(e) {
- if (e) {
- if (this.feedInterval) return;
- var t = this;
- this.feed(), this.feedInterval = setInterval(function() {
- t.feed()
- }, 80)
- } else this.feedInterval && (clearInterval(this.feedInterval), this.feedInterval = null)
- },
- split: function() {
- e.core && e.core.split && e.core.split()
- },
- doubleSplit: function() {
- var e = this;
- e.split(), setTimeout(function() {
- e.split()
- }, 40)
- },
- popSplit: function() {
- var e = this;
- e.split(), setTimeout(function() {
- e.split()
- }, 200)
- },
- split16: function() {
- var e = this;
- e.split(), setTimeout(function() {
- e.split()
- }, 40), setTimeout(function() {
- e.split()
- }, 80), setTimeout(function() {
- e.split()
- }, 120)
- },
- toggleCells: function() {
- this.selectBiggestCell = !this.selectBiggestCell, t.selectBiggestCell = this.selectBiggestCell
- },
- setShowSplitRange: function() {
- S.splitRange = !S.splitRange, t.splitRange = S.splitRange
- },
- setShowSplitInd: function() {
- this.showSplitInd = !this.showSplitInd, S.splitRange = this.showSplitInd, S.oppRings = this.showSplitInd, t.splitRange = S.splitRange, t.oppRings = S.oppRings
- },
- setShowTeammatesInd: function () {
- b.teammatesInd = !b.teammatesInd
- },
- setShowOppColors: function() {
- S.oppColors = !S.oppColors, t.oppColors = S.oppColors
- },
- setShowSkins: function() {
- this.noSkins = !this.noSkins, e.core && e.core.setSkins && e.core.setSkins(!this.noSkins), t.showCustomSkins = !this.noSkins, this.displayChatInfo(!this.noSkins, "showSkinsMsg")
- },
- setShowStats: function() {
- o("#stats-hud").toggle()
- },
- setShowFood: function() {
- t.showFood = !t.showFood
- },
- setShowHUD: function() {
- o("#overlays-hud").toggle()
- },
- setShowGrid: function() {
- S.showGrid = !S.showGrid, t.showGrid = S.showGrid
- },
- setShowLb: function() {
- ":teams" !== this.gameMode && o("#leaderboard-hud").toggle()
- },
- setShowBgSectors: function() {
- S.showBgSectors = !S.showBgSectors
- },
- setHideSmallBots: function() {
- t.hideSmallBots = !t.hideSmallBots, this.displayChatInfo(!t.hideSmallBots, "hideSmallBotsMsg")
- },
- setShowNames: function() {
- this.noNames = !this.noNames, e.core && e.core.setNames && e.core.setNames(!this.noNames)
- },
- setShowMass: function() {
- this.showMass = !this.showMass, e.core && e.core.setShowMass && e.core.setShowMass(this.showMass)
- },
- setShowChatroom: function() {
- S.showChatroom = !S.showChatroom, this.setChatroom()
- },
- setChatroom: function() {
- S.showChatroom ? this.showchatbox() : this.showpopup()
- },
- setShowMiniMap: function() {
- S.showMiniMap = !S.showMiniMap, this.setMiniMap()
- },
- setMiniMap: function() {
- S.showMiniMap ? o("#minimap-hud").show() : o("#minimap-hud").hide()
- },
- showpopup: function() {
- $("#chatstyle").remove(), $("head").append('<style id="chatstyle">#chatroom{display:none;}#toast-container{display:block;}</style>')
- },
- showchatbox: function() {
- $("#chatstyle").remove(), $("head").append('<style id="chatstyle">#chatroom{display:block;}#toast-container{display:none;}</style>')
- },
- resetZoom: function(e) {
- e ? (t.zoomResetValue = 1, t.zoomValue = 1) : t.zoomResetValue = 0
- },
- setZoom: function(e) {
- t.zoomValue = e
- },
- toggleDeath: function() {
- this.lastDeath--, this.lastDeath < 0 && (this.lastDeath = this.deathLocations.length - 1)
- },
- tryResp: function() {
- if (t.play || 20 == this.retryResp) return void(this.retryResp = 0);
- this.retryResp++;
- var e = this;
- setTimeout(function() {
- o(".btn-play").click(), t.play || e.tryResp()
- }, 500)
- },
- quickResp: function() {
- ":party" === this.gameMode && o("#join-party-btn").click(), t.play = !1, this.tryResp()
- },
- copyLb: function() {
- var e = o("<input>");
- o("body").append(e), e.val(o("#leaderboard-positions").text()).select();
- try {
- document.execCommand("copy")
- } catch (e) {}
- e.remove()
- },
- setPause: function() {
- this.pause = !this.pause, t.pause = this.pause, this.pause ? o("#pause-hud").show() : o("#pause-hud").hide()
- },
- displayLeaderboard: function(e) {
- this.leaderboardPositionsHUD && (this.leaderboardPositionsHUD.innerHTML = e)
- },
- displayStats: function() {
- if (!S.showStats) return void o("#stats-hud").hide();
- var e = "";
- t.play && (S.showStatsMass && t.playerMass && (e += "Mass: " + t.playerMass + " "), t.playerBestMass && (e += "Score: " + t.playerBestMass), S.showStatsSTE && t.STE && (e += " STE: " + t.STE), S.showStatsN16 && t.playerCellsMass && (e += " [" + t.playerCellsMass.length + "/16]"), S.showStatsFPS && (e += " ")), S.showStatsFPS && (e += "FPS: " + this.rFps), this.statsHUD.textContent = e;
- var a = this;
- setTimeout(function() {
- a.displayStats()
- }, 250)
- },
- displayPartys: function() {
- for (var e = "", t = 0; t < this.partys.length; t++) e += '<li><a href="http://agar.io/#' + this.partys[t] + "\" onclick=\"$('#joinPartyToken').val('agar.io/#" + this.partys[t] + "'); $('#join-party-btn').click();\">http://agar.io/#" + this.partys[t] + "</a></li>";
- this.activePartys.innerHTML = e
- },
- displayChatHistory: function(e) {
- if (e) {
- o("#messages").empty(), toastr.clear();
- for (var t = 0; t < this.chatHistory.length; t++) o("#messages").append('<li><span class="message-nick main-color">' + this.chatHistory[t].nick + ": </span>" + this.chatHistory[t].message + "</li>")
- } else o("#messages").empty()
- },
- displayChatInfo: function(e, t) {
- e ? toastr.info(p[d][t + "A"]) : toastr.error(p[d][t + "B"])
- },
- hideChat: function() {
- ":party" === this.gameMode && (S.hideChat = !S.hideChat, S.hideChat && o("#message").hide(), this.displayChatInfo(!S.hideChat, "hideChatMsg"))
- },
- enterChatMessage: function() {
- if (":party" === this.gameMode) {
- var e = o("#message");
- if (e.is(":visible")) {
- var a = e.val();
- a.length > 0 ? (this.sendChatMessage(101, a), t.play && (e.blur(), e.hide())) : (e.blur(), e.hide()), e.val("")
- } else e.show(), e.focus(), e.val("")
- }
- },
- escapeHTML: function(e) {
- return (e + "").replace(/[&<>"'\/]/g, function(e) {
- return u[e]
- })
- },
- loadSettings: function() {
- var o = null;
- null !== e.localStorage.getItem("ogarioSettings") && (o = JSON.parse(e.localStorage.getItem("ogarioSettings")));
- for (var a in S) S.hasOwnProperty(a) && (o && o.hasOwnProperty(a) && (S[a] = o[a]), t.hasOwnProperty(a) && (t[a] = S[a]))
- },
- saveSettings: function(t, o) {
- e.localStorage.setItem(o, JSON.stringify(t))
- },
- loadProfiles: function() {
- if (null !== e.localStorage.getItem("ogarioPlayerProfiles")) k = JSON.parse(e.localStorage.getItem("ogarioPlayerProfiles"));
- else
- for (var t = 0; 10 > t; t++) k.push({
- nick: "Profile " + (t + 1),
- clanTag: "",
- skinURL: "",
- color: y.mainColor
- });
- null !== e.localStorage.getItem("ogarioSelectedProfile") && (this.selectedProfile = JSON.parse(e.localStorage.getItem("ogarioSelectedProfile"))), v.nick = k[this.selectedProfile].nick, v.clanTag = k[this.selectedProfile].clanTag, v.skinURL = k[this.selectedProfile].skinURL, v.color = k[this.selectedProfile].color
- },
- changeSkinPreview: function(e, t) {
- e && t && o("#" + t).removeClass(t + "-default").append(o(e).fadeIn(500))
- },
- setSkinPreview: function(e, t) {
- if (o("#" + t).empty().addClass(t + "-default"), e && 0 != e.length) {
- var a = this,
- i = new Image;
- i.crossOrigin = "Anonymous", i.onload = function() {
- w[e] = i, a.changeSkinPreview(i, t)
- }, i.src = e
- }
- },
- setProfile: function() {
- (k.length + this.selectedProfile - 1) % k.length, (this.selectedProfile + 1) % k.length;
- this.setSkinPreview(k[this.selectedProfile].skinURL, "skin-preview"), o("#nick").val(k[this.selectedProfile].nick), o("#clantag").val(k[this.selectedProfile].clanTag), o("#skin").val(k[this.selectedProfile].skinURL), o("#color").val(k[this.selectedProfile].color), o(".skin").colorpicker("setValue", k[this.selectedProfile].color)
- },
- prevProfile: function() {
- this.setPlayerSettings(), this.selectedProfile = (k.length + this.selectedProfile - 1) % k.length, this.setProfile()
- },
- nextProfile: function() {
- this.setPlayerSettings(), this.selectedProfile = (this.selectedProfile + 1) % k.length, this.setProfile()
- },
- setMenu: function() {
- var e = this;
- document.title = this.name, o("#mainPanel").before('<div id="main-menu" class="agario-panel"><ul class="menu-tabs ' + d + '"><li class="start-tab active"><a href="#main-panel" class="active">' + p[d].start + '</a></li><li class="settings-tab"><a href="#og-settings">' + p[d].settings + '</a></li><li class="theme-tab"><a href="#theme">' + p[d].theme + '</a></li><li class="hotkeys-tab"><a href="#" class="hotkeys-link">' + p[d].hotkeys + '</a></li></ul><div id="main-panel" class="menu-panel"></div><div id="og-settings" class="menu-panel"></div><div id="theme" class="menu-panel"></div></div>'), o("#main-panel").append(""), o("#mainPanel div[role=form]").appendTo(o("#main-panel")), o("#main-panel div[role=form] .form-group:first").remove(), o("#nick").before('<input id="clantag" class="form-control" placeholder="Tag" maxlength="10" /><div class="input-group nick"></div>'), o("#nick").appendTo(o(".nick")), o(".nick").append('<span class="input-group-btn"><button id="stream-mode" class="btn active icon-eye"></button></span>'), o(".nick").after('<div class="input-group skin"><input id="skin" class="form-control" placeholder="Skin URL (imgur.com direct link)" maxlength="60" /><h8>التاق : </h8><h9>رابط السكن :</h9><input type="hidden" id="color" value="' + v.color + '" maxlength="7" /><span class="input-group-addon"><i></i></span><span class="input-group-btn"><button id="hide-url" class="btn active icon-eye"></button></span></div>'), o("#locationKnown, #locationUnknown").insertAfter(o(".skin")), o(".btn-spectate, .btn-logout").appendTo("#agario-main-buttons"), o("#agario-main-buttons").append('<br clear="both" />'), o("#helloContainer div[role=form]").after('<div id="ogario-party"></div>'), o("#settingsChoice, #options").appendTo(o("#og-settings")), o("#stats").appendTo(o("#main-menu")).addClass("menu-panel"), o("#statsContinue").attr("id", "statsContinue2"), o("#mainPanel").empty().remove(), o("#leftPanel, #rightPanel").removeAttr("id"), o(".left-container").empty(), o(".agario-party-6").appendTo(o(".center-container")), o(".right-container").empty(), o(".right-container").append('<div class="agario-party"></div>'), o(".agario-party-6").appendTo(o(".agario-party")), o(".agario-party h4, #cancel-party-btn").remove(), o(".btn-settings, .text-muted, .tosBox, .agario-promo, #agario-web-incentive, span[data-itr='page_option_dark_theme'], #options #darkTheme").remove(), o("#advertisement, #adbg, #a320x250, #g320x250, #s320x250, #adsBottom").css("display", "none"), o(".left-container").append('<div id="profiles"><div id="prev-profile"></div><div id="skin-preview"></div><div id="next-profile"></div></div><div><input id="joinPartyToken" class="partyToken form-control" placeholder="Party Code"><button id="join-party-btn" class="btn btn-primary" style="float: right;" data-itr="page_join_party">Join</button><button id="create-party-btn" class="btn btn-primary btn-success" style="width: 101px;float: right;margin-top: 1px;">Party Code</button><button id="connect-party-btn" class="btn btn-primary btn-success" style="width: 101px;float: right;margin-top: 1px;">Connect</button></div>'), $("#create-party-btn").html("اتصال"), o("#advertisement").removeClass("agario-panel"), o(".right-container").append('<div id="gameinfo"><div>Server:<span id="serverip"></span></div><div>Region:<span id="gamereg"></span></div><div>mode:<span id="gtype"></span></div></div><div id="lbPos"></div><button id="copyLb" class="btn btn-primary btn-success">نسخ</button>'), o("#adsBottom").css({
- "z-index": "1",
- opacity: "0",
- bottom: "-100px"
- }), o("#og-settings").prepend('<div id="zoom-speed-value">Zoom speed: ' + S.zoomSpeedValue + '</div><input id="zoom-speed" type="range" min="0.79" max="0.99" value="' + S.zoomSpeedValue + '" step="0.01">'), o("#zoom-speed").on("change", function() {
- var a = o(this).val();
- S.zoomSpeedValue = a, t.zoomSpeedValue = a, o("#zoom-speed-value").html("Zoom speed: " + a), e.saveSettings(S, "ogarioSettings")
- }), o("#og-settings").append('<div id="og-options"></div>');
- for (var a in S)
- if (S.hasOwnProperty(a)) {
- if ("zoomSpeedValue" === a) break;
- o("#og-options").append('<label><input type="checkbox" onchange="setSettings(\'' + a + "', $(this).is(':checked'));\" id=\"" + a + '">' + p[d][a] + "</label>")
- }
- o("#og-settings input:checkbox").each(function() {
- var e = o(this).attr("id");
- S.hasOwnProperty(e) && o(this).prop("checked", S[e])
- }), g && g.setThemeMenu(), o("body").append('<div id="overlays-hud"><div id="chatroom"><div id="chatroominner"></div></div><div id="stats-hud" class="hud main-color hud-bottom"></div> <div id="top5-hud" class="hud"><h5 class="main-color hud-text-center">Team top 5</h5><ol id="top5p-hud"></ol></div> <div id="pause-hud" class="hud">' + p[d].pause + '</div> <div id="leaderboard-hud" class="hud-b hud-text-left"><h4 class="main-color1">Leaderboard</h4><div id="leaderboard-positions"></div></div> <div id="minimap-hud" class="hud-b"><canvas id="minimap-sectors"></canvas><canvas id="minimap"></canvas></div></div>'), o("body").append('<ul id="messages"></ul>'), o("body").append('<input id="message" class="form-control" type="text" placeholder="' + p[d].enterChatMsg + '..." maxlength="80" />'), toastr.options = {
- newestOnTop: !1,
- positionClass: "toast-bottom-left",
- timeOut: "15000"
- }, o(document).ready(function() {
- o(".menu-tabs a").click(function(e) {
- e.preventDefault();
- var t = o(this);
- if (t.hasClass("hotkeys-link")) return void showHotkeys();
- t.addClass("active"), t.parent().addClass("active"), t.parent().siblings().removeClass("active"), t.parent().siblings().find("a").removeClass("active");
- var a = t.attr("href");
- o(".menu-panel").not(a).css("display", "none"), o(a).fadeIn(), r()
- })
- }), o("#gamemode").on("change", function() {
- e.gameMode = t.gameMode = this.value, ":party" !== this.value && e.isSocketOpen() && (e.socket.close(), o(".partyToken").val(""))
- }), o("#cancel-party-btn").on("click", function() {
- e.gameMode = t.gameMode = "", e.socket.close(), o(".partyToken").val("")
- }), o("#skin").on("input", function() {
- var t = o(this).val();
- e.setSkinPreview(t, "skin-preview")
- }), o("#prev-profile").on("click", function() {
- e.prevProfile()
- }), o("#next-profile").on("click", function() {
- e.nextProfile()
- }), o("#copyLb").on("click", function() {
- e.copyLb()
- }), o("#canvas").bind("contextmenu", function() {
- return !1
- }), o("#stream-mode").on("click", function() {
- S.streamMode = !S.streamMode, e.saveSettings(S, "ogarioSettings"), e.setStreamMode()
- }), o("#hide-url").on("click", function() {
- S.hideSkinUrl = !S.hideSkinUrl, e.saveSettings(S, "ogarioSettings"), e.setHideSkinUrl()
- }), this.statsHUD = document.getElementById("stats-hud"), this.activePartys = document.getElementById("activepartys"), this.top5pHUD = document.getElementById("top5p-hud"), this.leaderboardPositionsHUD = document.getElementById("leaderboard-positions")
- },
- rpanel: function() {
- var e = $("#joinPartyToken").val(),
- t = $("#region").val(),
- o = $("#gamemode").val();
- $("#serverip").append(e), $("#gamereg").append(t), $("#gtype").append(o)
- },
- updatePanelLB: function() {
- function e() {
- if ($("#overlays").is(":visible")) {
- var t = $("#joinPartyToken").val().split("#")[1],
- o = $("#region :selected").text(),
- a = $("#gamemode :selected").text();
- $("#serverip,#gamereg,#gtype").empty(), $("#serverip").append(" " + t), $("#gamereg").append(" " + o), $("#gtype").append(" " + a);
- var i = $("#leaderboard-positions").html();
- $("#lbPos").html(i)
- }
- setTimeout(e, 500)
- }
- e()
- },
- getDefaultSettings: function() {
- this.noSkins = o("#noSkins").is(":checked"), this.noNames = o("#noNames").is(":checked"), this.noColors = o("#noColors").is(":checked"), this.showMass = o("#showMass").is(":checked"), this.skipStats = o("#skipStats").is(":checked"), t.showCustomSkins = !this.noSkins;
- var a = this;
- if (o("#options input").on("click", function() {
- var e = o(this),
- i = e.attr("id");
- void 0 !== a[i] && (a[i] = e.is(":checked"), "noSkins" === i && (t.showCustomSkins = !a.noSkins))
- }), o("#quality").on("change", function() {
- var e = o(this).val();
- a.getQuality(e)
- }), null !== e.localStorage.getItem("scale_setting")) {
- var i = JSON.parse(e.localStorage.getItem("scale_setting"));
- this.setCanvasScale(i)
- } else {
- var s = o("#quality").val();
- this.getQuality(s)
- }
- if (null !== e.localStorage.getItem("location")) {
- var n = e.localStorage.getItem("location");
- o("#region").val(n), e.MC && e.MC.setRegion && e.MC.setRegion(n)
- }
- this.setParty(), ":party" === C.gameMode && e.location.hash && o("#join-party-btn").click()
- },
- getQuality: function(t) {
- var o = "devicePixelRatio" in e,
- a = 1;
- switch (o && (a = e.devicePixelRatio), t) {
- case "High":
- this.setCanvasScale(1);
- break;
- case "Medium":
- this.setCanvasScale(.9);
- break;
- case "Low":
- this.setCanvasScale(.75);
- break;
- case "VeryLow":
- this.setCanvasScale(.5);
- break;
- default:
- this.setCanvasScale(a)
- }
- },
- setCanvasScale: function(e) {
- this.canvasScale = e, t.canvasScale = e
- },
- setParty: function() {
- if (this.gameMode = o("#gamemode").val(), ":party" === this.gameMode) {
- var e = o(".partyToken").val();
- e && e.length > 5 && (e = e.split("#"), this.partyToken = e[1])
- }
- },
- setStreamMode: function() {
- S.streamMode ? (o("#stream-mode").addClass("icon-eye-blocked"), o("#clantag, #nick, #joinPartyToken").addClass("stream-mode")) : (o("#stream-mode").removeClass("icon-eye-blocked"), o("#clantag, #nick, #joinPartyToken").removeClass("stream-mode"))
- },
- setHideSkinUrl: function() {
- S.hideSkinUrl ? (o("#hide-url").addClass("icon-eye-blocked"), o("#skin").addClass("hide-url")) : (o("#hide-url").removeClass("icon-eye-blocked"), o("#skin").removeClass("hide-url"))
- },
- setButtons: function() {
- var e = this,
- t = document.getElementsByClassName("btn-play")[0],
- a = document.getElementsByClassName("btn-play-guest")[0],
- i = document.getElementsByClassName("btn-spectate")[0],
- s = document.getElementById("create-party-btn"),
- n = document.getElementById("join-party-btn"),
- l = document.getElementById("statsContinue2");
- t.addEventListener("click", function() {
- e.onPlay()
- }, !1), a.addEventListener("click", function() {
- e.onPlay()
- }, !1), i.addEventListener("click", function() {
- e.onSpectate()
- }, !1), s.addEventListener("click", function() {
- e.onCreate()
- }, !1), n.addEventListener("click", function() {
- e.onJoin()
- }, !1), l.addEventListener("click", function() {
- o("#stats, #main-panel").toggle()
- }, !1)
- },
- play: function() {
- if (this.setPlayerSettings(), ":party" === this.gameMode)
- if (this.setParty(), this.isSocketOpen()) this.sendPlayerClanTag(), this.sendPartyToken(), this.sendPlayerNick();
- else {
- this.connect();
- var e = this;
- setTimeout(function() {
- e.sendPlayerClanTag(), e.sendPartyToken(), e.sendPlayerNick()
- }, 1e3)
- }
- },
- onPlay: function() {
- this.play(), o("#overlays, #main-panel").hide(), e.addKeyListeners(), t.spectate = !1, t.playerBestMass = 0, S.autoHideFood && (t.showFood = !0), e.ga && e.ga("create", "UA-67142685-2", "auto", "ogarioTracker"), e.ga && e.ga("ogarioTracker.send", "pageview")
- },
- onSpectate: function() {
- ":party" === this.gameMode ? this.onJoin() : this.setPlayerSettings(), o("#main-panel").hide(), e.addKeyListeners(), t.play = !1, t.spectate = !0, S.autoHideFood && (t.showFood = !1)
- },
- join: function() {
- this.setParty(), this.setPlayerSettings(), this.sendPlayerClanTag(), this.sendPartyToken(), this.sendPlayerNick(), this.sendPlayerDeath(), this.sendPlayerJoin()
- },
- onJoin: function() {
- if (this.setParty(), this.isSocketOpen()) this.join();
- else {
- this.connect();
- var e = this;
- setTimeout(function() {
- e.join()
- }, 1e3)
- }
- },
- create: function() {
- if (this.setParty(), "" !== this.partyToken) return void this.onJoin();
- var e = this;
- setTimeout(function() {
- e.create()
- }, 100)
- },
- onCreate: function() {
- this.flushData(), o("#joinPartyToken").val(""), this.partyToken = "", this.create()
- },
- onPlayerSpawn: function() {
- if (t.play = !0, t.playerColor) return this.sendPlayerSpawn(), void this.cacheCustomSkin(v.nick + t.playerColor, v.skinURL);
- var e = this;
- setTimeout(function() {
- e.onPlayerSpawn()
- }, 100)
- },
- onPlayerDeath: function() {
- o(".menu-panel").hide(), this.skipStats ? o("#main-panel").show() : o("#stats").show(), t.play = !1, t.playerColor = null, t.foodIsHidden = !1, t.playerMass = 0, this.sendPlayerDeath(), this.updateDeathLocations(t.playerX, t.playerY), o(".btn-spectate").prop("disabled", !1), e.onkeydown = function() {}
- },
- setPlayerSettings: function() {
- var e = o("#nick").val(),
- a = o("#clantag").val(),
- i = o("#skin").val(),
- s = o("#color").val();
- v.nick = e || "", v.clanTag = a.trim() || "", v.skinURL = i.trim() || "", 7 == s.length && (v.color = s), t.playerNick = v.nick, v.clanTag.length > 0 && (t.clanTag = v.clanTag), k[this.selectedProfile].nick = v.nick, k[this.selectedProfile].clanTag = v.clanTag, k[this.selectedProfile].skinURL = v.skinURL, k[this.selectedProfile].color = v.color, this.saveSettings(k, "ogarioPlayerProfiles"), this.saveSettings(this.selectedProfile, "ogarioSelectedProfile")
- },
- cacheSkin: function(e, t) {
- t && (e[t] = new Image, e[t].crossOrigin = "Anonymous", e[t].src = t)
- },
- getCachedSkin: function(e, t) {
- return e[t] && e[t].width && e[t].complete ? e[t] : null
- },
- cacheCustomSkin: function(e, t) {
- if (t) {
- if (e && (this.customSkinsMap[e] = t), this.customSkinsCache.hasOwnProperty(t)) return;
- this.cacheSkin(this.customSkinsCache, t)
- }
- },
- getCustomSkin: function(e, t) {
- return this.customSkinsMap.hasOwnProperty(e + t) ? this.getCachedSkin(this.customSkinsCache, this.customSkinsMap[e + t]) : null
- },
- countFPS: function() {
- if (S.showStatsFPS) {
- if (!this.fpsLastRequest) return void(this.fpsLastRequest = Date.now());
- var e = Date.now(),
- t = e - this.fpsLastRequest;
- 1e3 > t || (this.rFps = this.renderedFrames, this.renderedFrames = 0, this.fpsLastRequest = e), this.renderedFrames++
- }
- },
- calculateCurrentSector: function() {
- if (!t.mapOffsetFixed) return void(this.currentSector = "");
- var e = t.mapOffsetX + t.mapOffset,
- o = t.mapOffsetY + t.mapOffset,
- a = String.fromCharCode(65 + Math.floor((t.playerY + o) / (t.mapSize / y.sectorsY))),
- i = "" + (Math.floor((t.playerX + e) / (t.mapSize / y.sectorsX)) + 1);
- this.currentSector = a + i
- },
- updateDeathLocations: function(e, o) {
- t.mapOffsetFixed && (this.deathLocations.push({
- x: e + t.mapOffsetX,
- y: o + t.mapOffsetY
- }), 6 == this.deathLocations.length && this.deathLocations.splice(0, 1), this.lastDeath = this.deathLocations.length - 1)
- },
- drawMapBorders: function(e, o, a, i, s, n) {
- t.mapOffsetFixed && S.showMapBorders && (e.strokeStyle = n, e.lineWidth = 40, e.beginPath(), e.moveTo(o - 25, a - 25), e.lineTo(i + 25, a - 25), e.lineTo(i + 25, s + 25), e.lineTo(o - 25, s + 25), e.closePath(), e.stroke())
- },
- drawMiniMap: function() {
- if (t.mapOffsetFixed) {
- this.miniMap ? this.miniMapCtx.clearRect(0, 0, 200, 200) : (this.miniMap = document.getElementById("minimap"), this.miniMapCtx = this.miniMap.getContext("2d"), this.miniMapCtx.ogarioCtx = !0, this.miniMap.width = 200, this.miniMap.height = 200);
- var e = 200 / t.mapSize,
- o = t.mapOffsetX + t.mapOffset,
- a = t.mapOffsetY + t.mapOffset;
- if (this.calculateCurrentSector(), this.miniMapSectors || this.drawMiniMapSectors(y.sectorsX, y.sectorsY, 200, 200), this.miniMapCtx.save(), this.miniMapCtx.fillStyle = "yellow", this.miniMapCtx.strokeStyle = "rgba(51,51,51,0.5)", this.miniMapCtx.beginPath(), this.miniMapCtx.arc((t.playerX + o) * e, (t.playerY + a) * e, 4, 0, this.pi2, !1), this.miniMapCtx.closePath(), this.miniMapCtx.fill(), this.miniMapCtx.stroke(), ":party" === this.gameMode && this.teamPlayers.length > 0)
- for (var i = 0; i < this.teamPlayers.length; i++) this.teamPlayers[i].drawPosition(this.miniMapCtx, t.mapOffset, e);
- if (this.deathLocations.length > 0) {
- var s = Math.round((this.deathLocations[this.lastDeath].x + t.mapOffset) * e),
- n = Math.round((this.deathLocations[this.lastDeath].y + t.mapOffset) * e);
- this.miniMapCtx.lineWidth = 1, this.miniMapCtx.strokeStyle = "#333333", this.miniMapCtx.beginPath(), this.miniMapCtx.moveTo(s - 4.5, n), this.miniMapCtx.lineTo(s + 4.5, n), this.miniMapCtx.moveTo(s, n - 4.5), this.miniMapCtx.lineTo(s, n + 4.5), this.miniMapCtx.stroke()
- }
- this.miniMapCtx.restore()
- }
- },
- drawMiniMapSectors: function(e, t, o, a) {
- this.miniMapSectors = document.getElementById("minimap-sectors");
- var i = this.miniMapSectors.getContext("2d");
- i.ogarioCtx = !0, this.miniMapSectors.width = o, this.miniMapSectors.height = a, i.fillStyle = "#FFFFFF", this.drawMMSectors(i, e, t, 0, 0, o, a, "#FFFFFF", 1, !1)
- },
- resetMiniMapSectors: function() {
- this.miniMapSectors = null
- },
- drawSectors: function(e, o, a, i, s, n, l, r, c, h) {
- if (!h || t.mapOffsetFixed && S.showBgSectors) {
- var d = Math.floor((n - i) / o),
- p = Math.floor((l - s) / a),
- m = (Math.floor(.4 * p), 0),
- u = 0;
- if (e.strokeStyle = "#1A1A1A", e.fillStyle = "#1A1A1A", e.lineWidth = 100, h || !h) {
- e.beginPath();
- for (var f = 0; o + 1 > f; f++) m = i + d * f, e.moveTo(f == o ? n : m, s), e.lineTo(f == o ? n : m, l);
- for (var f = 0; a + 1 > f; f++) u = s + p * f, e.moveTo(i - c / 2, f == a ? l : u), e.lineTo(n + c / 2, f == a ? l : u);
- e.stroke()
- } else this.drawMapBorders(e, i, s, n, l, r, c);
- e.font = "1700px Ubuntu", e.textAlign = "center", e.textBaseline = "middle";
- for (var f = 0; a > f; f++)
- for (var y = 0; o > y; y++) {
- var g = String.fromCharCode(65 + f) + (y + 1);
- m = Math.floor(i + d / 2 + y * d), u = Math.floor(s + p / 2 + f * p), e.fillText(g, m, u)
- }
- }
- },
- drawMMSectors: function(e, o, a, i, s, n, l, r, c, h) {
- if (!h || t.mapOffsetFixed && S.showBgSectors) {
- var d = Math.floor((n - i) / o),
- p = Math.floor((l - s) / a),
- m = (Math.floor(.4 * p), 0),
- u = 0;
- e.font = "600 18px Ubuntu", e.textAlign = "center", e.textBaseline = "middle";
- for (var f = 0; a > f; f++)
- for (var y = 0; o > y; y++) {
- var g = String.fromCharCode(65 + f) + (y + 1);
- m = Math.floor(i + d / 2 + y * d), u = Math.floor(s + p / 2 + f * p), e.fillText(g, m, u)
- }
- }
- },
- drawGrid: function(e) {
- if (S.showGrid) {
- var o = t.innerW / t.viewScale,
- a = t.innerH / t.viewScale,
- i = (-t.playerX + o / 2) % 50,
- s = (-t.playerY + a / 2) % 50;
- for (e.strokeStyle = "#1A1A1A", e.globalAlpha = 1 * t.viewScale, e.beginPath(); o > i; i += 50) e.moveTo(i * t.viewScale - .5, 0), e.lineTo(i * t.viewScale - .5, a * t.viewScale);
- for (; a > s; s += 50) e.moveTo(0, s * t.viewScale - .5), e.lineTo(o * t.viewScale, s * t.viewScale - .5);
- e.stroke(), e.globalAlpha = 1
- }
- },
- drawCircle: function(e, t, o, a, i, s) {
- var n = this;
- e.lineWidth = a, e.globalAlpha = i, e.strokeStyle = s;
- for (var l = 0; l < t.length; l++) {
- var r = n.getOppPlayerX(t[l].x) - n.getPlayerX(),
- c = n.getOppPlayerY(t[l].y) - n.getPlayerY(),
- h = r * r + c * c;
- Math.sqrt(h) > 780 + t[l].size || (e.beginPath(), e.arc(t[l].x, t[l].y, t[l].size + o, 0, this.pi2, !1), e.closePath(), e.stroke())
- }
- e.globalAlpha = 1
- },
- preDrawIndicator: function() {
- t.indicator = document.createElement("canvas");
- var e = t.indicator.getContext("2d");
- e.lineWidth = 2, e.fillStyle = "#FFFFFF", e.strokeStyle = "#000000", e.beginPath(), e.moveTo(0, 0), e.lineTo(90, 0), e.lineTo(45, 50), e.closePath(), e.fill(), e.stroke()
- },
- drawPellet: function() {
- t.pellet = document.createElement("canvas");
- var e = t.pellet.getContext("2d");
- e.fillStyle = y.mainColor, e.beginPath(), e.arc(20, 20, 20, 0, 2 * Math.PI, !1), e.closePath(), e.fill()
- },
- setVirusColor: function() {
- return "#333333"
- },
- setVirusStrokeColor: function() {
- return "#333333"
- },
- setOppColor: function(e, o) {
- if (o) return v.color;
- var a = Math.floor(e * e / 100),
- i = this.selectBiggestCell ? t.playerMaxMass : t.playerMinMass,
- s = a / i;
- if (s && s > 0) {
- var n = 1e3 > i ? .35 : .38;
- return s > 11 ? "#FF008C" : 2.5 > s ? 1.25 > s ? 1.25 > s && s > .75 ? "#FFDC00" : s > n ? "#00C8FF" : "#64FF00" : "#FF0A00" : "#BE00FF"
- }
- },
- connect: function() {
- if (this.closeConnection(), this.flushData(), this.setParty(), ":party" === this.gameMode && this.partyToken.length <= 5) {
- console.log("OGARio by szymy: Connecting to server"), this.socket = new WebSocket(this.privateMode && this.privateIP ? this.privateIP : this.publicIP), this.socket.ogarioWS = !0, this.socket.binaryType = "arraybuffer";
- var e = this;
- this.socket.onopen = function() {
- console.log("OGARio by szymy: Socket open");
- var t = e.createView(3);
- t.setUint8(0, 0), t.setUint16(1, 300, !0), e.sendBuffer(t), e.sendPlayerClanTag(), e.sendPartyToken()
- }, this.socket.onmessage = function(t) {
- e.handleMessage(t)
- }, this.socket.onclose = function() {
- e.flushData(), console.log("OGARio by szymy: Socket close")
- }, this.socket.onerror = function() {
- e.flushData(), console.log("OGARio by szymy: Socket error")
- }
- }
- },
- closeConnection: function() {
- if (this.socket) {
- this.socket.onmessage = null;
- try {
- this.socket.close()
- } catch (e) {}
- this.socket = null
- }
- },
- flushData: function() {
- this.teamPlayers = [], this.partys = [], this.lastSentNick = "", this.lastSentClanTag = null, this.lastSentSkinURL = "", this.lastSentCustomColor = "", this.lastSentPartyToken = "", this.customSkinsMap = {}, t.play = !1, t.playerColor = null
- },
- reConnect: function() {
- this.flushData(), this.setParty();
- var e = this;
- setTimeout(function() {
- e.connect()
- }, 1e3)
- },
- switchServerMode: function() {
- this.privateIP && ":party" === this.gameMode && (this.privateMode = !this.privateMode, this.isSocketOpen() && (this.closeConnection(), toastr.error("Zamknięto połączenie z serwerem!")), this.privateMode ? (toastr.info("Przełączono na serwer prywatny!"), o(".party-panel").show()) : (toastr.info("Przełączono na serwer publiczny!"), o("#activepartys").empty(), o(".party-panel").hide()), this.reConnect())
- },
- isSocketOpen: function() {
- return null != this.socket && this.socket.readyState == this.socket.OPEN
- },
- createView: function(e) {
- return new DataView(new ArrayBuffer(e))
- },
- strToBuff: function(e, t) {
- var o = this.createView(1 + 2 * t.length);
- o.setUint8(0, e);
- for (var a = 0; a < t.length; a++) o.setUint16(1 + 2 * a, t.charCodeAt(a), !0);
- return o
- },
- sendBuffer: function(e) {
- this.socket.send(e.buffer)
- },
- handleMessage: function(e) {
- this.readMessage(new DataView(e.data))
- },
- readMessage: function(e) {
- switch (e.getUint8(0)) {
- case 0:
- this.playerID = e.getUint32(1, !0);
- break;
- case 1:
- this.sendPlayerUpdate();
- break;
- case 20:
- this.updateTeamPlayer(e);
- break;
- case 30:
- this.updateTeamPlayerPosition(e);
- break;
- case 96:
- this.updatePartys(e), this.displayPartys();
- break;
- case 100:
- S.hideChat || this.readChatMessage(e)
- }
- },
- sendPlayerState: function(e) {
- this.isSocketOpen() && (view = this.createView(1), view.setUint8(0, e), this.sendBuffer(view))
- },
- sendPlayerSpawn: function() {
- this.sendPlayerState(1)
- },
- sendPlayerDeath: function() {
- this.sendPlayerState(2)
- },
- sendPlayerJoin: function() {
- this.sendPlayerState(3)
- },
- sendPlayerData: function(e, t, o) {
- (null === this[t] || this[t] !== o) && this.isSocketOpen() && (this.sendBuffer(this.strToBuff(e, o)), this[t] = o)
- },
- sendPlayerNick: function() {
- this.sendPlayerData(10, "lastSentNick", v.nick)
- },
- sendPlayerClanTag: function() {
- this.sendPlayerData(11, "lastSentClanTag", v.clanTag)
- },
- sendPlayerSkinURL: function() {
- this.sendPlayerData(12, "lastSentSkinURL", v.skinURL)
- },
- sendPlayerCustomColor: function() {
- this.sendPlayerData(13, "lastSentCustomColor", v.color)
- },
- sendPlayerColor: function() {
- this.isSocketOpen() && t.playerColor && this.sendBuffer(this.strToBuff(14, t.playerColor))
- },
- sendPartyToken: function() {
- this.setParty(), this.sendPlayerData(15, "lastSentPartyToken", this.partyToken)
- },
- sendPlayerUpdate: function() {
- function e(e) {
- for (var t = 0; t < e.length; t++) a.setUint16(i, e.charCodeAt(t), !0), i += 2;
- a.setUint16(i, 0, !0), i += 2
- }
- if (this.isSocketOpen() && this.playerID && t.play && t.playerColor) {
- var o = 41;
- o += 2 * v.nick.length, o += 2 * v.skinURL.length;
- var a = this.createView(o);
- a.setUint8(0, 20), a.setUint32(1, this.playerID, !0);
- var i = 5;
- e(v.nick), e(v.skinURL), e(v.color), e(t.playerColor), this.sendBuffer(a)
- }
- },
- sendPlayerPosition: function() {
- if (this.isSocketOpen() && t.play && this.playerID) {
- var e = this.createView(17);
- e.setUint8(0, 30), e.setUint32(1, this.playerID, !0), e.setInt32(5, this.getPlayerX(), !0), e.setInt32(9, this.getPlayerY(), !0), void 0 !== t.playerMass ? e.setUint32(13, t.playerMass, !0) : e.setUint32(13, this.playerMass, !0), this.sendBuffer(e)
- }
- },
- checkPlayerID: function(e) {
- for (var t = 0; t < this.teamPlayers.length; t++)
- if (this.teamPlayers[t].id == e) return t;
- return null
- },
- updateTeamPlayer: function(e) {
- function t() {
- for (var t = "";;) {
- var o = e.getUint16(a, !0);
- if (0 == o) break;
- t += String.fromCharCode(o), a += 2
- }
- return a += 2, t
- }
- var o = e.getUint32(1, !0),
- a = 5,
- s = t(),
- n = t(),
- l = t(),
- r = t(),
- c = this.checkPlayerID(o);
- if (null !== c) this.teamPlayers[c].nick = s, this.teamPlayers[c].skinID = s + r, this.teamPlayers[c].skinURL = n, this.teamPlayers[c].color = l;
- else {
- var h = new i(o, s, s + r, n, l);
- this.teamPlayers.push(h)
- }
- this.cacheCustomSkin(s + r, n)
- },
- updateTeamPlayerPosition: function(e) {
- var t = e.getUint32(1, !0),
- o = this.checkPlayerID(t);
- null !== o && (this.teamPlayers[o].x = e.getInt32(5, !0), this.teamPlayers[o].y = e.getInt32(9, !0), this.teamPlayers[o].mass = e.getUint32(13, !0), this.teamPlayers[o].alive = !0, this.teamPlayers[o].updateTime = Date.now())
- },
- updateTeamPlayers: function() {
- if (":party" === this.gameMode) {
- this.sendPlayerPosition();
- for (var e = 0; e < this.teamPlayers.length; e++)(this.teamPlayers[e].alive && Date.now() - this.teamPlayers[e].updateTime >= 2e3 || 0 == this.teamPlayers[e].mass) && (this.teamPlayers[e].alive = !1);
- this.top5 = []
- }
- },
- updatePartys: function(e) {
- this.partys = [];
- for (var t = e.getUint8(1), o = 2, a = 0; t > a; a++) {
- for (var i = "";;) {
- var s = e.getUint16(o, !0);
- if (0 == s) break;
- i += String.fromCharCode(s), o += 2
- }
- o += 2, this.partys.push(i)
- }
- },
- readChatMessage: function(e) {
- for (var t = e.getUint8(1), a = "", i = 10; i < e.byteLength; i += 2) {
- var s = e.getUint16(i, !0);
- if (0 == s) break;
- a += String.fromCharCode(s)
- }
- var n = this.escapeHTML(a);
- if (n.length > 0) {
- var l = n.split(": ", 1),
- r = new Date,
- c = r.getHours() + ":" + r.getMinutes();
- n = n.replace(l + ": ", ""), $("#chatroominner").append('<div id="msg"><span class="time">' + c + '</span><span class="message-nick main-color">' + l + ": </span>" + n + "</div>"), this.scrollDown = function() {
- $("#chatroom").perfectScrollbar && ($("#chatroom").scrollTop($("#chatroom").prop("scrollHeight")), $("#chatroom").perfectScrollbar("update"))
- }, this.scrollDown(), 101 == t ? (toastr.success('<span class="message-nick main-color">' + l + ": </span>" + n), this.chatHistory.push({
- nick: l,
- message: n
- }), this.chatHistory.length > 15 && this.chatHistory.splice(0, 1)) : 102 == t ? toastr.warning(l + ": " + n) : o("#messages").append(a)
- }
- },
- sendChatMessage: function(e, t) {
- if (Date.now() - this.lastMessageSentTime >= 500 && 0 != t.length && 0 != v.nick.length && this.isSocketOpen()) {
- var t = v.nick + ": " + t,
- o = this.createView(10 + 2 * t.length);
- o.setUint8(0, 100), o.setUint8(1, e);
- for (var a = 0; a < t.length; a++) o.setUint16(10 + 2 * a, t.charCodeAt(a), !0);
- this.sendBuffer(o), this.lastMessageSentTime = Date.now()
- }
- },
- prepareCommand: function(e) {
- var t = e.replace("%currentSector%", this.currentSector);
- return t
- },
- sendCommand: function(e) {
- var t = this.prepareCommand(m["comm" + e]);
- this.sendChatMessage(102, t)
- },
- init: function() {
- this.loadSettings(), this.loadProfiles(), this.setMenu(), g && g.setTheme(), this.setProfile(), this.setButtons(), this.setStreamMode(), this.setHideSkinUrl(), this.setMiniMap(), this.setChatroom(), this.displayStats(), this.preDrawIndicator(), this.drawPellet(), this.updatePanelLB();
- var e = this;
- setInterval(function() {
- e.drawMiniMap()
- }, 33), setInterval(function() {
- e.updateTeamPlayers()
- }, this.updateInterval)
- }
- };
- var C = new s;
- C.init(), n(), l(), e.addEventListener("resize", function() {
- setTimeout(r, 50)
- }, !1), e.onbeforeunload = c, e.setSettings = function(e, a) {
- if (S.hasOwnProperty(e) && null !== a) {
- switch (S[e] = a, t.hasOwnProperty(e) && (t[e] = a), e) {
- case "showMiniMap":
- C.setMiniMap();
- break;
- case "showChatroom":
- C.setChatroom();
- break;
- case "showStats":
- C.displayStats(), o("#stats-hud").show()
- }
- C.saveSettings(S, "ogarioSettings")
- }
- }, t.displayLeaderboard = function() {
- C.displayLeaderboard(t.leaderboardHTML)
- }, t.customDraw = function(e) {
- if (e) {
- C.countFPS();
- var o = Math.floor(t.mapMinX - t.mapOffsetX),
- a = Math.floor(t.mapMinY - t.mapOffsetY),
- i = Math.floor(t.mapMaxX - t.mapOffsetX),
- s = Math.floor(t.mapMaxY - t.mapOffsetY),
- n = y.bordersWidth / 2;
- if (C.drawSectors(e, y.sectorsX, y.sectorsY, o, a, i, s, "#1A1A1A", y.sectorsWidth, !0), C.drawMapBorders(e, o - n, a - n, i + n, s + n, y.bordersColor, y.bordersWidth), t.virusesCache && t.virusesCache.length > 0) {
- e.beginPath();
- for (var l = 0; l < t.virusesCache.length; l++) {
- var r = t.virusesCache[l].x,
- c = t.virusesCache[l].y;
- e.moveTo(r, c), e.arc(r, c, t.virusesCache[l].size + 820, 0, C.pi2, !1)
- }
- e.fillStyle = "#333333", e.globalAlpha = .1, e.fill(), e.globalAlpha = 1, t.virusesCache = []
- }
- if (t.foodCache && t.foodCache.length > 0) {
- e.beginPath();
- for (var l = 0; l < t.foodCache.length; l++) {
- var r = t.foodCache[l].x,
- c = t.foodCache[l].y;
- e.drawImage(ogario.pellet, r - 5, c - 5)
- }
- e.fillStyle = y.mainColor, e.globalAlpha = 1, e.fill(), t.foodCache = []
- }
- if (t.play) {
- if (S.splitRange) {
- if (t.playerCells && t.playerCells.length > 0) {
- t.playerCells.sort(function(e, t) {
- return t.size - e.size
- });
- var h = C.selectBiggestCell ? 0 : t.playerCells.length - 1;
- e.lineWidth = 6, e.globalAlpha = y.darkTheme ? .7 : .35, e.strokeStyle = y.darkTheme ? "#FFFFFF" : "#000000", e.beginPath(), e.arc(t.playerCells[h].x, t.playerCells[h].y, t.playerCells[h].size + 760, 0, C.pi2, !1), e.closePath(), e.stroke()
- }
- e.globalAlpha = 1, C.drawCircle(e, t.biggerSTECellsCache, 760, 4, .4, "#BE00FF")
- }
- if (S.oppRings) {
- var d = 14 + 2 / t.viewScale,
- p = 12 + 1 / t.viewScale;
- C.drawCircle(e, t.biggerSTECellsCache, d, p, .75, "#BE00FF"), C.drawCircle(e, t.biggerCellsCache, d, p, .75, "#FF0A00"), C.drawCircle(e, t.smallerCellsCache, d, p, .75, "#00C8FF"), C.drawCircle(e, t.STECellsCache, d, p, .75, "#64FF00")
- }
- if (S.cursorTracking && t.setCursorPosition) {
- t.setCursorPosition(), e.lineWidth = 4, e.globalAlpha = y.darkTheme ? .75 : .35, e.strokeStyle = y.darkTheme ? "#FFFFFF" : "#000000", e.beginPath();
- for (var l = 0; l < t.playerCells.length; l++) e.moveTo(t.playerCells[l].x, t.playerCells[l].y), e.lineTo(t.cursorX, t.cursorY);
- e.stroke(), e.globalAlpha = 1
- }
- }
- t.playerCells = [], (S.splitRange || S.oppRings) && (t.biggerSTECellsCache = [], t.biggerCellsCache = [], t.smallerCellsCache = [], t.STECellsCache = [])
- }
- }, t.drawGrid = function(e) {
- C.drawGrid(e)
- }, t.getCustomSkin = function(e, t) {
- return C.getCustomSkin(e, t)
- }, t.setVirusColor = function(e) {
- return C.setVirusColor(e)
- }, t.setVirusStrokeColor = function(e) {
- return C.setVirusStrokeColor(e)
- }, t.setOppColor = function(e, t) {
- return C.setOppColor(e, t)
- };
- var b = {},
- M = {},
- P = {
- "hk-feed": {
- label: p[d]["hk-feed"],
- defaultKey: "W",
- keyDown: function() {
- C && C.feed()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-macroFeed": {
- label: p[d]["hk-macroFeed"],
- defaultKey: "E",
- keyDown: function() {
- C && C.macroFeed(!0)
- },
- keyUp: function() {
- C && C.macroFeed(!1)
- },
- type: "normal"
- },
- "hk-split": {
- label: p[d]["hk-split"],
- defaultKey: "SPACE",
- keyDown: function() {
- C && C.split()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-doubleSplit": {
- label: p[d]["hk-doubleSplit"],
- defaultKey: "Q",
- keyDown: function() {
- C && C.doubleSplit()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-popSplit": {
- label: "Popsplit",
- defaultKey: "ALT+Q",
- keyDown: function() {
- C && C.popSplit()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-split16": {
- label: p[d]["hk-split16"],
- defaultKey: "SHIFT",
- keyDown: function() {
- C && C.split16()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-pause": {
- label: p[d]["hk-pause"],
- defaultKey: "R",
- keyDown: function() {
- C && C.setPause()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showSplitRange": {
- label: p[d]["hk-showSplitRange"],
- defaultKey: "U",
- keyDown: function() {
- C && C.setShowSplitRange()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showSplitInd": {
- label: p[d]["hk-showSplitInd"],
- defaultKey: "I",
- keyDown: function() {
- C && C.setShowSplitInd()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showOppColors": {
- label: p[d]["hk-showOppColors"],
- defaultKey: "O",
- keyDown: function() {
- C && C.setShowOppColors()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showSkins": {
- label: p[d]["hk-showSkins"],
- defaultKey: "S",
- keyDown: function() {
- C && C.setShowSkins()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showStats": {
- label: p[d]["hk-showStats"],
- defaultKey: "ALT+S",
- keyDown: function() {
- C && C.setShowStats()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-toggleCells": {
- label: p[d]["hk-toggleCells"],
- defaultKey: "D",
- keyDown: function() {
- C && C.toggleCells()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showFood": {
- label: p[d]["hk-showFood"],
- defaultKey: "F",
- keyDown: function() {
- C && C.setShowFood()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showGrid": {
- label: p[d]["hk-showGrid"],
- defaultKey: "G",
- keyDown: function() {
- C && C.setShowGrid()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-hideChat": {
- label: p[d]["hk-hideChat"],
- defaultKey: "H",
- keyDown: function() {
- C && C.hideChat()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showHUD": {
- label: p[d]["hk-showHUD"],
- defaultKey: "ALT+H",
- keyDown: function() {
- C && C.setShowHUD()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-copyLb": {
- label: p[d]["hk-copyLb"],
- defaultKey: "L",
- keyDown: function() {
- C && C.copyLb()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showLb": {
- label: p[d]["hk-showLb"],
- defaultKey: "ALT+L",
- keyDown: function() {
- C && C.setShowLb()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-resetZoom": {
- label: p[d]["hk-resetZoom"],
- defaultKey: "Z",
- keyDown: function() {
- C && C.resetZoom(!0)
- },
- keyUp: function() {
- C && C.resetZoom(!1)
- },
- type: "normal"
- },
- "hk-toggleDeath": {
- label: p[d]["hk-toggleDeath"],
- defaultKey: "X",
- keyDown: function() {
- C && C.toggleDeath()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-clearChat": {
- label: p[d]["hk-clearChat"],
- defaultKey: "C",
- keyDown: function() {
- C && C.displayChatHistory(!0)
- },
- keyUp: function() {
- C && C.displayChatHistory(!1)
- },
- type: "normal"
- },
- "hk-showBgSectors": {
- label: p[d]["hk-showBgSectors"],
- defaultKey: "B",
- keyDown: function() {
- C && C.setShowBgSectors()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-hideBots": {
- label: p[d]["hk-hideBots"],
- defaultKey: "ALT+B",
- keyDown: function() {
- C && C.setHideSmallBots()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showNames": {
- label: p[d]["hk-showNames"],
- defaultKey: "N",
- keyDown: function() {
- C && C.setShowNames()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showMass": {
- label: p[d]["hk-showMass"],
- defaultKey: "M",
- keyDown: function() {
- C && C.setShowMass()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-showMiniMap": {
- label: p[d]["hk-showMiniMap"],
- defaultKey: "ALT+M",
- keyDown: function() {
- C && C.setShowMiniMap()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-chatMessage": {
- label: p[d]["hk-chatMessage"],
- defaultKey: "ENTER",
- keyDown: function() {
- C && C.enterChatMessage()
- },
- keyUp: null,
- type: "special"
- },
- "hk-quickResp": {
- label: p[d]["hk-quickResp"],
- defaultKey: "TILDE",
- keyDown: function() {
- C && C.quickResp()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-zoom1": {
- label: p[d]["hk-zoomLevel"] + " 1",
- defaultKey: "ALT+1",
- keyDown: function() {
- C && C.setZoom(.5)
- },
- keyUp: null,
- type: "normal"
- },
- "hk-zoom2": {
- label: p[d]["hk-zoomLevel"] + " 2",
- defaultKey: "ALT+2",
- keyDown: function() {
- C && C.setZoom(.25)
- },
- keyUp: null,
- type: "normal"
- },
- "hk-zoom3": {
- label: p[d]["hk-zoomLevel"] + " 3",
- defaultKey: "ALT+3",
- keyDown: function() {
- C && C.setZoom(.125)
- },
- keyUp: null,
- type: "normal"
- },
- "hk-zoom4": {
- label: p[d]["hk-zoomLevel"] + " 4",
- defaultKey: "ALT+4",
- keyDown: function() {
- C && C.setZoom(.075)
- },
- keyUp: null,
- type: "normal"
- },
- "hk-zoom5": {
- label: p[d]["hk-zoomLevel"] + " 5",
- defaultKey: "ALT+5",
- keyDown: function() {
- C && C.setZoom(.05)
- },
- keyUp: null,
- type: "normal"
- },
- "hk-switchServerMode": {
- label: "Przełącz serwer [publiczny/prywatny]",
- defaultKey: "=",
- keyDown: function() {
- C && C.switchServerMode()
- },
- keyUp: null,
- type: "normal"
- },
- "hk-comm1": {
- label: m.comm1,
- defaultKey: "1",
- keyDown: function() {
- C && C.sendCommand(1)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm2": {
- label: m.comm2,
- defaultKey: "2",
- keyDown: function() {
- C && C.sendCommand(2)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm3": {
- label: m.comm3,
- defaultKey: "3",
- keyDown: function() {
- C && C.sendCommand(3)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm4": {
- label: m.comm4,
- defaultKey: "4",
- keyDown: function() {
- C && C.sendCommand(4)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm5": {
- label: m.comm5,
- defaultKey: "5",
- keyDown: function() {
- C && C.sendCommand(5)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm6": {
- label: m.comm6,
- defaultKey: "6",
- keyDown: function() {
- C && C.sendCommand(6)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm7": {
- label: m.comm7,
- defaultKey: "7",
- keyDown: function() {
- C && C.sendCommand(7)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm8": {
- label: m.comm8,
- defaultKey: "8",
- keyDown: function() {
- C && C.sendCommand(8)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm9": {
- label: m.comm9,
- defaultKey: "9",
- keyDown: function() {
- C && C.sendCommand(9)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm0": {
- label: m.comm0,
- defaultKey: "0",
- keyDown: function() {
- C && C.sendCommand(0)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm10": {
- label: m.comm10,
- defaultKey: "MOUSE WHEEL",
- keyDown: function() {
- C && C.sendCommand(10)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm11": {
- label: m.comm11,
- defaultKey: "LEFT",
- keyDown: function() {
- C && C.sendCommand(11)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm12": {
- label: m.comm12,
- defaultKey: "UP",
- keyDown: function() {
- C && C.sendCommand(12)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm13": {
- label: m.comm13,
- defaultKey: "RIGHT",
- keyDown: function() {
- C && C.sendCommand(13)
- },
- keyUp: null,
- type: "command"
- },
- "hk-comm14": {
- label: m.comm14,
- defaultKey: "DOWN",
- keyDown: function() {
- C && C.sendCommand(14)
- },
- keyUp: null,
- type: "command"
- }
- };
- h.prototype = {
- lastPressedKey: "",
- lastKeyId: "",
- defaultMessageKey: "ENTER",
- inputClassName: "custom-key-in form-control input-sm",
- loadDefaultHotkeys: function() {
- M = {};
- for (var e in P) P.hasOwnProperty(e) && (M[P[e].defaultKey] = e);
- M["spec-messageKey"] = this.defaultMessageKey
- },
- loadHotkeys: function() {
- null !== e.localStorage.getItem("ogarioHotkeys") ? M = JSON.parse(e.localStorage.getItem("ogarioHotkeys")) : this.loadDefaultHotkeys(), null !== e.localStorage.getItem("ogarioCommands") && (m = JSON.parse(e.localStorage.getItem("ogarioCommands")))
- },
- saveHotkeys: function() {
- e.localStorage.setItem("ogarioHotkeys", JSON.stringify(M)), this.saveCommands()
- },
- saveCommands: function() {
- o("#hotkeys .command-in").each(function() {
- var e = o(this),
- t = e.attr("id");
- m.hasOwnProperty(t) && (m[t] = e.val())
- }), e.localStorage.setItem("ogarioCommands", JSON.stringify(m))
- },
- resetHotkeys: function() {
- this.loadDefaultHotkeys(), o("#hotkeys-cfg .custom-key-in").each(function() {
- var e = o(this).attr("id");
- P[e] && o(this).val(P[e].defaultKey)
- })
- },
- setHotkeysMenu: function() {
- o("body").append('<div id="hotkeys"><div id="hotkeys-head">Hotkey setup</div><div id="hotkeys-cfg"></div><div id="hotkeys-menu"><button class="btn btn-primary" onclick="resetHotkeys();">' + p[d].resetSett + '</button> <button class="btn btn-success" style="float: right;" onclick="saveHotkeys();">' + p[d].saveSett + '</button> <button class="btn btn-danger" style="float: right;" onclick="closeHotkeys();">' + p[d].close + "</button></div></div>"), o("#hotkeys-cfg").append('<div id="hotkeys-inst"><div><p>' + p[d]["hk-inst-assign"] + "</p><p>" + p[d]["hk-inst-delete"] + "</p><p>" + p[d]["hk-inst-keys"] + "</p><p>" + p[d]["hk-inst-keys2"] + '</p></div></div><div class="row rowhead"><div class="key-label">LABEL</div><div class="default-key">DEFAULT KEY</div><div class="custom-key">CUSTOM KEY</div></div>');
- for (keyId in P)
- if (P.hasOwnProperty(keyId)) {
- var e = P[keyId],
- t = "";
- for (var a in M)
- if (M.hasOwnProperty(a) && M[a] === keyId) {
- t = a;
- break
- }
- if ("hk-switchServerMode" === keyId && C && !C.privateIP) continue;
- if ("command" === e.type) {
- var i = keyId.replace("hk-", "");
- o("#hotkeys-cfg").append('<div class="row"><div class="key-label"><input id="' + i + '" class="command-in form-control input-sm" value="' + m[i] + '" maxlength="80" /></div><div class="default-key">' + e.defaultKey + '</div><div class="custom-key"><input id="' + keyId + '" class="custom-key-in form-control input-sm" value="' + t + '" /></div></div>')
- } else o("#hotkeys-cfg").append('<div class="row"><div class="key-label">' + e.label + '</div><div class="default-key">' + e.defaultKey + '</div><div class="custom-key"><input id="' + keyId + '" class="custom-key-in form-control input-sm" value="' + t + '" /></div></div>')
- }
- },
- getPressedKey: function(e) {
- var t = "",
- o = "";
- switch (e.ctrlKey || 17 == e.keyCode ? t = "CTRL" : (e.altKey || 18 == e.keyCode) && (t = "ALT"), e.keyCode) {
- case 9:
- o = "TAB";
- break;
- case 13:
- o = "ENTER";
- break;
- case 16:
- o = "SHIFT";
- break;
- case 17:
- break;
- case 18:
- break;
- case 32:
- o = "SPACE";
- break;
- case 37:
- o = "LEFT";
- break;
- case 38:
- o = "UP";
- break;
- case 39:
- o = "RIGHT";
- break;
- case 40:
- o = "DOWN";
- break;
- case 46:
- o = "DEL";
- break;
- case 61:
- o = "=";
- break;
- case 187:
- o = "=";
- break;
- case 192:
- o = "TILDE";
- break;
- default:
- o = String.fromCharCode(e.keyCode)
- }
- return "" !== t ? "" !== o ? t + "+" + o : t : o
- },
- deleteHotkey: function(e, t) {
- delete M[e], o("#" + t).val("")
- },
- setDefaultHotkey: function(e) {
- var t = !1;
- return P[e] && !M.hasOwnProperty(P[e].defaultKey) ? (t = P[e].defaultKey, M[t] = e, t) : t
- },
- setHotkey: function(e, t) {
- if (t && (this.lastPressedKey !== e || this.lastKeyId !== t)) {
- var a = o("#" + t).val();
- if (this.deleteHotkey(a, t), "DEL" !== e) {
- if (M[e] && M[e] !== t) {
- var i = M[e],
- s = this.setDefaultHotkey(i);
- s ? (M[s] = i, o("#" + i).val(s)) : this.deleteHotkey(e, i)
- }
- M[e] = t, o("#" + t).val(e), "hk-chatMessage" === t && (M["spec-messageKey"] = e), this.lastPressedKey = e, this.lastKeyId = t
- }
- }
- },
- init: function() {
- this.loadHotkeys(), this.setHotkeysMenu()
- }
- };
- var T = new h;
- T.init(), document.onkeydown = function(e) {
- var t = T.getPressedKey(e);
- if (("INPUT" !== e.target.tagName || e.target.className === T.inputClassName || t === M["spec-messageKey"]) && "" !== t && !b[t]) {
- if (b[t] = !0, e.target.className === T.inputClassName) return e.preventDefault(), void T.setHotkey(t, e.target.id);
- if (M[t]) {
- e.preventDefault();
- var o = M[t];
- "" !== o && P[o] && P[o].keyDown && P[o].keyDown()
- }
- }
- }, document.onkeyup = function(e) {
- var t = T.getPressedKey(e);
- if ("" !== t) {
- if (M[t]) {
- var o = M[t];
- "" !== o && P[o] && P[o].keyUp && P[o].keyUp()
- }
- b[t] = !1
- }
- }, e.addKeyListeners = function() {
- e.onkeydown = function(t) {
- switch (t.keyCode) {
- case 81:
- e.core && e.core.specialOn && e.core.specialOn();
- break;
- case 27:
- t.preventDefault(), e.MC.showNickDialog(300), o("#oferwallContainer").is(":visible") && e.closeOfferwall(), o("#videoContainer").is(":visible") && e.closeVideoContainer()
- }
- }, e.onkeyup = function(t) {
- 81 == t.keyCode && e.specialOff && e.core.specialOff()
- }
- }, e.onmousedown = function(e) {
- o("#overlays").is(":visible") || (2 == e.which ? (e.preventDefault(), C && C.sendCommand(10)) : (S.mouseSplit && (1 == e.which && !S.mouseInvert || 3 == e.which && S.mouseInvert) && (e.preventDefault(), C && C.split()), S.mouseFeed && (3 == e.which && !S.mouseInvert || 1 == e.which && S.mouseInvert) && (e.preventDefault(), C && C.macroFeed(!0))))
- }, e.onmouseup = function(e) {
- S.mouseFeed && (3 == e.which && !S.mouseInvert || 1 == e.which && S.mouseInvert) && C && C.macroFeed(!1)
- }, e.resetHotkeys = function() {
- T && T.resetHotkeys()
- }, e.saveHotkeys = function() {
- T && T.saveHotkeys(), o("#hotkeys").fadeOut()
- }, e.showHotkeys = function() {
- e.onkeydown = function() {}, o("#hotkeys").fadeIn()
- }, e.closeHotkeys = function() {
- o("#hotkeys").fadeOut()
- }
- }(window, window.ogario, window.jQuery), $(function() {
- this.width = 280, this.height = 300;
- var e = this;
- $("#chatroom").mouseup(function() {
- e.resize()
- }), e.resize = function() {
- ($("#chatroom").width() != this.width || $("#chatroom").height() != this.height) && $("#chatroom").perfectScrollbar && $("#chatroom").perfectScrollbar("update")
- }, $("#chatroom").perfectScrollbar()
- });
- $("#skin-preview").prependTo("#main-panel.menu-panel");
- $("#profiles").prependTo("#main-panel.menu-panel")
- $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.nick > span").remove();
- $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.skin.colorpicker-element > span.input-group-addon").remove();
- $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.skin.colorpicker-element > span.input-group-btn").remove();
- $("#joinPartyToken").appendTo(".input-group.nick");
- $("#connect-party-btn").insertAfter("#joinPartyToken");
- $("#clantag").insertBefore("#skin");
- $("#gamemode").insertAfter("#nick");
- $("#helloContainer > div.side-container.left-container.disable-mouse > div").hide();
- $(".left-container").hide();
- $("#agario-main-buttons > div.row > button.btn.btn-play.btn-primary.btn-needs-server").before('<button type="button" id="x12" class="btn btn-info btn-settings"><i class="glyphicon glyphicon-cog"></i></button>')
- $("#agario-main-buttons > button.btn.btn-danger.btn-logout").insertAfter("#og-options");
- $("#x12").on('click',function() {
- $("#main-panel").hide();
- $("#og-settings").show();
- });
- // Connect Button
- $("#connect-party-btn").on("click", function() {
- if ($("#joinPartyToken").val().length === 0) {
- $("#create-party-btn").click();
- } else {
- $("#join-party-btn").click();
- }});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement