Advertisement
GODLIKE5

Slither Mod

May 9th, 2016
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.60 KB | None | 0 0
  1. tags = [
  2. "HERO",
  3. "NBK",
  4. "MG"
  5. ];
  6.  
  7. function set(a, b) {
  8. options[a] = b;
  9. }
  10.  
  11. String.prototype.isJSON = function() {
  12. try {
  13. JSON.parse(this);
  14. } catch (e) {
  15. return false;
  16. }
  17.  
  18. return true;
  19. };
  20.  
  21. options = {
  22. 'zoom': true,
  23. 'clans': true,
  24. 'custombg': false,
  25. 'parties': true,
  26. 'lowergph': false,
  27. 'skinrotator': false,
  28. 'background': '',
  29. 'nick': '',
  30. 'clantag': '',
  31. 'drawfood': false,
  32. 'drawfoodsize': 1,
  33. 'drawfoodcolor': 1,
  34. 'drawfoodcrazie': false,
  35. 'showshortcuts': false,
  36. 'chat': true
  37. };
  38.  
  39. if (!localStorage["slitherplus"] || (localStorage["slitherplus"].isJSON() && !JSON.parse(localStorage["slitherplus"]).hasOwnProperty("drawfood"))) {
  40. localStorage["slitherplus"] = JSON.stringify(options);
  41. } else if (localStorage["slitherplus"].isJSON()) {
  42. options = JSON.parse(localStorage["slitherplus"]);
  43. }
  44.  
  45. opts = {
  46. "Zoom": 'zoom',
  47. "Clan tag list": 'clans',
  48. "Custom background": 'custombg',
  49. "Party mode": 'parties',
  50. "Lower graphics": 'lowergph',
  51. "Skin rotator": 'skinrotator'
  52. };
  53.  
  54. function zoom(e) {
  55. if (!window.gsc) { return; }
  56. if (!options.zoom) { window.gsc = 0.9; return; }
  57. window.gsc *= Math.pow(0.9, e.wheelDelta / -120 || e.detail / 2 || 0);
  58. window.gsc > 2 ? window.gsc = 2 : window.gsc < 0.1 ? window.gsc = 0.1 : null;
  59. }
  60.  
  61. function addParty() {
  62. $("#playh").after('<div id="party" style="margin: auto; width: 200px; display: block !important; margin-bottom: 25px"><div class="btn-group" style="width: 100%"><button class="btn btn-success" id="createParty" style="width: 50%">Create</button><button style="width: 50%" class="btn btn-primary" id="joinParty">Join</button></div><input id="partyCode" placeholder="Party Code" class="form-control" type="text" style="width: 100%;color:black;text-align:center;font-weight:bold;box-shadow:inset 0 0 3px #000;"></div>');
  63. $(".btnt.nsi.sadg1:first").css('margin-bottom', '35px');
  64.  
  65. jQuery("#createParty").click(function(e) {
  66. if (!window.bso) {
  67. $("#partyCode").val("click play");
  68. setTimeout(function() {
  69. $("#partyCode").val("");
  70. }, 1000);
  71. return;
  72. }
  73.  
  74. $.get("http://51.254.206.4:8080/create/" + window.bso.ip + ':' + window.bso.po, function(data) {
  75. $("#partyCode").val(data);
  76. forceServer(window.bso.ip, window.bso.po);
  77. document.location.href = "http://slither.io/#" + data;
  78. });
  79. return false;
  80. });
  81.  
  82. jQuery("#joinParty").click(function(e) {
  83. if ($("#partyCode").val() == '') {
  84. window.forcing = false;
  85. getData("/i49526.txt", o);
  86. } else {
  87. $.get("http://51.254.206.4:8080/join/" + $("#partyCode").val(), function(data) {
  88. if (data == 'error') {
  89. $("#partyCode").val('wrong code');
  90.  
  91. setTimeout(function() {
  92. $("#partyCode").val('');
  93. }, 1000);
  94. } else {
  95. srv = data.split(":");
  96. forceServer(srv[0], srv[1]);
  97. }
  98. });
  99. }
  100. return false;
  101. });
  102.  
  103. $("#createParty").css('border-bottom-left-radius', '0');
  104. $("#joinParty").css('border-bottom-right-radius', '0');
  105. $("#partyCode").css('border-top-left-radius', '0');
  106. $("#partyCode").css('border-top-right-radius', '0');
  107. }
  108.  
  109. function asciize(b, typing = false) {
  110. var h, c, f;
  111. c = b.length;
  112. var w = !1;
  113. for (h = 0; h < c; h++)
  114. if (f = b.charCodeAt(h), 32 > f || 127 < f) {
  115. w = !0;
  116. break
  117. }
  118. if (w) {
  119. w = "";
  120. for (h = 0; h < c; h++) f = b.charCodeAt(h), w = 32 > f || 127 < f ? w + " " : w + String.fromCharCode(f);
  121. return w
  122. }
  123.  
  124. if (!typing) {
  125. window.options.nick = $("#nick").val();
  126. window.options.clantag = $("#tag").val();
  127. localStorage["slitherplus"] = JSON.stringify(window.options);
  128. }
  129.  
  130. return window.options.clans && !typing ? jQuery("#tag").val() + ' ' + b : b;
  131. }
  132.  
  133. function addClanTags() {
  134. jQuery(".taho").before('<div id="tag_holder" class="taho" style="width: 110px; height: 40px; margin-top: 10px; box-shadow: rgb(0, 0, 0) 0px 6px 50px; opacity: 1; background: rgb(76, 68, 124);"><select class="sumsginp" id="tag" style="width: 85px; top: 0px; outline: 0; height: 35px; padding: 5px; border-radius:29px"></select></div>')
  135.  
  136. nick.oninput = function(){var b=this.value,h=asciize(b,true);24<h.length&&(h=h.substr(0,24));b!=h&&(this.value=h)};
  137.  
  138. jQuery("#tag").append("<option value='' style='background: rgb(76, 68, 124)'>-</option>");
  139. for (tag of tags) {
  140. jQuery("#tag").append("<option value='[" + tag + "]' style='background: rgb(76, 68, 124)'>[" + tag + "]</option>");
  141. }
  142. }
  143.  
  144. if (/firefox/i.test(navigator.userAgent)) {
  145. document.addEventListener("DOMMouseScroll", zoom, false);
  146. } else {
  147. document.body.onmousewheel = zoom;
  148. }
  149.  
  150. function setBackground(url = '/s/bg45.jpg') {
  151. ii.src = url;
  152. }
  153.  
  154. function setLowerGraphics(a) {
  155. if (a) {
  156. setBackground('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AQYBigs0bXWaQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAADUlEQVQI12P4//8/AwAI/AL+XJ/P2gAAAABJRU5ErkJggg==');
  157. render_mode = 1;
  158. } else {
  159. if (!options.custombg) {
  160. setBackground();
  161. } else {
  162. setBackground(options.background);
  163. }
  164. render_mode = 2;
  165. }
  166. }
  167.  
  168. function skinRotator(i = 0) {
  169. if (typeof ws != "undefined" && options.skinrotator && !$("#psk").is(":visible") && typeof snake != "undefined" && snake != null) {
  170. setSkin(snake, i++);
  171. }
  172.  
  173. if (i > (25 + 16)) i = 0;
  174. setTimeout(skinRotator, 1000, i);
  175. }
  176.  
  177. function addOptions() {
  178. jQuery("#saveh").after('<div id="options" style="width: 260px; color: rgb(128, 88, 208); border-radius: 29px; font-family: \'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif; font-size: 14px; margin: 0px auto 100px; padding: 10px 14px; background-color: rgb(30, 38, 46);"></div>');
  179. for (option in opts) {
  180. if (option == "Clan tag list" || option == "Party mode") {
  181. continue;
  182. }
  183. jQuery("#options").append('<div class="option"><span>' + option + '</span><label id="' + opts[option] + '" class="' + (options[opts[option]] ? 'on' : 'off') + '">' + (options[opts[option]] ? 'ON' : 'OFF') + '</label></div>');
  184. jQuery("#" + opts[option]).click(function() {
  185. if (jQuery(this).attr('class') == 'on') {
  186. jQuery(this).attr('class', 'off');
  187. jQuery(this).html('OFF');
  188. set(jQuery(this).attr('id'), false);
  189. } else {
  190. jQuery(this).attr('class', 'on');
  191. jQuery(this).html('ON');
  192. set(jQuery(this).attr('id'), true);
  193. }
  194. });
  195. }
  196.  
  197. jQuery("#lowergph").click(function() {
  198. setLowerGraphics(jQuery(this).attr('class') == 'on');
  199. });
  200.  
  201. jQuery("#custombg").click(function() {
  202. if (jQuery(this).attr('class') == 'on') {
  203. options.custombg = false;
  204. url = prompt('Enter new URL (image):', '');
  205. if (url && url.length > 10) {
  206. options.custombg = true;
  207. options.background = url;
  208. setBackground(url);
  209. } else {
  210. options.background = '';
  211. setBackground();
  212. jQuery("#custombg").attr('class', 'off');
  213. jQuery("#custombg").html('OFF');
  214. }
  215. } else {
  216. options.background = '';
  217. setBackground();
  218. }
  219. });
  220.  
  221. jQuery(".option").attr('style', 'color: rgb(128, 88, 208); border-radius: 29px; margin: 10px auto; padding: 8px; background-color: rgb(76, 68, 124)');
  222. jQuery(".option > span").attr('style', 'height: 24px; color: rgb(224, 224, 255); margin-left: 5px');
  223. jQuery(".option > label").attr('style', 'float: right; width: 67px; text-align: center; border-radius: 12px; color: white; cursor: pointer; padding: 0px 20px;');
  224. jQuery("head").append("<style type='text/css'>label.on{background-color: rgb(86, 172, 129)}label.off{background-color:#861B1B}</style>");
  225.  
  226. jQuery("#tag").val(options.clantag);
  227. jQuery("#nick").val(options.nick);
  228. $("#options").append('<label id="showshortcuts" class="on" style="text-align: center; border-radius: 12px; color: white; cursor: pointer; padding: 0px 20px; width:100%">Show shortcuts</label>');
  229. $("#options").append('<label id="showchat" class="on" style="text-align: center; border-radius: 12px; color: white; cursor: pointer; padding: 0px 20px; width:100%">Show chat</label>');
  230. $("body").append('<div id="shortcuts" style="display:none;z-index:999;width: 260px; color: rgb(128, 88, 208); border-radius: 29px; font-family: \'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif; font-size: 14px; margin: 0px auto 100px; padding: 10px 14px; background-color: rgba(30, 38, 46,0.7);position:absolute;top:50px;left:6px;"><ul style="list-style-type:none;padding:0;"><li>[F] - switch drawing mode</li><li>[G] - change color of drawing</li><li>[H] - change size of drawing</li><li>[J] - crazy drawing</li><li>[E] - previous skin</li><li>[R] - next skin</li><li>[Q] - quit</li><li>[ESC] - respawn</li><li>[SHIFT] - accelerate</li><li>[1-6] - switching options</li></ul></div>');
  231. $("body").append('<div id="chat" style="display:none;z-index:999; width: 260px; height: 270px; color: rgb(128, 88, 208); border-radius: 29px; font-family: \'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif; font-size: 14px; padding: 10px 14px; background-color: rgba(30, 38, 46,0.7);position:absolute;bottom:110px;left:6px;"><div id="chatMessages" style="height:200px"></div><div id="yourMessage_holder" class="taho" style="width: 100%; height: 35px; margin-top: 10px; box-shadow: rgb(0, 0, 0) 0px 6px 50px; opacity: 1; background: rgb(76, 68, 124);"><input class="sumsginp" id="yourMessage" placeholder="Press [ENTER] to chat" style="width: 100%; top: 0px; outline: 0; height: 35px; padding: 10px; left:0; border-radius:29px;font-size:14px" /></div></div>');
  232. $("#showshortcuts").click(function() {
  233. if (jQuery(this).attr('class') == 'on') {
  234. jQuery(this).attr('class', 'off');
  235. jQuery(this).html('Hide shortcuts');
  236. set(jQuery(this).attr('id'), false);
  237. $("iframe").attr('src','data:html,');
  238. $("#shortcuts").show();
  239. options['showshortcuts'] = true;
  240. } else {
  241. jQuery(this).attr('class', 'on');
  242. jQuery(this).html('Show shortcuts');
  243. set(jQuery(this).attr('id'), true);
  244. $("iframe").attr('src','http://slitherplus.io/social.html');
  245. $("#shortcuts").hide();
  246. options['showshortcuts'] = false;
  247. }
  248. });
  249. $("#showchat").click(function() {
  250. if (jQuery(this).attr('class') == 'on') {
  251. jQuery(this).attr('class', 'off');
  252. jQuery(this).html('Hide chat');
  253. $("#chat").show();
  254. options['chat'] = true;
  255. } else {
  256. jQuery(this).attr('class', 'on');
  257. jQuery(this).html('Show chat');
  258. $("#chat").hide();
  259. options['chat'] = false;
  260. }
  261. });
  262.  
  263. $("body").append('<div id="fpsBox" style="position:fixed;bottom: 160px; right: 20px; color: lightgray; z-index:99999999;">FPS: <span id="fps">waiting...</span></div>');
  264. }
  265.  
  266. function resizeView() {
  267. $("#login").css('margin-top', '0px');
  268. if (window.resize) {
  269. window.lww = 0;
  270. window.wsu = 0;
  271. window.resize();
  272. var wh = Math.ceil(window.innerHeight);
  273. if (wh < 800) {
  274. var login = document.getElementById("login");
  275. window.lgbsc = wh / 800;
  276. login.style.top = - (Math.round(wh * (1 - window.lgbsc) * 1E5) / 1E5) + "px";
  277. if (window.trf) {
  278. window.trf(login, "scale(" + window.lgbsc + "," + window.lgbsc + ")");
  279. }
  280. }
  281. } else {
  282. setTimeout(resizeView, 100);
  283. }
  284. }
  285.  
  286. function addKeyEvents() {
  287. options['drawfood'] = false;
  288. $(document).keydown(function(e) {
  289. switch (e.keyCode) {
  290. case 27:
  291. if ($("#yourMessage").is(":focus")) { return; }
  292. if (typeof bso != "undefined") {
  293. forcing = true;
  294. connect();
  295. }
  296. break;
  297. case 9:
  298. e.preventDefault();
  299. $("#ipBox").toggle();
  300. $("#fpsBox").toggle();
  301. break;
  302. case 71:
  303. if ($("#yourMessage").is(":focus")) { return; }
  304. if (options['drawfoodcolor'] >= 7) {
  305. options['drawfoodcolor'] = 0;
  306. }
  307. options['drawfoodcolor']++;
  308. break;
  309. case 70:
  310. if ($("#yourMessage").is(":focus")) { return; }
  311. options['drawfood'] = !options['drawfood'];
  312. if (options['drawfood']) {
  313. drawFood = setInterval(function(){
  314. try {
  315. if (!options['drawfoodcrazie']) {
  316. if (options['drawfoodcolor'] != 7) {
  317. newFood(3, snake.xx, snake.yy, options['drawfoodsize'],5, options['drawfoodcolor']);
  318. } else if (options['drawfoodcolor'] == 7) {
  319. newFood(3, snake.xx, snake.yy, options['drawfoodsize'], 5, Math.floor(Math.random() * 7) + 1);
  320. }
  321. } else {
  322. newFood(3, snake.xx, snake.yy, Math.floor(Math.random() * 20) + 1, 5, Math.floor(Math.random() * 7) + 1);
  323. }
  324. } catch(err) {}
  325. }, 100);
  326. } else {
  327. clearInterval(drawFood);
  328. }
  329. break;
  330. case 72:
  331. if ($("#yourMessage").is(":focus")) { return; }
  332. if (options['drawfoodsize'] >= 20) {
  333. options['drawfoodsize'] = 0;
  334. }
  335.  
  336. options['drawfoodsize'] += 2;
  337. break;
  338. case 74:
  339. if ($("#yourMessage").is(":focus")) { return; }
  340. options['drawfoodcrazie'] = !options['drawfoodcrazie'];
  341. break;
  342. case 69:
  343. if ($("#yourMessage").is(":focus")) { return; }
  344. $("#psk").click();
  345. break;
  346. case 82:
  347. if ($("#yourMessage").is(":focus")) { return; }
  348. $("#nsk").click();
  349. break;
  350. case 13:
  351. if ($("#chat").is(":visible")) {
  352. if ($("#yourMessage").is(":focus")) {
  353. chatWebSocket.send(JSON.stringify({ action: 1, nick: $("#nick").val(), message: $("#yourMessage").val(), color: (snake ? snake.cs : "#FFFFFF") }));
  354. $("#yourMessage").blur();
  355. $("#yourMessage").val('');
  356. } else {
  357. $("#yourMessage").focus();
  358. }
  359. }
  360. break;
  361. case 81:
  362. if ($("#yourMessage").is(":focus")) { return; }
  363. if (playing) {
  364. want_close_socket = -1;
  365. dead_mtm = Date.now() - 5E3;
  366. ws.close();
  367. ws = null;
  368. playing = !1;
  369. connected = !1;
  370. resetGame();
  371. play_btn.setEnabled(!0);
  372. }
  373. break;
  374. case 16:
  375. if ($("#yourMessage").is(":focus")) { return; }
  376. setAcceleration(true);
  377. break;
  378. case 49:
  379. if ($("#yourMessage").is(":focus")) { return; }
  380. $("#zoom").click();
  381. break;
  382. case 50:
  383. if ($("#yourMessage").is(":focus")) { return; }
  384. $("#custombg").click();
  385. break;
  386. case 51:
  387. if ($("#yourMessage").is(":focus")) { return; }
  388. $("#lowergph").click();
  389. break;
  390. case 52:
  391. if ($("#yourMessage").is(":focus")) { return; }
  392. $("#skinrotator").click();
  393. break;
  394. case 53:
  395. if ($("#yourMessage").is(":focus")) { return; }
  396. $("#showshortcuts").click();
  397. break;
  398. case 54:
  399. if ($("#yourMessage").is(":focus")) { return; }
  400. $("#showchat").click();
  401. break;
  402. }
  403. });
  404. $(document).keyup(function(e) {
  405. switch (e.keyCode) {
  406. case 16:
  407. setAcceleration(false);
  408. break;
  409. }
  410. });
  411. }
  412.  
  413. function showFPS() {
  414. if (typeof playing != "undefined" && playing && fps && lrd_mtm) {
  415. if (Date.now() - lrd_mtm > 970) {
  416. $("#fps").html(fps);
  417. }
  418. }
  419. setTimeout(showFPS, 30);
  420. }
  421.  
  422. function loop() {
  423. if (typeof lbh != "undefined") {
  424. lbh.textContent = "slitherplus.io";
  425. }
  426.  
  427. if (typeof bso != "undefined" && $("#ipAddress").html() != (bso.ip + ":" + bso.po)) {
  428. $("#ipAddress").html(bso.ip + ":" + bso.po);
  429. chatWebSocket.send(JSON.stringify({ action: 0, token: (bso.ip + ":" + bso.po) }));
  430. }
  431.  
  432. setTimeout(loop, 1000);
  433. }
  434.  
  435. $("body").append('<div id="ipBox" style="position:fixed;bottom: 120px; right: 20px; color: lightgray; z-index:99999999;">IP: <span id="ipAddress">play first</span> <label style="float: right;text-align: center; border-radius: 12px; color: white; cursor: pointer; padding: 0px 20px;width: 140px; margin-left: 10px;" id="ip-connect" class="on">Connect to IP</label></div>');
  436.  
  437. $("#ip-connect").click(function() {
  438. eipaddr = prompt('Enter the IP address:', '');
  439. if (eipaddr && eipaddr.indexOf(":") != -1 && eipaddr.indexOf(".") != -1) {
  440. forceServer(eipaddr.split(":")[0], eipaddr.split(":")[1]);
  441. connect();
  442. $("#partyCode").val('');
  443. }
  444. });
  445.  
  446. if (document.location.href.indexOf("#") != -1) {
  447. $.get("http://51.254.206.4:8080/join/" + document.location.href.substr(document.location.href.indexOf("#")+1,6), function(data) {
  448. if (data == 'error') {
  449. $("#partyCode").val('wrong code');
  450.  
  451. setTimeout(function() {
  452. $("#partyCode").val('');
  453. }, 1000);
  454. } else {
  455. $("#partyCode").val(document.location.href.substr(document.location.href.indexOf("#")+1,6));
  456. srv = data.split(":");
  457. forceServer(srv[0], srv[1]);
  458. }
  459. });
  460. }
  461.  
  462. function checkForMods() {
  463. if ($("#ip-hud").length != 0 || $("#worms").length != 0 || $("#login").html().toLowerCase().indexOf("slitherio.org") != -1) {
  464. $("body").html("<div style='text-align:center;width:100%;position:absolute;top:50%;margin-top:-98px;color:rgb(128, 88, 208);'><img src='s/favicon.png'/><h1>Please disable other slither.io extensions to use SlitherPlus.</h1></div>");
  465. return;
  466. }
  467.  
  468. if (!$("#psk").is(":visible") && snake && snake.rcv != localStorage.snakercv && !options['skinrotator']) {
  469. setSkin(snake, localStorage.snakercv);
  470. }
  471. }
  472.  
  473. var slitherplus_skins = {
  474. skins: [
  475. {// NBK
  476. body: [19, 19, 19, 10, 14, 15, 20],
  477. bulb: {id: 'hAKN6iu', width: 180, height: 73, x: -50, y: -36.5, scale: 0.36, alpha: 1, antenna_length: 9, antenna_border: '#000000', antenna_color: '#0045BE'}
  478. },
  479. {// HERO
  480. body: [7],
  481. bulb: {id: 'Q9072QW', width: 150, height: 149, x: -20, y: -60, scale: 0.3, alpha: 1, antenna_length: 9, antenna_border: '#000000', antenna_color: '#333333'}
  482. },
  483. {// MASTER GAMING
  484. body: [18],
  485. bulb: {id: '3CTUIZ5', width: 140, height: 118, x: -20, y: -59, scale: 0.4, alpha: 1, antenna_length: 9, antenna_border: '#000000', antenna_color: '#DBD444'}
  486. },
  487. {// TURTLE CLAN :D
  488. body: [26, 26, 26, 26, 26, 26, 3, 25],
  489. bulb: {id: 'pfHG6uU', width: 151, height: 79, x: -40, y: -39.5, scale: 0.44, alpha: 1, antenna_length: 20, antenna_border: '#000000', antenna_color: '#3dba48'},
  490. extras: {er: 7.2, ec: '#000000', eca: 1, ppc: '#3DBA48', swell: 0.04}
  491. },
  492. {// CRYSTAL
  493. body: [23],
  494. bulb: {id: 'Lji6MbX', width: 195, height: 250, x: -20, y: -125, scale: 0.18, alpha: 0.9, antenna_length: 9, antenna_border: '#000000', antenna_color: '#69D0F1'},
  495. extras: {swell: 0.025}
  496. },
  497. {// TYT
  498. body: [9, 9, 9, 22, 22, 22],
  499. bulb: {id: '7C3HtLB', width: 240, height: 202, x: -20, y: -101, scale: 0.28, alpha: 1, antenna_length: 2, antenna_border: 'transparent', antenna_color: 'transparent'},
  500. extras: {er: 2, ec: '#000000', eca: 1, ppc: 'transparent', swell: 0.04}
  501. },
  502. {// GLSG
  503. body: [1,9,5,7,11,5,6],
  504. bulb: {id: 'T3VUWS2', width: 250, height: 106, x: -40, y: -53, scale: 0.3, alpha: 1, antenna_length: 10, antenna_border: '#000000', antenna_color: '#485aff'}
  505. },
  506. {// GLSG2
  507. body: [6,9,3,5,10,7],
  508. bulb: {id: 'EqzSLj5', width: 150, height: 150, x: -40, y: -53, scale: 0.3, alpha: 1, antenna_length: 10, antenna_border: '#000000', antenna_color: '#485aff'}
  509. },
  510. {// GLSG3
  511. body: [10,4,3,7,1,11,16,18],
  512. bulb: {id: 'EqzSLj5', width: 150, height: 150, x: -40, y: -53, scale: 0.3, alpha: 1, antenna_length: 10, antenna_border: '#000000', antenna_color: '#485aff'}
  513. },
  514. {// GLSG4
  515. body: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
  516. bulb: {id: 'EqzSLj5', width: 150, height: 150, x: -40, y: -53, scale: 0.3, alpha: 1, antenna_length: 10, antenna_border: '#000000', antenna_color: '#485aff'}
  517. },
  518. {// GLSG5
  519. body: [25,1,26,25,12,15],
  520. bulb: {id: 'EqzSLj5', width: 150, height: 150, x: -40, y: -53, scale: 0.3, alpha: 1, antenna_length: 10, antenna_border: '#000000', antenna_color: '#485aff'}
  521. },
  522. {body: [11, 7, 7, 11, 11, 11, 9, 9], bulb: false, extras: false},
  523. {body: [4, 3, 3, 4, 4, 4], bulb: false, extras: false},
  524. {body: [5, 5, 7, 5, 22, 22, 4, 4, 22, 22, 5, 5, 9, 9], bulb: false, extras: false},
  525. {body: [16, 16, 16, 16, 7, 7, 7, 9, 9, 10, 10, 10, 9, 9, 7, 7, 7], bulb: false, extras: false},
  526. {body: [12, 7, 7, 7, 7, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7], bulb: false, extras: false},
  527. {body: [11, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], bulb: false, extras: false},
  528. {body: [16, 16, 7, 7, 7, 7, 9, 11, 7, 7, 7, 7, 16], bulb: false, extras: false},
  529. {body: [3, 3, 3, 9, 11, 9], bulb: false, extras: false},
  530. {body: [11, 11, 18, 18], bulb: false, extras: false},
  531. {body: [21, 21, 7, 7], bulb: false, extras: false},
  532. {body: [11, 11, 7, 7], bulb: false, extras: false},
  533. {body: [11, 11, 1, 1], bulb: false, extras: false},
  534. {body: [11, 11, 9, 9], bulb: false, extras: false},
  535. {body: [18, 18, 21, 21], bulb: false, extras: false},
  536. {body: [18, 18, 7, 7], bulb: false, extras: false},
  537. {body: [21, 21, 1, 1], bulb: false, extras: false},
  538. {body: [21, 21, 8, 8], bulb: false, extras: false},
  539. {body: [21, 21, 21, 9, 7, 9], bulb: false, extras: false},
  540. {body: [11, 9, 11, 7, 7, 7], bulb: false, extras: false},
  541. {body: [11, 9, 11, 4, 4, 4], bulb: false, extras: false},
  542. {body: [11, 9, 11, 5, 5, 5], bulb: false, extras: false},
  543. {body: [11, 9, 11, 23, 23, 23], bulb: false, extras: false},
  544. {body: [12, 13, 14, 15, 16, 17, 18, 21, 22, 23], bulb: false, extras: false},
  545. {body: [12, 11, 22, 22, 23, 23, 12], bulb: false, extras: false},
  546. {body: [11], bulb: false, extras: false},
  547. {body: [25], bulb: false, extras: false},
  548. {body: [21], bulb: false, extras: false}
  549. ],
  550. cache: {},
  551. isset: function(variable) {
  552. return (variable !== undefined && variable !== null ? true : false);
  553. },
  554. addskins: function() {
  555. if ( slitherplus_skins.isset(window.max_skin_cv) && slitherplus_skins.isset(window.setSkin) ) {
  556. window.setSkin = (function() {
  557. var old1 = window.max_skin_cv;
  558. var old2 = window.setSkin;
  559. window.max_skin_cv += slitherplus_skins.skins.length;
  560. return function(snake, id) {
  561. old2(snake, id);
  562. if ( id > old1 ) {
  563. var colors = null, index = id - old1 - 1;
  564. ((slitherplus_skins.isset(slitherplus_skins.skins[index]) ? (colors = slitherplus_skins.skins[index].body) : (id %= 9)), (colors && (id = colors[0])));
  565. if ( index in slitherplus_skins.skins && slitherplus_skins.skins[index].bulb ) {
  566. if ( !(index in slitherplus_skins.cache) ) {
  567. var bulb = new Image;
  568. bulb.crossOrigin = 'anonymous';
  569. bulb.src = 'http://i.imgur.com/' + slitherplus_skins.skins[index].bulb.id + '.png';
  570. slitherplus_skins.cache[index] = bulb;
  571. }
  572. snake.antenna = true;
  573. snake.abrot = true;
  574. snake.atba = false;
  575. snake.atc1 = slitherplus_skins.skins[index].bulb.antenna_border;
  576. snake.atc2 = slitherplus_skins.skins[index].bulb.antenna_color;
  577. antenna_length = slitherplus_skins.skins[index].bulb.antenna_length;
  578. snake.atx = new Float32Array(antenna_length);
  579. snake.aty = new Float32Array(antenna_length);
  580. snake.atvx = new Float32Array(antenna_length);
  581. snake.atvy = new Float32Array(antenna_length);
  582. snake.atax = new Float32Array(antenna_length);
  583. snake.atay = new Float32Array(antenna_length);
  584. for (--antenna_length; 0 <= antenna_length; antenna_length--) {
  585. snake.atx[antenna_length] = snake.xx;
  586. snake.aty[antenna_length] = snake.yy;
  587. }
  588. snake.bulb = slitherplus_skins.cache[index];
  589. snake.blbx = slitherplus_skins.skins[index].bulb.x;
  590. snake.blby = slitherplus_skins.skins[index].bulb.y;
  591. snake.blbw = slitherplus_skins.skins[index].bulb.width;
  592. snake.blbh = slitherplus_skins.skins[index].bulb.height;
  593. snake.bsc = slitherplus_skins.skins[index].bulb.scale;
  594. snake.blba = slitherplus_skins.skins[index].bulb.alpha;
  595. }
  596. if ( index in slitherplus_skins.skins && slitherplus_skins.skins[index].extras ) {
  597. for ( key in slitherplus_skins.skins[index].extras ) {
  598. snake[key] = slitherplus_skins.skins[index].extras[key];
  599. }
  600. }
  601. snake.rbcs = colors;
  602. snake.cv = id;
  603. }
  604. };
  605. })();
  606. }
  607. else {
  608. window.setTimeout(slitherplus_skins.addskins, 50);
  609. }
  610. }
  611. };
  612.  
  613. addParty();
  614. addClanTags();
  615. skinRotator();
  616. addOptions();
  617. resizeView();
  618. addKeyEvents();
  619. showFPS();
  620. loop();
  621. $(function(){
  622. if (options.custombg && ii.src != options.background) {
  623. setBackground(options.background);
  624. }
  625. $("iframe").attr('src', 'http://slitherplus.io/social.html');
  626. if (options['showshortcuts']) $("#showshortcuts").click();
  627. if (options['chat']) $("#showchat").click();
  628.  
  629. setLowerGraphics(options['lowergph']);
  630.  
  631. slitherplus_skins.addskins();
  632. setInterval(checkForMods, 1000);
  633. });
  634.  
  635. function msgsHeight() {
  636. msgs = $(".chatMessage").toArray();
  637. height = 0;
  638. for (key in msgs) { div = msgs[key]; height += div.clientHeight }
  639. return height;
  640. }
  641.  
  642. function deleteMessages() {
  643. if (msgsHeight() > $("#chatMessages").height()) { $(".chatMessage:first").remove(); deleteMessages(); }
  644. }
  645. chatWebSocket = new WebSocket("ws://51.254.206.49:1337");
  646. chatWebSocket.onopen = function() {
  647. $(".chatMessage").remove();
  648. $("#chatMessages").append('<div class="chatMessage"><span style="color:green;">Welcome to the chat!</span></div>');
  649. };
  650. chatWebSocket.onmessage = function(msg) {
  651. $("#chatMessages").append(msg.data);
  652. deleteMessages();
  653. };
  654. chatWebSocket.onerror = function(err) {
  655. $("#chatMessages").append('<div class="chatMessage"><span style="color:orange;">Got an error.</span></div>');
  656. deleteMessages();
  657. };
  658. chatWebSocket.onclose = function() {
  659. $("#chatMessages").append('<div class="chatMessage"><span style="color:red;">Chat closed.</span></div>');
  660. deleteMessages();
  661. };
  662.  
  663. $("#playh .btnt.nsi.sadg1").click(function() {
  664. setTimeout(function(ip){
  665. if ((!ws || ws.readyState != ws.OPEN) && window.bso.ip == ip) {
  666. alert("Server is full! Looking for a new server...");
  667. document.location.href = "http://slither.io/";
  668. }
  669. }, 10000, bso.ip);
  670. });
  671.  
  672. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  673. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  674. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  675. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  676.  
  677. ga('create', 'UA-76843908-1', 'auto');
  678. ga('send', 'pageview');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement