Advertisement
ImNotSpam

Untitled

Nov 19th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 99.96 KB | None | 0 0
  1. ! function(e, t, o) {
  2. function a() {}
  3.  
  4. function i(e, t, o, a, i) {
  5. this.id = e, this.nick = t, this.skinID = o, this.skinURL = a, 7 == i.length && (this.color = i)
  6. }
  7.  
  8. function s() {}
  9.  
  10. function n() {
  11. if (document.getElementById("canvas")) {
  12. var e = document.getElementById("canvas");
  13. return void e.addEventListener("mousemove", function(e) {
  14. t.play && t.cursorTracking && t.setCursorPosition && (t.clientX = e.clientX, t.clientY = e.clientY, t.setCursorPosition())
  15. }, !1)
  16. }
  17. setTimeout(n, 50)
  18. }
  19.  
  20. function l() {
  21. return e.MC && e.MC.showNickDialog ? (e.MC._showNickDialog = e.MC.showNickDialog, e.MC.showNickDialog = function() {
  22. e.MC._showNickDialog.apply(this, arguments), o("#main-panel").show(), e.onkeydown = function() {}
  23. }, e.MC._showStatsDialog = e.MC.showStatsDialog, e.MC.showStatsDialog = function() {
  24. e.MC._showStatsDialog.apply(this, arguments), e.onkeydown = function() {}
  25. }, e.MC._onPlayerSpawn = e.MC.onPlayerSpawn, e.MC.onPlayerSpawn = function() {
  26. e.MC._onPlayerSpawn.apply(this, arguments), t.playerColor = null, C && C.onPlayerSpawn()
  27. }, e.MC._onPlayerDeath = e.MC.onPlayerDeath, e.MC.onPlayerDeath = function() {
  28. e.MC._onPlayerDeath.apply(this, arguments), C && C.onPlayerDeath()
  29. }, e.MC._onAgarioCoreLoaded = e.MC.onAgarioCoreLoaded, e.MC.onAgarioCoreLoaded = function() {
  30. e.MC._onAgarioCoreLoaded.apply(this, arguments), r()
  31. }, e.MC._wasInitialized = e.MC.wasInitialized, void(e.MC.wasInitialized = function() {
  32. e.MC._wasInitialized.apply(this, arguments), setTimeout(function() {
  33. r(), C && C.getDefaultSettings(), o(".btn-spectate").prop("disabled", !1), e.onkeydown = function() {}
  34. }, 1e3)
  35. })) : void setTimeout(l, 50)
  36. }
  37.  
  38. function r() {
  39. var a = 1 * e.innerWidth,
  40. i = 1 * e.innerHeight,
  41. s = o("#helloContainer"),
  42. n = s.innerHeight();
  43. n > 0 ? t.menuHeight = n : n = t.menuHeight || 570;
  44. var l = Math.min(1, i / n),
  45. r = n * l,
  46. c = Math.round(i / 2 - .5 * r),
  47. h = "translate(-25%, 0%) scale(" + l + ")";
  48. 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
  49. }
  50.  
  51. function c() {
  52. return t.play ? p[d].exit : void 0
  53. }
  54.  
  55. function h() {}
  56. "/ogario" == e.location.pathname && e.history && e.history.replaceState && e.history.replaceState({}, e.document.title, "/" + e.location.hash),
  57. function() {
  58. e.NREUM && (e.NREUM = null, delete e.NREUM), e.core && (e.core = null, delete e.core), o.ajax("http://agar.io/agario.core.js", {
  59. success: function(e) {
  60. var t = e;
  61. 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");
  62. var o = document.createElement("script");
  63. o.textContent = t, o.async = !0, document.body.appendChild(o)
  64. },
  65. dataType: "text",
  66. method: "GET",
  67. cache: !1,
  68. crossDomain: !0
  69. })
  70. }();
  71. var d = "en",
  72. p = {
  73. en: {
  74. start: "الرئيسيه",
  75. settings: "الاعدادات",
  76. hideMyName: "اخفاء اسمي",
  77. showMiniMap: "الخريطه",
  78. showChatroom: "الشات",
  79. mouseFeed: "التفيد بالماوس",
  80. rainbowFood: "تصغير حجم الالماس",
  81. showStatsMass: "عرض الاسكور",
  82. transparentCells: "نقاط شفافه",
  83. showBgSectors: "احرف على الماب",
  84. showStatsFPS: "FPS",
  85. cursorTracking: "خط للمؤشر",
  86. autoHideCellsInfo: "اخفاء الاسامي والاسكور",
  87. autoZoom: "زوم تلقائي",
  88. autoHideFood: "اخفاء الماس تلقائي",
  89. hideMyMass: "اخفاء سكوري",
  90. hideEnemiesMass: "اخفاء سكور الاعداء",
  91. customSkins: "السكنات",
  92. myTransparentSkin: "تحويل السكنات لشفاف",
  93. myCustomColor: "لون سكناتي",
  94. transparentViruses: "الفايرس شفاف",
  95. transparentSkins: "السكنات شفافه",
  96. showGrid: "عرض الخطوط",
  97. showMapBorders: "اظهار حد للخريطه",
  98. oppColors: "الوان الخصوم",
  99. oppRings: "خط عند الانقسام",
  100. teammatesInd: "خط على التيم بنفس التاق",
  101. splitRange: "دائره عند الانقسام",
  102. virusesRange: "دائره عند الفايرس",
  103. textStroke: "الكتابه",
  104. mouseSplit: "الانقسام بالماوس",
  105. mouseInvert: "عكس ازرار الماوس",
  106. hideChat: "اخفاء الشات",
  107. showStats: "عرض احصائيات اللعبه",
  108. showStatsSTE: "STE",
  109. showStatsN16: "[n/16]",
  110. hotkeys: "الازرار",
  111. "hk-inst-assign": "الخطوه الاولى : اضغط على الي تبي تغيره ",
  112. "hk-inst-delete": "الخطوه الثانيه : اضغط على الزر الجديد",
  113. "hk-inst-keys": "اضغط زر ديليت لحذف الزر",
  114. "hk-inst-keys2": "المسموح [CTRL] + 0-9, [ALT] + 0-9,a-z,[ENTER],[SHIFT],[SPACE]",
  115. "hk-feed": "Feed",
  116. "hk-macroFeed": "تفييد سريع",
  117. "hk-split": "انقسام",
  118. "hk-doubleSplit": "دبل انقسام",
  119. "hk-split16": "انقسام 16",
  120. "hk-pause": "توقف عن الحركه",
  121. "hk-showSplitRange": "عرض/اخفاء دائره الانقسام",
  122. "hk-showSplitInd": "عرض/اخفاء خط الانقسام",
  123. "hk-showOppColors": "عرض/اخفاء الوان العدو",
  124. "hk-showSkins": "عرض/اخفاء السكنات",
  125. "hk-showStats": "عرض/اخفاء احصائيات اللعبه",
  126. "hk-toggleCells": "Toggle own cells (smallest/biggest)",
  127. "hk-showFood": "عرض/اخفاء الالماس",
  128. "hk-showGrid": "عرض/اخفاء الخطوط",
  129. "hk-hideChat": "عرض/اخفاء الشات",
  130. "hk-showHUD": "عرض/اخفاء HUD",
  131. "hk-copyLb": "نسخ المتصدرين",
  132. "hk-showLb": "عرض/اخفاء المتصدرين",
  133. "hk-resetZoom": "اعاده الزوم للوضع الطبيعي",
  134. "hk-zoomLevel": "مستوى الزوم",
  135. "hk-toggleDeath": "Toggle death location",
  136. "hk-clearChat": "عرض/حذف رسائل الشات",
  137. "hk-showBgSectors": "Show/hide background sectors",
  138. "hk-hideBots": "Show/hide small bots",
  139. "hk-showNames": "عرض/اخفاء الاسامي",
  140. "hk-showMass": "عرض/اخفاء الماس",
  141. "hk-showMiniMap": "عرض/اخفاء الخريطه",
  142. "hk-chatMessage": "اكتب رساله",
  143. "hk-quickResp": "اعاده لعب سريع",
  144. commands: "Commands",
  145. comm1: "عطني!",
  146. comm2: "انقسم علي!",
  147. comm3: "محتاج فزعه في %currentSector%!",
  148. comm4: "العدو %currentSector%!",
  149. comm5: "احتاج تيم!",
  150. comm6: "فجره!",
  151. comm7: "كل الفايرس!",
  152. comm8: "بايت!",
  153. comm9: "ترك سبلت وهمي!",
  154. comm0: "ياليل!",
  155. comm10: "ترك سبلت!",
  156. comm11: "يسار!",
  157. comm12: "فوق!",
  158. comm13: "يمين!",
  159. comm14: "تحت!",
  160. saveComm: "حفظ الاعدادات",
  161. theme: "الثيم",
  162. themePreset: "Theme preset",
  163. themeType: "Theme type",
  164. darkTheme: "ثيم اسود",
  165. lightTheme: "ثيم ابيض",
  166. mainColor: "Pellets color",
  167. bgColor: "Background color",
  168. bordersColor: "Borders color",
  169. hideChatMsgA: "الشات ظهر!",
  170. hideChatMsgB: "الشات مخفي!",
  171. showSkinsMsgA: "السكنات ظهرت!",
  172. showSkinsMsgB: "السكنات مخفيه!",
  173. hideSmallBotsMsgA: "Small bots are visible!",
  174. hideSmallBotsMsgB: "Small bots are hidden!",
  175. profile: "Profile",
  176. saveSett: "حفظ",
  177. resetSett: "استعاده الاعدادات",
  178. close: "Cancel",
  179. enterChatMsg: "اضغط انتر للكتابه",
  180. activePartys: "Active partys",
  181. pause: "PAUSE!",
  182. visit: "Visit",
  183. exit: "OGARio by szymy: Are you sure you want to quit the game?"
  184. }
  185. },
  186. m = {
  187. comm1: p[d].comm1,
  188. comm2: p[d].comm2,
  189. comm3: p[d].comm3,
  190. comm4: p[d].comm4,
  191. comm5: p[d].comm5,
  192. comm6: p[d].comm6,
  193. comm7: p[d].comm7,
  194. comm8: p[d].comm8,
  195. comm9: p[d].comm9,
  196. comm0: p[d].comm0,
  197. comm10: p[d].comm10,
  198. comm11: p[d].comm11,
  199. comm12: p[d].comm12,
  200. comm13: p[d].comm13,
  201. comm14: p[d].comm14
  202. },
  203. u = {
  204. "&": "&amp;",
  205. "<": "&lt;",
  206. ">": "&gt;",
  207. '"': "&quot;",
  208. "'": "&#39;",
  209. "/": "&#x2F;"
  210. },
  211. f = {},
  212. y = {
  213. preset: "ogario-orange",
  214. fpsAtTop: !0,
  215. miniMapGrid: !1,
  216. darkTheme: !0,
  217. mainColor: "#31a8f0",
  218. bgColor: "#000000",
  219. bordersColor: "#ffffff",
  220. sectorsX: 5,
  221. sectorsY: 5,
  222. bordersWidth: 20,
  223. sectorsWidth: 40,
  224. cellsAlpha: .9,
  225. skinsAlpha: .7,
  226. virusAlpha: .6
  227. };
  228. a.prototype = {
  229. customStyle: null,
  230. loadThemeSettings: function() {
  231. var o = null;
  232. null !== e.localStorage.getItem("ogarioThemeSettings") && (o = JSON.parse(e.localStorage.getItem("ogarioThemeSettings")));
  233. for (var a in y) y.hasOwnProperty(a) && (o && o.hasOwnProperty(a) && (y[a] = o[a]), t.hasOwnProperty(a) && (t[a] = y[a]))
  234. },
  235. saveThemeSettings: function() {
  236. e.localStorage.setItem("ogarioTheme", JSON.stringify(y))
  237. },
  238. setThemeMenu: function() {
  239. var e = this;
  240. 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({
  241. format: "hex"
  242. }).on("changeColor.colorpicker", function(t) {
  243. y.mainColor = t.color.toHex(), e.setMainColor(), saveThemeSettings(), drawpellets()
  244. }), o("#theme .background-color-picker").colorpicker({
  245. format: "hex"
  246. }).on("changeColor.colorpicker", function(e) {
  247. y.bgColor = e.color.toHex(), saveThemeSettings(), o("body").css("background-color", y.bgColor)
  248. }), o("#theme .borders-color-picker").colorpicker({
  249. format: "hex"
  250. }).on("changeColor.colorpicker", function(e) {
  251. y.bordersColor = e.color.toHex(), saveThemeSettings()
  252. }), o("#theme").append(), o("#theme").append(""), o(".skin").colorpicker({
  253. format: "hex",
  254. input: "#color"
  255. })
  256. },
  257. setMainColor: function() {
  258. 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 + "; }")
  259. },
  260. changeThemePreset: function(e) {
  261. if (f[e]) {
  262. y.preset = e;
  263. var e = f[e];
  264. for (var a in e) e.hasOwnProperty(a) && y.hasOwnProperty(a) && (y[a] = e[a], t.hasOwnProperty(a) && (t[a] = y[a]));
  265. 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)
  266. }
  267. },
  268. setTheme: function() {
  269. 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"))
  270. },
  271. init: function() {
  272. this.loadThemeSettings()
  273. }
  274. };
  275. var g = new a;
  276. g.init(), e.setThemeSettings = function(e, t) {
  277. y.hasOwnProperty(e) && null !== t && (y[e] = t, e)
  278. }, e.saveThemeSettings = function() {
  279. C && C.saveSettings(y, "ogarioThemeSettings")
  280. }, e.drawpellets = function() {
  281. C && C.drawPellet()
  282. };
  283. var k = [],
  284. w = {},
  285. v = {
  286. nick: "",
  287. clanTag: "",
  288. skinURL: "",
  289. color: y.mainColor
  290. },
  291. S = {
  292. autoZoom: !1,
  293. autoHideCellsInfo: !0,
  294. autoHideFood: !1,
  295. hideMyName: !0,
  296. hideMyMass: !0,
  297. hideEnemiesMass: !0,
  298. customSkins: !0,
  299. myTransparentSkin: !1,
  300. myCustomColor: !1,
  301. transparentCells: !1,
  302. transparentViruses: !0,
  303. transparentSkins: !1,
  304. showGrid: !1,
  305. showBgSectors: !1,
  306. showMapBorders: !0,
  307. showMiniMap: !0,
  308. showChatroom: !0,
  309. rainbowFood: !1,
  310. oppColors: !1,
  311. oppRings: !1,
  312. showSplitInd: !1,
  313. splitRange: !1,
  314. virusesRange: !1,
  315. textStroke: !1,
  316. cursorTracking: !1,
  317. mouseSplit: !1,
  318. mouseFeed: !1,
  319. mouseInvert: !1,
  320. hideChat: !1,
  321. showStats: !0,
  322. showStatsMass: !1,
  323. showStatsSTE: !0,
  324. showStatsN16: !0,
  325. showStatsFPS: !0,
  326. zoomSpeedValue: .9,
  327. streamMode: !1,
  328. hideSkinUrl: !1
  329. };
  330. i.prototype = {
  331. id: 0,
  332. skinID: "",
  333. x: 0,
  334. y: 0,
  335. lastX: 0,
  336. lastY: 0,
  337. mass: 0,
  338. nick: "",
  339. clanTag: "",
  340. skinURL: "",
  341. color: y.mainColor,
  342. alive: !1,
  343. updateTime: null,
  344. pi2: 2 * Math.PI,
  345. drawPosition: function(e, t, o) {
  346. if (this.alive) {
  347. this.lastX = (29 * this.lastX + this.x) / 30, this.lastY = (29 * this.lastY + this.y) / 30;
  348. var a = (this.lastX + t) * o,
  349. i = (this.lastY + t) * o;
  350. 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()
  351. }
  352. }
  353. }, s.prototype = {
  354. name: "SikaPlus",
  355. version: "v2.1.2",
  356. privateMode: !1,
  357. publicIP: "ws://164.132.227.101:3000",
  358. privateIP: null,
  359. updateInterval: 1e3,
  360. updateTick: 0,
  361. updateMaxTick: 2,
  362. currentSector: "",
  363. miniMap: null,
  364. miniMapCtx: null,
  365. miniMapSectors: null,
  366. pi2: 2 * Math.PI,
  367. socket: null,
  368. teamPlayers: [],
  369. partys: [],
  370. chatHistory: [],
  371. customSkinsCache: {},
  372. customSkinsMap: {},
  373. deathLocations: [],
  374. playerID: null,
  375. playerMass: 0,
  376. selectedProfile: 0,
  377. lastDeath: 0,
  378. gameMode: "",
  379. partyToken: "",
  380. lastSentNick: "",
  381. lastSentClanTag: null,
  382. lastSentSkinURL: "",
  383. lastSentCustomColor: "",
  384. lastSentPartyToken: "",
  385. lastMessageSentTime: Date.now(),
  386. rFps: 0,
  387. renderedFrames: 0,
  388. fpsLastRequest: null,
  389. statsHUD: null,
  390. leaderboardPositionsHUD: null,
  391. activePartys: null,
  392. top5HUD: null,
  393. timeHUD: null,
  394. retryResp: 0,
  395. token: "b2dhcmlvLm92aA==",
  396. canvasScale: 1,
  397. selectBiggestCell: !0,
  398. noSkins: !1,
  399. noNames: !1,
  400. noColors: !1,
  401. showMass: !0,
  402. skipStats: !1,
  403. showSplitInd: !1,
  404. pause: !1,
  405. feedInterval: null,
  406. getPlayerX: function() {
  407. return t.playerX + t.mapOffsetX
  408. },
  409. getPlayerY: function() {
  410. return t.playerY + t.mapOffsetY
  411. },
  412. getOppPlayerX: function(e) {
  413. return e + t.mapOffsetX
  414. },
  415. getOppPlayerY: function(e) {
  416. return e + t.mapOffsetY
  417. },
  418. feed: function() {
  419. e.core && e.core.eject && e.core.eject()
  420. },
  421. macroFeed: function(e) {
  422. if (e) {
  423. if (this.feedInterval) return;
  424. var t = this;
  425. this.feed(), this.feedInterval = setInterval(function() {
  426. t.feed()
  427. }, 80)
  428. } else this.feedInterval && (clearInterval(this.feedInterval), this.feedInterval = null)
  429. },
  430. split: function() {
  431. e.core && e.core.split && e.core.split()
  432. },
  433. doubleSplit: function() {
  434. var e = this;
  435. e.split(), setTimeout(function() {
  436. e.split()
  437. }, 40)
  438. },
  439. popSplit: function() {
  440. var e = this;
  441. e.split(), setTimeout(function() {
  442. e.split()
  443. }, 200)
  444. },
  445. split16: function() {
  446. var e = this;
  447. e.split(), setTimeout(function() {
  448. e.split()
  449. }, 40), setTimeout(function() {
  450. e.split()
  451. }, 80), setTimeout(function() {
  452. e.split()
  453. }, 120)
  454. },
  455. toggleCells: function() {
  456. this.selectBiggestCell = !this.selectBiggestCell, t.selectBiggestCell = this.selectBiggestCell
  457. },
  458. setShowSplitRange: function() {
  459. S.splitRange = !S.splitRange, t.splitRange = S.splitRange
  460. },
  461. setShowSplitInd: function() {
  462. this.showSplitInd = !this.showSplitInd, S.splitRange = this.showSplitInd, S.oppRings = this.showSplitInd, t.splitRange = S.splitRange, t.oppRings = S.oppRings
  463. },
  464. setShowTeammatesInd: function () {
  465. b.teammatesInd = !b.teammatesInd
  466. },
  467. setShowOppColors: function() {
  468. S.oppColors = !S.oppColors, t.oppColors = S.oppColors
  469. },
  470. setShowSkins: function() {
  471. this.noSkins = !this.noSkins, e.core && e.core.setSkins && e.core.setSkins(!this.noSkins), t.showCustomSkins = !this.noSkins, this.displayChatInfo(!this.noSkins, "showSkinsMsg")
  472. },
  473. setShowStats: function() {
  474. o("#stats-hud").toggle()
  475. },
  476. setShowFood: function() {
  477. t.showFood = !t.showFood
  478. },
  479. setShowHUD: function() {
  480. o("#overlays-hud").toggle()
  481. },
  482. setShowGrid: function() {
  483. S.showGrid = !S.showGrid, t.showGrid = S.showGrid
  484. },
  485. setShowLb: function() {
  486. ":teams" !== this.gameMode && o("#leaderboard-hud").toggle()
  487. },
  488. setShowBgSectors: function() {
  489. S.showBgSectors = !S.showBgSectors
  490. },
  491. setHideSmallBots: function() {
  492. t.hideSmallBots = !t.hideSmallBots, this.displayChatInfo(!t.hideSmallBots, "hideSmallBotsMsg")
  493. },
  494. setShowNames: function() {
  495. this.noNames = !this.noNames, e.core && e.core.setNames && e.core.setNames(!this.noNames)
  496. },
  497. setShowMass: function() {
  498. this.showMass = !this.showMass, e.core && e.core.setShowMass && e.core.setShowMass(this.showMass)
  499. },
  500. setShowChatroom: function() {
  501. S.showChatroom = !S.showChatroom, this.setChatroom()
  502. },
  503. setChatroom: function() {
  504. S.showChatroom ? this.showchatbox() : this.showpopup()
  505. },
  506. setShowMiniMap: function() {
  507. S.showMiniMap = !S.showMiniMap, this.setMiniMap()
  508. },
  509. setMiniMap: function() {
  510. S.showMiniMap ? o("#minimap-hud").show() : o("#minimap-hud").hide()
  511. },
  512. showpopup: function() {
  513. $("#chatstyle").remove(), $("head").append('<style id="chatstyle">#chatroom{display:none;}#toast-container{display:block;}</style>')
  514. },
  515. showchatbox: function() {
  516. $("#chatstyle").remove(), $("head").append('<style id="chatstyle">#chatroom{display:block;}#toast-container{display:none;}</style>')
  517. },
  518. resetZoom: function(e) {
  519. e ? (t.zoomResetValue = 1, t.zoomValue = 1) : t.zoomResetValue = 0
  520. },
  521. setZoom: function(e) {
  522. t.zoomValue = e
  523. },
  524. toggleDeath: function() {
  525. this.lastDeath--, this.lastDeath < 0 && (this.lastDeath = this.deathLocations.length - 1)
  526. },
  527. tryResp: function() {
  528. if (t.play || 20 == this.retryResp) return void(this.retryResp = 0);
  529. this.retryResp++;
  530. var e = this;
  531. setTimeout(function() {
  532. o(".btn-play").click(), t.play || e.tryResp()
  533. }, 500)
  534. },
  535. quickResp: function() {
  536. ":party" === this.gameMode && o("#join-party-btn").click(), t.play = !1, this.tryResp()
  537. },
  538. copyLb: function() {
  539. var e = o("<input>");
  540. o("body").append(e), e.val(o("#leaderboard-positions").text()).select();
  541. try {
  542. document.execCommand("copy")
  543. } catch (e) {}
  544. e.remove()
  545. },
  546. setPause: function() {
  547. this.pause = !this.pause, t.pause = this.pause, this.pause ? o("#pause-hud").show() : o("#pause-hud").hide()
  548. },
  549. displayLeaderboard: function(e) {
  550. this.leaderboardPositionsHUD && (this.leaderboardPositionsHUD.innerHTML = e)
  551. },
  552. displayStats: function() {
  553. if (!S.showStats) return void o("#stats-hud").hide();
  554. var e = "";
  555. 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;
  556. var a = this;
  557. setTimeout(function() {
  558. a.displayStats()
  559. }, 250)
  560. },
  561. displayPartys: function() {
  562. 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>";
  563. this.activePartys.innerHTML = e
  564. },
  565. displayChatHistory: function(e) {
  566. if (e) {
  567. o("#messages").empty(), toastr.clear();
  568. 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>")
  569. } else o("#messages").empty()
  570. },
  571. displayChatInfo: function(e, t) {
  572. e ? toastr.info(p[d][t + "A"]) : toastr.error(p[d][t + "B"])
  573. },
  574. hideChat: function() {
  575. ":party" === this.gameMode && (S.hideChat = !S.hideChat, S.hideChat && o("#message").hide(), this.displayChatInfo(!S.hideChat, "hideChatMsg"))
  576. },
  577. enterChatMessage: function() {
  578. if (":party" === this.gameMode) {
  579. var e = o("#message");
  580. if (e.is(":visible")) {
  581. var a = e.val();
  582. a.length > 0 ? (this.sendChatMessage(101, a), t.play && (e.blur(), e.hide())) : (e.blur(), e.hide()), e.val("")
  583. } else e.show(), e.focus(), e.val("")
  584. }
  585. },
  586. escapeHTML: function(e) {
  587. return (e + "").replace(/[&<>"'\/]/g, function(e) {
  588. return u[e]
  589. })
  590. },
  591. loadSettings: function() {
  592. var o = null;
  593. null !== e.localStorage.getItem("ogarioSettings") && (o = JSON.parse(e.localStorage.getItem("ogarioSettings")));
  594. for (var a in S) S.hasOwnProperty(a) && (o && o.hasOwnProperty(a) && (S[a] = o[a]), t.hasOwnProperty(a) && (t[a] = S[a]))
  595. },
  596. saveSettings: function(t, o) {
  597. e.localStorage.setItem(o, JSON.stringify(t))
  598. },
  599. loadProfiles: function() {
  600. if (null !== e.localStorage.getItem("ogarioPlayerProfiles")) k = JSON.parse(e.localStorage.getItem("ogarioPlayerProfiles"));
  601. else
  602. for (var t = 0; 10 > t; t++) k.push({
  603. nick: "Profile " + (t + 1),
  604. clanTag: "",
  605. skinURL: "",
  606. color: y.mainColor
  607. });
  608. 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
  609. },
  610. changeSkinPreview: function(e, t) {
  611. e && t && o("#" + t).removeClass(t + "-default").append(o(e).fadeIn(500))
  612. },
  613. setSkinPreview: function(e, t) {
  614. if (o("#" + t).empty().addClass(t + "-default"), e && 0 != e.length) {
  615. var a = this,
  616. i = new Image;
  617. i.crossOrigin = "Anonymous", i.onload = function() {
  618. w[e] = i, a.changeSkinPreview(i, t)
  619. }, i.src = e
  620. }
  621. },
  622. setProfile: function() {
  623. (k.length + this.selectedProfile - 1) % k.length, (this.selectedProfile + 1) % k.length;
  624. 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)
  625. },
  626. prevProfile: function() {
  627. this.setPlayerSettings(), this.selectedProfile = (k.length + this.selectedProfile - 1) % k.length, this.setProfile()
  628. },
  629. nextProfile: function() {
  630. this.setPlayerSettings(), this.selectedProfile = (this.selectedProfile + 1) % k.length, this.setProfile()
  631. },
  632. setMenu: function() {
  633. var e = this;
  634. 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({
  635. "z-index": "1",
  636. opacity: "0",
  637. bottom: "-100px"
  638. }), 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() {
  639. var a = o(this).val();
  640. S.zoomSpeedValue = a, t.zoomSpeedValue = a, o("#zoom-speed-value").html("Zoom speed: " + a), e.saveSettings(S, "ogarioSettings")
  641. }), o("#og-settings").append('<div id="og-options"></div>');
  642. for (var a in S)
  643. if (S.hasOwnProperty(a)) {
  644. if ("zoomSpeedValue" === a) break;
  645. o("#og-options").append('<label><input type="checkbox" onchange="setSettings(\'' + a + "', $(this).is(':checked'));\" id=\"" + a + '">' + p[d][a] + "</label>")
  646. }
  647. o("#og-settings input:checkbox").each(function() {
  648. var e = o(this).attr("id");
  649. S.hasOwnProperty(e) && o(this).prop("checked", S[e])
  650. }), 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 = {
  651. newestOnTop: !1,
  652. positionClass: "toast-bottom-left",
  653. timeOut: "15000"
  654. }, o(document).ready(function() {
  655. o(".menu-tabs a").click(function(e) {
  656. e.preventDefault();
  657. var t = o(this);
  658. if (t.hasClass("hotkeys-link")) return void showHotkeys();
  659. t.addClass("active"), t.parent().addClass("active"), t.parent().siblings().removeClass("active"), t.parent().siblings().find("a").removeClass("active");
  660. var a = t.attr("href");
  661. o(".menu-panel").not(a).css("display", "none"), o(a).fadeIn(), r()
  662. })
  663. }), o("#gamemode").on("change", function() {
  664. e.gameMode = t.gameMode = this.value, ":party" !== this.value && e.isSocketOpen() && (e.socket.close(), o(".partyToken").val(""))
  665. }), o("#cancel-party-btn").on("click", function() {
  666. e.gameMode = t.gameMode = "", e.socket.close(), o(".partyToken").val("")
  667. }), o("#skin").on("input", function() {
  668. var t = o(this).val();
  669. e.setSkinPreview(t, "skin-preview")
  670. }), o("#prev-profile").on("click", function() {
  671. e.prevProfile()
  672. }), o("#next-profile").on("click", function() {
  673. e.nextProfile()
  674. }), o("#copyLb").on("click", function() {
  675. e.copyLb()
  676. }), o("#canvas").bind("contextmenu", function() {
  677. return !1
  678. }), o("#stream-mode").on("click", function() {
  679. S.streamMode = !S.streamMode, e.saveSettings(S, "ogarioSettings"), e.setStreamMode()
  680. }), o("#hide-url").on("click", function() {
  681. S.hideSkinUrl = !S.hideSkinUrl, e.saveSettings(S, "ogarioSettings"), e.setHideSkinUrl()
  682. }), this.statsHUD = document.getElementById("stats-hud"), this.activePartys = document.getElementById("activepartys"), this.top5pHUD = document.getElementById("top5p-hud"), this.leaderboardPositionsHUD = document.getElementById("leaderboard-positions")
  683. },
  684. rpanel: function() {
  685. var e = $("#joinPartyToken").val(),
  686. t = $("#region").val(),
  687. o = $("#gamemode").val();
  688. $("#serverip").append(e), $("#gamereg").append(t), $("#gtype").append(o)
  689. },
  690. updatePanelLB: function() {
  691. function e() {
  692. if ($("#overlays").is(":visible")) {
  693. var t = $("#joinPartyToken").val().split("#")[1],
  694. o = $("#region :selected").text(),
  695. a = $("#gamemode :selected").text();
  696. $("#serverip,#gamereg,#gtype").empty(), $("#serverip").append(" " + t), $("#gamereg").append(" " + o), $("#gtype").append(" " + a);
  697. var i = $("#leaderboard-positions").html();
  698. $("#lbPos").html(i)
  699. }
  700. setTimeout(e, 500)
  701. }
  702. e()
  703. },
  704. getDefaultSettings: function() {
  705. 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;
  706. var a = this;
  707. if (o("#options input").on("click", function() {
  708. var e = o(this),
  709. i = e.attr("id");
  710. void 0 !== a[i] && (a[i] = e.is(":checked"), "noSkins" === i && (t.showCustomSkins = !a.noSkins))
  711. }), o("#quality").on("change", function() {
  712. var e = o(this).val();
  713. a.getQuality(e)
  714. }), null !== e.localStorage.getItem("scale_setting")) {
  715. var i = JSON.parse(e.localStorage.getItem("scale_setting"));
  716. this.setCanvasScale(i)
  717. } else {
  718. var s = o("#quality").val();
  719. this.getQuality(s)
  720. }
  721. if (null !== e.localStorage.getItem("location")) {
  722. var n = e.localStorage.getItem("location");
  723. o("#region").val(n), e.MC && e.MC.setRegion && e.MC.setRegion(n)
  724. }
  725. this.setParty(), ":party" === C.gameMode && e.location.hash && o("#join-party-btn").click()
  726. },
  727. getQuality: function(t) {
  728. var o = "devicePixelRatio" in e,
  729. a = 1;
  730. switch (o && (a = e.devicePixelRatio), t) {
  731. case "High":
  732. this.setCanvasScale(1);
  733. break;
  734. case "Medium":
  735. this.setCanvasScale(.9);
  736. break;
  737. case "Low":
  738. this.setCanvasScale(.75);
  739. break;
  740. case "VeryLow":
  741. this.setCanvasScale(.5);
  742. break;
  743. default:
  744. this.setCanvasScale(a)
  745. }
  746. },
  747. setCanvasScale: function(e) {
  748. this.canvasScale = e, t.canvasScale = e
  749. },
  750. setParty: function() {
  751. if (this.gameMode = o("#gamemode").val(), ":party" === this.gameMode) {
  752. var e = o(".partyToken").val();
  753. e && e.length > 5 && (e = e.split("#"), this.partyToken = e[1])
  754. }
  755. },
  756. setStreamMode: function() {
  757. 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"))
  758. },
  759. setHideSkinUrl: function() {
  760. 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"))
  761. },
  762. setButtons: function() {
  763. var e = this,
  764. t = document.getElementsByClassName("btn-play")[0],
  765. a = document.getElementsByClassName("btn-play-guest")[0],
  766. i = document.getElementsByClassName("btn-spectate")[0],
  767. s = document.getElementById("create-party-btn"),
  768. n = document.getElementById("join-party-btn"),
  769. l = document.getElementById("statsContinue2");
  770. t.addEventListener("click", function() {
  771. e.onPlay()
  772. }, !1), a.addEventListener("click", function() {
  773. e.onPlay()
  774. }, !1), i.addEventListener("click", function() {
  775. e.onSpectate()
  776. }, !1), s.addEventListener("click", function() {
  777. e.onCreate()
  778. }, !1), n.addEventListener("click", function() {
  779. e.onJoin()
  780. }, !1), l.addEventListener("click", function() {
  781. o("#stats, #main-panel").toggle()
  782. }, !1)
  783. },
  784. play: function() {
  785. if (this.setPlayerSettings(), ":party" === this.gameMode)
  786. if (this.setParty(), this.isSocketOpen()) this.sendPlayerClanTag(), this.sendPartyToken(), this.sendPlayerNick();
  787. else {
  788. this.connect();
  789. var e = this;
  790. setTimeout(function() {
  791. e.sendPlayerClanTag(), e.sendPartyToken(), e.sendPlayerNick()
  792. }, 1e3)
  793. }
  794. },
  795. onPlay: function() {
  796. 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")
  797. },
  798. onSpectate: function() {
  799. ":party" === this.gameMode ? this.onJoin() : this.setPlayerSettings(), o("#main-panel").hide(), e.addKeyListeners(), t.play = !1, t.spectate = !0, S.autoHideFood && (t.showFood = !1)
  800. },
  801. join: function() {
  802. this.setParty(), this.setPlayerSettings(), this.sendPlayerClanTag(), this.sendPartyToken(), this.sendPlayerNick(), this.sendPlayerDeath(), this.sendPlayerJoin()
  803. },
  804. onJoin: function() {
  805. if (this.setParty(), this.isSocketOpen()) this.join();
  806. else {
  807. this.connect();
  808. var e = this;
  809. setTimeout(function() {
  810. e.join()
  811. }, 1e3)
  812. }
  813. },
  814. create: function() {
  815. if (this.setParty(), "" !== this.partyToken) return void this.onJoin();
  816. var e = this;
  817. setTimeout(function() {
  818. e.create()
  819. }, 100)
  820. },
  821. onCreate: function() {
  822. this.flushData(), o("#joinPartyToken").val(""), this.partyToken = "", this.create()
  823. },
  824. onPlayerSpawn: function() {
  825. if (t.play = !0, t.playerColor) return this.sendPlayerSpawn(), void this.cacheCustomSkin(v.nick + t.playerColor, v.skinURL);
  826. var e = this;
  827. setTimeout(function() {
  828. e.onPlayerSpawn()
  829. }, 100)
  830. },
  831. onPlayerDeath: function() {
  832. 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() {}
  833. },
  834. setPlayerSettings: function() {
  835. var e = o("#nick").val(),
  836. a = o("#clantag").val(),
  837. i = o("#skin").val(),
  838. s = o("#color").val();
  839. 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")
  840. },
  841. cacheSkin: function(e, t) {
  842. t && (e[t] = new Image, e[t].crossOrigin = "Anonymous", e[t].src = t)
  843. },
  844. getCachedSkin: function(e, t) {
  845. return e[t] && e[t].width && e[t].complete ? e[t] : null
  846. },
  847. cacheCustomSkin: function(e, t) {
  848. if (t) {
  849. if (e && (this.customSkinsMap[e] = t), this.customSkinsCache.hasOwnProperty(t)) return;
  850. this.cacheSkin(this.customSkinsCache, t)
  851. }
  852. },
  853. getCustomSkin: function(e, t) {
  854. return this.customSkinsMap.hasOwnProperty(e + t) ? this.getCachedSkin(this.customSkinsCache, this.customSkinsMap[e + t]) : null
  855. },
  856. countFPS: function() {
  857. if (S.showStatsFPS) {
  858. if (!this.fpsLastRequest) return void(this.fpsLastRequest = Date.now());
  859. var e = Date.now(),
  860. t = e - this.fpsLastRequest;
  861. 1e3 > t || (this.rFps = this.renderedFrames, this.renderedFrames = 0, this.fpsLastRequest = e), this.renderedFrames++
  862. }
  863. },
  864. calculateCurrentSector: function() {
  865. if (!t.mapOffsetFixed) return void(this.currentSector = "");
  866. var e = t.mapOffsetX + t.mapOffset,
  867. o = t.mapOffsetY + t.mapOffset,
  868. a = String.fromCharCode(65 + Math.floor((t.playerY + o) / (t.mapSize / y.sectorsY))),
  869. i = "" + (Math.floor((t.playerX + e) / (t.mapSize / y.sectorsX)) + 1);
  870. this.currentSector = a + i
  871. },
  872. updateDeathLocations: function(e, o) {
  873. t.mapOffsetFixed && (this.deathLocations.push({
  874. x: e + t.mapOffsetX,
  875. y: o + t.mapOffsetY
  876. }), 6 == this.deathLocations.length && this.deathLocations.splice(0, 1), this.lastDeath = this.deathLocations.length - 1)
  877. },
  878. drawMapBorders: function(e, o, a, i, s, n) {
  879. 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())
  880. },
  881. drawMiniMap: function() {
  882. if (t.mapOffsetFixed) {
  883. 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);
  884. var e = 200 / t.mapSize,
  885. o = t.mapOffsetX + t.mapOffset,
  886. a = t.mapOffsetY + t.mapOffset;
  887. 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)
  888. for (var i = 0; i < this.teamPlayers.length; i++) this.teamPlayers[i].drawPosition(this.miniMapCtx, t.mapOffset, e);
  889. if (this.deathLocations.length > 0) {
  890. var s = Math.round((this.deathLocations[this.lastDeath].x + t.mapOffset) * e),
  891. n = Math.round((this.deathLocations[this.lastDeath].y + t.mapOffset) * e);
  892. 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()
  893. }
  894. this.miniMapCtx.restore()
  895. }
  896. },
  897. drawMiniMapSectors: function(e, t, o, a) {
  898. this.miniMapSectors = document.getElementById("minimap-sectors");
  899. var i = this.miniMapSectors.getContext("2d");
  900. 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)
  901. },
  902. resetMiniMapSectors: function() {
  903. this.miniMapSectors = null
  904. },
  905. drawSectors: function(e, o, a, i, s, n, l, r, c, h) {
  906. if (!h || t.mapOffsetFixed && S.showBgSectors) {
  907. var d = Math.floor((n - i) / o),
  908. p = Math.floor((l - s) / a),
  909. m = (Math.floor(.4 * p), 0),
  910. u = 0;
  911. if (e.strokeStyle = "#1A1A1A", e.fillStyle = "#1A1A1A", e.lineWidth = 100, h || !h) {
  912. e.beginPath();
  913. 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);
  914. 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);
  915. e.stroke()
  916. } else this.drawMapBorders(e, i, s, n, l, r, c);
  917. e.font = "1700px Ubuntu", e.textAlign = "center", e.textBaseline = "middle";
  918. for (var f = 0; a > f; f++)
  919. for (var y = 0; o > y; y++) {
  920. var g = String.fromCharCode(65 + f) + (y + 1);
  921. m = Math.floor(i + d / 2 + y * d), u = Math.floor(s + p / 2 + f * p), e.fillText(g, m, u)
  922. }
  923. }
  924. },
  925. drawMMSectors: function(e, o, a, i, s, n, l, r, c, h) {
  926. if (!h || t.mapOffsetFixed && S.showBgSectors) {
  927. var d = Math.floor((n - i) / o),
  928. p = Math.floor((l - s) / a),
  929. m = (Math.floor(.4 * p), 0),
  930. u = 0;
  931. e.font = "600 18px Ubuntu", e.textAlign = "center", e.textBaseline = "middle";
  932. for (var f = 0; a > f; f++)
  933. for (var y = 0; o > y; y++) {
  934. var g = String.fromCharCode(65 + f) + (y + 1);
  935. m = Math.floor(i + d / 2 + y * d), u = Math.floor(s + p / 2 + f * p), e.fillText(g, m, u)
  936. }
  937. }
  938. },
  939. drawGrid: function(e) {
  940. if (S.showGrid) {
  941. var o = t.innerW / t.viewScale,
  942. a = t.innerH / t.viewScale,
  943. i = (-t.playerX + o / 2) % 50,
  944. s = (-t.playerY + a / 2) % 50;
  945. 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);
  946. for (; a > s; s += 50) e.moveTo(0, s * t.viewScale - .5), e.lineTo(o * t.viewScale, s * t.viewScale - .5);
  947. e.stroke(), e.globalAlpha = 1
  948. }
  949. },
  950. drawCircle: function(e, t, o, a, i, s) {
  951. var n = this;
  952. e.lineWidth = a, e.globalAlpha = i, e.strokeStyle = s;
  953. for (var l = 0; l < t.length; l++) {
  954. var r = n.getOppPlayerX(t[l].x) - n.getPlayerX(),
  955. c = n.getOppPlayerY(t[l].y) - n.getPlayerY(),
  956. h = r * r + c * c;
  957. 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())
  958. }
  959. e.globalAlpha = 1
  960. },
  961. preDrawIndicator: function() {
  962. t.indicator = document.createElement("canvas");
  963. var e = t.indicator.getContext("2d");
  964. 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()
  965. },
  966. drawPellet: function() {
  967. t.pellet = document.createElement("canvas");
  968. var e = t.pellet.getContext("2d");
  969. e.fillStyle = y.mainColor, e.beginPath(), e.arc(20, 20, 20, 0, 2 * Math.PI, !1), e.closePath(), e.fill()
  970. },
  971. setVirusColor: function() {
  972. return "#333333"
  973. },
  974. setVirusStrokeColor: function() {
  975. return "#333333"
  976. },
  977. setOppColor: function(e, o) {
  978. if (o) return v.color;
  979. var a = Math.floor(e * e / 100),
  980. i = this.selectBiggestCell ? t.playerMaxMass : t.playerMinMass,
  981. s = a / i;
  982. if (s && s > 0) {
  983. var n = 1e3 > i ? .35 : .38;
  984. return s > 11 ? "#FF008C" : 2.5 > s ? 1.25 > s ? 1.25 > s && s > .75 ? "#FFDC00" : s > n ? "#00C8FF" : "#64FF00" : "#FF0A00" : "#BE00FF"
  985. }
  986. },
  987. connect: function() {
  988. if (this.closeConnection(), this.flushData(), this.setParty(), ":party" === this.gameMode && this.partyToken.length <= 5) {
  989. 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";
  990. var e = this;
  991. this.socket.onopen = function() {
  992. console.log("OGARio by szymy: Socket open");
  993. var t = e.createView(3);
  994. t.setUint8(0, 0), t.setUint16(1, 300, !0), e.sendBuffer(t), e.sendPlayerClanTag(), e.sendPartyToken()
  995. }, this.socket.onmessage = function(t) {
  996. e.handleMessage(t)
  997. }, this.socket.onclose = function() {
  998. e.flushData(), console.log("OGARio by szymy: Socket close")
  999. }, this.socket.onerror = function() {
  1000. e.flushData(), console.log("OGARio by szymy: Socket error")
  1001. }
  1002. }
  1003. },
  1004. closeConnection: function() {
  1005. if (this.socket) {
  1006. this.socket.onmessage = null;
  1007. try {
  1008. this.socket.close()
  1009. } catch (e) {}
  1010. this.socket = null
  1011. }
  1012. },
  1013. flushData: function() {
  1014. this.teamPlayers = [], this.partys = [], this.lastSentNick = "", this.lastSentClanTag = null, this.lastSentSkinURL = "", this.lastSentCustomColor = "", this.lastSentPartyToken = "", this.customSkinsMap = {}, t.play = !1, t.playerColor = null
  1015. },
  1016. reConnect: function() {
  1017. this.flushData(), this.setParty();
  1018. var e = this;
  1019. setTimeout(function() {
  1020. e.connect()
  1021. }, 1e3)
  1022. },
  1023. switchServerMode: function() {
  1024. 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())
  1025. },
  1026. isSocketOpen: function() {
  1027. return null != this.socket && this.socket.readyState == this.socket.OPEN
  1028. },
  1029. createView: function(e) {
  1030. return new DataView(new ArrayBuffer(e))
  1031. },
  1032. strToBuff: function(e, t) {
  1033. var o = this.createView(1 + 2 * t.length);
  1034. o.setUint8(0, e);
  1035. for (var a = 0; a < t.length; a++) o.setUint16(1 + 2 * a, t.charCodeAt(a), !0);
  1036. return o
  1037. },
  1038. sendBuffer: function(e) {
  1039. this.socket.send(e.buffer)
  1040. },
  1041. handleMessage: function(e) {
  1042. this.readMessage(new DataView(e.data))
  1043. },
  1044. readMessage: function(e) {
  1045. switch (e.getUint8(0)) {
  1046. case 0:
  1047. this.playerID = e.getUint32(1, !0);
  1048. break;
  1049. case 1:
  1050. this.sendPlayerUpdate();
  1051. break;
  1052. case 20:
  1053. this.updateTeamPlayer(e);
  1054. break;
  1055. case 30:
  1056. this.updateTeamPlayerPosition(e);
  1057. break;
  1058. case 96:
  1059. this.updatePartys(e), this.displayPartys();
  1060. break;
  1061. case 100:
  1062. S.hideChat || this.readChatMessage(e)
  1063. }
  1064. },
  1065. sendPlayerState: function(e) {
  1066. this.isSocketOpen() && (view = this.createView(1), view.setUint8(0, e), this.sendBuffer(view))
  1067. },
  1068. sendPlayerSpawn: function() {
  1069. this.sendPlayerState(1)
  1070. },
  1071. sendPlayerDeath: function() {
  1072. this.sendPlayerState(2)
  1073. },
  1074. sendPlayerJoin: function() {
  1075. this.sendPlayerState(3)
  1076. },
  1077. sendPlayerData: function(e, t, o) {
  1078. (null === this[t] || this[t] !== o) && this.isSocketOpen() && (this.sendBuffer(this.strToBuff(e, o)), this[t] = o)
  1079. },
  1080. sendPlayerNick: function() {
  1081. this.sendPlayerData(10, "lastSentNick", v.nick)
  1082. },
  1083. sendPlayerClanTag: function() {
  1084. this.sendPlayerData(11, "lastSentClanTag", v.clanTag)
  1085. },
  1086. sendPlayerSkinURL: function() {
  1087. this.sendPlayerData(12, "lastSentSkinURL", v.skinURL)
  1088. },
  1089. sendPlayerCustomColor: function() {
  1090. this.sendPlayerData(13, "lastSentCustomColor", v.color)
  1091. },
  1092. sendPlayerColor: function() {
  1093. this.isSocketOpen() && t.playerColor && this.sendBuffer(this.strToBuff(14, t.playerColor))
  1094. },
  1095. sendPartyToken: function() {
  1096. this.setParty(), this.sendPlayerData(15, "lastSentPartyToken", this.partyToken)
  1097. },
  1098. sendPlayerUpdate: function() {
  1099. function e(e) {
  1100. for (var t = 0; t < e.length; t++) a.setUint16(i, e.charCodeAt(t), !0), i += 2;
  1101. a.setUint16(i, 0, !0), i += 2
  1102. }
  1103. if (this.isSocketOpen() && this.playerID && t.play && t.playerColor) {
  1104. var o = 41;
  1105. o += 2 * v.nick.length, o += 2 * v.skinURL.length;
  1106. var a = this.createView(o);
  1107. a.setUint8(0, 20), a.setUint32(1, this.playerID, !0);
  1108. var i = 5;
  1109. e(v.nick), e(v.skinURL), e(v.color), e(t.playerColor), this.sendBuffer(a)
  1110. }
  1111. },
  1112. sendPlayerPosition: function() {
  1113. if (this.isSocketOpen() && t.play && this.playerID) {
  1114. var e = this.createView(17);
  1115. 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)
  1116. }
  1117. },
  1118. checkPlayerID: function(e) {
  1119. for (var t = 0; t < this.teamPlayers.length; t++)
  1120. if (this.teamPlayers[t].id == e) return t;
  1121. return null
  1122. },
  1123. updateTeamPlayer: function(e) {
  1124. function t() {
  1125. for (var t = "";;) {
  1126. var o = e.getUint16(a, !0);
  1127. if (0 == o) break;
  1128. t += String.fromCharCode(o), a += 2
  1129. }
  1130. return a += 2, t
  1131. }
  1132. var o = e.getUint32(1, !0),
  1133. a = 5,
  1134. s = t(),
  1135. n = t(),
  1136. l = t(),
  1137. r = t(),
  1138. c = this.checkPlayerID(o);
  1139. if (null !== c) this.teamPlayers[c].nick = s, this.teamPlayers[c].skinID = s + r, this.teamPlayers[c].skinURL = n, this.teamPlayers[c].color = l;
  1140. else {
  1141. var h = new i(o, s, s + r, n, l);
  1142. this.teamPlayers.push(h)
  1143. }
  1144. this.cacheCustomSkin(s + r, n)
  1145. },
  1146. updateTeamPlayerPosition: function(e) {
  1147. var t = e.getUint32(1, !0),
  1148. o = this.checkPlayerID(t);
  1149. 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())
  1150. },
  1151. updateTeamPlayers: function() {
  1152. if (":party" === this.gameMode) {
  1153. this.sendPlayerPosition();
  1154. 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);
  1155. this.top5 = []
  1156. }
  1157. },
  1158. updatePartys: function(e) {
  1159. this.partys = [];
  1160. for (var t = e.getUint8(1), o = 2, a = 0; t > a; a++) {
  1161. for (var i = "";;) {
  1162. var s = e.getUint16(o, !0);
  1163. if (0 == s) break;
  1164. i += String.fromCharCode(s), o += 2
  1165. }
  1166. o += 2, this.partys.push(i)
  1167. }
  1168. },
  1169. readChatMessage: function(e) {
  1170. for (var t = e.getUint8(1), a = "", i = 10; i < e.byteLength; i += 2) {
  1171. var s = e.getUint16(i, !0);
  1172. if (0 == s) break;
  1173. a += String.fromCharCode(s)
  1174. }
  1175. var n = this.escapeHTML(a);
  1176. if (n.length > 0) {
  1177. var l = n.split(": ", 1),
  1178. r = new Date,
  1179. c = r.getHours() + ":" + r.getMinutes();
  1180. 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() {
  1181. $("#chatroom").perfectScrollbar && ($("#chatroom").scrollTop($("#chatroom").prop("scrollHeight")), $("#chatroom").perfectScrollbar("update"))
  1182. }, this.scrollDown(), 101 == t ? (toastr.success('<span class="message-nick main-color">' + l + ": </span>" + n), this.chatHistory.push({
  1183. nick: l,
  1184. message: n
  1185. }), this.chatHistory.length > 15 && this.chatHistory.splice(0, 1)) : 102 == t ? toastr.warning(l + ": " + n) : o("#messages").append(a)
  1186. }
  1187. },
  1188. sendChatMessage: function(e, t) {
  1189. if (Date.now() - this.lastMessageSentTime >= 500 && 0 != t.length && 0 != v.nick.length && this.isSocketOpen()) {
  1190. var t = v.nick + ": " + t,
  1191. o = this.createView(10 + 2 * t.length);
  1192. o.setUint8(0, 100), o.setUint8(1, e);
  1193. for (var a = 0; a < t.length; a++) o.setUint16(10 + 2 * a, t.charCodeAt(a), !0);
  1194. this.sendBuffer(o), this.lastMessageSentTime = Date.now()
  1195. }
  1196. },
  1197. prepareCommand: function(e) {
  1198. var t = e.replace("%currentSector%", this.currentSector);
  1199. return t
  1200. },
  1201. sendCommand: function(e) {
  1202. var t = this.prepareCommand(m["comm" + e]);
  1203. this.sendChatMessage(102, t)
  1204. },
  1205. init: function() {
  1206. 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();
  1207. var e = this;
  1208. setInterval(function() {
  1209. e.drawMiniMap()
  1210. }, 33), setInterval(function() {
  1211. e.updateTeamPlayers()
  1212. }, this.updateInterval)
  1213. }
  1214. };
  1215. var C = new s;
  1216. C.init(), n(), l(), e.addEventListener("resize", function() {
  1217. setTimeout(r, 50)
  1218. }, !1), e.onbeforeunload = c, e.setSettings = function(e, a) {
  1219. if (S.hasOwnProperty(e) && null !== a) {
  1220. switch (S[e] = a, t.hasOwnProperty(e) && (t[e] = a), e) {
  1221. case "showMiniMap":
  1222. C.setMiniMap();
  1223. break;
  1224. case "showChatroom":
  1225. C.setChatroom();
  1226. break;
  1227. case "showStats":
  1228. C.displayStats(), o("#stats-hud").show()
  1229. }
  1230. C.saveSettings(S, "ogarioSettings")
  1231. }
  1232. }, t.displayLeaderboard = function() {
  1233. C.displayLeaderboard(t.leaderboardHTML)
  1234. }, t.customDraw = function(e) {
  1235. if (e) {
  1236. C.countFPS();
  1237. var o = Math.floor(t.mapMinX - t.mapOffsetX),
  1238. a = Math.floor(t.mapMinY - t.mapOffsetY),
  1239. i = Math.floor(t.mapMaxX - t.mapOffsetX),
  1240. s = Math.floor(t.mapMaxY - t.mapOffsetY),
  1241. n = y.bordersWidth / 2;
  1242. 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) {
  1243. e.beginPath();
  1244. for (var l = 0; l < t.virusesCache.length; l++) {
  1245. var r = t.virusesCache[l].x,
  1246. c = t.virusesCache[l].y;
  1247. e.moveTo(r, c), e.arc(r, c, t.virusesCache[l].size + 820, 0, C.pi2, !1)
  1248. }
  1249. e.fillStyle = "#333333", e.globalAlpha = .1, e.fill(), e.globalAlpha = 1, t.virusesCache = []
  1250. }
  1251. if (t.foodCache && t.foodCache.length > 0) {
  1252. e.beginPath();
  1253. for (var l = 0; l < t.foodCache.length; l++) {
  1254. var r = t.foodCache[l].x,
  1255. c = t.foodCache[l].y;
  1256. e.drawImage(ogario.pellet, r - 5, c - 5)
  1257. }
  1258. e.fillStyle = y.mainColor, e.globalAlpha = 1, e.fill(), t.foodCache = []
  1259. }
  1260. if (t.play) {
  1261. if (S.splitRange) {
  1262. if (t.playerCells && t.playerCells.length > 0) {
  1263. t.playerCells.sort(function(e, t) {
  1264. return t.size - e.size
  1265. });
  1266. var h = C.selectBiggestCell ? 0 : t.playerCells.length - 1;
  1267. 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()
  1268. }
  1269. e.globalAlpha = 1, C.drawCircle(e, t.biggerSTECellsCache, 760, 4, .4, "#BE00FF")
  1270. }
  1271. if (S.oppRings) {
  1272. var d = 14 + 2 / t.viewScale,
  1273. p = 12 + 1 / t.viewScale;
  1274. 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")
  1275. }
  1276. if (S.cursorTracking && t.setCursorPosition) {
  1277. t.setCursorPosition(), e.lineWidth = 4, e.globalAlpha = y.darkTheme ? .75 : .35, e.strokeStyle = y.darkTheme ? "#FFFFFF" : "#000000", e.beginPath();
  1278. 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);
  1279. e.stroke(), e.globalAlpha = 1
  1280. }
  1281. }
  1282. t.playerCells = [], (S.splitRange || S.oppRings) && (t.biggerSTECellsCache = [], t.biggerCellsCache = [], t.smallerCellsCache = [], t.STECellsCache = [])
  1283. }
  1284. }, t.drawGrid = function(e) {
  1285. C.drawGrid(e)
  1286. }, t.getCustomSkin = function(e, t) {
  1287. return C.getCustomSkin(e, t)
  1288. }, t.setVirusColor = function(e) {
  1289. return C.setVirusColor(e)
  1290. }, t.setVirusStrokeColor = function(e) {
  1291. return C.setVirusStrokeColor(e)
  1292. }, t.setOppColor = function(e, t) {
  1293. return C.setOppColor(e, t)
  1294. };
  1295. var b = {},
  1296. M = {},
  1297. P = {
  1298. "hk-feed": {
  1299. label: p[d]["hk-feed"],
  1300. defaultKey: "W",
  1301. keyDown: function() {
  1302. C && C.feed()
  1303. },
  1304. keyUp: null,
  1305. type: "normal"
  1306. },
  1307. "hk-macroFeed": {
  1308. label: p[d]["hk-macroFeed"],
  1309. defaultKey: "E",
  1310. keyDown: function() {
  1311. C && C.macroFeed(!0)
  1312. },
  1313. keyUp: function() {
  1314. C && C.macroFeed(!1)
  1315. },
  1316. type: "normal"
  1317. },
  1318. "hk-split": {
  1319. label: p[d]["hk-split"],
  1320. defaultKey: "SPACE",
  1321. keyDown: function() {
  1322. C && C.split()
  1323. },
  1324. keyUp: null,
  1325. type: "normal"
  1326. },
  1327. "hk-doubleSplit": {
  1328. label: p[d]["hk-doubleSplit"],
  1329. defaultKey: "Q",
  1330. keyDown: function() {
  1331. C && C.doubleSplit()
  1332. },
  1333. keyUp: null,
  1334. type: "normal"
  1335. },
  1336. "hk-popSplit": {
  1337. label: "Popsplit",
  1338. defaultKey: "ALT+Q",
  1339. keyDown: function() {
  1340. C && C.popSplit()
  1341. },
  1342. keyUp: null,
  1343. type: "normal"
  1344. },
  1345. "hk-split16": {
  1346. label: p[d]["hk-split16"],
  1347. defaultKey: "SHIFT",
  1348. keyDown: function() {
  1349. C && C.split16()
  1350. },
  1351. keyUp: null,
  1352. type: "normal"
  1353. },
  1354. "hk-pause": {
  1355. label: p[d]["hk-pause"],
  1356. defaultKey: "R",
  1357. keyDown: function() {
  1358. C && C.setPause()
  1359. },
  1360. keyUp: null,
  1361. type: "normal"
  1362. },
  1363. "hk-showSplitRange": {
  1364. label: p[d]["hk-showSplitRange"],
  1365. defaultKey: "U",
  1366. keyDown: function() {
  1367. C && C.setShowSplitRange()
  1368. },
  1369. keyUp: null,
  1370. type: "normal"
  1371. },
  1372. "hk-showSplitInd": {
  1373. label: p[d]["hk-showSplitInd"],
  1374. defaultKey: "I",
  1375. keyDown: function() {
  1376. C && C.setShowSplitInd()
  1377. },
  1378. keyUp: null,
  1379. type: "normal"
  1380. },
  1381. "hk-showOppColors": {
  1382. label: p[d]["hk-showOppColors"],
  1383. defaultKey: "O",
  1384. keyDown: function() {
  1385. C && C.setShowOppColors()
  1386. },
  1387. keyUp: null,
  1388. type: "normal"
  1389. },
  1390. "hk-showSkins": {
  1391. label: p[d]["hk-showSkins"],
  1392. defaultKey: "S",
  1393. keyDown: function() {
  1394. C && C.setShowSkins()
  1395. },
  1396. keyUp: null,
  1397. type: "normal"
  1398. },
  1399. "hk-showStats": {
  1400. label: p[d]["hk-showStats"],
  1401. defaultKey: "ALT+S",
  1402. keyDown: function() {
  1403. C && C.setShowStats()
  1404. },
  1405. keyUp: null,
  1406. type: "normal"
  1407. },
  1408. "hk-toggleCells": {
  1409. label: p[d]["hk-toggleCells"],
  1410. defaultKey: "D",
  1411. keyDown: function() {
  1412. C && C.toggleCells()
  1413. },
  1414. keyUp: null,
  1415. type: "normal"
  1416. },
  1417. "hk-showFood": {
  1418. label: p[d]["hk-showFood"],
  1419. defaultKey: "F",
  1420. keyDown: function() {
  1421. C && C.setShowFood()
  1422. },
  1423. keyUp: null,
  1424. type: "normal"
  1425. },
  1426. "hk-showGrid": {
  1427. label: p[d]["hk-showGrid"],
  1428. defaultKey: "G",
  1429. keyDown: function() {
  1430. C && C.setShowGrid()
  1431. },
  1432. keyUp: null,
  1433. type: "normal"
  1434. },
  1435. "hk-hideChat": {
  1436. label: p[d]["hk-hideChat"],
  1437. defaultKey: "H",
  1438. keyDown: function() {
  1439. C && C.hideChat()
  1440. },
  1441. keyUp: null,
  1442. type: "normal"
  1443. },
  1444. "hk-showHUD": {
  1445. label: p[d]["hk-showHUD"],
  1446. defaultKey: "ALT+H",
  1447. keyDown: function() {
  1448. C && C.setShowHUD()
  1449. },
  1450. keyUp: null,
  1451. type: "normal"
  1452. },
  1453. "hk-copyLb": {
  1454. label: p[d]["hk-copyLb"],
  1455. defaultKey: "L",
  1456. keyDown: function() {
  1457. C && C.copyLb()
  1458. },
  1459. keyUp: null,
  1460. type: "normal"
  1461. },
  1462. "hk-showLb": {
  1463. label: p[d]["hk-showLb"],
  1464. defaultKey: "ALT+L",
  1465. keyDown: function() {
  1466. C && C.setShowLb()
  1467. },
  1468. keyUp: null,
  1469. type: "normal"
  1470. },
  1471. "hk-resetZoom": {
  1472. label: p[d]["hk-resetZoom"],
  1473. defaultKey: "Z",
  1474. keyDown: function() {
  1475. C && C.resetZoom(!0)
  1476. },
  1477. keyUp: function() {
  1478. C && C.resetZoom(!1)
  1479. },
  1480. type: "normal"
  1481. },
  1482. "hk-toggleDeath": {
  1483. label: p[d]["hk-toggleDeath"],
  1484. defaultKey: "X",
  1485. keyDown: function() {
  1486. C && C.toggleDeath()
  1487. },
  1488. keyUp: null,
  1489. type: "normal"
  1490. },
  1491. "hk-clearChat": {
  1492. label: p[d]["hk-clearChat"],
  1493. defaultKey: "C",
  1494. keyDown: function() {
  1495. C && C.displayChatHistory(!0)
  1496. },
  1497. keyUp: function() {
  1498. C && C.displayChatHistory(!1)
  1499. },
  1500. type: "normal"
  1501. },
  1502. "hk-showBgSectors": {
  1503. label: p[d]["hk-showBgSectors"],
  1504. defaultKey: "B",
  1505. keyDown: function() {
  1506. C && C.setShowBgSectors()
  1507. },
  1508. keyUp: null,
  1509. type: "normal"
  1510. },
  1511. "hk-hideBots": {
  1512. label: p[d]["hk-hideBots"],
  1513. defaultKey: "ALT+B",
  1514. keyDown: function() {
  1515. C && C.setHideSmallBots()
  1516. },
  1517. keyUp: null,
  1518. type: "normal"
  1519. },
  1520. "hk-showNames": {
  1521. label: p[d]["hk-showNames"],
  1522. defaultKey: "N",
  1523. keyDown: function() {
  1524. C && C.setShowNames()
  1525. },
  1526. keyUp: null,
  1527. type: "normal"
  1528. },
  1529. "hk-showMass": {
  1530. label: p[d]["hk-showMass"],
  1531. defaultKey: "M",
  1532. keyDown: function() {
  1533. C && C.setShowMass()
  1534. },
  1535. keyUp: null,
  1536. type: "normal"
  1537. },
  1538. "hk-showMiniMap": {
  1539. label: p[d]["hk-showMiniMap"],
  1540. defaultKey: "ALT+M",
  1541. keyDown: function() {
  1542. C && C.setShowMiniMap()
  1543. },
  1544. keyUp: null,
  1545. type: "normal"
  1546. },
  1547. "hk-chatMessage": {
  1548. label: p[d]["hk-chatMessage"],
  1549. defaultKey: "ENTER",
  1550. keyDown: function() {
  1551. C && C.enterChatMessage()
  1552. },
  1553. keyUp: null,
  1554. type: "special"
  1555. },
  1556. "hk-quickResp": {
  1557. label: p[d]["hk-quickResp"],
  1558. defaultKey: "TILDE",
  1559. keyDown: function() {
  1560. C && C.quickResp()
  1561. },
  1562. keyUp: null,
  1563. type: "normal"
  1564. },
  1565. "hk-zoom1": {
  1566. label: p[d]["hk-zoomLevel"] + " 1",
  1567. defaultKey: "ALT+1",
  1568. keyDown: function() {
  1569. C && C.setZoom(.5)
  1570. },
  1571. keyUp: null,
  1572. type: "normal"
  1573. },
  1574. "hk-zoom2": {
  1575. label: p[d]["hk-zoomLevel"] + " 2",
  1576. defaultKey: "ALT+2",
  1577. keyDown: function() {
  1578. C && C.setZoom(.25)
  1579. },
  1580. keyUp: null,
  1581. type: "normal"
  1582. },
  1583. "hk-zoom3": {
  1584. label: p[d]["hk-zoomLevel"] + " 3",
  1585. defaultKey: "ALT+3",
  1586. keyDown: function() {
  1587. C && C.setZoom(.125)
  1588. },
  1589. keyUp: null,
  1590. type: "normal"
  1591. },
  1592. "hk-zoom4": {
  1593. label: p[d]["hk-zoomLevel"] + " 4",
  1594. defaultKey: "ALT+4",
  1595. keyDown: function() {
  1596. C && C.setZoom(.075)
  1597. },
  1598. keyUp: null,
  1599. type: "normal"
  1600. },
  1601. "hk-zoom5": {
  1602. label: p[d]["hk-zoomLevel"] + " 5",
  1603. defaultKey: "ALT+5",
  1604. keyDown: function() {
  1605. C && C.setZoom(.05)
  1606. },
  1607. keyUp: null,
  1608. type: "normal"
  1609. },
  1610. "hk-switchServerMode": {
  1611. label: "Przełącz serwer [publiczny/prywatny]",
  1612. defaultKey: "=",
  1613. keyDown: function() {
  1614. C && C.switchServerMode()
  1615. },
  1616. keyUp: null,
  1617. type: "normal"
  1618. },
  1619. "hk-comm1": {
  1620. label: m.comm1,
  1621. defaultKey: "1",
  1622. keyDown: function() {
  1623. C && C.sendCommand(1)
  1624. },
  1625. keyUp: null,
  1626. type: "command"
  1627. },
  1628. "hk-comm2": {
  1629. label: m.comm2,
  1630. defaultKey: "2",
  1631. keyDown: function() {
  1632. C && C.sendCommand(2)
  1633. },
  1634. keyUp: null,
  1635. type: "command"
  1636. },
  1637. "hk-comm3": {
  1638. label: m.comm3,
  1639. defaultKey: "3",
  1640. keyDown: function() {
  1641. C && C.sendCommand(3)
  1642. },
  1643. keyUp: null,
  1644. type: "command"
  1645. },
  1646. "hk-comm4": {
  1647. label: m.comm4,
  1648. defaultKey: "4",
  1649. keyDown: function() {
  1650. C && C.sendCommand(4)
  1651. },
  1652. keyUp: null,
  1653. type: "command"
  1654. },
  1655. "hk-comm5": {
  1656. label: m.comm5,
  1657. defaultKey: "5",
  1658. keyDown: function() {
  1659. C && C.sendCommand(5)
  1660. },
  1661. keyUp: null,
  1662. type: "command"
  1663. },
  1664. "hk-comm6": {
  1665. label: m.comm6,
  1666. defaultKey: "6",
  1667. keyDown: function() {
  1668. C && C.sendCommand(6)
  1669. },
  1670. keyUp: null,
  1671. type: "command"
  1672. },
  1673. "hk-comm7": {
  1674. label: m.comm7,
  1675. defaultKey: "7",
  1676. keyDown: function() {
  1677. C && C.sendCommand(7)
  1678. },
  1679. keyUp: null,
  1680. type: "command"
  1681. },
  1682. "hk-comm8": {
  1683. label: m.comm8,
  1684. defaultKey: "8",
  1685. keyDown: function() {
  1686. C && C.sendCommand(8)
  1687. },
  1688. keyUp: null,
  1689. type: "command"
  1690. },
  1691. "hk-comm9": {
  1692. label: m.comm9,
  1693. defaultKey: "9",
  1694. keyDown: function() {
  1695. C && C.sendCommand(9)
  1696. },
  1697. keyUp: null,
  1698. type: "command"
  1699. },
  1700. "hk-comm0": {
  1701. label: m.comm0,
  1702. defaultKey: "0",
  1703. keyDown: function() {
  1704. C && C.sendCommand(0)
  1705. },
  1706. keyUp: null,
  1707. type: "command"
  1708. },
  1709. "hk-comm10": {
  1710. label: m.comm10,
  1711. defaultKey: "MOUSE WHEEL",
  1712. keyDown: function() {
  1713. C && C.sendCommand(10)
  1714. },
  1715. keyUp: null,
  1716. type: "command"
  1717. },
  1718. "hk-comm11": {
  1719. label: m.comm11,
  1720. defaultKey: "LEFT",
  1721. keyDown: function() {
  1722. C && C.sendCommand(11)
  1723. },
  1724. keyUp: null,
  1725. type: "command"
  1726. },
  1727. "hk-comm12": {
  1728. label: m.comm12,
  1729. defaultKey: "UP",
  1730. keyDown: function() {
  1731. C && C.sendCommand(12)
  1732. },
  1733. keyUp: null,
  1734. type: "command"
  1735. },
  1736. "hk-comm13": {
  1737. label: m.comm13,
  1738. defaultKey: "RIGHT",
  1739. keyDown: function() {
  1740. C && C.sendCommand(13)
  1741. },
  1742. keyUp: null,
  1743. type: "command"
  1744. },
  1745. "hk-comm14": {
  1746. label: m.comm14,
  1747. defaultKey: "DOWN",
  1748. keyDown: function() {
  1749. C && C.sendCommand(14)
  1750. },
  1751. keyUp: null,
  1752. type: "command"
  1753. }
  1754. };
  1755. h.prototype = {
  1756. lastPressedKey: "",
  1757. lastKeyId: "",
  1758. defaultMessageKey: "ENTER",
  1759. inputClassName: "custom-key-in form-control input-sm",
  1760. loadDefaultHotkeys: function() {
  1761. M = {};
  1762. for (var e in P) P.hasOwnProperty(e) && (M[P[e].defaultKey] = e);
  1763. M["spec-messageKey"] = this.defaultMessageKey
  1764. },
  1765. loadHotkeys: function() {
  1766. 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")))
  1767. },
  1768. saveHotkeys: function() {
  1769. e.localStorage.setItem("ogarioHotkeys", JSON.stringify(M)), this.saveCommands()
  1770. },
  1771. saveCommands: function() {
  1772. o("#hotkeys .command-in").each(function() {
  1773. var e = o(this),
  1774. t = e.attr("id");
  1775. m.hasOwnProperty(t) && (m[t] = e.val())
  1776. }), e.localStorage.setItem("ogarioCommands", JSON.stringify(m))
  1777. },
  1778. resetHotkeys: function() {
  1779. this.loadDefaultHotkeys(), o("#hotkeys-cfg .custom-key-in").each(function() {
  1780. var e = o(this).attr("id");
  1781. P[e] && o(this).val(P[e].defaultKey)
  1782. })
  1783. },
  1784. setHotkeysMenu: function() {
  1785. 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>');
  1786. for (keyId in P)
  1787. if (P.hasOwnProperty(keyId)) {
  1788. var e = P[keyId],
  1789. t = "";
  1790. for (var a in M)
  1791. if (M.hasOwnProperty(a) && M[a] === keyId) {
  1792. t = a;
  1793. break
  1794. }
  1795. if ("hk-switchServerMode" === keyId && C && !C.privateIP) continue;
  1796. if ("command" === e.type) {
  1797. var i = keyId.replace("hk-", "");
  1798. 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>')
  1799. } 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>')
  1800. }
  1801. },
  1802. getPressedKey: function(e) {
  1803. var t = "",
  1804. o = "";
  1805. switch (e.ctrlKey || 17 == e.keyCode ? t = "CTRL" : (e.altKey || 18 == e.keyCode) && (t = "ALT"), e.keyCode) {
  1806. case 9:
  1807. o = "TAB";
  1808. break;
  1809. case 13:
  1810. o = "ENTER";
  1811. break;
  1812. case 16:
  1813. o = "SHIFT";
  1814. break;
  1815. case 17:
  1816. break;
  1817. case 18:
  1818. break;
  1819. case 32:
  1820. o = "SPACE";
  1821. break;
  1822. case 37:
  1823. o = "LEFT";
  1824. break;
  1825. case 38:
  1826. o = "UP";
  1827. break;
  1828. case 39:
  1829. o = "RIGHT";
  1830. break;
  1831. case 40:
  1832. o = "DOWN";
  1833. break;
  1834. case 46:
  1835. o = "DEL";
  1836. break;
  1837. case 61:
  1838. o = "=";
  1839. break;
  1840. case 187:
  1841. o = "=";
  1842. break;
  1843. case 192:
  1844. o = "TILDE";
  1845. break;
  1846. default:
  1847. o = String.fromCharCode(e.keyCode)
  1848. }
  1849. return "" !== t ? "" !== o ? t + "+" + o : t : o
  1850. },
  1851. deleteHotkey: function(e, t) {
  1852. delete M[e], o("#" + t).val("")
  1853. },
  1854. setDefaultHotkey: function(e) {
  1855. var t = !1;
  1856. return P[e] && !M.hasOwnProperty(P[e].defaultKey) ? (t = P[e].defaultKey, M[t] = e, t) : t
  1857. },
  1858. setHotkey: function(e, t) {
  1859. if (t && (this.lastPressedKey !== e || this.lastKeyId !== t)) {
  1860. var a = o("#" + t).val();
  1861. if (this.deleteHotkey(a, t), "DEL" !== e) {
  1862. if (M[e] && M[e] !== t) {
  1863. var i = M[e],
  1864. s = this.setDefaultHotkey(i);
  1865. s ? (M[s] = i, o("#" + i).val(s)) : this.deleteHotkey(e, i)
  1866. }
  1867. M[e] = t, o("#" + t).val(e), "hk-chatMessage" === t && (M["spec-messageKey"] = e), this.lastPressedKey = e, this.lastKeyId = t
  1868. }
  1869. }
  1870. },
  1871. init: function() {
  1872. this.loadHotkeys(), this.setHotkeysMenu()
  1873. }
  1874. };
  1875. var T = new h;
  1876. T.init(), document.onkeydown = function(e) {
  1877. var t = T.getPressedKey(e);
  1878. if (("INPUT" !== e.target.tagName || e.target.className === T.inputClassName || t === M["spec-messageKey"]) && "" !== t && !b[t]) {
  1879. if (b[t] = !0, e.target.className === T.inputClassName) return e.preventDefault(), void T.setHotkey(t, e.target.id);
  1880. if (M[t]) {
  1881. e.preventDefault();
  1882. var o = M[t];
  1883. "" !== o && P[o] && P[o].keyDown && P[o].keyDown()
  1884. }
  1885. }
  1886. }, document.onkeyup = function(e) {
  1887. var t = T.getPressedKey(e);
  1888. if ("" !== t) {
  1889. if (M[t]) {
  1890. var o = M[t];
  1891. "" !== o && P[o] && P[o].keyUp && P[o].keyUp()
  1892. }
  1893. b[t] = !1
  1894. }
  1895. }, e.addKeyListeners = function() {
  1896. e.onkeydown = function(t) {
  1897. switch (t.keyCode) {
  1898. case 81:
  1899. e.core && e.core.specialOn && e.core.specialOn();
  1900. break;
  1901. case 27:
  1902. t.preventDefault(), e.MC.showNickDialog(300), o("#oferwallContainer").is(":visible") && e.closeOfferwall(), o("#videoContainer").is(":visible") && e.closeVideoContainer()
  1903. }
  1904. }, e.onkeyup = function(t) {
  1905. 81 == t.keyCode && e.specialOff && e.core.specialOff()
  1906. }
  1907. }, e.onmousedown = function(e) {
  1908. 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))))
  1909. }, e.onmouseup = function(e) {
  1910. S.mouseFeed && (3 == e.which && !S.mouseInvert || 1 == e.which && S.mouseInvert) && C && C.macroFeed(!1)
  1911. }, e.resetHotkeys = function() {
  1912. T && T.resetHotkeys()
  1913. }, e.saveHotkeys = function() {
  1914. T && T.saveHotkeys(), o("#hotkeys").fadeOut()
  1915. }, e.showHotkeys = function() {
  1916. e.onkeydown = function() {}, o("#hotkeys").fadeIn()
  1917. }, e.closeHotkeys = function() {
  1918. o("#hotkeys").fadeOut()
  1919. }
  1920. }(window, window.ogario, window.jQuery), $(function() {
  1921. this.width = 280, this.height = 300;
  1922. var e = this;
  1923. $("#chatroom").mouseup(function() {
  1924. e.resize()
  1925. }), e.resize = function() {
  1926. ($("#chatroom").width() != this.width || $("#chatroom").height() != this.height) && $("#chatroom").perfectScrollbar && $("#chatroom").perfectScrollbar("update")
  1927. }, $("#chatroom").perfectScrollbar()
  1928. });
  1929.  
  1930. $("#skin-preview").prependTo("#main-panel.menu-panel");
  1931. $("#profiles").prependTo("#main-panel.menu-panel")
  1932. $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.nick > span").remove();
  1933. $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.skin.colorpicker-element > span.input-group-addon").remove();
  1934. $("#main-panel > div:nth-child(3) > div.form-group.clearfix > div.input-group.skin.colorpicker-element > span.input-group-btn").remove();
  1935. $("#joinPartyToken").appendTo(".input-group.nick");
  1936. $("#connect-party-btn").insertAfter("#joinPartyToken");
  1937. $("#clantag").insertBefore("#skin");
  1938. $("#gamemode").insertAfter("#nick");
  1939. $("#helloContainer > div.side-container.left-container.disable-mouse > div").hide();
  1940. $(".left-container").hide();
  1941.  
  1942.  
  1943. $("#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>')
  1944. $("#agario-main-buttons > button.btn.btn-danger.btn-logout").insertAfter("#og-options");
  1945.  
  1946. $("#x12").on('click',function() {
  1947. $("#main-panel").hide();
  1948. $("#og-settings").show();
  1949. });
  1950.  
  1951. // Connect Button
  1952. $("#connect-party-btn").on("click", function() {
  1953. if ($("#joinPartyToken").val().length === 0) {
  1954. $("#create-party-btn").click();
  1955. } else {
  1956. $("#join-party-btn").click();
  1957. }});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement