Advertisement
Guest User

XP HACK AGAR.IO / AGARNEWS.TK

a guest
Jul 19th, 2016
33,800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.97 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Agar.io auto respawn (evergreen)
  3. // @namespace http://redd.it/3ut09g
  4. // @description Autospawn + Autoclick coin + Profiles w/ autosave settings + Macros + Reload server button + Spectate mode and more!
  5. // @version 39
  6. // @author condoriano
  7. // @icon http://i.imgur.com/YkDG9CI.png
  8. // @include http://agar.io/*
  9. // @include https://agar.io/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14.  
  15. var lastEdit = 1465120103810;
  16. var profileOptions = {};
  17. var topPlayers = [], allPlayers = [];
  18. var loopCount = 0;
  19. var overlaysOpened = true;
  20. var gameLoaded = false, coinFirstClick = false;
  21. var keysHold = {}, ejectorLoop = null;
  22. var canvas = document.getElementById('canvas');
  23. var canvas2 = document.getElementById('openfl-content').getElementsByTagName('canvas')[0];
  24.  
  25. $(document).ready(function() {
  26. window.onbeforeunload = function() { return 'Quit game?'; };
  27. $(document).ajaxComplete(function(e, xhr, stg) {
  28. if(stg.url.indexOf('findServer') != -1 && xhr.status == 200) {
  29. if(gameLoaded) setTimeout(onRoomLoad, 800);
  30. else setTimeout(onGameLoad, 1800);
  31. gameLoaded = true;
  32. }
  33. });
  34. setTimeout(function() {
  35. if(!gameLoaded) $('#region').val('US-Atlanta').change();
  36. }, 10000);
  37. editOverlays();
  38. hookOverlays();
  39. hookKeys();
  40. });
  41.  
  42. function editOverlays() {
  43. [ 'settings', 'scale_setting', 'quality_setting', 'location' ].forEach(function(e) { localStorage.removeItem(e); });
  44. $('button[data-itr="play"]').css({'width': '230px'});
  45. $('button[data-itr="play_as_guest"]').css({'width': '112px'});
  46. $('button[data-itr="login_and_play"]').css({'width': '112px'}).after('<button id="joinNewRoom" title="Join new room" style="width: 40px; display: block; float: right;" class="btn btn-success btn-refresh"><i class="glyphicon glyphicon-refresh"></i></button>');
  47.  
  48. $('#nick').before('<div id="profiles" style="margin-bottom: 6px;"><span>Profiles: </span></div>');
  49. for(i = 0; i <= 10; i++) { $('#profiles').append('<button data-title="Loading profile..." class="btn" style="margin: 0px 1px; padding: 0px 5px; border: none;">' + (i ? i : 'Default') + '</button>'); }
  50.  
  51. $('#settings').before('<hr style="margin-top: 10px; margin-bottom: 10px;">');
  52. $('#options').css({ 'margin-top': '16px' })
  53. .append('<div>Action on room join:<select id="optnOnJoin" style="margin: 0px 6px"><option value="">Do nothing</option><option value="spawn">Spawn</option><option value="spec">Join spectator</option></select></div>')
  54. .append('<div><label><input id="optnSpawn" type="checkbox">Auto respawn</label></div>')
  55. .append('<div><label><input id="optnCoin" type="checkbox">Click coin every</label><input id="optnCoin_Interval" type="number" min="1" value="15" disabled="disabled" style="margin: 0px 6px; width: 50px;"><span>min</span></div>')
  56. .append('<div><label><input id="optnMove" type="checkbox">Randomized movement every</label><input id="optnMove_Interval" type="number" min="1" value="5" disabled="disabled" style="margin: 0px 6px; width: 50px;"><span>sec</span></div>');
  57.  
  58. var addedOptions = $('#options div');
  59. for(var i = 0; i < addedOptions.length; i++) {
  60. addedOptions.eq(i).css({ 'width': '282px', 'margin': '2px 0px' });
  61. if(i === 0) addedOptions.eq(i).css({ 'border-top': '1px dashed', 'margin-top': '10px', 'padding-top': '10px' });
  62. }
  63.  
  64. $('#instructions')
  65. .html('<div style="text-align: center;"><strong>Instructions</strong>Move your mouse to control your cell<br>Press <b>Space</b> to split<br>Press <b>W</b> to eject some mass</div><hr style="margin: 10px 0px;">')
  66. .append('<div><strong>Ingame Shortcuts / Macros</strong><span style="width: 300px; text-align: center;"><b>~</b> Toggle selectable leaderboard list</span><span style="width: 300px; text-align: center; margin-bottom: 4px;"><b>1</b> - <b>0</b> Copy leaderboard name #1 to #10</span><span><b>E</b> Shoot mass cont.</span><span><b>R</b> Shoot mass 7 times</span><span><b>T</b> Split into 16 pieces</span><span><b>S</b> Stop movement</span><span><b>V</b> Skin panel</span><span><b>B</b> Shop panel</span><span><b>N</b> XP Boost panel</span><span><b>M</b> Mass Boost panel</span><span><b>,</b> Free coins panel</span></div>')
  67. .after('<div class="modInfo-toggler" style="font-size: 75%; float: right; margin-bottom: 6px !important;">Mod by condoriano. <a href="#">More Info</a></div>');
  68. $('#instructions div').css({ 'color': '#555', 'padding': '0px 10px', 'font-size': '12px', 'margin': '12px 0px' });
  69. $('#instructions strong').css({ 'color': '#333', 'display': 'block', 'margin-bottom': '6px', 'text-align': 'center', 'font-size': '16px' });
  70. $('#instructions b').css({ 'background-color': '#333', 'color': '#EEE', 'padding': '1px 5px', 'border-radius': '3px', 'min-width': '20px', 'display': 'inline-block', 'margin': '1px 0px', 'text-align': 'center' });
  71. $('#instructions span').css({ 'display': 'inline-block', 'min-width': '150px' });
  72.  
  73. $('footer.tosBox.left').removeClass('left').addClass('gamemodes').css({ 'position': 'absolute', 'bottom': '32px', 'right': '0px', 'font-size': '12px', 'background-color': '#3071A9', 'border-radius': '15px 0px 0px 15px', 'padding-left': '18px' });
  74. $('footer.tosBox.right').removeClass('right').addClass('tos').css({ 'position': 'absolute', 'bottom': '2px', 'right': '0px', 'font-size': '12px', 'background-color': '#3071A9', 'border-radius': '15px 0px 0px 15px', 'padding-left': '18px' })
  75. .after('<footer class="donate" style="position: absolute; bottom: -2px; right: 380px;"><form id="donate-mod" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"><input type="hidden" name="cmd" value="_donations"><input type="hidden"name="business" value="[email protected]"><input type="hidden" name="lc" value="US"><input type="hidden" name="item_name" value="Donation"><input type="hidden" name"no_not" value="0"><input type="hidden" name="currency_code" value="USD"><input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest"><input type="image" style="height: 24px;" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" alt="PayPal button" border="0"></footer>')
  76. .after('<footer class="tosBox homepage" style="position: absolute; bottom: 0px; right: 280px; background-color: #398439; border-radius: 5px 5px 0px 0px;"><a href="https://greasyfork.org/en/scripts/14297-agar-io-auto-respawn-evergreen" target="_blank">Homepage</a></footer>');
  77. $('footer a').css('color', '#FFF');
  78. appendGoogleAd();
  79. setInterval(appendGoogleAd, 90000);
  80.  
  81. $('footer').eq(0).before('<div id="toolTip" style="position: absolute; display: none; transform: translate(-50%, -100%); background-color: #222; color: #EEE; text-align: center; padding: 2px 6px; border-radius: 3px;"></div><div id="modInfo"><div id="modInfo-header"><button class="modInfo-toggler">&#x2716;</button><h2>Script Info</h2><span title="' + Date(lastEdit).toString() + '">Last update: ' + timeSince(lastEdit) + ' ago</span></div><div id="modInfo-content"></div><div id="modInfo-footer"></div></div>');
  82. $('#modInfo').css({ 'display': 'none', 'width': '820px', 'height': '500px', 'padding': '0px 20px', 'position': 'absolute', 'top': '50%', 'left': '50%', 'transform': 'translate(-50%, -50%)', 'background-color': '#123', 'color': '#AAA', 'border': '1px solid #000000', 'border-radius': '12px', 'box-shadow': '0px 0px 100px #012 inset' });
  83. $('#modInfo-header').css({ 'font-family': 'Consolas', 'color': '#EEE', 'padding': '20px 0px', 'text-align': 'center', 'border-bottom': '2px solid #28B', 'position': 'relative' });
  84. $('#modInfo-header button').css({ 'float': 'right', 'color': '#AAA', 'border': 'none', 'background-color': 'rgba(0, 0, 0, 0.3)', 'position': 'absolute', 'top': '10', 'right': '0' });
  85. $('#modInfo-header h2').css({ 'margin': '0px' });
  86. $('#modInfo-header span').css({ 'font-size': '80%', 'color': '#999' });
  87. $('#modInfo-content').css({ 'font-family': 'Tahoma, sans-serif', 'width': '780px', 'height': '338px', 'overflow': 'auto', 'margin': '20px 0px' });
  88. $('#modInfo-footer').css({ 'font-size': '80%' });
  89. $('#modInfo-content').html('<div id="modInfo-content-features"><span style="color: #EEE;">Features</span><ul><li>Auto respawn<li>Auto click hourly coin - clicks at set interval<li>Auto-save settings<li>Profiles - you can save 10 different profiles each with their own settings<li>Reload server button<li>Various macros/shortcuts<li>Join room action - choose between do nothing, spawn, or join spectator<li>Copy leaderboard names<li>Randomize movement - move randomly at set interval<li>Confirm dialog on logout and closing/reloading tab<li>Hide ads and promos<li>...more will be added on updates</ul></div>\
  90. <div id="modInfo-content-changelogs"><span style="color: #EEE;">Changelog</span> <a href="#" class="modInfoChangelog-toggler" style="font-size: 11px;">Show</a><div style="display: none; width: 90%; background: rgba(0,0,0,0.3); font-size: 11px; padding: 10px"><ul style="padding-left: 20px;">\
  91. <li>2016-07-10<ul><li>Added new feature: Copy leaderboard player names (use key 1-0)<li>Added shortcut to display selectable leaderboard list (key ~)</ul></li><li>2016-06-22 - Profile buttons now diplay region, game mode and name when you hover over them</li><li>2016-06-04<ul><li>Fixed pressing "login to play" button making overlay close if you have autospawn enabled<li>You will also click coin when you start the game if you have the autoclick coin enabled<li>Added delay before applying profile settings just to be safe</ul></li>\
  92. <li>2016-06-03 - Rewrote most of the codes</li><li>2016-05-27<ul><li>Changed source code location</li><li>Added auto-click hourly coin feature</li><li>Auto movement and autoclick coin interval now can be set</li></ul></li><li>2016-05-24 - Fixed broken stop moving and random moving function. The \'go to map center\' function is still broken though.</li><li>2016-05-23<ul><li>Opening free coins panel will automatically clicks the get coins button<li>Replaced promo banner with google ads banner</ul></li><li>2016-04-20 - Added profiles - you can save 10 different profiles each with their own settings</li><li>2016-04-06 - Changed leaderboard text to show what mode it currently is</li><li>2016-03-23<ul><li>Added confirm box on clicking log out button<li>Refresh server button now also works in party mode</li></li></ul></li><li>2016-03-01<ul><li>Made all panels opened with the ingame shortcut to be semi-transparent</li><li>Added new feature - Press , to open free coin panel</li><li>Added new feature - Spectator Mode - You will be put into spectatormode when you join a server</li></ul></li>\
  93. <li>2015-02-19<ul><li>Added new feature - Press V to open skin panel</li><li>Added new feature - Press B to open shop panel</li><li>Added new feature - Press M to open mass boost panel</li><li>Added new feature - Press N to open xp panel</li><li>Removed checkboxes for ingame shortcut features - they are now not toggle-able</li><li>Reworked instruction UI</li></ul></li><li>2015-12-29<ul><li>Added new feature - Press R to eject mass 7 times</li><li>Added new fature - Press T to split 4 times</li></ul></li><li>2015-12-26<ul><li>Moved connecting panel to top right corner of the screen</li><li>Added region and gamemode info on connecting panel</li></ul></li><li>2015-12-24 - Added new feature - Acid mode</li><li>2015-12-23 - Resized stats panel to exclude ads height</li>\
  94. <li>2015-12-22<ul><li>Added new feature - Press S key to stop movement</li><li>Added new feature - Press C to go to the center of the map</li><li>Added new feature - Randomize movement - change direction every 5 seconds</li></ul></li><li>2015-12-18 - Added changelog into the info panel</li><li>2015-12-16 - Added info panel</li><li>2015-12-13 - Fixed gamemode not always changing to the saved value</li><li>2015-12-11 - Fixed not being able to spectate</li><li>2015-12-09 - Script is now hosted on pastebin to make updating easy</li><li>2015-12-08<ul><li>Fixed overlay not displayed on center y-axis</li><li>Updated link for update script url</li><li>Added donate button in the footer</li></ul></li>\
  95. <li>2015-12-06<ul><li>Added promo hiding</li><li>Stylized footer and moved it to the right</li></ul></li><li>2015-12-05<ul><li>Rewrote code to use jQuery</li><li>Fixed auto spawn not working for guest players</li><li>Added ads hiding feature</li><li>Added instruction for "hold E to W"</li><li>Added link to this page</li><li>Stylized instructions a little bit</li></ul></li><li>2015-12-02 - Added refresh server button</li><li>2015-12-01<ul><li>Fixed button style on chrome</li><li>Added "hold E to W" function</li><li>Removed debugging alert message</li></ul></li><li>2015-11-30 - Fixed auto spawn checkbox not working</li><li>2015-11-29 - Initial release</li></ul></div></div>');
  96. $('#modInfo-footer').html('<a href="https://greasyfork.org/en/scripts/14297-agar-io-auto-respawn-evergreen" target="_blank">Homepage</a> - <a href="https://greasyfork.org/scripts/20003-agar-io-auto-respawn-code/code/Agario%20auto%20respawn%20code.js" target="_blank">Source Code</a> - <a href="#" onclick="$(\'#donate-mod input[name=submit]\').click(); return false;">Donate</a>');
  97. $('#overlays').after('<div id="playerListBox" style="display: none; z-index: 201; position: absolute; top: 10px; left: 10px; opacity: 0.9; background-color: #000; padding: 8px; border-radius: 6px;"><a href="#" style="position: absolute; top: 0px; right: 0px;">&times;</a><a href="#">Leaderboard</a><a href="#">All Players</a><textarea rows="10" cols="50" readonly="readonly" wrap="off" style="display: block; border: none; padding: 8px 0px 8px 8px;"></textarea></div>');
  98.  
  99. $('#playerListBox a').css({ 'text-decoration': 'none', 'color': '#FFF', 'display': 'inline-block', 'padding': '2px 12px', 'border-radius': '4px 4px 0px 0px' });
  100. $('#playerListBox a').eq(0).css({ 'position': 'absolute', 'top': '-2px', 'right': '6px', 'font-size': '20px', 'padding': '0' });
  101. $('#playerListBox a').eq(1).css({ 'background-color': '#FFF', 'color': '#000' });
  102.  
  103. $('#advertisement').hide().css({ 'visibility': 'hidden' });
  104. $('#agario-web-incentive a, .agario-promo a').remove();
  105. $('#region').val('').css({ 'display': 'block' });
  106. //$('#stats').css('height', '375px');
  107. //$('#stats hr').remove();
  108. //$('#socialStats').css('bottom', '65px');
  109. //$('#statsContinue').css('bottom', '25px');
  110. //$('#statsGraph').css({ 'bottom': '110px', 'opacity': '1' }).attr('height', '200px');
  111. //$('#s300x250').css({ 'display': 'none', 'z-index': '-10' });
  112. setTimeout(function() { $('#___ytsubscribe_0').css({'width': '112px'}); }, 12000);
  113. }
  114.  
  115. function hookOverlays() {
  116. $('#freeCoins').on('click', function() { getCoin(); });
  117. $('button[data-itr="play"]').on('click', function() { overlaysOpened = false; });
  118. $('button[data-itr="play_as_guest"]').on('click', function() { overlaysOpened = false; });
  119. $('button[data-itr="spectate"]').on('click', function() { overlaysOpened = true; });
  120. $('button[data-itr="logout"]').removeAttr('onclick').on('click', function() { var lg = confirm('Logout?'); if(lg) logout(); });
  121. $('#joinNewRoom').on('click', function() {
  122. var q = $('#gamemode').val();
  123. if(q == ':party') $('button[data-itr="create_party"]').click();
  124. else {
  125. $('#gamemode').val(':party').change();
  126. $('#gamemode').val(q).change();
  127. }
  128. });
  129. $('#playerListBox a').on('click', function(e) {
  130. var curLink = $(this).index();
  131. if(curLink) {
  132. $('#playerListBox a').css({ 'background-color': 'transparent', 'color': '#FFF' });
  133. $(this).css({ 'background-color': '#FFF', 'color': '#000' });
  134. populatePlayerList(curLink);
  135. }
  136. else {
  137. if($(this).parent().is(':hidden')) $('#playerListBox a').eq(1).click();
  138. $(this).parent().fadeToggle(200);
  139. }
  140. return false;
  141. });
  142. $('#profiles button').on('mouseover', function(e) { $('#toolTip').html($(this).attr('data-title')).css({ 'display': 'block', 'top': e.clientY - 20, 'left': e.clientX }); });
  143. $('#profiles button').on('mouseout', function(e) { $('#toolTip').css({ 'display': 'none' }); });
  144. $('.modInfo-toggler').on('click', function(e) { $('#modInfo').fadeToggle(); e.preventDefault(); });
  145. $('.modInfoChangelog-toggler').on('click', function(e) { $(this).next().slideToggle(); e.preventDefault(); });
  146. $.each(['show', 'hide'], function (i, ev) { var el = $.fn[ev]; $.fn[ev] = function () { this.trigger(ev); return el.apply(this, arguments); }; });
  147. $('#openfl-content').on('hide', function() {
  148. setTimeout(function() {
  149. $('#openfl-content').css({'opacity' : '1'});
  150. $('#openfl-overlay').css({'pointer-events' : ''});
  151. }, 10);
  152. });
  153. }
  154.  
  155. function onGameLoad() {
  156. handleOptions();
  157. setInterval(logicLoop, 1000);
  158. if(localStorage.getItem('activeProfile') === null) localStorage.setItem('activeProfile', 0);
  159. $('#profiles button').eq(localStorage.getItem('activeProfile')).click();
  160. updateProfileTitle();
  161. }
  162. function onRoomLoad() {
  163. if(profileOptions.optnOnJoin == 'spawn') $('button[data-itr="play"]').click();
  164. else if(profileOptions.optnOnJoin == 'spec') $('button[data-itr="spectate"]').click();
  165. topPlayers = [];
  166. allPlayers = [];
  167. }
  168.  
  169. function updateProfileTitle(p) {
  170. var n, m;
  171. if(p === undefined) { n = 0; m = 10; }
  172. else { n = p; m = p; }
  173. for(i = n; i <= m; i++) {
  174. var temp = JSON.parse(localStorage.getItem('rprofile' + i));
  175. if(temp === null) $('#profiles button').eq(i).attr('data-title', 'Empty profile');
  176. else {
  177. var x, y, z = temp.nick;
  178. $('#region option').each(function(e) { if($(this).val() == temp.region) x = $(this).text().split(' (')[0]; });
  179. $('#gamemode option').each(function(e) { if($(this).val() == temp.gamemode) y = '<span style="font-weight: bold; color: ' + (e === 0 ? '#3F3' : e == 1 ? '#3AF' : e == 2 ? '#F33' : '#A3F') + ';">' + $(this).text() + '</span>'; });
  180. $('#profiles button').eq(i).attr('data-title', x + ' - ' + y + '<br>' + z);
  181. }
  182. }
  183. }
  184.  
  185. function logicLoop() {
  186. loopCount++;
  187. $('button[data-itr="spectate"]').removeAttr('disabled');
  188. if(profileOptions.optnSpawn && !overlaysOpened) MC.setNick($('#nick').val());
  189. if(profileOptions.optnCoin && loopCount % (parseInt($('#optnCoin_Interval').val()) * 60) === 0) showPanel(5);
  190. if(profileOptions.optnMove && loopCount % parseInt($('#optnMove_Interval').val()) === 0) simulateMove(Math.random() * innerWidth, Math.random() * innerHeight, canvas);
  191. if(!coinFirstClick) {
  192. if(profileOptions.optnCoin && $('#coins-blocker').css('display') == 'none') {
  193. coinFirstClick = true;
  194. setTimeout(function() { showPanel(5); }, 1600);
  195. }
  196. }
  197. }
  198.  
  199. function hookKeys() {
  200. $(document).on('keyup', function(e) {
  201. var key = e.which || e.keyCode;
  202. keysHold[key] = false;
  203. if(key == 69) { // key E
  204. clearInterval(ejectorLoop);
  205. ejectorLoop = null;
  206. }
  207. });
  208.  
  209. $(document).on('keydown', function(e) {
  210. var key = e.which || e.keyCode;
  211. var spKeys = e.ctrlKey || e.altKey || e.shiftKey;
  212. //console.log('keydown ' + key);
  213. if($('#overlays').is(':hidden') && !spKeys) {
  214. if(key == 27) overlaysOpened = true; // key ESC
  215. if(!keysHold[key]) {
  216. if(key == 69) { // key E
  217. if(!ejectorLoop) {
  218. ejectorLoop = setInterval(function() {
  219. window.onkeydown({ keyCode: 87 });
  220. window.onkeyup({ keyCode: 87 });
  221. }, 10);
  222. }
  223. }
  224. else if(key == 82) { // key R
  225. setIntervalX(function() {
  226. window.onkeydown({ keyCode: 87 }); // key W
  227. window.onkeyup({ keyCode: 87 });
  228. }, 120, 7);
  229. }
  230. else if(key == 84) { // key T
  231. setIntervalX(function() {
  232. window.onkeydown({ keyCode: 32 }); // key SPACE
  233. window.onkeyup({ keyCode: 32 });
  234. }, 60, 4);
  235. }
  236. else if(key == 83) { // key S // todo - this is not working in chrome
  237. var mEv = new MouseEvent('mousemove', { 'clientX': window.innerWidth/2, 'clientY': window.innerHeight / 2 });
  238. canvas.dispatchEvent(mEv);
  239. }
  240. else if(key == 86) showPanel(2); // key V
  241. else if(key == 66) showPanel(1); // key B
  242. else if(key == 78) showPanel(3); // key N
  243. else if(key == 77) showPanel(4); // key M
  244. else if(key == 188) showPanel(5); // key ,
  245. }
  246. keysHold[key] = true;
  247. }
  248. if(document.activeElement.tagName.toUpperCase() != 'INPUT' && document.activeElement.type != 'text') {
  249. if(key == 192) { // key ~
  250. $('#playerListBox a').eq(0).click();
  251. keysHold[key] = true;
  252. }
  253. else if(key >= 48 && key <= 57) { // keys 0-9
  254. var playerPos = key == 48 ? 9 : key - 49;
  255. if(topPlayers[playerPos] !== undefined) {
  256. var newName = topPlayers[playerPos];
  257. var cnfrm = confirm('Copy "' + newName + '" to current profile?');
  258. if(cnfrm) $('#nick').val(newName).change();
  259. }
  260. }
  261. }
  262. });
  263. }
  264.  
  265. function populatePlayerList(curTab) {
  266. var playerList = '';
  267. if(curTab == 1) for(var i = 0; i < topPlayers.length; i++) playerList += (i + 1) + '. ' + topPlayers[i] + (i == topPlayers.length - 1 ? '' : '\n');
  268. else if(curTab == 2) for(var i = 0; i < allPlayers.length; i++) playerList += (i + 1) + '. ' + allPlayers[i] + (i == allPlayers.length - 1 ? '' : '\n');
  269. $('#playerListBox textarea').html(playerList);
  270. }
  271.  
  272. function handleOptions() {
  273. var profiles = $('#profiles button');
  274. var checkboxes = $('#options input[type="checkbox"]');
  275. var textfields = $('#nick, #gamemode, #region, #quality, #optnOnJoin, #optnCoin_Interval, #optnMove_Interval');
  276.  
  277. checkboxes.on('change', function() {
  278. var optnID = $(this).attr('id');
  279. var optnEnabled = $(this).is(':checked');
  280. profileOptions[optnID] = optnEnabled;
  281. localStorage.setItem('rprofile' + localStorage.getItem('activeProfile'), JSON.stringify(profileOptions));
  282. updateProfileTitle(localStorage.getItem('activeProfile'));
  283. if(optnID == 'optnCoin') {
  284. if(optnEnabled) $('#optnCoin_Interval').removeAttr('disabled');
  285. else $('#optnCoin_Interval').attr('disabled', 'disabled');
  286. }
  287. else if(optnID == 'optnMove') {
  288. if(optnEnabled) $('#optnMove_Interval').removeAttr('disabled');
  289. else $('#optnMove_Interval').attr('disabled', 'disabled');
  290. }
  291. });
  292. textfields.on('change', function() {
  293. var optnID = $(this).attr('id');
  294. var optnValue = $(this).val();
  295. if(parseInt(optnValue) < parseInt($(this).attr('min'))) $(this).val($(this).attr('min')).change();
  296. profileOptions[optnID] = optnValue;
  297. localStorage.setItem('rprofile' + localStorage.getItem('activeProfile'), JSON.stringify(profileOptions));
  298. updateProfileTitle(localStorage.getItem('activeProfile'));
  299. if(optnID == 'optnCoin_Interval') loopCount = 0;
  300. });
  301.  
  302. profiles.on('click', function() {
  303. var curProfile = parseInt($(this).text()) ? parseInt($(this).text()) : 0;
  304. var profileExist = false;
  305. profiles.css({ 'background-color': '#222', 'color': '#EEE' });
  306. $(this).css({ 'background-color': '#D22' });
  307. localStorage.setItem('activeProfile', curProfile);
  308. if(localStorage.getItem('rprofile' + curProfile)) { profileOptions = JSON.parse(localStorage.getItem('rprofile' + curProfile)); profileExist = true; }
  309. if(!Object.keys(profileOptions).length) profileExist = false;
  310.  
  311. checkboxes.each(function() {
  312. var optnID = $(this).attr('id');
  313. var optnEnabled = $(this).is(':checked');
  314. if(profileExist) {
  315. if(optnEnabled && !profileOptions[optnID]) $(this).click().change();
  316. else if(profileOptions[optnID] === true && !optnEnabled) $(this).click().change();
  317. }
  318. });
  319. textfields.each(function() {
  320. var optnID = $(this).attr('id');
  321. var optnValue = $(this).val();
  322. if(!profileExist) {
  323. if(optnID == 'nick') {
  324. if(localStorage.getItem('profile' + curProfile) !== null) {
  325. $(this).val(JSON.parse(localStorage.getItem('profile' + curProfile)).nick);
  326. localStorage.removeItem('profile' + curProfile);
  327. }
  328. else $(this).val('ௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌ');
  329. }
  330. profileOptions[optnID] = $(this).val();
  331. }
  332. if(profileExist && profileOptions[optnID] != optnValue) $(this).val(profileOptions[optnID]).change();
  333. });
  334. if($('#gamemode').val() == ':party')$('button[data-itr="create_party"]').click();
  335. else if(window.location.href.indexOf('#') != -1) $('#cancel-party-btn').click();
  336. localStorage.setItem('rprofile' + localStorage.getItem('activeProfile'), JSON.stringify(profileOptions));
  337. updateProfileTitle(localStorage.getItem('activeProfile'));
  338. });
  339. }
  340.  
  341. function appendGoogleAd() {
  342. window.google_ad_client = "ca-pub-8318511014856551"; window.google_ad_slot = "5881481221"; window.google_ad_width = 300; window.google_ad_height = 250;
  343. var container = document.getElementById('agario-web-incentive'), script = document.createElement('script'), w = document.write;
  344. document.write = function (content) { container.innerHTML = content; document.write = w; };
  345. script.src = 'http://pagead2.googlesyndication.com/pagead/show_ads.js';
  346. document.body.appendChild(script);
  347. setTimeout(function() { script.remove(); }, 50000);
  348. }
  349.  
  350. function getCoin() {
  351. var xPoses = [ -151, 192, 192, 192, 232 ];
  352. var yPoses = [ 31, -208, -160, -150, -62 ];
  353. var delays = [ 500, 1700, 1750, 1800, 2000 ];
  354. for(var i = 0; i < xPoses.length; i++) {
  355. (function(j) {
  356. setTimeout(function() { simulateClick(window.innerWidth / 2 + xPoses[j], window.innerHeight / 2 + yPoses[j], canvas2); }, delays[j]);
  357. })(i);
  358. }
  359. }
  360.  
  361. function showPanel(x) {
  362. $('#openfl-content').css({'opacity' : '0.30'});
  363. $('#openfl-overlay').css({'pointer-events' : 'none'});
  364. if(x == 1) $('#openShopBtn').click();
  365. else if(x == 2) $('#skinButton').click();
  366. else if(x == 3) $('#boostButton').click();
  367. else if(x == 4) $('#massButton').click();
  368. else if(x == 5) $('#freeCoins').click();
  369. }
  370.  
  371. function simulateMove(x, y, el) {
  372. if(!el) el = document.elementFromPoint(x, y);
  373. var ev = new MouseEvent('mousemove', { 'clientX': x, 'clientY': y }); el.dispatchEvent(ev);
  374. }
  375.  
  376. function simulateClick(x, y, el) {
  377. // console.log(x + ',' + y);
  378. if(!el) el = document.elementFromPoint(x, y);
  379. var ev = new MouseEvent('mousedown', { 'clientX': x, 'clientY': y }); el.dispatchEvent(ev);
  380. ev = new MouseEvent('mouseup', { 'clientX': x, 'clientY': y }); el.dispatchEvent(ev);
  381. }
  382.  
  383. function setIntervalX(callback, delay, repetitions) {
  384. var x = 0;
  385. var intervalID = window.setInterval(function () {
  386. callback();
  387. if (++x === repetitions) window.clearInterval(intervalID);
  388. }, delay);
  389. }
  390.  
  391. function timeSince(date) {
  392. var seconds = Math.floor((new Date() - date) / 1000);
  393. var interval = Math.floor(seconds / 31536000);
  394. if(interval > 1) return interval + ' years'; interval = Math.floor(seconds / 2592000);
  395. if(interval > 1) return interval + ' months'; interval = Math.floor(seconds / 86400);
  396. if(interval > 1) return interval + ' days'; interval = Math.floor(seconds / 3600);
  397. if(interval > 1) return interval + ' hours'; interval = Math.floor(seconds / 60);
  398. if(interval > 1) return interval + ' minutes';
  399. return Math.floor(seconds) + ' seconds';
  400. }
  401.  
  402. function canvasModding() {
  403. var proxiedFillText = CanvasRenderingContext2D.prototype.fillText;
  404. CanvasRenderingContext2D.prototype.fillText = function() {
  405. if(arguments[0] == 'Leaderboard') {
  406. arguments[0] = 'tiny.cc/iAgar';
  407. topPlayers = [];
  408. }
  409. else if(parseInt(arguments[0]) >= 1 && parseInt(arguments[0]) <= 10) { // 1. xxx to 10. xxx
  410. var rank = parseInt(arguments[0]);
  411. if(rank <= 9 && arguments[0][1] == '.' || rank == 10 && arguments[0][2] == '.') {
  412. var tempName = arguments[0].substr(rank == 10 ? 4 : 3);
  413. topPlayers[rank - 1] = tempName;
  414. if(allPlayers.indexOf(tempName) == -1) allPlayers.push(tempName);
  415. }
  416. }
  417. return proxiedFillText.apply(this, arguments);
  418. };
  419. var proxiedStrokeText = CanvasRenderingContext2D.prototype.strokeText;
  420. CanvasRenderingContext2D.prototype.strokeText = function() {
  421. if(isNaN(arguments[0]) && allPlayers.indexOf(arguments[0]) == -1) allPlayers.push(arguments[0]);
  422. return proxiedStrokeText.apply(this, arguments);
  423. };
  424. }
  425. canvasModding();
  426.  
  427. })();
  428.  
  429.  
  430.  
  431.  
  432. /*
  433. var script = document.createElement('script');
  434. script.src = document.location.protocol+"//greasyfork.org/scripts/20003-agar-io-auto-respawn-code/code/Agario%20auto%20respawn%20code.js";
  435. (document.body || document.head || document.documentElement).appendChild(script);
  436. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement