fsfb scripts

a script for agma.io with features such as Copy Chat, Linesplit Toggle, Anti-AFK, Show Portal Mass, Change Food/Virus Color, and more!

目前为 2022-08-28 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name fsfb scripts
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description a script for agma.io with features such as Copy Chat, Linesplit Toggle, Anti-AFK, Show Portal Mass, Change Food/Virus Color, and more!
  6. // @author fishy & firebone
  7. // @match *://agma.io/*
  8. // @run-at document-start
  9. // @icon https://i.imgur.com/8AASK55.png
  10. // @license GPL-3.0-or-later
  11. // @grant unsafeWindow
  12. // @grant GM_setValue
  13. // @grant GM_getValue
  14. // ==/UserScript==
  15.  
  16. /* settings that you can't change in UI but might interfere with other scripts */
  17. let hideAds = true,
  18. improvedShop = true,
  19. extraBotPacks = true,
  20. rightClickCopyChat = true,
  21. rightClickCopyInfo = true,
  22. showRemainingAbilityTime = true,
  23. unlockFreeSkins = true,
  24. hoverShowSkinID = true,
  25. coinXPstats = true,
  26. saveStatsBoxPosition = true,
  27. showXPdecimals = true,
  28. whiteBorder4BlackCells = true,
  29. overrideFastsplitDelay = false, // delays are set automatically, set to "true" if you want custom delays
  30. fastSplitDelay1 = 60, // delay before first freeze (milliseconds)
  31. fastSplitDelay2 = 60, // delay before last freeze (milliseconds)
  32. sortWearablesByOwned = true,
  33. linesplitClosestSide = false, // make the linespli go to the closest side (adjusted) instead of closest bubble
  34. inventorySingleRow = false;
  35.  
  36.  
  37. // ~~~~~~~~~ Don't change anything below this unless you know what you are doing ~~~~~~~~~
  38. let settings = {
  39. hotkeys: [
  40. {title: "Shoot 7 Ejected", id: "fsfb-key7Feed", key: 0, active: false}, // 0
  41. {title: "Linesplit Lock", id: "fsfb-linesplit", key: 0, active: false}, // 1
  42. {title: "Macro Split Bots", id: "fsfb-MacroSplitBots", key: 0, active: false}, // 2
  43. {title: "Hide UI", id: "fsfb-hideUI", key: 0, active: false}, // 3
  44. {title: "Toggle Cursor", id: "fsfb-togglecursor", key: 0, active: false} // 4
  45. ],
  46. fastsplit_hotkeys: [
  47. {title: "Fast Onesplit", id: "fsfb-fsOne", keyName: "", keyCode: 0, active: false},
  48. {title: "Fast Doublesplit", id: "fsfb-fsTwo", keyName: "", keyCode: 0, active: false}
  49. ],
  50. checkboxes: [
  51. {title: "Chat Copy/Cut/Paste", id: "fsfb-copycutpaste", active: false}, // 0
  52. {title: "Anti-AFK", id: "fsfb-antiAFK", active: false}, // 1
  53. {title: "Anti-Invis", id: "fsfb-anticloak", active: false}, // 2
  54. {title: "Linesplit Toggle", id: "fsfb-linetoggle", active: false}, // 3
  55. {title: "Change Page Title", id: "fsfb-changetitle", active: false}, // 4
  56. {title: "Hide Shouts", id: "fsfb-hideshouts", active: false}, // 5
  57. {title: "Hold To Spam Rec/Spd", id: "fsfb-recospeed", active: false}, // 6
  58. {title: "Show Portal Mass", id: "fsfb-portalmass", active: false}, // 7
  59. {title: "Power Spawns Overlay", id: "fsfb-pwsoverlay", active: false}, // 8
  60. {title: "Quick Buy", id: "fsfb-qBuy", active: false}, // 9
  61. ],
  62. slowFeed: [
  63. {title: "Toggle Feed", id: "fsfb-slowFeed", key: 0, active: false},
  64. {title: "Feed Speed", id: "fsfb-slowfeedtimer", val: 100, active: false}
  65. ],
  66. quickSettings: [
  67. {id: "fsfb-quick-hotkey1", id1: "fsfb-quick-select1", set: "cSkins", key: 0, active: false},
  68. {id: "fsfb-quick-hotkey2", id1: "fsfb-quick-select2", set: "cWearables", key: 0, active: false},
  69. {id: "fsfb-quick-hotkey3", id1: "fsfb-quick-select3", set: "cFood", key: 0, active: false},
  70. {id: "fsfb-quick-hotkey4", id1: "fsfb-quick-select4", set: "cBubbleCells", key: 0, active: false}
  71. ],
  72. uiScaling: [
  73. // {title: "Chat Size", id: "fsfb-chatSize", level: 5},
  74. {title: "Inventory Size", id: "fsfb-invSize", level: 5},
  75. {title: "Statsbox Size", id: "fsfb-statsSize", level: 5}
  76. ],
  77. theme: [
  78. {title: "Food Color", id: "fsfb-check-foodcolor", id1: "fsfb-color-foodcolor", color: "#FFFFFF", active: false},
  79. {title: "Virus Color", id: "fsfb-check-viruscolor", id1: "fsfb-color-viruscolor", color: "#00ff00", active: false},
  80. {title: "Virus Stroke", id: "fsfb-check-virusstroke", id1: "fsfb-color-virusstroke", color: "#00ff00", active: false},
  81. {title: "Mothercell Color", id: "fsfb-check-msColor", id1: "fsfb-color-msColor", color: "#cd5564", active: false},
  82. {title: "Mothercell Stroke", id: "fsfb-check-msStroke", id1: "fsfb-color-msStroke", color: "#cd5564", active: false}
  83. ],
  84. theme_boxes: [
  85. {title: "Fancy Bubble Cells", id: "fsfb-bublecell", active: false}, // 0
  86. {title: "Show Player Mass", id: "fsfb-showmass", active: false}, // 1
  87. {title: "Only My Skin", id: "fsfb-myskins", active: false}, // 2
  88. {title: "Only Party Skins", id: "fsfb-partyskins", active: false}, // 3
  89. {title: "Only My Nick", id: "fsfb-mynick", active: false}, // 4
  90. {title: "Only Party Nicks", id: "fsfb-partynicks", active: false}, // 5
  91. {title: "Spiked Cells", id: "fsfb-spikedcells", active: false} // 6
  92. ],
  93. export_import: [
  94. {title: "Game Settings", id: "fsfb-game-settings", active: false},
  95. {title: "Game Controls", id: "fsfb-game-controls", active: false},
  96. {title: "Script Settings", id: "fsfb-script-settings", active: false},
  97. {title: "Script Theme", id: "fsfb-theme-settings", active: false}
  98. ]
  99. }
  100.  
  101. const txtMappings = { "": 0, "BACKSPACE": 8, "TAB": 9, "ENTER": 13, "SHIFT": 16, "CTRL": 17, "ALT": 18, "PAUSE": 19, "CAPSLOCK": 20, "ESC": 27, "SPACE": 32, "PAGEUP": 33, "PAGEDOWN": 34, "END": 35, "HOME": 36, "LEFT": 37, "UP": 38, "RIGHT": 39, "DOWN": 40, "PRTSCN": 44, "INS": 45, "DEL": 46, "WIN": 91, "CONTEXTMENU": 93, "NUM 0": 96, "NUM 1": 97, "NUM 2": 98, "NUM 3": 99, "NUM 4": 100, "NUM 5": 101, "NUM 6": 102, "NUM 7": 103, "NUM 8": 104, "NUM 9": 105, "NUM *": 106, "NUM +": 107, "NUM -": 109, "NUM .": 110, "NUM /": 111, "F1": 112, "F2": 113, "F3": 114, "F4": 115, "F5": 116, "F6": 117, "F7": 118, "F8": 119, "F9": 120, "F10": 121, "F11": 122, "F12": 123, "F13": 124, "F14": 125, "F15": 126, "F16": 127, "F17": 128, "F18": 129, "F19": 130, "F20": 131, "F21": 132, "F22": 133, "F23": 134, "F24": 135, "NUMLOCK": 144, "SCROLLLOCK": 145, ";": 186, "=": 187, ",": 188, "-": 189, ".": 190, "/": 191, "`": 192, "[": 219, "\\": 220, "]": 221, "'": 222 }
  102. const keyCodeMappings = { 0: "", 8: "BACKSPACE", 9: "TAB", 12: "CLEAR", 13: "ENTER", 16: "SHIFT", 17: "CTRL", 18: "ALT", 19: "PAUSE", 20: "CAPSLOCK", 27: "ESC", 32: "SPACE", 33: "PAGEUP", 34: "PAGEDOWN", 35: "END", 36: "HOME", 37: "LEFT", 38: "UP", 39: "RIGHT", 40: "DOWN", 44: "PRTSCN", 45: "INS", 46: "DEL", 91: "WIN", 92: "WIN", 93: "CONTEXTMENU", 96: "NUM 0", 97: "NUM 1", 98: "NUM 2", 99: "NUM 3", 100: "NUM 4", 101: "NUM 5", 102: "NUM 6", 103: "NUM 7", 104: "NUM 8", 105: "NUM 9", 106: "NUM *", 107: "NUM +", 109: "NUM -", 110: "NUM .", 111: "NUM /", 112: "F1", 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 124: "F13", 125: "F14", 126: "F15", 127: "F16", 128: "F17", 129: "F18", 130: "F19", 131: "F20", 132: "F21", 133: "F22", 134: "F23", 135: "F24", 144: "NUMLOCK", 145: "SCROLLLOCK", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'"};
  103.  
  104. const set = (name, obj) => typeof GM_setValue != "function" ? localStorage.setItem(name, JSON.stringify(obj)) : GM_setValue(name, obj),
  105. get = (name, default_obj) => typeof GM_getValue != "function" ? localStorage.getItem(name) != null ? JSON.parse(localStorage.getItem(name)) : set(name, default_obj) : GM_getValue(name, default_obj);
  106.  
  107. if(typeof unsafeWindow === 'undefined') unsafeWindow = window;
  108. const saveSettings = () => set("fsfb-scripts", settings);
  109. const getSettings = () => {
  110. let settingsPrev = get("fsfb-scripts", settings);
  111. for(let i in settingsPrev) {
  112. for(let j in settingsPrev[i]) {
  113. for(let x in settings){
  114. for(let y in settings[x]){
  115. if(settingsPrev[i][j].id == settings[x][y].id) settings[x][y] = settingsPrev[i][j];
  116. }
  117. }
  118. }
  119. }
  120. }
  121. getSettings();
  122.  
  123. const getKey = id => {
  124. const name = $("#" + id).text();
  125. return txtMappings[name] == null ? name.charCodeAt(0) : txtMappings[name];
  126. }
  127.  
  128. const getName = key => keyCodeMappings[key] == null ? String.fromCharCode(key) : keyCodeMappings[key];
  129.  
  130. const levelSum = lvl => lvl * (lvl - 1) / 2,
  131. range = arr => Math.max(...arr) - Math.min(...arr),
  132. sigma = arr => arr.reduce((a, b) => a + b),
  133. mean = arr => sigma(arr) / arr.length,
  134. variance = arr => arr.reduce((a, b) => a + (b - mean(arr)) ** 2, 0) / arr.length,
  135. standardDeviation = arr => Math.sqrt(variance(arr)),
  136. ascending = arr => arr.sort((a, b) => a - b),
  137. getIQR = arr => quartile(arr, .75) - quartile(arr, .25),
  138. round = (num, places) => Math.round(num * +("1e" + places)) / +("1e" + places);
  139. const median = arr => {
  140. const mid = ~~(arr.length / 2),
  141. asc = ascending(arr);
  142. return arr.length % 2 !== 0 ? asc[mid] : (asc[mid - 1] + asc[mid]) / 2;
  143. }
  144. const getProperty = (arr, property) => {
  145. let newArr = [];
  146. for (let i of arr) newArr.push(i[property]);
  147. return newArr;
  148. }
  149. const quartile = (arr, q) => {
  150. const sorted = ascending(arr),
  151. pos = (sorted.length - 1) * q,
  152. base = ~~pos,
  153. rest = pos - base;
  154. return sorted[base + 1] !== null ? sorted[base] + rest * (sorted[base + 1] - sorted[base]) : sorted[base]
  155. }
  156. const checkOutliers = (arr, returnOutliers) => {
  157. let nonOutliers = [], outliers = [];
  158. const IQR = getIQR(arr),
  159. Q1 = quartile(arr, .25),
  160. Q3 = quartile(arr, .75);
  161. for (let i of arr) i < Q1 - 1.5 * IQR || i > Q3 + 1.5 * IQR ? outliers.push(i) : nonOutliers.push(i);
  162. return returnOutliers ? outliers : nonOutliers;
  163. }
  164. const msToTime = ms => {
  165. let sec = ~~((ms / 1e3) % 60),
  166. min = ~~((ms / 6e4) % 60),
  167. hr = ~~(ms / 36e5);
  168. return (hr < 10 ? "0" + hr : hr) + ":" + (min < 10 ? "0" + min : min) + ":" + (sec < 10 ? "0" + sec : sec);
  169. }
  170. const changeTitle = title => {
  171. if(document.title != title) document.title = title;
  172. };
  173.  
  174. if(!settings.checkboxes[5].active) changeTitle('Agma.io');
  175.  
  176. if(unlockFreeSkins){
  177. const ytSkins = ["", 56, 1657, 2281, 2282, 2297, 2331, 2529, 2626, 2683, 2816, 2832];
  178. for (let i of ytSkins) localStorage.setItem('ytSkin' + i, '1');
  179. localStorage.setItem('fbSkin', '1');
  180. }
  181.  
  182. ['paste', 'copy', 'cut'].forEach(a => {
  183. unsafeWindow.addEventListener(a, e => {
  184. if(!$('#fsfb-copycutpaste').is(':checked')) return;
  185. e.stopImmediatePropagation();
  186. }, true)
  187. });
  188.  
  189. const afterLoaded = () => {
  190. // attempt to prevent the script from being active on subpages of agma.io
  191. if($('#friendResizer').length < 1 || $('#megaholder').length < 1 || $('#preroll').length < 1) return;
  192.  
  193. $('.setting-tablink').css({'width' : '30%', "font-size" : "font-size: calc(0.3vw + 7.5px);"});
  194. $('#settingTab2').after(`<button id="settingTab4" class="setting-tablink" onclick="openSettingPage(4);" style="width: 9%; font-size: calc(0.3vw + 7.5px);"><div class="fa fa-cogs fa-lg" style="font-size: 1.25em; color: lightgray;"></div></button>`);
  195. $('#settingPage3').after(`<div id="settingPage4" class="setting-tabcontent"><div class="row"><div class="col-md-10 col-md-offset-1 stng" id="fsfb-settings-main" style="padding:0"><div id="fsfb-settings-left"><section id="fsfb-sect-checkbox" class="padbot10 fsfb-sect-ch"></section><section id="fsfb-sect-theme" class="fsfb-sect-ch"></section></div><div id="fsfb-settings-right"><section id="fsfb-sect-hotkeys" class="padbot10"></section><section id="fsfb-sect-slowfeed" class="padbot10"></section><section id="fsfb-sect-quickSettings" class="padbot10"></section><section id="fsfb-sect-uiScale" class="padbot10"></section><section id="fsfb-sect-imexport" class="fsfb-sect-ch"></section></div></div></div></div>`);
  196. $('.container').eq(0).css("max-width", "1250px");
  197. $('#fsfb-sect-checkbox').append(`<p class="hotkey-paragraph">Script Features</p>`);
  198.  
  199. // add checkbox HTML
  200. for(let i of settings.checkboxes){
  201. $('#fsfb-sect-checkbox').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  202. $( "#" + i.id).change(function() {
  203. changeSettings(this.id, $(this).is(':checked'));
  204. });
  205. }
  206.  
  207. // add import/export HTML
  208. $('#fsfb-sect-imexport').append(`<p class="hotkey-paragraph">Import/Export</p>`);
  209. for(let i of settings.export_import){
  210. $('#fsfb-sect-imexport').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  211. $( "#" + i.id).change(function() {
  212. changeSettings(this.id, $(this).is(':checked'));
  213. });
  214. }
  215. $('#fsfb-sect-imexport').append(`<div id="fsfb-ximport-cont"><div id="fsfb-export-btn" class="fsfb-eximport">Export</div><div id="fsfb-import-btn" class="fsfb-eximport">Import</div></div>`);
  216.  
  217. $('#fsfb-sect-theme').append(`<p class="hotkey-paragraph">Game Theme</p`)
  218. for(let i of settings.theme){
  219. $('#fsfb-sect-theme').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title}</p><div style="background-color: black;"><input id="${i.id1}"type="color"></div></label>`);
  220. $( "#" + i.id).change(function() {
  221. changeSettings(this.id, $(this).is(':checked'));
  222. });
  223. $( "#" + i.id1).change(function() {
  224. changeSettings(this.id, this.value);
  225. $(this).parent().css('background-color', this.value); // bcs the regular [input="color"] looks rly shit, change color of overlayed div instead
  226. });
  227. }
  228. for(let i of settings.theme_boxes){
  229. $('#fsfb-sect-theme').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  230. $( "#" + i.id).change(function() {
  231. changeSettings(this.id, $(this).is(':checked'));
  232. });
  233. }
  234.  
  235. $('#fsfb-sect-hotkeys').append(`<p class="hotkey-paragraph">Script Hotkeys</p>`);
  236.  
  237. const checkHotkeyClicked = (e, thing) => {
  238. if (e.target.id == thing.id && !thing.active){
  239. $('#' + thing.id).addClass('selected');
  240. thing.active = true;
  241. keysChanging = true; // prevent features from triggering when setting hotkey
  242. } else {
  243. thing.active = false;
  244. $('#' + thing.id).removeClass('selected');
  245. }
  246. }
  247. const checkNewHotkey = (e, thing) => {
  248. if (!thing.active) return;
  249. thing.key = e.keyCode;
  250. $('#' + thing.id).text(getName(e.keyCode));
  251. $('#' + thing.id).removeClass('selected');
  252. thing.active = false;
  253. saveSettings();
  254. e.preventDefault();
  255. }
  256. const checkFsHotkey = (e, thing) => {
  257. if (!thing.active) return;
  258. thing.key = e.keyCode;
  259. thing.keyName = e.key;
  260. $('#' + thing.id).text(getName(e.keyCode));
  261. $('#' + thing.id).removeClass('selected');
  262. thing.active = false;
  263. saveSettings();
  264. e.preventDefault();
  265. }
  266.  
  267. const checkPowerupClicked = e => {
  268. if(!quickBuying || $(e.target).attr('class') == 'purchase-btn confirmation' || $(e.target).attr('class') == 'megaphone-btn') return;
  269. let pwID;
  270. switch (e.target.id) {
  271. case 'invWall':
  272. pwID = 33;
  273. break;
  274. case 'invAntiFreeze':
  275. pwID = 35;
  276. break;
  277. case 'invAntiRecombine':
  278. pwID = 34;
  279. break;
  280. case 'invShield':
  281. pwID = 38;
  282. break;
  283. case 'invFrozenVirus':
  284. pwID = 36;
  285. break;
  286. case 'invRecombine':
  287. pwID = 1;
  288. break;
  289. case 'invSpeed':
  290. pwID = 2;
  291. break;
  292. case 'invGrowth':
  293. pwID = 6;
  294. break;
  295. case 'invSpawnVirus':
  296. pwID = 7;
  297. break;
  298. case 'invSpawnMothercell':
  299. pwID = 8;
  300. break;
  301. case 'invSpawnPortal':
  302. pwID = 9;
  303. break;
  304. case 'invSpawnGoldOre':
  305. pwID = 10;
  306. break;
  307. case 'invFreeze':
  308. pwID = 5;
  309. break;
  310. case 'inv360Shot':
  311. pwID = 30;
  312. break;
  313. case 'inv360Shot':
  314. pwID = 30;
  315. break;
  316. case 'fsfb-minionNuker':
  317. pwID = 39;
  318. break;
  319. case 'fsfb-quickMega':
  320. pwID = 14;
  321. break;
  322. case 'fsfb-quickbuy-img':
  323. quickBuying = true;
  324. return;
  325. default:
  326. quickBuying = false;
  327. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  328. $('#fsfb-quickbuy').removeClass('activatedInv')
  329. curserMsg('Quick buy deactivated.', 'red');
  330. return;
  331. }
  332. if(pwID == 14) $('.megaphone-btn')[0].click();
  333. else $('.purchase-btn.confirmation[item="' + pwID + '"]')[0].click();
  334.  
  335. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  336. $('#fsfb-quickbuy').removeClass('activatedInv')
  337. quickBuying = false;
  338. }
  339.  
  340. const slowfeedhotkey = settings.slowFeed[0];
  341.  
  342. for(let i of settings.hotkeys){
  343. $('#fsfb-sect-hotkeys').append(`<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>`);
  344. $('#' + i.id).on('contextmenu', e => {
  345. $('#' + i.id).text('');
  346. i.key = 0;
  347. saveSettings();
  348. e.preventDefault();
  349. });
  350. }
  351. for(let i of settings.fastsplit_hotkeys){
  352. $('#fsfb-sect-hotkeys').append(`<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>`);
  353. $('#' + i.id).on('contextmenu', e => {
  354. $('#' + i.id).text('');
  355. i.key = 0;
  356. i.keyName = '';
  357. saveSettings();
  358. e.preventDefault();
  359. });
  360. }
  361.  
  362. const typing = () => $('input, textarea').is(':focus');
  363. const sleep = ms => new Promise(r => setTimeout(r, ms));
  364. const press = key => {
  365. unsafeWindow.onkeydown({ keyCode: key });
  366. unsafeWindow.onkeyup({ keyCode: key });
  367. }
  368. let fsCheck;
  369. const fastSplit = async(a) => {
  370. if(!fsCheck) return void(fsCheck = !0);
  371. const fps = +$('#fps').text();
  372. let delay1, delay2; // i think slower cpu speeds can make the keypress times funky so this tries to make it fail less if cpu is slow (low fps)
  373. if(fps > 55){ // 55+ fps
  374. delay1 = 60;
  375. delay2 = 60;
  376. } else if(fps > 30 && fps < 55){ // 31-54 fps
  377. delay1 = 65;
  378. delay2 = 65;
  379. } else if(fps > 10 && fps < 31){ // 11 - 30 fps
  380. delay1 = 70;
  381. delay2 = 70;
  382. } else if(fps < 11){ // less than 11 fps
  383. delay1 = 80;
  384. delay2 = 80;
  385. }
  386. if(overrideFastsplitDelay){
  387. delay1 = fastSplitDelay1;
  388. delay2 = fastSplitDelay1;
  389. }
  390. if([39, 37, 2, 4, 6].indexOf(currentServerId) != -1 || !a) await sleep(delay1);
  391. press(getKey("keyFreezeSelf"));
  392. await sleep(delay2);
  393. press(getKey("keyFreezeSelf"));
  394. }
  395. setTimeout(fastSplit, 120);
  396.  
  397. let cursorLockActivated = false, _onblur;
  398. setTimeout(() => {
  399. _onblur = unsafeWindow.onblur
  400. }, 4e3);
  401. const toggleCursorLock = () => {
  402. cursorLockActivated = !cursorLockActivated;
  403. cursorLockActivated ? unsafeWindow.onblur = function(){} : unsafeWindow.onblur = _onblur;
  404. cursorLockActivated ? unsafeWindow.onkeydown({keyCode: 67}) : unsafeWindow.onkeyup({keyCode: 67});
  405. console.log(unsafeWindow.onblur);
  406. }
  407.  
  408. Object.defineProperty(KeyboardEvent.prototype, 'keyCode', {
  409. get: function() {
  410. switch (this.key.toLowerCase()) {
  411. case settings.fastsplit_hotkeys[0].keyName.toLowerCase(): return getKey("keySplit");
  412. case settings.fastsplit_hotkeys[1].keyName.toLowerCase(): return getKey("keyDoubleSplit");
  413. default: return this.which;
  414. }
  415. }
  416. });
  417.  
  418. let slowfeeding = !1, linesplitting = !1, hiddenUI = !1, splittingbots = !1, spamRec = !1, spamSpeed = !1;
  419. const pressed = e => {
  420. const key = e.which ? e.which : e.keyCode;
  421. if($('textarea').is(':focus')) e.stopImmediatePropagation();
  422. if(typing() || keysChanging) return;
  423. if(key == settings.hotkeys[0].key){ // 7 feed
  424. let i = 1;
  425. let interval = setInterval(() => {
  426. press(getKey("keyMacroFeed"));
  427. if(++i > 7) clearInterval(interval);
  428. }, 85);
  429. e.preventDefault();
  430. }
  431. if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  432. linesplitting = true;
  433. linesplit();
  434. $("#linesplit-markers div").css('display', 'block');
  435. e.preventDefault();
  436. }
  437. if(key == settings.hotkeys[1].key && $('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  438. linesplitting = !linesplitting;
  439. if(linesplitting){
  440. $("#linesplit-markers div").css('display', 'block');
  441. linesplit();
  442. } else {
  443. $("#linesplit-markers div").css('display', 'none');
  444. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  445. }
  446. e.preventDefault();
  447. }
  448. if(key == settings.hotkeys[2].key){ // macro split bots
  449. splittingbots = true;
  450. const splittingBots = () => {
  451. if(!splittingbots) return;
  452. press(getKey("keySplitBots"));
  453. setTimeout(splittingBots, 50);
  454. }
  455. splittingBots();
  456. e.preventDefault();
  457. }
  458.  
  459. if(key == settings.hotkeys[3].key){ // hide ui
  460. hiddenUI = !hiddenUI;
  461. hiddenUI ? _replaceCSS('hideUI-css', '.hideUI{ display: none !important;}') : _replaceCSS('hideUI-css', ''); // replacing CSS bcs class is less likely to be overriden
  462. e.preventDefault();
  463. }
  464. if(key == settings.hotkeys[4].key){ // toggle cursor lock
  465. console.log('cursor lock pressed');
  466. toggleCursorLock();
  467. e.preventDefault();
  468. }
  469. if(key == getKey("keyFixedMouse")){ // real cursor lock key is pressed
  470. cursorLockActivated = false;
  471. unsafeWindow.onblur = _onblur;
  472. }
  473. if(e.key.toLowerCase() == settings.fastsplit_hotkeys[0].keyName.toLowerCase() && e.keyCode != 0){ // fast onesplit
  474. fastSplit(!0);
  475. }
  476. if(e.key.toLowerCase() == settings.fastsplit_hotkeys[1].keyName.toLowerCase() && e.keyCode != 0){ // fast doublesplit
  477. fastSplit(!1);
  478. }
  479. if(key == settings.slowFeed[0].key){ // toggle feed
  480. slowfeeding = !slowfeeding;
  481. const feeding = () => {
  482. if(!slowfeeding) return;
  483. press(getKey("keyMacroFeed"));
  484. setTimeout(feeding, settings.slowFeed[1].val);
  485. }
  486. feeding();
  487. e.preventDefault();
  488. }
  489. if(key == settings.quickSettings[0].key){ // quick settings 1
  490. let el = $('#' + settings.quickSettings[0].set);
  491. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  492. else el.unbind().click();
  493. e.preventDefault();
  494. }
  495. if(key == settings.quickSettings[1].key){ // quick settings 2
  496. let el = $('#' + settings.quickSettings[1].set);
  497. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  498. else el.unbind().click();
  499. e.preventDefault();
  500. }
  501. if(key == settings.quickSettings[2].key){ // quick settings 3
  502. let el = $('#' + settings.quickSettings[2].set);
  503. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  504. else el.unbind().click();
  505. e.preventDefault();
  506. }
  507. if(key == settings.quickSettings[3].key){ // quick settings 4
  508. let el = $('#' + settings.quickSettings[3].set);
  509. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  510. else el.unbind().click();
  511. e.preventDefault();
  512. }
  513. if($('#fsfb-recospeed').is(':checked') && key == getKey("keyRecombine")){
  514. spamRec = true;
  515. const spammingRec = () => {
  516. if(!spamRec) return;
  517. press(getKey("keyRecombine"));
  518. setTimeout(spammingRec, 10);
  519. }
  520. spammingRec();
  521. e.preventDefault();
  522. }
  523. if($('#fsfb-recospeed').is(':checked') && key == getKey("keySpeed")){
  524. spamSpeed = true;
  525. const spammingSpeed = () => {
  526. if(!spamSpeed) return;
  527. press(getKey("keySpeed"));
  528. setTimeout(spammingSpeed, 10);
  529. }
  530. spammingSpeed();
  531. e.preventDefault();
  532. }
  533. }
  534.  
  535. const released = key => {
  536. if(typing() || keysChanging) return;
  537. if(key == settings.hotkeys[2].key) splittingbots = false; // macro split bots
  538. if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  539. linesplitting = false;
  540. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  541. $("#linesplit-markers div").css('display', 'none');
  542. }
  543. if(key == getKey("keyRecombine")) spamRec = false;
  544. if(key == getKey("keySpeed")) spamSpeed = false;
  545. }
  546. let pwSpawnCheck = false;
  547. const changeSettings = (ID, a) => {
  548. for(let i of settings.uiScaling) if(i.id == ID) i.level = a;
  549. for(let i of settings.checkboxes) if(i.id == ID) i.active = a;
  550. for(let i of settings.export_import) if(i.id == ID) i.active = a;
  551. for(let i of settings.theme_boxes) if(i.id == ID) i.active = a;
  552. for(let i of settings.theme){
  553. if(i.id == ID) i.active = a
  554. if(i.id1 == ID) i.color = a;
  555. }
  556. customCells = $("#fsfb-sect-theme>label>input, #fsfb-portalmass, #fsfb-pwsoverlay, #fsfb-anticloak").is(":checked");
  557. if(ID == "fsfb-hideshouts") a ? $('#megaholder').addClass('hideMegaphone') : $('#megaholder').removeClass('hideMegaphone');
  558. if(ID == "fsfb-qBuy") a ? $('#fsfb-quickbuy').css('display', 'flex') : $('#fsfb-quickbuy').css('display', 'none');
  559. if(ID == "fsfb-bublecell" && !$("#cBubbleCells").is(":checked") && a) $('#cBubbleCells').unbind().click();
  560. if(ID == "fsfb-showmass" && !$("#cMass").is(":checked") && a) $('#cMass').unbind().click();
  561. if((ID == "fsfb-myskins" || ID == "fsfb-partyskins") && !$("#cSkins").is(":checked") && a) $('#cSkins').unbind().click();
  562. if((ID == "fsfb-mynick" || ID == "fsfb-partynicks") && !$("#cNames").is(":checked") && a) $('#cNames').unbind().click();
  563. if(ID == "fsfb-myskins" && a) $('#fsfb-partyskins').prop('checked', false).trigger('change');
  564. if(ID == "fsfb-partyskins" && a) $('#fsfb-myskins').prop('checked', false).trigger('change');
  565. if(ID == "fsfb-mynick" && a) $('#fsfb-partynicks').prop('checked', false).trigger('change');
  566. if(ID == "fsfb-partynicks" && a) $('#fsfb-mynick').prop('checked', false).trigger('change');
  567. if(ID == "fsfb-pwsoverlay"){
  568. if(!a && pwSpawnCheck) curserMsg('To hide powerup spawns, you need to respawn or switch servers.', 'red');
  569. pwSpawnCheck = true;
  570. }
  571. if(ID == "fsfb-pwsoverlay") svSwitch = true;
  572. let zoomLvl = "100%";
  573. switch(+a) {
  574. case 1:
  575. zoomLvl = "50%";
  576. break;
  577. case 2:
  578. zoomLvl = "70%";
  579. break;
  580. case 3:
  581. zoomLvl = "80%";
  582. break;
  583. case 4:
  584. zoomLvl = "90%";
  585. break;
  586. case 5:
  587. zoomLvl = "100%";
  588. break;
  589. case 6:
  590. zoomLvl = "110%";
  591. break;
  592. case 7:
  593. zoomLvl = "125%";
  594. break;
  595. case 8:
  596. zoomLvl = "150%";
  597. break;
  598. case 9:
  599. zoomLvl = "200%";
  600. break;
  601. default:
  602. zoomLvl = "100%";
  603. }
  604. if(ID == "fsfb-invSize") $('#inventory').css('zoom', zoomLvl);
  605. if(ID == "fsfb-statsSize") $('#stats-container').css('zoom', zoomLvl);
  606. saveSettings();
  607. }
  608. // add slowfeed HTML
  609. $('#fsfb-sect-slowfeed').append(`<p class="hotkey-paragraph">Slow-Feed</p>`);
  610. $('#fsfb-sect-slowfeed').append(`<br><p>${slowfeedhotkey.title}</p><div id="${slowfeedhotkey.id}" class="fsfb-hotkey"></div>`);
  611. $('#fsfb-sect-slowfeed').append(`<br><p>${settings.slowFeed[1].title}</p><input id="${settings.slowFeed[1].id}" class="fsfb-hotkey" onkeypress="return onlyNumberKey(event)" maxlength="3"></input>`);
  612.  
  613. $('#' + slowfeedhotkey.id).on('contextmenu', e => {
  614. $('#' + slowfeedhotkey.id).text('');
  615. slowfeedhotkey.key = 0;
  616. saveSettings();
  617. e.preventDefault();
  618. });
  619.  
  620. document.getElementById(settings.slowFeed[1].id).addEventListener("keypress", function(e){
  621. setTimeout(() => { // goes too fast or smth
  622. settings.slowFeed[1].val = +$('#' + settings.slowFeed[1].id).val();
  623. if($('#' + settings.slowFeed[1].id).val() == "") settings.slowFeed[1].val = 0;
  624. saveSettings();
  625. }, 5);
  626. });
  627.  
  628. // add quick settings HTML
  629. $('#fsfb-sect-quickSettings').append(`<p class="hotkey-paragraph">Quick Settings</p>`);
  630.  
  631. for(let i of settings.quickSettings){
  632. $('#fsfb-sect-quickSettings').append(`<select id="${i.id1}" class="fsfb-quickchange"><option value="cDark">Dark Theme</option><option value="cFancyGrid">Fancy Grid</option><option value="cSectionGrid">Section Grid</option><option value="cGrid">Gridlines</option><option value="cSkins">Skins</option><option value="cWearables">Wearables</option><option value="cNames">Show Names</option><option value="cMinionNames">Minion Names</option><option value="cLargeNames">Large Names</option><option value="cNameOutlines">Name Outline</option><option value="cMass">Show Mass</option><option value="cFood">Show Food</option><option value="cCellAnimations">Cell Anim</option><option value="cSkinAnimations">Skin Anim</option><option value="cMapBorder">Map Border</option><option value="cCustomBack">Custom BG</option><option value="aCustomBack">Sounds</option><option value="cZoom">Infinite Zoom</option><option value="cFixedZoom">Fixed Zoom</option><option value="cSlowMotion">Slow-Motion</option><option value="cMinionUi">Minion Panel</option><option value="cLeaderboard">Leaderboard</option><option value="cChat">Chat</option><option value="cMinimap">Minimap</option><option value="cFPS">FPS/Ping</option><option value="cColors">Cell Colors</option><option value="cCellBorders">Cell Borders</option><option value="cCellSpikes">Cell Spikes</option><option value="cClassicViruses">Classic Virus</option><option value="cPolygonShapes">Polygon Cells</option><option value="cLineShapes">Line Cells</option><option value="cBubbleCells">Bubble Cells</option><option value="cVisibilityStatus">Prof Visiblity</option><option value="cAllowPartyInvite">Party Inv</option><option value="cAllowPartyAnimations">Party Anim</option><option value="cIconDRank">Dono Icon</option><option value="cGoldCrownChat">Gold Icon</option></select><div id="${i.id}" class="fsfb-hotkey"></div>`); $('#' + i.id).on('contextmenu', e =>{
  633. $('#' + i.id).text('');
  634. i.key = 0;
  635. saveSettings();
  636. e.preventDefault();
  637. });
  638. };
  639.  
  640. $('.fsfb-quickchange').on("change", function(){
  641. settings.quickSettings[+this.id.replace('fsfb-quick-select', '') - 1].set = this.value;
  642. saveSettings();
  643. });
  644.  
  645. // add UI scaling
  646. $('#fsfb-sect-uiScale').append(`<p class="hotkey-paragraph">UI Scaling</p>`);
  647. for(let i of settings.uiScaling){
  648. $('#fsfb-sect-uiScale').append(`<div class="fsfb-slider"><p>${i.title}</p><input id="${i.id}" class="fsfb-slider" type="range" min="1" max="9" value="5"></input></div>`);
  649. $( "#" + i.id).change(function() {
  650. changeSettings(this.id, $(this).val());
  651. });
  652. };
  653.  
  654. // add event listeners
  655. let mosX, mosY,
  656. keys = {},
  657. keysChanging = false;
  658.  
  659. $(document).on('click', e => {
  660. for(let i = 0; i < settings.hotkeys.length; i++) checkHotkeyClicked(e, settings.hotkeys[i]);
  661. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkHotkeyClicked(e, settings.fastsplit_hotkeys[i]);
  662. for(let i = 0; i < settings.quickSettings.length; i++) checkHotkeyClicked(e, settings.quickSettings[i]);
  663. checkHotkeyClicked(e, settings.slowFeed[0]);
  664. checkPowerupClicked(e);
  665. })
  666. .on('mousemove', e => {
  667. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  668. ({clientX: mosX, clientY: mosY} = e);
  669. if (linesplitting) linesplit();
  670. })
  671.  
  672. .on("keydown", e => {
  673. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  674. for(let i = 0; i < settings.hotkeys.length; i++) checkNewHotkey(e, settings.hotkeys[i]);
  675. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkFsHotkey(e, settings.fastsplit_hotkeys[i]);
  676. for(let i = 0; i < settings.quickSettings.length; i++) checkNewHotkey(e, settings.quickSettings[i]);
  677. checkNewHotkey(e, settings.slowFeed[0]);
  678. if (!(e.keyCode in keys)){
  679. keys[e.keyCode] = !0;
  680. pressed(e);
  681. }
  682. keysChanging = false;
  683. })
  684. .on("keyup", e => {
  685. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  686. delete keys[e.keyCode];
  687. released(e.keyCode);
  688. });
  689.  
  690. $('#fsfb-export-btn').on('click', () => {
  691. let script_settings = {},
  692. script_themes = {};
  693. for (let i in settings) { // put the settings & themes into different objects
  694. if (i == "theme" || i == "theme_boxes") script_themes[i] = settings[i];
  695. else if(i == "export_import") {}
  696. else script_settings[i] = settings[i];
  697. }
  698. let obj = {
  699. selected: {
  700. game_settings: $('#fsfb-game-settings').is(':checked'),
  701. game_controls: $('#fsfb-game-controls').is(':checked'),
  702. script_settings: $('#fsfb-script-settings').is(':checked'),
  703. script_theme: $('#fsfb-theme-settings').is(':checked')
  704. },
  705. game_settings: localStorage.settings,
  706. game_controls: localStorage.hotkeys,
  707. script_settings: script_settings,
  708. script_theme: script_themes
  709. }
  710. // if the setting is turned off, then dont need to export it - set it to null
  711. if(!obj.selected.game_settings) obj.game_settings = null;
  712. if(!obj.selected.game_controls) obj.game_controls = null;
  713. if(!obj.selected.script_settings) obj.script_settings = null;
  714. if(!obj.selected.script_theme) obj.script_theme = null;
  715.  
  716. const a = document.createElement('a'),
  717. file = new Blob([JSON.stringify(obj)], {type: "text/plain"});
  718. a.href = URL.createObjectURL(file), a.download = "fishy & firebone script settings", a.click(), URL.revokeObjectURL(a.href); // download a txt file of exported settings
  719. });
  720.  
  721. $('#fsfb-import-btn').on('click', () => {
  722. swal({
  723. title: "Import Settings",
  724. text: "Add your exported settings below and press OK to continue.",
  725. type: "input",
  726. showCancelButton: true,
  727. closeOnConfirm: false,
  728. animation: "slide-from-top",
  729. inputPlaceholder: "Paste exported settings here"
  730. },
  731. function(inputVal){
  732. if (inputVal == null) return false;
  733. if (inputVal == "") {
  734. swal.showInputError("Please don't leave the input empty!");
  735. return false
  736. }
  737. try {
  738. let val = JSON.parse(inputVal);
  739. if(val.selected.script_settings && $('#fsfb-script-settings').is(':checked')){
  740. for (let i in val.script_settings) {
  741. for (let j in val.script_settings[i]) {
  742. for(let x in settings){
  743. for(let y in settings[x]){
  744. if(val.script_settings[i][j].id == settings[x][y].id) settings[x][y] = val.script_settings[i][j];
  745. }
  746. }
  747. }
  748. }
  749. }
  750. if(val.selected.script_theme && $('#fsfb-theme-settings').is(':checked')){
  751. for (let i in val.script_theme) {
  752. for (let j in val.script_theme[i]) {
  753. for(let x in settings){
  754. for(let y in settings[x]){
  755. if(val.script_theme[i][j].id == settings[x][y].id) settings[x][y] = val.script_theme[i][j];
  756. }
  757. }
  758. }
  759. }
  760. }
  761. if(val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) localStorage.setItem('settings', val.game_settings);
  762. if(val.selected.game_controls && $('#fsfb-game-controls').is(':checked')) localStorage.setItem('hotkeys', val.game_controls);
  763. // if any agma controls were imported, need to refresh bc it's set using localstorage
  764. if((val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) || (val.selected.game_controls && $('#fsfb-game-controls').is(':checked'))){
  765. swal({
  766. title: "Please Refresh!",
  767. text: "Refreshing the page is required for your imported agma settings to take effect",
  768. type: "warning",
  769. });
  770. } else swal({ title: "Settings Successfully Imported!", type: "success" });
  771. saveSettings();
  772. updateScriptSettingsUI();
  773.  
  774. } catch (error){
  775. swal({
  776. title: "Something went wrong!",
  777. text: "Please make sure you've entered in valid settings",
  778. type: "error"
  779. });
  780. }
  781. });
  782.  
  783. });
  784.  
  785. $('#fsfb-settings-right').append(`<div class="fa fa-2x fa-info-circle" id="fsfb-extra-info" data-toggle="modal" data-target=".fsfb-bug-modal"></div>`)
  786. // PUT MODAL HERE
  787.  
  788.  
  789. localStorage.ad_l_time = "9e99"; // smth like time since last ad
  790. $('[id^="agma-io_"], [id^="adWrapper"], #preroll').addClass("fuckAds"); // move ads way off the screen
  791.  
  792. let width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight;
  793. $(unsafeWindow).on('resize', function(){
  794. width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight;
  795. });
  796.  
  797. let pointMove;
  798. const linesplit = () => {
  799. if(!linesplitting) return;
  800. let closest, points = [{n: "#linesplit-top", x: width / 2, y: 0, nx: width / 2, ny: -10e6}, {n: "#linesplit-bottom", x: width / 2, y: height, nx: width / 2, ny: 10e6}, {n: "#linesplit-left", x: 0, y: height / 2, nx: -10e6, ny: height / 2}, {n: "#linesplit-right", x: width, y: height / 2, nx: 10e6, ny: height / 2}];
  801. if(linesplitClosestSide){
  802. let closestSide = [mosY / height, (height - mosY) / height, mosX / width, (width - mosX) / width]; // top, bottom, left, right
  803. closest = points[closestSide.indexOf(Math.min(...closestSide))];
  804. } else {
  805. let distance = p => Math.sqrt(Math.pow(mosX - p.x, 2) + Math.pow(mosY - p.y, 2)),
  806. closestPoint = points.reduce((a, b) => distance(a) < distance(b) ? a : b);
  807. for (let i = 0; i < points.length; i++) {
  808. if (closestPoint.x == points[i].x && closestPoint.y == points[i].y) closest = points[i]
  809. }
  810. }
  811. pointMove = {x: closest.nx, y: closest.ny};
  812. $('canvas').trigger($.Event('mousemove', { clientX: closest.nx, clientY: closest.ny }));
  813. $("#linesplit-markers div").css('background-color', 'transparent');
  814. $(closest.n).css('background-color', '#e25615');
  815. }
  816.  
  817. let confBtns = document.getElementsByClassName('purchase-btn confirmation');
  818. const btnsArr = Array.from(document.getElementsByClassName('purchase-btn confirmation'));
  819.  
  820. const changeHTML = (index, price, id, name) => {
  821. setTimeout(() => {
  822. const amtDropdown = document.getElementById('shopAmountDropdown')
  823. document.getElementsByClassName('sweet-alert showSweetAlert')[0].childNodes[7].firstChild.textContent = 'If you click "Buy", you will purchase this item. It will cost ' + price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' in total.';
  824. const dropdownChange = () => {
  825. if (amtDropdown.value == "custom") return buyCstmAmt(price, id, name);
  826. let priceSum = (amtDropdown.value * price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  827. document.getElementsByClassName('sweet-alert showSweetAlert')[0].childNodes[7].firstChild.textContent = 'If you click "Buy", you will purchase this item. It will cost ' + priceSum + ' in total.';
  828. };
  829. try { // try to remove old event listener before adding new one so they don't stack (no idea if this does anything bcs the event listener might be deleted anyway)
  830. amtDropdown.removeEventListener('change', dropdownChange);
  831. amtDropdown.addEventListener('change', dropdownChange);
  832. }
  833. catch (error){
  834. amtDropdown.addEventListener('change', dropdownChange);
  835. };
  836. }, 30);
  837. };
  838. const buyCstmAmt = (price, id, name) => {
  839. swal({
  840. title: "Enter Purchase Amount",
  841. text: "<span>How many <b>" + name + "</b> would you like to buy?</span>",
  842. html: true,
  843. type: "input",
  844. showCancelButton: true,
  845. closeOnConfirm: false,
  846. inputPlaceholder: "Input amount here"
  847. },
  848. function(input){
  849. let pwAmt = +input,
  850. priceTotal = pwAmt * price;
  851. if (input == null) return false;
  852. if (input == "") {
  853. swal.showInputError("Please don't leave the input empty!");
  854. return false
  855. }
  856. if(!/^[0-9]+$/.test(input) || !(+input >>> 0 === parseFloat(+input))){
  857. swal.showInputError("Please only enter positive integers!");
  858. return false
  859. }
  860. swal({
  861. title: 'Confirm',
  862. text: '<p>If you click "Buy", you will purchase this item. It will cost ' + priceTotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' in total.<br><small>You chose to purchase ' + pwAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' <b>' + name + '</b></small></p>',
  863. html: true,
  864. type: 'warning',
  865. showCancelButton: true,
  866. closeOnConfirm: false,
  867. confirmButtonColor: '#4CAF50',
  868. confirmButtonText: 'Yes, confirm purchase',
  869. cancelButtonText: 'No, cancel purchase'
  870. }, function(confirmed){
  871. if(confirmed) buyPw(id, pwAmt);
  872. })
  873.  
  874. });
  875. };
  876. // buy a certain amount of powers including > 255
  877. const buyPw = (shopID, pwAmt) => {
  878. if (pwAmt < 1) return;
  879. if (pwAmt > 255) {
  880. for (let i = 0; i < ~~(pwAmt / 255); i++) setTimeout(() => purchaseItem(shopID, 255), 250 * i + 250);
  881. purchaseItem(shopID, pwAmt % 255);
  882. } else purchaseItem(shopID, pwAmt);
  883. };
  884.  
  885.  
  886. if(improvedShop){
  887. // add event listeners to dropdown buttons
  888. for (let i = 0; i < confBtns.length; i++) {
  889. confBtns[i].onclick = function () {
  890. setTimeout(() => {
  891. if (document.getElementById('shopAmountDropdown') != null) document.getElementById('shopAmountDropdown').innerHTML += '<option value="20">20</option> <option value="50">50</option> <option value="100">100</option> <option value="250">250</option> <option value="custom">Pick</option>';
  892. }, 5);
  893. }
  894. }
  895. // add event listeners to shop buttons
  896. for (let i = 0; i < 16; i++) {
  897. if (i != 10 && i != 11){
  898. btnsArr[i].addEventListener('click', () => {
  899. let index = i;
  900. changeHTML(index, btnsArr[index].getAttribute('price'), btnsArr[index].getAttribute('item'), $('.purchase-btn.confirmation[item="' + btnsArr[index].getAttribute('item') + '"]').prev().find('h3').eq(0).text());
  901. });
  902. }
  903. }
  904. }
  905.  
  906.  
  907. // add extra bot packs
  908. const newBots = [
  909. {title: "100 Bots", time: "24 HOURS", price: "700,000", id: 9},
  910. {title: "125 Bots", time: "48 HOURS", price: "900,000", id: 10},
  911. {title: "300 Bots", time: "24 HOURS", price: "900,000", id: 7},
  912. {title: "100 MASS Bots", time: "1 HOURS", price: "800,000", id: 8},
  913. {title: "300 Bots", time: "72 HOURS", price: "2,000,000", id: 11},
  914. {title: "100 MASS Bots", time: "24 HOURS", price: "2,600,000", id: 12}
  915. ]
  916.  
  917. const minul = document.getElementsByClassName('tab-container-section minion scroll')[0].children[0].children[0]
  918. $('.confirm-minion[item=7], .confirm-minion[item=8]').parent().hide();
  919. document.getElementById('extraTab').childNodes[0].setAttribute('onclick', '');
  920.  
  921. function createEl(i) {
  922. const botEl = document.createElement('li');
  923. botEl.setAttribute('class', 'masterTooltip extra-min');
  924. botEl.setAttribute('title', 'Spawns bots/minions which suicide into your playercell to make you big in no time! Minions follow your mouse and split upon your command! Minions start immediately after you buy them.');
  925. minul.appendChild(botEl);
  926. botEl.innerHTML = `
  927. <div class="title_prch">
  928. <img src="img/store/minions/minions_tab.png" width="70px" height="60px">
  929. <div class="minionDescription">
  930. <h4 style="font-size: 18px;">` + i.title + `</h4>
  931. <h3 style="margin-top:10px;color:white;"> ` + i.time + `</h3>
  932. </div> <span class="win-price">` + i.price + `</span>
  933. </div>
  934. <a href="#" price="` + i.price + `" item="` + i.id + `" class="purchase-btn2 confirm-minion extra-min">Buy</a>
  935. `;
  936. }
  937. if(extraBotPacks){
  938. for(let i of newBots) createEl(i);
  939. }
  940.  
  941. function warnBeforeMinion(linkURL, priceK,itemId) {
  942. swal({
  943. title: "Confirm",
  944. text: 'If you click "Buy", you will purchase these minions. They cost ' + priceK,
  945. type: "warning",
  946. showCancelButton: true,
  947. confirmButtonColor: "#4CAF50",
  948. confirmButtonText: "Yes, confirm purchase",
  949. cancelButtonText: "No, cancel purchase"
  950. }, function() {
  951. purchaseMinion(itemId);
  952. });
  953. }
  954.  
  955.  
  956. // context menu: click on skin -> skin ID to clipboard, click on name -> name to clipboard
  957. $('#contextPlayer').on('click', e => {
  958. if(!rightClickCopyInfo) return;
  959. if($('#contextPlayerSkin').width() + $('#contextPlayerSkin').offset().left + 5 > e.pageX){ // bcs #contextMenu event :dog:
  960. // cell was clicked
  961. if($('#contextPlayerSkin').css('background-image') != "none"){
  962. let skinID = $('#contextPlayerSkin').css('background-image').match(/\/skins\/[0-9]+/g)[0].substring(7); // get the skin image, then match only the skin's ID
  963. navigator.clipboard.writeText(skinID).then(function() {
  964. curserMsg('Skin ID of ' + skinID + ' was copied to your clipboard.', 'green');
  965. }, function() {
  966. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  967. });
  968. } else if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  969. else curserMsg('No skin equipped. Nothing was added to your clipboard.', 'red');
  970. } else { // name was clicked
  971. if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  972. else {
  973. navigator.clipboard.writeText($('#contextPlayerName').text()).then(function() {
  974. curserMsg('Nickname: "' + $('#contextPlayerName').text() + '" was copied to your clipboard', 'green');
  975. }, function() {
  976. curserMsg("Something went wrong. Nothing was added to your clipboard.", "red");
  977. });
  978. }
  979. }
  980. });
  981.  
  982.  
  983. // little bar at the top of the screen that tells u stuff
  984. const curserMsg = (msg, color) => {
  985. if(color == "green") color = "rgb(0, 192, 0)";
  986. if(color == "red") color = "rgb(255, 0, 0)";
  987. if(color == "gray") color = "rgb(153, 153, 153)";
  988. $('#curser').text(msg).show().css('color', color)
  989. setTimeout(() => $('#curser').fadeOut(400), 4e3);
  990. }
  991.  
  992.  
  993. // ability time remaining
  994. let acc_abil = get("fsfb-abil", {});
  995. let lastClickedPrice, currentPrice, lastID;
  996.  
  997. const confirmClicked = () => {
  998. setTimeout(() => {
  999. if($('.sweet-alert.showSweetAlert.visible h2').text() != "Success!" || lastClickedPrice != currentPrice) return;
  1000. acc_abil[currentUser] = {...acc_abil[currentUser], ...{[lastID] : Date.now()}};
  1001. set("fsfb-abil", acc_abil);
  1002. }, 950);
  1003. };
  1004.  
  1005. [18, 20, 22, 23].forEach(el => {
  1006. if(!showRemainingAbilityTime) return;
  1007. let h5 = $(`.purchase-btn.confirmation[item="${el}"]`).parents().eq(0).find('div h5');
  1008. h5.clone().insertAfter(h5).addClass('fsfb-fake').hide();
  1009. $(`.purchase-btn[item="${el}"]`).on('click', function () {
  1010. lastClickedPrice = this.getAttribute('price');
  1011. lastID = this.getAttribute('item');
  1012. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  1013. setTimeout(() => {
  1014. $('.confirm').removeAttr('disabled');
  1015. currentPrice = $('.sweet-alert.showSweetAlert.visible p').eq(0).text().replaceAll(/\D+/g, '');
  1016. }, 750);
  1017. setTimeout(() => $('.confirm')[0].addEventListener('click', confirmClicked), 500);
  1018. })
  1019. });
  1020.  
  1021.  
  1022. // sort wearables by owned
  1023. const waitUntil = condition => new Promise(resolve => {
  1024. let interval = setInterval(() => {
  1025. condition() && (clearInterval(interval), resolve());
  1026. }, 100);
  1027. });
  1028. if(sortWearablesByOwned){
  1029. $('#wearablesTab').on('click', async()=> {
  1030. await waitUntil(() => $('#phpWearables li').length > 55);
  1031. for(let i = 0; i < 2; i++){
  1032. $('[id^="wearableUseBtn"]').each(function(){
  1033. $($(this).parents().get(2)).insertBefore($("#phpWearables li:eq(0)"));
  1034. })
  1035. }
  1036. });
  1037. }
  1038. // https://stackoverflow.com/questions/2424191/how-do-i-make-an-element-draggable-in-jquery
  1039. $.fn.draggable = function(){
  1040. var $this = this,
  1041. ns = 'draggable_'+(Math.random()+'').replace('.',''),
  1042. mm = 'mousemove.'+ns,
  1043. mu = 'mouseup.'+ns,
  1044. $w = $(window),
  1045. isFixed = ($this.css('position') === 'fixed'),
  1046. adjX = 0, adjY = 0;
  1047.  
  1048. $this.mousedown(function(ev){
  1049. var pos = $this.offset();
  1050. if (isFixed) {
  1051. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  1052. }
  1053. var ox = (ev.pageX - pos.left), oy = (ev.pageY - pos.top);
  1054. $this.data(ns,{ x : ox, y: oy });
  1055. $w.on(mm, function(ev){
  1056. ev.preventDefault();
  1057. ev.stopPropagation();
  1058. if (isFixed) {
  1059. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  1060. }
  1061. var offset = $this.data(ns);
  1062. $this.css({left: ev.pageX - adjX - offset.x, top: ev.pageY - adjY - offset.y});
  1063. });
  1064. $w.on(mu, function(){
  1065. $w.off(mm + ' ' + mu).removeData(ns);
  1066. });
  1067. });
  1068. return this;
  1069. };
  1070.  
  1071.  
  1072. /* xp/coins statistics */
  1073.  
  1074. const updateTimeXP = 12e3; // xp bar updates every 12 seconds, don't change
  1075. let lastMinXP = [];
  1076. let lastHrXP = [];
  1077. let currentPercent, currentLevel, currentXP, currentCoins;
  1078.  
  1079. unsafeWindow.logStatsScriptXP = !1;
  1080. unsafeWindow.logStatsScriptCoins = !1;
  1081. let scriptStartCoins = Date.now();
  1082. let scriptStartXP = Date.now();
  1083. let accounts = {};
  1084. const guiDisplay = "none";
  1085. let coinsHTMLactive = false;
  1086.  
  1087. const updateTimeCoins = 6e3;
  1088. let lastMinCoins = [];
  1089. let lastHrCoins = [];
  1090.  
  1091. // add stats box html
  1092.  
  1093. const statsBody = document.createElement('div');
  1094. statsBody.setAttribute('id', 'stats-container');
  1095. statsBody.style.display = guiDisplay;
  1096. statsBody.innerHTML = `<div id="stats-main"><div id="stats-title"><title id="stats-extra-info">XP Stats - Updating Every 12s</title><div title="Reset Stats" class="fa fa-refresh" id="stats-reset-btn"></div></div><div><div><section id="stats-info"><div><p class="stats-label">Lvl Completed:</p><span>0/0</span></div><div><p class="stats-label">Remaining:</p><span>0</span></div><div><p class="stats-label">Projected (hr):</p><span>0</span></div><div><p class="stats-label">Last Hour:</p><span>0</span><span class="stats-completed">(0/60)</span></div><div><p class="stats-label">Last Minute:</p><span>0</span><span class="stats-completed">(0/5)</span></div><div><p class="stats-label">Last 12s:</p><span>0</span></div><div><p class="stats-label">Minute Mean:</p><span>0</span></div><div><p class="stats-label">Minute Median:</p><span>0</span></div><div><p class="stats-label">Minute Sd:</p><span>0</span></div><div style="display:none"><p class="stats-label">Latest Outliers:</p><span style="display:none">0, 200, 500</span></div><div><p class="stats-label">Session XP:</p><span>0</span></div><div><p class="stats-label">Session Length:</p><span>00:00:00</span></div><div><p class="stats-label" id="stats-sesh-length">Lifetime XP:</p><span>0</span></div><p style="font-size:0" id="last-updated">0</p></section></div></div>`;
  1097. document.querySelector('body').append(statsBody)
  1098.  
  1099. $("#stats-container").draggable();
  1100. let statsboxPos = get("fsfb-statsPos", {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left});
  1101. if(saveStatsBoxPosition && statsboxPos) $("#stats-container").css({'top' : statsboxPos.top, 'left' : statsboxPos.left});
  1102.  
  1103. $('#stats-reset-btn').on('click', () => {
  1104. if(coinsHTMLactive){
  1105. lastMinCoins = [];
  1106. lastHrCoins = [];
  1107. for(let i in accounts) accounts[i].coins = 0;
  1108. if(accounts[currentUser] !== null && currentUser !== 'Please Login First') accounts[currentUser].coins = currentCoins;
  1109. scriptStartCoins = Date.now();
  1110. } else {
  1111. lastMinXP = [];
  1112. lastHrXP = [];
  1113. for(let i in accounts) accounts[i].xp = 0;
  1114. if(accounts[currentUser] !== null && currentUser !== 'Please Login First') accounts[currentUser].xp = currentXP;
  1115. scriptStartXP = Date.now();
  1116. }
  1117. updateUI();
  1118. });
  1119.  
  1120. class record {
  1121. constructor(val, user, arr) {
  1122. // this.type = this.findWhich(arr); // mostly for debugging
  1123. this.id = this.getID(arr);
  1124. this.user = user;
  1125. this.amount = val;
  1126. this.gained = this.calcGain(val, arr, this.id);
  1127. // this.timestamp = Date.now(); // mostly for debugging
  1128. }
  1129. findWhich(arr) {
  1130. return ((arr == lastMinXP || arr == lastHrXP ? "xp " : "coins " ) + (arr == lastHrXP || arr == lastHrCoins ? "hour" : "minute"));
  1131. }
  1132. calcGain(val, arr, id){
  1133. const prevObj = arr[arr.length - 1];
  1134. if(prevObj && arr == lastHrXP && id == 1) return round(sigma(getProperty(lastMinXP, "gained")), 3);
  1135. if(prevObj && arr == lastHrCoins && id == 1) return round(sigma(getProperty(lastMinCoins, "gained")), 3);
  1136. return prevObj && val - prevObj.amount >= 0 && prevObj.user == this.user && prevObj.amount != 0 ? round(val - prevObj.amount, 3) : 0;
  1137. }
  1138. getID(arr) {
  1139. return arr[arr.length - 1] ? arr[arr.length - 1].id + 1 : 1;
  1140. }
  1141.  
  1142. }
  1143.  
  1144. const xpInfo = () => {
  1145. currentPercent = $('.progress-bar[role=progressbar]')[0].style.width.slice(0, -1) / 100;
  1146. currentLevel = +$('#level.user-level')[0].textContent;
  1147. currentXP = (levelSum(currentLevel) + currentLevel * currentPercent) * 1e3;
  1148. }
  1149. const coinsInfo = () => {
  1150. currentCoins = +($('#coinsDash')[0].textContent.replaceAll(' ', ''));
  1151. }
  1152.  
  1153. const updateUI = () => {
  1154. if(!coinsHTMLactive){
  1155. const xpHr = lastHrXP.length,
  1156. xpMin = lastMinXP.length,
  1157. lvlCompleted = currentPercent ? String(Math.round(currentPercent * currentLevel * 1e3, 1)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "/" + (currentLevel * 1e3).toLocaleString('en-US') : "0/0",
  1158. xpRemaining = currentLevel ? Math.round(currentLevel * 1e3 - currentPercent * currentLevel * 1e3) : 0,
  1159. projectedHr = xpHr > 0 ? Math.round(sigma(getProperty(lastHrXP.slice(-5), "gained")) * 12) : 0,
  1160. lastHr = xpHr > 0 ? Math.round(sigma(getProperty(lastHrXP, "gained"))) : 0,
  1161. lastHrCompleted = xpHr > 0 ? xpHr : 0,
  1162. lastMin = xpMin > 0 ? Math.round(sigma(getProperty(lastMinXP, "gained"))) : 0,
  1163. lastMinCompleted = xpMin > 0 ? xpMin : 0,
  1164. lastMinTotal = 6e4 / updateTimeXP,
  1165. last12sec = xpMin > 0 ? Math.round(lastMinXP[lastMinXP.length - 1].gained) : 0,
  1166. xBar = xpHr > 0 ? Math.round(mean(getProperty(lastHrXP, "gained"))) : 0,
  1167. xTilde = xpHr > 0 ? Math.round(median(getProperty(lastHrXP, "gained"))) : 0,
  1168. standardDev = xpHr > 0 ? Math.round(standardDeviation(getProperty(lastHrXP, "gained"))) : 0,
  1169. outliers = xpHr > 0 ? checkOutliers(getProperty(lastHrXP, "gained")) : 0,
  1170. sessionXP = currentXP && accounts[currentUser] ? Math.round(currentXP - accounts[currentUser].xp): 0,
  1171. sessionLength = msToTime(Date.now() - scriptStartCoins),
  1172. lifetimeXP = currentXP ? Math.round(currentXP) : 0,
  1173. updateTime = updateTimeXP;
  1174. document.getElementById('stats-info').innerHTML = `<div><p class="stats-label">Lvl Completed:</p><span>${lvlCompleted.toLocaleString('en-US')}</span></div><div><p class="stats-label">Remaining:</p><span>${xpRemaining.toLocaleString('en-US')}</span></div><div><p class="stats-label">Projected (hr):</p><span>${projectedHr.toLocaleString('en-US')}</span></div><div><p class="stats-label">Last Hour:</p><span>${lastHr.toLocaleString('en-US')}</span><span class="stats-completed">(${lastHrCompleted}/60)</span></div><div><p class="stats-label">Last Minute:</p><span>${lastMin.toLocaleString('en-US')}</span><span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></div><div><p class="stats-label">Last 12s:</p><span>${last12sec.toLocaleString('en-US')}</span></div><div><p class="stats-label">Minute Mean:</p><span>${xBar.toLocaleString('en-US')}</span></div><div><p class="stats-label">Minute Median:</p><span>${xTilde.toLocaleString('en-US')}</span></div><div><p class="stats-label">Minute Sd:</p><span>${standardDev.toLocaleString('en-US')}</span></div><div><p class="stats-label" style="display:none">Latest Outliers:</p><span style="display:none">${outliers}</span></div><div><p class="stats-label">Session XP:</p><span>${sessionXP.toLocaleString('en-US')}</span></div><div><p class="stats-label">Session Length:</p><span id="stats-sesh-length">${sessionLength}</span></div><div><p class="stats-label">Lifetime XP:</p><span>${lifetimeXP.toLocaleString('en-US')}</span></div>`;
  1175. $('#stats-extra-info').text(`XP Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#00bbff');
  1176. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartXP));
  1177. } else {
  1178. const coinsHr = lastHrCoins.length,
  1179. coinsMin = lastMinCoins.length,
  1180. coinGoalCompleted = currentCoins ? currentCoins.toLocaleString('en-US') + "/" + Math.ceil(currentCoins / 25e4).toLocaleString('en-US') * 25e4 : 0,
  1181. coinsRemaining = currentCoins ? 25e4 - currentCoins % 25e4 : 0,
  1182. projectedHr = coinsHr > 5 ? Math.round(sigma(getProperty(lastHrCoins.slice(-5), "gained")) * 12) : 0,
  1183. lastHr = coinsHr > 0 ? Math.round(sigma(getProperty(lastHrCoins, "gained"))) : 0,
  1184. lastHrCompleted = coinsHr > 0 ? coinsHr : 0,
  1185. lastMin = coinsMin > 0 ? Math.round(sigma(getProperty(lastMinCoins, "gained"))) : 0,
  1186. lastMinCompleted = coinsMin > 0 ? coinsMin : 0,
  1187. lastMinTotal = 6e4 / updateTimeCoins,
  1188. last12sec = coinsMin > 0 ? getProperty(lastHrCoins.slice(-5), "amount")[0] : 0,
  1189. xBar = coinsHr > 0 ? Math.round(mean(getProperty(lastHrCoins, "gained"))) : 0,
  1190. xTilde = coinsHr > 0 ? Math.round(median(getProperty(lastHrCoins, "gained"))) : 0,
  1191. standardDev = coinsHr > 0 ? Math.round(standardDeviation(getProperty(lastHrCoins, "gained"))) : 0,
  1192. outliers = coinsHr > 0 ? checkOutliers(getProperty(lastHrCoins, "gained")) : 0,
  1193. sessionXP = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0,
  1194. sessionLength = msToTime(Date.now() - scriptStartXP),
  1195. updateTime = updateTimeCoins;
  1196. document.getElementById('stats-info').innerHTML = `<div style="display:none"><p class="stats-label">Coins Completed:</p><span>${coinGoalCompleted}</span></div><div><p class="stats-label">Remaining:</p><span>${coinsRemaining.toLocaleString('en-US')}</span></div><div><p class="stats-label">Projected (hr):</p><span>${projectedHr.toLocaleString('en-US')}</span></div><div><p class="stats-label">Last Hour:</p><span>${lastHr.toLocaleString('en-US')}</span><span class="stats-completed">(${lastHrCompleted}/60)</span></div><div><p class="stats-label">Last Minute:</p><span>${lastMin.toLocaleString('en-US')}</span><span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></div><div style="display:none"><p class="stats-label">Last 12s:</p><span></span></div><div><p class="stats-label">Minute Mean:</p><span>${xBar.toLocaleString('en-US')}</span></div><div><p class="stats-label">Minute Median:</p><span>${xTilde.toLocaleString('en-US')}</span></div><div><p class="stats-label">Minute Sd:</p><span>${standardDev.toLocaleString('en-US')}</span></div><div><p class="stats-label" style="display:none">Latest Outliers:</p><span style="display:none">${outliers}</span></div><div><p class="stats-label">Session Coins:</p><span>${sessionXP.toLocaleString('en-US')}</span></div><div><p class="stats-label">Session Length:</p><span id="stats-sesh-length">${sessionLength}</span></div>`;
  1197. $('#stats-extra-info').text(`Coin Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#ffc800');
  1198. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartCoins));
  1199. }
  1200. }
  1201.  
  1202. $('.progress-bar').eq(1).parent()[0].style.cursor = "pointer";
  1203.  
  1204. if(coinXPstats){
  1205. $('.progress-bar').eq(1).parent().on("click", () => {
  1206. const statsCont = $('#stats-container');
  1207. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  1208. else if(!coinsHTMLactive) statsCont.fadeOut(400);
  1209. coinsHTMLactive = false;
  1210. updateUI();
  1211. }), [$(".dash-coin.dcTopBar").eq(0), $("#coinsTopLeft"), $(".progress-bar-coins").eq(1)].forEach(el => {
  1212. el.on('click', (e) => {
  1213. const statsCont = $('#stats-container');
  1214. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  1215. else if(coinsHTMLactive) statsCont.fadeOut(400);
  1216. coinsHTMLactive = true;
  1217. updateUI();
  1218. e.stopImmediatePropagation();
  1219. });
  1220. });
  1221. }
  1222.  
  1223. // copy chat msgs
  1224. if(rightClickCopyChat){
  1225. $('#contextSpectate').after(`<li id="contextCopyChat" class="contextmenu-item enabled"><div class="fa fa-clipboard fa-2x context-icon"></div><p>Copy Chat Messages</p></li>`)
  1226. $('#contextCopyChat').on('click', () => {
  1227. let arr = chatmsgs, str = "";
  1228. if(arr != null){
  1229. for(let i of arr.reverse()) str += ((new Date(i.time).toLocaleTimeString()) + " " + i.name + i.cache.oe + "\n")
  1230. navigator.clipboard.writeText(str).then(function() {
  1231. curserMsg('Chat messages were successfully added to clipboard.', 'green');
  1232. }, function() {
  1233. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  1234. });
  1235. }
  1236. $('#contextMenu').fadeOut(100);
  1237. });
  1238. }
  1239.  
  1240. let quickBuying = false;
  1241. $('#inv360Shot').after(`<div class="inventory-box" id="fsfb-quickbuy" style="display: none;"><img id="fsfb-quickbuy-img" height="80%" src="https://i.imgur.com/tAjoEyU.png"></div>`);
  1242. $('#invCloak').after(`<div class="inventory-box" id="fsfb-quickMega" style="background-image: url(../img/store/megaphone_shout.png); display: none;"></div>`);
  1243. $('#invCloak').after(`<div class="inventory-box" id="fsfb-minionNuker" style="background-image: url(../img/store/minion_nuker.png); display: none;"></div>`);
  1244. $('#fsfb-quickbuy').on('click', function(){
  1245. quickBuying = !quickBuying;
  1246. if (quickBuying){
  1247. $(this).addClass('activatedInv');
  1248. curserMsg('Quick buy activated, click the powerup you would like to buy.', 'green');
  1249. $('.inventory-box').addClass('fsfb-shown').find('p').css('display', 'none');
  1250. $('#invCloak').removeClass('fsfb-shown');
  1251. $('#fsfb-quickbuy').removeClass('fsfb-shown');
  1252. } else {
  1253. $(this).removeClass('activatedInv');
  1254. curserMsg('Quick buy deactivated.', 'red');
  1255. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  1256. }
  1257. });
  1258.  
  1259. // add linesplit bubbles
  1260. $('body').append(`<div id="linesplit-markers"><div id="linesplit-top"></div><div id="linesplit-right"></div><div id="linesplit-bottom"></div><div id="linesplit-left"></div></div>`); // linesplit html
  1261. // add class to all elements that need to behidden
  1262. $('#inventory, #chat, #minionUi, #infection_remain_zombie, #party, #challengeInfoBox, #gamemodeBox, #infoBox, #brGameContainer, #infGameContainer, #curser, #leaderboard, #minimap, #btnFriends, .innerBoxDashboard2, #fpsBox, #settingsBtn, #megaholder').addClass("hideUI");
  1263.  
  1264. // put inventory onto a single line
  1265. if(inventorySingleRow){
  1266. for (let i = 1; i < 3; i++) $("#inventory" + i).addClass("fsfb-inventories").css("order", i);
  1267. }
  1268.  
  1269. let pushFn = Array.prototype.push,
  1270. spliceFn = Array.prototype.splice,
  1271. prop = null,
  1272. customCells = !0,
  1273. specialCells = !0,
  1274. customDc = false,
  1275. cellProto,
  1276. avgFps = 0,
  1277. fpsArr = [],
  1278. svSwitch = false,
  1279. entArr = null,
  1280. chatmsgs;
  1281.  
  1282. let r1Portal = {
  1283. portal: null,
  1284. lastMass: 0,
  1285. lastMassChange: 0,
  1286. lastValue: 0,
  1287. room: 1
  1288. }, r2Portal = {
  1289. portal: null,
  1290. lastMass: 0,
  1291. lastMassChange: 0,
  1292. lastValue: 0,
  1293. room: 2
  1294. };
  1295.  
  1296. let svInfo = {
  1297. "default": {
  1298. ejPortalMass: 12,
  1299. r1Id: 1,
  1300. r2Id: 7,
  1301. r3Id: null,
  1302. r1StartMass: 500,
  1303. r2StartMass: 500,
  1304. entities: []
  1305. },
  1306. 1: { // POPSPLIT
  1307. entities: [
  1308. // A1
  1309. {type: 1, x: 2500, y: 2500, size: 45},
  1310. // r1
  1311. {type: 0, x: 3400, y: 15300, size: 195},
  1312. {type: 1, x: 2500, y: 15000, size: 45},
  1313. {type: 2, x: 3000, y: 14500, size: 35},
  1314. {type: 3, x: 2700, y: 14600, size: 29},
  1315. // r2
  1316. {type: 0, x: 12000, y: 15500, size: 195},
  1317. {type: 1, x: 11000, y: 15000, size: 29},
  1318. {type: 2, x: 12600, y: 14900, size: 35},
  1319. {type: 2, x: 12000, y: 15200, size: 35},
  1320. {type: 2, x: 11300, y: 14900, size: 35},
  1321. {type: 3, x: 12800, y: 14500, size: 29}
  1322. ]
  1323. },
  1324. 2: { // SLOWSPLIT
  1325. ejPortalMass: 20,
  1326. r1Id: 1,
  1327. r2Id: 14, // rightmost portal
  1328. r3Id: 6,
  1329. r1StartMass: 500,
  1330. r2StartMass: 500,
  1331. entities: [
  1332. // A1
  1333. {type: 1, x: 2500, y: 2500, size: 45},
  1334. // r1
  1335. {type: 0, x: 7400, y: 21300, size: 195},
  1336. {type: 1, x: 3500, y: 21000, size: 45},
  1337. {type: 2, x: 5000, y: 20500, size: 35},
  1338. {type: 3, x: 3700, y: 20600, size: 29},
  1339. // r2
  1340. {type: 0, x: 14000, y: 22000, size: 195},
  1341. {type: 1, x: 11000, y: 21000, size: 29},
  1342. {type: 2, x: 11300, y: 20900, size: 35},
  1343. {type: 2, x: 12000, y: 21200, size: 35},
  1344. {type: 2, x: 12600, y: 20900, size: 35},
  1345. {type: 3, x: 12800, y: 20500, size: 29},
  1346. // r2 (2nd?)
  1347. {type: 0, x: 22000, y: 21500, size: 195},
  1348. {type: 2, x: 21300, y: 21000, size: 45}
  1349. ]
  1350. },
  1351. 4: { // FASTSPLIT
  1352. ejPortalMass: 20,
  1353. r1Id: 1,
  1354. r2Id: 14, // rightmost portal
  1355. r3Id: 6,
  1356. r1StartMass: 500,
  1357. r2StartMass: 500,
  1358. entities: [
  1359. // A1
  1360. {type: 1, x: 2500, y: 2500, size: 45},
  1361. // r1
  1362. {type: 0, x: 7400, y: 21300, size: 195},
  1363. {type: 1, x: 3500, y: 21000, size: 45},
  1364. {type: 2, x: 5000, y: 20500, size: 35},
  1365. {type: 3, x: 3700, y: 20600, size: 29},
  1366. // r2
  1367. {type: 0, x: 14000, y: 22000, size: 195},
  1368. {type: 1, x: 11000, y: 21000, size: 29},
  1369. {type: 2, x: 11300, y: 20900, size: 35},
  1370. {type: 2, x: 12000, y: 21200, size: 35},
  1371. {type: 2, x: 12600, y: 20900, size: 35},
  1372. {type: 3, x: 12800, y: 20500, size: 29},
  1373. // r2 (2nd?)
  1374. {type: 0, x: 22000, y: 21500, size: 195},
  1375. {type: 2, x: 21300, y: 21000, size: 35}
  1376. ]
  1377. },
  1378. 5: { // SPLITRUN
  1379. entities: [
  1380. // A1
  1381. {type: 1, x: 2500, y: 2500, size: 45},
  1382. // r1
  1383. {type: 0, x: 3400, y: 15300, size: 195},
  1384. {type: 1, x: 2500, y: 15000, size: 45},
  1385. {type: 2, x: 3000, y: 14500, size: 35},
  1386. {type: 3, x: 2700, y: 14600, size: 29},
  1387. // r2
  1388. {type: 0, x: 12000, y: 15500, size: 195},
  1389. {type: 1, x: 11000, y: 15000, size: 29},
  1390. {type: 2, x: 12600, y: 14900, size: 35},
  1391. {type: 2, x: 11300, y: 14900, size: 35},
  1392. {type: 2, x: 12000, y: 15200, size: 35},
  1393. {type: 3, x: 12800, y: 14500, size: 29}
  1394. ]
  1395. },
  1396. 6: { // XINSTA
  1397. ejPortalMass: 12,
  1398. r1Id: 1,
  1399. r2Id: 6,
  1400. r1StartMass: 500,
  1401. r2StartMass: 500,
  1402. entities: [
  1403. // A1
  1404. {type: 1, x: 2500, y: 2500, size: 45},
  1405. // r1
  1406. {type: 0, x: 3400, y: 26300, size: 195},
  1407. {type: 1, x: 2500, y: 26000, size: 45},
  1408. {type: 2, x: 3000, y: 25500, size: 45},
  1409. {type: 3, x: 2700, y: 25600, size: 29},
  1410. // r2
  1411. {type: 0, x: 15000, y: 26500, size: 195},
  1412. {type: 1, x: 14000, y: 26000, size: 29},
  1413. {type: 2, x: 14300, y: 25900, size: 45},
  1414. {type: 2, x: 15000, y: 26200, size: 45},
  1415. {type: 2, x: 15600, y: 25900, size: 45},
  1416. {type: 3, x: 15800, y: 25500, size: 29}
  1417. ]
  1418. },
  1419. 7: { // XY
  1420. entities: [
  1421. // A1
  1422. {type: 1, x: 2500, y: 2500, size: 45},
  1423. // r1
  1424. {type: 0, x: 3400, y: 15300, size: 195},
  1425. {type: 1, x: 2500, y: 15000, size: 45},
  1426. {type: 2, x: 3000, y: 14500, size: 35},
  1427. {type: 3, x: 2700, y: 14600, size: 29},
  1428. // r2
  1429. {type: 0, x: 12000, y: 15500, size: 195},
  1430. {type: 1, x: 11000, y: 15000, size: 29},
  1431. {type: 2, x: 11300, y: 14900, size: 35},
  1432. {type: 2, x: 12000, y: 15200, size: 35},
  1433. {type: 2, x: 12600, y: 14900, size: 35},
  1434. {type: 3, x: 12800, y: 14500, size: 29}
  1435. ]
  1436. },
  1437. 8: { // INSTANT EU
  1438. entities: [
  1439. // A1
  1440. {type: 1, x: 2500, y: 2500, size: 45},
  1441. // r1
  1442. {type: 0, x: 3400, y: 15300, size: 195},
  1443. {type: 1, x: 2500, y: 15000, size: 45},
  1444. {type: 2, x: 3000, y: 14500, size: 35},
  1445. {type: 3, x: 2700, y: 14600, size: 29},
  1446. // r2
  1447. {type: 0, x: 12000, y: 15500, size: 195},
  1448. {type: 1, x: 11000, y: 15000, size: 29},
  1449. {type: 2, x: 11300, y: 14900, size: 35},
  1450. {type: 2, x: 12000, y: 15200, size: 35},
  1451. {type: 2, x: 12600, y: 14900, size: 35},
  1452. {type: 3, x: 12800, y: 14500, size: 29}
  1453. ]
  1454. },
  1455. 9: { // CR EU
  1456. entities: [
  1457. // A1
  1458. {type: 1, x: 2500, y: 2500, size: 45},
  1459. // r1
  1460. {type: 0, x: 3400, y: 27300, size: 195},
  1461. {type: 1, x: 2500, y: 27000, size: 45},
  1462. {type: 2, x: 3000, y: 26500, size: 35},
  1463. {type: 3, x: 2700, y: 26600, size: 29},
  1464. // r2
  1465. {type: 0, x: 12000, y: 27500, size: 195},
  1466. {type: 1, x: 11000, y: 27000, size: 29},
  1467. {type: 2, x: 11300, y: 26900, size: 35},
  1468. {type: 2, x: 12000, y: 27200, size: 35},
  1469. {type: 2, x: 12600, y: 26900, size: 35},
  1470. {type: 3, x: 12800, y: 26500, size: 29}
  1471. ]
  1472. },
  1473. 11: { // GIGANTIC 1
  1474. entities: [
  1475. {type: 1, x: 2500, y: 2500, size: 45},
  1476. {type: 3, x: 5000, y: 33000, size: 45},
  1477. {type: 1, x: 18000, y: 18000, size: 45},
  1478. {type: 3, x: 24000, y: 12000, size: 45}
  1479. ]
  1480. },
  1481. 12: { // GIANT NA
  1482. entities: [
  1483. {type: 1, x: 2500, y: 2500, size: 45},
  1484. {type: 3, x: 5000, y: 33000, size: 45},
  1485. {type: 1, x: 18000, y: 18000, size: 45},
  1486. {type: 3, x: 24000, y: 12000, size: 45}
  1487. ]
  1488. },
  1489. 13: { // SS EU
  1490. ejPortalMass: 13.5,
  1491. r1Id: 12, //Lower room
  1492. r2Id: 11,
  1493. r1StartMass: 500,
  1494. r2StartMass: 500,
  1495. entities: [
  1496. // r1
  1497. {type: 0, x: 1500, y: 27500, size: 195},
  1498. {type: 1, x: 14000, y: 32000, size: 45},
  1499. {type: 3, x: 13200, y: 33500, size: 45},
  1500. {type: 4, x: 12500, y: 32200, size: 142},
  1501. {type: 4, x: 14500, y: 32200, size: 142},
  1502. // r2
  1503. {type: 0, x: 16000, y: 33500, size: 195},
  1504. {type: 1, x: 500, y: 24000, size: 45},
  1505. {type: 3, x: 2500, y: 24000, size: 45},
  1506. {type: 4, x: 900, y: 22000, size: 142},
  1507. {type: 4, x: 500, y: 15000, size: 224},
  1508. // r3 (?)
  1509. {type: 4, x: 1200, y: 5500, size: 224},
  1510. {type: 4, x: 2000, y: 3000, size: 224},
  1511. {type: 4, x: 4000, y: 6000, size: 224},
  1512. {type: 4, x: 4500, y: 3000, size: 224},
  1513. // on map
  1514. {type: 4, x: 8000, y: 3500, size: 224},
  1515. {type: 4, x: 10000, y: 4500, size: 224},
  1516. {type: 4, x: 16000, y: 3000, size: 224},
  1517. {type: 4, x: 15400, y: 2400, size: 224},
  1518. {type: 4, x: 7500, y: 19000, size: 224},
  1519. {type: 4, x: 19200, y: 14000, size: 224},
  1520. {type: 4, x: 24400, y: 24000, size: 224},
  1521. {type: 4, x: 17500, y: 14000, size: 142},
  1522. {type: 4, x: 30000, y: 16000, size: 142}
  1523. ]
  1524. },
  1525. 14: { // SS NA
  1526. ejPortalMass: 13.5,
  1527. r1Id: 12, //Lower room
  1528. r2Id: 11,
  1529. r1StartMass: 500,
  1530. r2StartMass: 500,
  1531. entities: [
  1532. // r1
  1533. {type: 0, x: 1500, y: 27500, size: 195},
  1534. {type: 1, x: 14000, y: 32000, size: 45},
  1535. {type: 3, x: 13200, y: 33500, size: 45},
  1536. {type: 4, x: 12500, y: 32200, size: 142},
  1537. {type: 4, x: 14500, y: 32200, size: 142},
  1538. // r2
  1539. {type: 0, x: 16000, y: 33500, size: 195},
  1540. {type: 1, x: 500, y: 24000, size: 45},
  1541. {type: 3, x: 2500, y: 24000, size: 45},
  1542. {type: 4, x: 900, y: 22000, size: 142},
  1543. {type: 4, x: 500, y: 15000, size: 224},
  1544. // r3 (?)
  1545. {type: 4, x: 1200, y: 5500, size: 224},
  1546. {type: 4, x: 2000, y: 3000, size: 224},
  1547. {type: 4, x: 4000, y: 6000, size: 224},
  1548. {type: 4, x: 4500, y: 3000, size: 224},
  1549. // on map
  1550. {type: 4, x: 8000, y: 3500, size: 224},
  1551. {type: 4, x: 10000, y: 4500, size: 224},
  1552. {type: 4, x: 16000, y: 3000, size: 224},
  1553. {type: 4, x: 15400, y: 2400, size: 224},
  1554. {type: 4, x: 7500, y: 19000, size: 224},
  1555. {type: 4, x: 19200, y: 14000, size: 224},
  1556. {type: 4, x: 24400, y: 24000, size: 224},
  1557. {type: 4, x: 17500, y: 14000, size: 142},
  1558. {type: 4, x: 30000, y: 16000, size: 142}
  1559. ]
  1560. },
  1561. 17: { // CR AS
  1562. entities: [
  1563. // A1
  1564. {type: 1, x: 2500, y: 2500, size: 45},
  1565. // r1
  1566. {type: 0, x: 3400, y: 27300, size: 195},
  1567. {type: 1, x: 2500, y: 27000, size: 45},
  1568. {type: 2, x: 3000, y: 26500, size: 35},
  1569. {type: 3, x: 2700, y: 26600, size: 29},
  1570. // r2
  1571. {type: 0, x: 12000, y: 27500, size: 195},
  1572. {type: 1, x: 11000, y: 27000, size: 29},
  1573. {type: 2, x: 11300, y: 26900, size: 35},
  1574. {type: 2, x: 12000, y: 27200, size: 35},
  1575. {type: 2, x: 12600, y: 26900, size: 35},
  1576. {type: 3, x: 12800, y: 26500, size: 29}
  1577. ]
  1578. },
  1579. 18: { // GIGA 1
  1580. entities: [
  1581. {type: 1, x: 2500, y: 2500, size: 45},
  1582. {type: 3, x: 5000, y: 33000, size: 45},
  1583. {type: 1, x: 18000, y: 18000, size: 45},
  1584. {type: 3, x: 24000, y: 12000, size: 45}
  1585. ]
  1586. },
  1587. 19: { // GIGANTIC 2
  1588. entities: [
  1589. {type: 1, x: 2500, y: 2500, size: 45},
  1590. {type: 3, x: 5000, y: 33000, size: 45},
  1591. {type: 1, x: 18000, y: 18000, size: 45},
  1592. {type: 3, x: 24000, y: 12000, size: 45}
  1593. ]
  1594. },
  1595. 20: { // CR NA
  1596. entities: [
  1597. // A1
  1598. {type: 1, x: 2500, y: 2500, size: 45},
  1599. // r1
  1600. {type: 0, x: 3400, y: 27300, size: 195},
  1601. {type: 1, x: 2500, y: 27000, size: 45},
  1602. {type: 2, x: 3000, y: 26500, size: 35},
  1603. {type: 3, x: 2700, y: 26600, size: 29},
  1604. // r2
  1605. {type: 0, x: 12000, y: 27500, size: 195},
  1606. {type: 1, x: 11000, y: 27000, size: 29},
  1607. {type: 2, x: 11300, y: 26900, size: 35},
  1608. {type: 2, x: 12000, y: 27200, size: 35},
  1609. {type: 2, x: 12600, y: 26900, size: 35},
  1610. {type: 3, x: 12800, y: 26500, size: 29}
  1611. ]
  1612. },
  1613. 23: { // GIGANTIC 3
  1614. entities: [
  1615. {type: 1, x: 2500, y: 2500, size: 45},
  1616. {type: 3, x: 5000, y: 33000, size: 45},
  1617. {type: 1, x: 18000, y: 18000, size: 45},
  1618. {type: 3, x: 24000, y: 12000, size: 45}
  1619. ]
  1620. },
  1621. 24: { // GIGANTIC 4
  1622. entities: [
  1623. {type: 1, x: 2500, y: 2500, size: 45},
  1624. {type: 3, x: 5000, y: 33000, size: 45},
  1625. {type: 1, x: 18000, y: 18000, size: 45},
  1626. {type: 3, x: 24000, y: 12000, size: 45}
  1627. ]
  1628. },
  1629. 25: { // GIANT 2 NA
  1630. entities: [
  1631. {type: 1, x: 2500, y: 2500, size: 45},
  1632. {type: 3, x: 5000, y: 33000, size: 45},
  1633. {type: 1, x: 18000, y: 18000, size: 45},
  1634. {type: 3, x: 24000, y: 12000, size: 45}
  1635. ]
  1636. },
  1637. 26: { // GIGA 2
  1638. entities: [
  1639. {type: 1, x: 2500, y: 2500, size: 45},
  1640. {type: 3, x: 5000, y: 33000, size: 45},
  1641. {type: 1, x: 18000, y: 18000, size: 45},
  1642. {type: 3, x: 24000, y: 12000, size: 45}
  1643. ]
  1644. },
  1645. 38: { // Solo Agf
  1646. ejPortalMass: 12,
  1647. r1Id: 1,
  1648. r2Id: 6,
  1649. r1StartMass: 500,
  1650. r2StartMass: 400,
  1651. entities: [
  1652. // A1
  1653. {type: 1, x: 2500, y: 2500, size: 45},
  1654. // room 1
  1655. {type: 0, x: 3500, y: 11500, size: 195},
  1656. {type: 1, x: 2500, y: 11500, size: 45},
  1657. {type: 2, x: 3000, y: 11000, size: 35},
  1658. {type: 3, x: 2700, y: 11100, size: 29},
  1659. // room 2
  1660. {type: 0, x: 9000, y: 11800, size: 180},
  1661. {type: 1, x: 8200, y: 10500, size: 29},
  1662. {type: 2, x: 8300, y: 10900, size: 35},
  1663. {type: 2, x: 9000, y: 11200, size: 35},
  1664. {type: 2, x: 9600, y: 10900, size: 35},
  1665. {type: 3, x: 9800, y: 10500, size: 29}
  1666. ]
  1667. },
  1668. 39: { // MEGASPLIT AS
  1669. entities: [
  1670. ]
  1671. },
  1672. 42: { // GIANT 3 NA
  1673. entities: [
  1674. {type: 1, x: 2500, y: 2500, size: 45},
  1675. {type: 3, x: 5000, y: 33000, size: 45},
  1676. {type: 1, x: 18000, y: 18000, size: 45},
  1677. {type: 3, x: 24000, y: 12000, size: 45}
  1678. ]
  1679. },
  1680. 43: { // Instant AS
  1681. ejPortalMass: 11, //might have to reevaluate
  1682. r1Id: 1,
  1683. r2Id: 13, // rightmost portal
  1684. r3Id: 7,
  1685. r1StartMass: 1004,
  1686. r2StartMass: 250,
  1687. r3StartMass: 1004,
  1688. entities: [
  1689. // A1
  1690. {type: 1, x: 2500, y: 2500, size: 45},
  1691. // r1
  1692. {type: 0, x: 3400, y: 20300, size: 275},
  1693. {type: 1, x: 2500, y: 20000, size: 45},
  1694. {type: 2, x: 3000, y: 19500, size: 35},
  1695. {type: 3, x: 2700, y: 19600, size: 29},
  1696. // r2
  1697. {type: 0, x: 13000, y: 21000, size: 150},
  1698. {type: 1, x: 11000, y: 20000, size: 45},
  1699. {type: 2, x: 11300, y: 19900, size: 35},
  1700. {type: 2, x: 12000, y: 20200, size: 35},
  1701. {type: 2, x: 12600, y: 19900, size: 35},
  1702. {type: 3, x: 12800, y: 19500, size: 45},
  1703. // r2 (2nd?)
  1704. {type: 0, x: 30000, y: 21000, size: 275},
  1705. {type: 1, x: 28000, y: 19900, size: 55},
  1706. {type: 2, x: 28300, y: 19900, size: 45},
  1707. {type: 2, x: 28450, y: 20200, size: 45},
  1708. {type: 2, x: 28600, y: 19900, size: 45},
  1709. {type: 3, x: 28900, y: 19900, size: 55}
  1710. ]
  1711. }
  1712. };
  1713. let noPortalSvIdList = [11, 19, 23, 24, 37, 36, 31, 29, 40, 41, 16, 15, 21, 35, 12, 25, 42, 28, 32, 22, 18, 26, 30, 39];
  1714. let currentServerId = 0;
  1715.  
  1716. try{
  1717. for(let i of JSON.parse(localStorage.gameservers)){
  1718. if(i.isCurrent) currentServerId = i.id;
  1719. }
  1720. } catch {};
  1721.  
  1722. setTimeout(() => {
  1723. svSwitch = true;
  1724. }, 250);
  1725.  
  1726. let ss = unsafeWindow.setserver;
  1727. unsafeWindow.setserver = (sv, sn) => {
  1728. currentServerId = parseInt($(".server-tabmenu").find(".active")[0].id.slice(9));
  1729. r1Portal.portal = null;
  1730. r2Portal.portal = null;
  1731. svSwitch = true;
  1732. ss(sv, sn);
  1733. }
  1734.  
  1735. function getServerValue(value) {
  1736. return (svInfo[currentServerId] && svInfo[currentServerId][value]) ? svInfo[currentServerId][value] : svInfo.default[value]
  1737. }
  1738.  
  1739. function createCell(posX, posY, type, nSize){
  1740. if(!cellProto) return null;
  1741.  
  1742. let color,
  1743. colorDimmed = "#FFFFFF",
  1744. size = 0,
  1745. imageId = 0,
  1746. spikes = null;
  1747.  
  1748. switch(type){
  1749. case 0:
  1750. color = "#622373";
  1751. colorDimmed = "#4e1c5c";
  1752. size = nSize ? nSize : 200;
  1753. imageId = 1;
  1754. break;
  1755. case 1:
  1756. color = "#ff0000";
  1757. colorDimmed = "#cc0001";
  1758. size = nSize ? nSize : 32;
  1759. spikes = {x: posX, y: posY, s: size, p: size};
  1760. imageId = 2;
  1761. break;
  1762. case 2:
  1763. color = "#76ff54";
  1764. colorDimmed = "#66b319";
  1765. size = nSize ? nSize : 35;
  1766. imageId = 3;
  1767. break;
  1768. case 3:
  1769. color = "#ffd000";
  1770. colorDimmed = "#ccb300";
  1771. size = nSize ? nSize : 32;
  1772. spikes = {x: posX, y: posY, s: size, p: size};
  1773. imageId = 4;
  1774. break;
  1775. case 4:
  1776. color = "#00a2e8";
  1777. colorDimmed = "#0081b9";
  1778. size = nSize ? nSize : 150;
  1779. imageId = 5;
  1780. break;
  1781. default:
  1782. color = "#FFFFFF";
  1783. size = 500;
  1784. };
  1785.  
  1786. let cell = new cellProto.constructor();
  1787. cell[prop[41]] = imageId;
  1788. cell[prop[19]] = null;
  1789. cell[prop[50]] = 0;
  1790. cell[prop[40]] = spikes ? 1 : 0;
  1791. cell[prop[26]] = null;
  1792. cell[prop[52]] = false;
  1793. cell[prop[53]] = false;
  1794. cell[prop[39]] = [];
  1795. cell[prop[57]] = 0;
  1796. cell[prop[45]] = false;
  1797. cell[prop[37]] = true;
  1798. cell[prop[24]] = null;
  1799. cell[prop[44]] = false;
  1800. cell[prop[56]] = false;
  1801. cell[prop[47]] = false;
  1802. cell[prop[25]] = null;
  1803. cell[prop[35]] = Date.now();
  1804. cell[prop[51]] = 0;
  1805. cell[prop[42]] = null;
  1806. cell.clanCache = null;
  1807. cell.clanPart = null;
  1808. cell.color = color;
  1809. cell[prop[46]] = 9;
  1810. cell[prop[38]] = spikes;
  1811. cell[prop[33]] = 1;
  1812. cell[prop[36]] = 0;
  1813. cell[prop[31]] = posX;
  1814. cell[prop[32]] = posY;
  1815. cell[prop[3]] = 0;
  1816. cell.id = 1e9;
  1817. cell[prop[21]] = null;
  1818. cell[prop[20]] = null;
  1819. cell.massCache = null;
  1820. cell[prop[11]] = size;
  1821. cell.nSize = size;
  1822. cell.name = null;
  1823. cell.namePart = null;
  1824. cell.nameSize = 0;
  1825. cell.oid = 0;
  1826. cell.ox = posX;
  1827. cell.oy = posY;
  1828. cell[prop[58]] = 0;
  1829. cell.rotation = 0;
  1830. cell.shape = 0;
  1831. cell.size = size;
  1832. cell.skinId = 0;
  1833. cell.strokeSize = size + 4;
  1834. cell.textDrawn = null;
  1835. cell.transform = null;
  1836. cell[prop[18]] = true;
  1837. cell[prop[2]] = colorDimmed ? colorDimmed : dimmColor(color);
  1838. cell[prop[17]] = null;
  1839. cell.x = posX;
  1840. cell[prop[23]] = null;
  1841. cell.y = posY;
  1842. cell[prop[22]] = null;
  1843. cell[prop[54]] = false;
  1844. cell[prop[34]] = Date.now();
  1845. cell[prop[55]] = true;
  1846. return cell;
  1847. }
  1848.  
  1849. function customize(c){
  1850. cellProto = c.__proto__;
  1851. let dc = c.__proto__.de;
  1852. c.__proto__.oldDrawCell = dc;
  1853. c.__proto__.de = function(){
  1854. let cell = this,
  1855. cellType = cell[prop[46]];
  1856. if(cellType == 0){
  1857. if(settings.theme_boxes[1].active){
  1858. if(cell.oOwnCell === undefined) cell.oOwnCell = cell[prop[45]];
  1859. cell[prop[45]] = true;
  1860. }
  1861. if(settings.theme_boxes[6].active){
  1862. if(cell.oSpiked === undefined) cell.oSpiked = cell[prop[56]];
  1863. cell[prop[56]] = settings.theme_boxes[6].active;
  1864. } else {
  1865. if(cell.oSpiked != undefined) cell[prop[56]] = cell.oSpiked;
  1866. }
  1867. if(settings.theme_boxes[2].active){
  1868. if(cell.oHasImage === undefined) cell.oHasImage = cell[prop[18]];
  1869. cell[prop[18]] = (cell.oOwnCell === undefined ? cell[prop[45]] : cell.oOwnCell) ? cell[prop[18]] : false;
  1870. } else {
  1871. if(cell.oHasImage != undefined && !settings.theme_boxes[3].active) cell[prop[18]] = cell.oHasImage;
  1872. }
  1873. if(settings.theme_boxes[4].active){
  1874. if(cell.oName === undefined) cell.oName = cell.name;
  1875. cell.name = (cell.oOwnCell === undefined ? cell[prop[45]] : cell.oOwnCell) ? cell.name : "";
  1876. } else {
  1877. if(cell.oName != undefined && !settings.theme_boxes[3].active) cell.name = cell.oName;
  1878. }
  1879. if(settings.theme_boxes[3].active){
  1880. if(cell.oHasImage === undefined) cell.oHasImage = cell[prop[18]];
  1881. cell[prop[18]] = cell[prop[53]] ? cell[prop[18]] : false;
  1882. } else {
  1883. if(cell.oHasImage != undefined && !settings.theme_boxes[2].active) cell[prop[18]] = cell.oHasImage;
  1884. }
  1885. if(settings.theme_boxes[5].active){
  1886. if(cell.oName === undefined) cell.oName = cell.name;
  1887. cell.name = cell[prop[53]] ? cell.name : "";
  1888. } else {
  1889. if(cell.oName != undefined && !settings.theme_boxes[4].active) cell.name = cell.oName;
  1890. }
  1891. }
  1892. if(cellType == 1){
  1893. if(cell.color == "#00ff00") cell.color = "#00ff01";
  1894. if(settings.theme[0].active){
  1895. if(!cell.oColor) cell.oColor = cell.color;
  1896. cell.color = settings.theme[0].color;
  1897. } else {
  1898. if(cell.oColor) cell.color = cell.oColor;
  1899. }
  1900. }
  1901. return dc.apply(this, arguments);
  1902. }
  1903. customDc = true;
  1904. }
  1905.  
  1906. function dimmColor(color) {
  1907. var r = (~~(parseInt(color.substr(1, 2), 16) * 0.5)).toString(16),
  1908. g = (~~(parseInt(color.substr(3, 2), 16) * 0.5)).toString(16),
  1909. b = (~~(parseInt(color.substr(5, 2), 16) * 0.5)).toString(16);
  1910. if (r.length == 1) r = "0" + r;
  1911. if (g.length == 1) g = "0" + g;
  1912. if (b.length == 1) b = "0" + b;
  1913. return "#" + r + g + b
  1914. }
  1915.  
  1916. let sn = unsafeWindow.setNick;
  1917. unsafeWindow.setNick = function(name, rspwn){
  1918. setTimeout(() => {svSwitch = true}, 1000);
  1919. sn(name, rspwn);
  1920. };
  1921.  
  1922. Array.prototype.push = function(){
  1923. if(this.length && typeof this[0].message === 'string') chatmsgs = this;
  1924. if(this.length && typeof this[0].id == "number" && typeof this[0].color == "string"){
  1925. if(customCells){
  1926. let cell = this[this.length - 1];
  1927. let pushedCell = arguments[0];
  1928. if(!prop){
  1929. prop = Object.keys(cell);
  1930. if(prop.length != 59 || prop[28] != "massCache"){
  1931. // unsafeWindow.swal({
  1932. // title: "FSFB scripts experienced an error, please contact authors",
  1933. // type: "error"
  1934. // });
  1935. console.error("FSFB Scripts error, contact authors");
  1936. }
  1937. }
  1938. if(pushedCell.id === getServerValue("r1Id")){
  1939. r1Portal.portal = pushedCell;
  1940. } else if(pushedCell.id === getServerValue("r2Id")){
  1941. r2Portal.portal = pushedCell;
  1942. }
  1943. !customDc && customize(cell);
  1944. if(svSwitch && this[0][prop[47]] && settings.checkboxes[8].active){
  1945. let hasEntities = false;
  1946. for(let i = 0; i < this.length; i++){
  1947. if(this[i].id == 1e9) hasEntities = true;
  1948. }
  1949. if(!hasEntities){
  1950. for(let i = 0; i < getServerValue("entities").length; i++){
  1951. let ent = getServerValue("entities")[i];
  1952. pushFn.apply(this, [createCell(ent.x, ent.y, ent.type, ent.size)]);
  1953. }
  1954. } else {
  1955. //console.warn("hasents");
  1956. }
  1957. svSwitch = false;
  1958. }
  1959. }
  1960. }
  1961. return pushFn.apply(this, arguments);
  1962. }
  1963. Array.prototype.splice = function(){
  1964. if(this.length && typeof this[0].id == "number" && typeof this[0].color == "string"){
  1965. if(customCells){
  1966. let cell = this[arguments[0]];
  1967. if(cell == r1Portal.portal){
  1968. r1Portal.portal = null;
  1969. } else if(cell == r2Portal.portal){
  1970. r2Portal.portal = null;
  1971. }
  1972. }
  1973. }
  1974.  
  1975. return spliceFn.apply(this, arguments);
  1976. }
  1977. let fillFn = CanvasRenderingContext2D.prototype.fill;
  1978. CanvasRenderingContext2D.prototype.fill = function() {
  1979. let doStroke = true;
  1980. if(this.globalAlpha == .04){
  1981. switch(this.fillStyle){
  1982. case "#ff0000": // rec
  1983. this.strokeStyle = "#cc0001";
  1984. break;
  1985. case "#76ff54": // grw
  1986. this.strokeStyle = "#66b319";
  1987. break;
  1988. case "#ffd000": // spd
  1989. this.strokeStyle = "#ccb300";
  1990. break;
  1991. case "#00a2e8": // min pack
  1992. this.strokeStyle = "#0081b9";
  1993. break;
  1994. case "#622373": // portal
  1995. this.strokeStyle = "#4e1c5c";
  1996. break;
  1997. default:
  1998. doStroke = false;
  1999. };
  2000. if(doStroke){
  2001. this.globalAlpha = .2;
  2002. this.lineWidth = 8;
  2003. this.stroke();
  2004. this.globalAlpha = .1;
  2005. this.shadowOffsetY = 1; // for fucking curser lock
  2006. }
  2007. };
  2008. if(!doStroke && this.globalAlpha == 0.04 && settings.checkboxes[2].active){
  2009. this.strokeStyle = $('#cDark').prop("checked") ? "#FFFFFF" : "#000000";
  2010. this.globalAlpha = 1;
  2011. this.lineWidth = 30;
  2012. this.stroke();
  2013. this.globalAlpha = 0.04;
  2014. }
  2015. if (settings.theme_boxes[0].active && this.canvas.id === "canvas" && this.globalAlpha == .4) {
  2016. this.globalAlpha = 0.15
  2017. }
  2018. if (settings.theme[1].active && (this.fillStyle == "#00ff00" || this.fillStyle == "#19a0cc")) {
  2019. this.fillStyle = settings.theme[1].color
  2020. }
  2021. if (settings.theme[3].active && this.fillStyle == "#cd5564") {
  2022. this.fillStyle = settings.theme[3].color
  2023. }
  2024. if(whiteBorder4BlackCells && this.fillStyle == "#000000"){
  2025. this.strokeStyle = "#FFFFFF";
  2026. this.lineWidth = 20;
  2027. this.stroke();
  2028. }
  2029. return fillFn.apply(this, arguments)
  2030. }
  2031. let strokeFn = CanvasRenderingContext2D.prototype.stroke;
  2032. CanvasRenderingContext2D.prototype.stroke = function() {
  2033. if (this.canvas.id === "canvas") {
  2034. if (this.strokeStyle == "#dddddd" || this.strokeStyle == "#333333") {
  2035. if(settings.checkboxes[2].active) this.strokeStyle = $('#cDark').prop("checked") ? "#FFFFFF" : "#000000";
  2036. if(this.shadowOffsetY == 1){
  2037. this.shadowOffsetY = 0;
  2038. return;
  2039. };
  2040. };
  2041. if (settings.theme_boxes[0].active && this.lineWidth != 4 && $('#cBubbleCells').prop("checked")) {
  2042. this.lineWidth = 15 + Math.min(Math.max(avgFps - 25, 0), 10)
  2043. }
  2044. if((settings.theme[1].active || settings.theme[2].active) && (this.strokeStyle == "#00ff00" || this.strokeStyle == "#00cc00" || this.strokeStyle == "#1480a3" || this.strokeStyle == "#1690b7" || this.strokeStyle == "#00e500")) {
  2045. this.strokeStyle = settings.theme[2].active ? settings.theme[2].color : settings.theme_boxes[0].active && $('#cBubbleCells').prop("checked") ? settings.theme[1].color : dimmColor(settings.theme[1].color); // if no stroke color is set, it will just be a darker version of the virusColor
  2046. }
  2047. if((settings.theme[3].active || settings.theme[4].active) && (this.strokeStyle == "#cd5564" || this.strokeStyle == "#a44450" || this.strokeStyle == "#b84c5a")) {
  2048. this.strokeStyle = settings.theme[4].active ? settings.theme[4].color : settings.theme_boxes[0].active && $('#cBubbleCells').prop("checked") ? settings.theme[3].color : dimmColor(settings.theme[3].color);
  2049. }
  2050. }
  2051. return strokeFn.apply(this, arguments)
  2052. }
  2053. let drawImgFn = CanvasRenderingContext2D.prototype.drawImage;
  2054. CanvasRenderingContext2D.prototype.drawImage = function () {
  2055. if(this.globalAlpha == 0.01 && arguments[0].src && arguments[0].src.match(RegExp(`https://agma\\.io/skins/objects/[1-5]`))){
  2056. this.globalAlpha = .35;
  2057. }
  2058. drawImgFn.apply(this, arguments);
  2059. if(this.canvas.id == "canvas"){
  2060. if((arguments[0].src == "https://agma.io/skins/objects/1_lo.png?v=2" || arguments[0].src == "https://agma.io/skins/objects/1.png?v=2") && (r1Portal.portal || r2Portal.portal)){ // using destroyed doesnt work hence splice
  2061. //draw portal mass
  2062. if(settings.checkboxes[7].active && noPortalSvIdList.indexOf(currentServerId) == -1){
  2063. let c = (p) => {
  2064. if((p.portal.nSize * p.portal.nSize / 100) != p.lastMass){
  2065. p.lastMassChange = Date.now();
  2066. }
  2067. p.lastMass = (p.portal.nSize * p.portal.nSize / 100);
  2068.  
  2069. let value = Date.now() - p.lastMassChange > 200 ? ~~(((p.portal.nSize * p.portal.nSize / 100) - getServerValue("r" + p.room + "StartMass")) / getServerValue("ejPortalMass")).toString() : p.lastValue;
  2070. p.lastValue = value;
  2071. if(value > 9 || value < 0){
  2072. value = "?";
  2073. }
  2074. this.fillStyle = value == "7" ? "#FFCC12" : "#FFFFFF";
  2075. this.globalAlpha = 1;
  2076. this.font = "72px Ubuntu, serif";
  2077. this.fillText(value, p.portal.x - this.measureText(value).width / 2, p.portal.y + 20);
  2078. }
  2079. r1Portal.portal && c(r1Portal);
  2080. currentServerId != 43 && r2Portal.portal && c(r2Portal);
  2081. }
  2082. }
  2083. }
  2084. }
  2085.  
  2086. // const oldFillText = CanvasRenderingContext2D.prototype.fillText;
  2087. // CanvasRenderingContext2D.prototype.fillText = function() {
  2088. // if (hiddenUI && arguments[0].includes("Mass: ")) arguments[0] = "";
  2089. // oldFillText.apply(this, arguments);
  2090. // }
  2091.  
  2092. let dURIC = unsafeWindow.decodeURIComponent,
  2093. opt = [0x92933AFC, 0x75408D32];
  2094. unsafeWindow.decodeURIComponent = function(x){
  2095. if(x === "") x = opt[Math.round(Math.random())].toString();
  2096. return dURIC(x);
  2097. }
  2098.  
  2099. let intervalCount = 0, currentUser, lastLoggedOut = Date.now();
  2100. const mainInterval = setInterval(() => {
  2101. intervalCount++;
  2102. if(hoverShowSkinID && $('#publicSkinsPage').children().length > 0 && $('#publicSkinsPage').find('[id^="skinContainer"]>img')[0].title == ''){ // check if skins have loaded
  2103. $('[id^="skinContainer"]').each(function(){
  2104. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', '')); // make hover show skin ID
  2105. })
  2106. $('.publicskins-nav-btn').on('click', () => {
  2107. $('[id^="skinContainer"]').each(function(){
  2108. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', ''));
  2109. })
  2110. })
  2111. }
  2112. currentUser = $('#userCoins2')[0].innerText;
  2113. let user_abil = currentUser == 'Please Login First' ? null : acc_abil[currentUser];
  2114. if(user_abil != undefined && showRemainingAbilityTime){
  2115. for(let i in user_abil){
  2116. let text = $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0).find('div h5'),
  2117. active = $('#' + $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0)[0].id + ' img').eq(1).css('display') != "none";
  2118. // has been 24h+ and the player hasn't logged out since it's expired
  2119. if(Date.now() - user_abil[i] > 8.64e7 && active){
  2120. text.eq(1).text('EXPIRED IF UNLOG');
  2121. text.eq(0).find('div h5').hide();
  2122. }
  2123. // has been >24h
  2124. else if(Date.now() - user_abil[i] < 8.64e7 && active){
  2125. text.eq(0).hide();
  2126. text.eq(1).text(msToTime(8.64e7 - (Date.now() - user_abil[i]))).show();
  2127. }
  2128. else { // has been 24h+ & player has logged out
  2129. text.eq(1).find('div h5').hide();
  2130. text.eq(0).find('div h5').show();
  2131. }
  2132. }
  2133. } else {
  2134. $('.white_shopdesc').show();
  2135. $('.white_shopdesc.fsfb-fake').hide();
  2136. }
  2137. if(accounts[currentUser] == null && currentUser !== 'Please Login First'){
  2138. xpInfo();
  2139. coinsInfo();
  2140. accounts = {...accounts, ...{[currentUser] : {coins: currentCoins, xp: currentXP}}};
  2141. }
  2142. if(accounts[currentUser] != null && accounts[currentUser].coins == 0) accounts[currentUser].coins = currentCoins;
  2143. if(accounts[currentUser] != null && accounts[currentUser].xp == 0) accounts[currentUser].xp = currentXP;
  2144. if(coinXPstats && intervalCount % 12 == 0){
  2145. setTimeout(() => {
  2146. xpInfo();
  2147. lastMinXP.push(new record(round(currentXP, 3), currentUser, lastMinXP));
  2148. const prevObjXP = lastMinXP[lastMinXP.length - 1];
  2149. if(prevObjXP && prevObjXP.id % (6e4 / updateTimeXP) == 0) lastHrXP.push(new record(currentXP, currentUser, lastHrXP));
  2150. if(lastMinXP.length > 6e4 / updateTimeXP) lastMinXP.shift();
  2151. if(lastHrXP.length > 60) lastHrXP.shift();
  2152. if(!coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  2153. }, 500);
  2154. }
  2155. if(coinXPstats && intervalCount % 6 == 0){
  2156. coinsInfo();
  2157. lastMinCoins.push(new record(currentCoins, currentUser, lastMinCoins));
  2158. const lastObjCoins = lastMinCoins[lastMinCoins.length - 1];
  2159. if(lastObjCoins && lastObjCoins.id % (6e4 / updateTimeCoins) == 0) lastHrCoins.push(new record(currentCoins, currentUser, lastHrCoins));
  2160. if(lastMinCoins.length > 6e4 / updateTimeCoins) lastMinCoins.shift();
  2161. if(lastHrCoins.length > 60) lastHrCoins.shift();
  2162. if(coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  2163. }
  2164. if(coinsHTMLactive){
  2165. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartCoins));
  2166. } else {
  2167. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartXP));
  2168. }
  2169. if(intervalCount % 3 == 0){
  2170. statsboxPos = {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left}
  2171. set("fsfb-statsPos", statsboxPos);
  2172. }
  2173. if(currentServerId === 0){
  2174. try {
  2175. for(let i of JSON.parse(localStorage.gameservers)){
  2176. if(i.isCurrent) currentServerId = i.id;
  2177. }
  2178. svSwitch = true;
  2179. } catch {};
  2180. }
  2181. if(currentUser == 'Please Login First' || $('#level').text() == 0) lastLoggedOut = Date.now();
  2182. changeTitle(settings.checkboxes[4].active ? currentUser == 'Please Login First' ? "Agma.io" : "Agma.io - " + currentUser : "Agma.io - A free multiplayer MMO game");
  2183.  
  2184. fpsArr.push(+document.getElementById("fps").innerText);
  2185. if(fpsArr.length == 6) fpsArr.shift();
  2186. avgFps = mean(fpsArr);
  2187. }, 1e3);
  2188.  
  2189. if(showXPdecimals){
  2190. $('.progress-bar span').each(function(){
  2191. $(this).hide().clone().insertAfter($(this)).addClass('fsfb-fakePerc').removeClass('sr-only exp-bar').show(); // show detailed lvl percent (clone to prevent showing the old % before it gets changed)
  2192. });
  2193. setInterval(() => {
  2194. let currPercent = $('.progress-bar[role=progressbar]')[0].style.width.slice(0, -1) / 100;
  2195. $('.fsfb-fakePerc').text(currPercent && $('.sr-only.exp-bar')[0].textContent != '0%' ? round(currPercent * 100, 2) + '%' : '0%');
  2196. }, 250);
  2197. }
  2198.  
  2199. const antiAFK = () => {
  2200. setTimeout(antiAFK, 3e4);
  2201. if(!$('#fsfb-antiAFK').is(':checked'))return; // move mouse every 30sec
  2202. if(linesplitting){
  2203. $('#canvas').trigger($.Event('mousemove', {clientX: pointMove.x + 1, clientY: pointMove.y}));
  2204. $('#canvas').trigger($.Event('mousemove', {clientX: pointMove.x - 1, clientY: pointMove.y}));
  2205. } else {
  2206. $('#canvas').trigger($.Event('mousemove', {clientX: mosX + 1, clientY: mosY}));
  2207. $('#canvas').trigger($.Event('mousemove', {clientX: mosX - 1, clientY: mosY}));
  2208. }
  2209. }
  2210. setTimeout(antiAFK, 3e4);
  2211.  
  2212.  
  2213. const updateScriptSettingsUI = () => {
  2214. for(let i of settings.checkboxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  2215. for(let i of settings.hotkeys) $('#' + i.id).text(getName(i.key));
  2216. for(let i of settings.fastsplit_hotkeys) $('#' + i.id).text(getName(i.key));
  2217. for(let i of settings.quickSettings){
  2218. $('#' + i.id1).val(i.set);
  2219. $('#' + i.id).text(getName(i.key));
  2220. }
  2221. $('#' + settings.slowFeed[0].id).text(getName(settings.slowFeed[0].key));
  2222. $('#' + settings.slowFeed[1].id).val(settings.slowFeed[1].val);
  2223. for(let i of settings.uiScaling) $('#' + i.id).val(i.level).trigger("change");
  2224. for(let i of settings.export_import) $('#' + i.id).prop("checked", i.active).trigger("change");
  2225. for(let i of settings.theme){
  2226. $('#' + i.id).prop("checked", i.active).trigger("change");
  2227. $('#' + i.id1).val(i.color).trigger("change");
  2228. }
  2229. for(let i of settings.theme_boxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  2230. }
  2231. setTimeout(() => updateScriptSettingsUI(), 1e3);
  2232.  
  2233. $('body').append('<div id="fsfb-css-styles"><style id="hideUI-css" type="text/css"></style></div>');
  2234.  
  2235. const _replaceCSS = (a,b) => {
  2236. document.getElementById(a).innerHTML = b;
  2237. }
  2238. $('body').append(`
  2239. <div class="modal fade fsfb-bug-modal" tabindex="-1" role="dialog" aria-hidden="true">
  2240. <div class="modal-dialog modal-lg">
  2241. <div class="modal-content">
  2242. <div class="modal-interior">
  2243. <h2 class="fsfb-modal-title">Script Documentation</h2>
  2244. <button type="button" class="close fsfb-btn" data-dismiss="modal">×</button>
  2245. <section class="fsfb-modal-body">
  2246. <!-- Checkboxes -->
  2247. <div><span>Chat Copy/Cut/Paste</span> - allows you to use the commands in chat (e.g. Ctrl + V becomes avaiable inside chat)</div>
  2248. <div><span>Anti-AFK</span> - prevents you from automatically disconnecting after 10 minutes</div>
  2249. <div><span>Anti-Invis</span> - shows you players even when they have the invisibility ability active</div>
  2250. <div><span>Linesplit Toggle</span> - enabled means that if you press the linesplit hotkey, it will turn linesplitting on until the key is pressed again (in contrast to stopping the linesplit when key is released)</div>
  2251. <div><span>Change Page Title</span> - changes the tab's title to just "Agma.io" with the current username</div>
  2252. <div><span>Hide Shouts</span> - prevent megaphone shouts from showing up at all</div>
  2253. <div><span>Hold To Spam</span> - while the powerup's hotkey is held, it will continuously use the powerup</div>
  2254. <div><span>Show Portal Mass</span> - displays the predicted amount of times the portals in rooms 1 & 2 have been fed by players (not 100% accurate & doesn't work at all servers)</div>
  2255. <div><span>Power Spawns Overlay</span> - show the locations of where powerups/minion packs spawn with lower opacity (thanks to Light for helping with getting all of the power locations)</div>
  2256. <div><span>Quick Buy</span> - click plus sign (+) next to your powers (only if you set it to true in the code), then click on the powerup you want to buy</div>
  2257. <!-- Theme -->
  2258. <div><span>Food/Virus/Mothercell Color</span> - changes the color that's filling these to a custom one</div>
  2259. <div><span>Virus/Mothercell Stroke</span> - changes the color of the stroke (border/outline) to a custom one</div>
  2260. <div><span>Spiked Cells</span> - render all cells with the spikes from the infecton gamemode</div>
  2261. <div><span>Show Mass</span> - show the mass of all players' cells</div>
  2262. <div><span>Only My Skin</span> - hide all skins besides the one you're using</div>
  2263. <div><span>Only Party Skin</span> - hide all skins besides the ones people in your party are using</div>
  2264. <div><span>Only My Nick</span> - hide all nicks besides the one you're using</div>
  2265. <div><span>Only Party Nick</span> - hide all nicks besides the ones people in your party are using</div>
  2266. <!-- Hotkeys -->
  2267. <div><span>Shoot 7 Ejected</span> - press ejected mass hotkey 7 times (useful to prime room 1 or 2 portal when it's been reset</div>
  2268. <div><span>Linesplit Lock</span> - finds which direction your mouse is the closest to & puts mouse way off the map (towards that direction) so you can perform perfect linesplits without zooming out or precisely placing your mouse (feature and design inspired by <a href="https://greasyfork.org/en/scripts/404559-agma-io-linesplit-overlay" target="_blank">Wynell's script</a>)</div>
  2269. <div><span>Macrosplit Bots</span> - hold this key to macrosplit your bots without switching controls off of yourself</div>
  2270. <div><span>Hide UI</span> - press this key to toggle showing the game UI (intended for recording/screenshots)</div>
  2271. <div><span>Toggle Slow Feed</span> - (toggle) this presses eject mass hotkey at the defined interval (intended for feeding the gold block while AFK)</div>
  2272. <div><span>Slow Feed Speed</span> - the speed at which eject mass is pressed when slow-feeding</div>
  2273. <div><span>Quick Settings</span> - when the hotkey assigned is pressed, it will toggle the setting that is selected</div>
  2274. <div><span>Toggle Cursor Lock</span> - when pressed, this will keep cursor lock active until you press it again (also works when the tab is unfocused)</div>
  2275. <div><span>Fast Onesplit</span> - performs a fast onesplit (Onesplit -> Freeze -> Unfreeze); speed is dependent fps (low fps indicates slow CPU, slow CPU can mess timings up)</div>
  2276. <div><span>Fast Doublesplit</span> - performs a fast Doublesplit (Doublesplit -> Freeze -> Unfreeze); speed is dependent fps (low fps indicates slow CPU, slow CPU can mess timings up)</div>
  2277. <!-- UI Scaling -->
  2278. <div><span>Chat Size</span> - make the size of chat bigger/smaller</div>
  2279. <div><span>Inventory Size</span> - make the size of powerups inventory bigger/smaller</div>
  2280. <div><span>Statsbox Size</span> - make the size of XP/coins stats bigger/smaller</div>
  2281. <!-- (Ex/Im)port -->
  2282. <div><span>Export</span> - select the boxes of the settings you wish to export and press the button, a .txt file will be downloaded with your settings inside</div>
  2283. <div><span>Import</span> - select the boxes of the settings you wish to import and insert the exported settings into the input (note: settings will only be changed if they were selected in both export & import</div>
  2284. <!-- Passive features -->
  2285. <div><span>Hide Ads</span> - both video and image ads will be removed from the screen</div>
  2286. <div><span>Improved Shop</span> - added larger amounts that can be purchased at a time, can also buy a specified amount at one time</div>
  2287. <div><span>Sort Wearables</span> - wearables are automatically sorted by owned (the ones you own will be before all others)</div>
  2288. <div><span>Extra Bot Packs</span> - added hidden bot packs that can be purchased with coins (originally discovered by firebone)</div>
  2289. <div><span>Context Menu Copy Info</span> - right click on a player, then click on their cell icon to copy their skin ID to clipboard or click on their name to copy their nickname to clipboard</div>
  2290. <div><span>Copy Chat</span> - right click on screen, then click "Copy Chat Messages" to copy the currently visible chat messages to your clipboard</div>
  2291. <div><span>Abilities Remaining Time</span> - shows the remaining time left of abilities (only works if the abilities were purchased in the same browser)</div>
  2292. <div><span>Unlock Free Skins</span> - gives you access to the facebook & youtube free skins</div>
  2293. <div><span>Hover For Skin ID</span> - hovering skins in the skin menu will shop their ID</div>
  2294. <div><span>In Depth XP/Coins Stats</span> - click on coins/xp progress bar in top left to view respective statistics</div>
  2295. <div><span>XP Bar Decimals</span> - show the percentage up to 2 decimal places</div>
  2296. <div><span>White Border For Black Cells</span> - show a white border around black cells (from minion nuker) so they're easier to see with dark backgrounds</div>
  2297. <div><span>Inventory Single Row</span> - put powerups inventory on a single row instead of on 2 seperate rows (inspired by Principito)</div>
  2298. <div><span>Custom Backgrounds</span> - a few <a href="https://imgur.com/a/sTANNBE" target="_blank">backgrounds</a></div>
  2299. </section>
  2300. </div>
  2301. </div>`)
  2302.  
  2303. const styles = document.createElement('style');
  2304. styles.innerHTML = `
  2305. ${ inventorySingleRow && `
  2306. #inventory{
  2307. display: flex;
  2308. position: absolute;
  2309. left: 50%;
  2310. bottom: 8px;
  2311. transform: translateX(-50%);
  2312. }
  2313. .fsfb-inventories {
  2314. position: initial !important;
  2315. transform: initial !important;
  2316. }
  2317. `}
  2318. div.fsfb-slider{
  2319. display: flex;
  2320. align-items: center;
  2321. }
  2322. input[type="range"].fsfb-slider{
  2323. width: 58px;
  2324. display: inline;
  2325. position: absolute;
  2326. right: 5px;
  2327. }
  2328. #fsfb-minionNuker img{
  2329. margin-top: 2px;
  2330. }
  2331. .fsfb-shown{
  2332. display: block !important;
  2333. }
  2334. #fsfb-quickbuy{
  2335. justify-content: center;
  2336. align-items: center;
  2337. }
  2338. #fsfb-quickbuy-img{
  2339. height: 80%
  2340. }
  2341. .fsfb-bug-modal>div>div{
  2342. -webkit-box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
  2343. background: linear-gradient(to bottom,#3b414e 0,#302f33 100%);
  2344. border: 3px solid #232630;
  2345. }
  2346. .close.fsfb-btn{
  2347. position: absolute;
  2348. right: 10px;
  2349. top: 3px;
  2350. font-size: 60px;
  2351. }
  2352. .fsfb-modal-body>div{
  2353. color: ffffffb0;
  2354. margin: 10px 20px
  2355. }
  2356. .fsfb-modal-body>div>span{
  2357. color: white;
  2358. }
  2359. .fsfb-modal-body{
  2360. margin: 10px 10px;
  2361. font-size: 20px;
  2362. max-height: 600px;
  2363. overflow-y: auto;
  2364. }
  2365. .fsfb-modal-title{
  2366. text-align: center;
  2367. color: white;
  2368. }
  2369. .fsfb-hotkey{
  2370. background-color: #df901c;
  2371. color: #fff;
  2372. cursor: pointer;
  2373. text-align: center;
  2374. min-width: 40px;
  2375. max-width: 60px;
  2376. height: 18px;
  2377. line-height: 18px;
  2378. vertical-align: middle;
  2379. border-radius: 9px;
  2380. right: 5px;
  2381. position: absolute;
  2382. display: inline-block;
  2383. padding: 0 5px;
  2384. overflow: hidden;
  2385. opacity: 1;
  2386. }
  2387. .fsfb-modal-body::-webkit-scrollbar-thumb {
  2388. background-color: #57595b;
  2389. border: 1px solid black;
  2390. border-radius: 12px;
  2391. }
  2392. .fsfb-modal-body::-webkit-scrollbar {
  2393. border: 1px solid black;
  2394. background-color: #2523239e;
  2395. width: 15px;
  2396. border-radius: 12px;
  2397. }
  2398. .fsfb-modal-body::-webkit-scrollbar-track {
  2399. -webkit-box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75);
  2400. box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75);
  2401. border-radius: 12px;
  2402. }
  2403. .fsfb-hotkey:hover {
  2404. background-color: #f1a02d;
  2405. }
  2406. .fsfb-hotkey.selected{
  2407. background-color: #ff4;
  2408. color: #444;
  2409. }
  2410. #fsfb-settings-main p{
  2411. margin: 0;
  2412. display: inline-block;
  2413. margin-left: 4px;
  2414. }
  2415. #fsfb-settings-main{
  2416. display: -ms-grid;
  2417. display: grid;
  2418. -ms-grid-columns: 50% 50%;
  2419. grid-template-columns: 50% 50%;
  2420. }
  2421. #settingPage4::-webkit-scrollbar-thumb {
  2422. background-color: #ff9800c2;
  2423. border-radius: 12px;
  2424. border: 1px #000000c2 solid;
  2425. }
  2426. #settingPage4::-webkit-scrollbar {
  2427. border: 1px solid #00000085;
  2428. background-color: #2523239e;
  2429. width: 9px;
  2430. border-radius: 12px;
  2431. }
  2432. #settingPage4{
  2433. display: none;
  2434. max-height: 650px;
  2435. overflow-x: hidden;
  2436. }
  2437. .padbot10{
  2438. padding-bottom: 10px;
  2439. }
  2440. #fsfb-slowfeedtimer{
  2441. border: none;
  2442. width: 40px;
  2443. }
  2444. select.fsfb-quickchange{
  2445. background: none;
  2446. border: none;
  2447. height: 20px;
  2448. }
  2449. select.fsfb-quickchange:focus-visible{
  2450. outline: none;
  2451. }
  2452. select.fsfb-quickchange option{
  2453. background: #222;
  2454. }
  2455. .fsfb-sect-ch label{
  2456. display: flex;
  2457. align-items: center;
  2458. }
  2459. .fsfb-sect-ch label input{
  2460. margin: 0 2px 0 0;
  2461. }
  2462. #fsfb-sect-theme label input[type="color"]{
  2463. width: 14px;
  2464. height: 14px;
  2465. opacity: 0;
  2466. border: none;
  2467. background-color: white;
  2468. margin: 0;
  2469. cursor: pointer;
  2470. }
  2471. #fsfb-sect-theme label p{
  2472. min-width: 120px;
  2473. margin-left: 5px;
  2474. }
  2475. #fsfb-sect-theme label div{
  2476. border-radius: 4px;
  2477. border: 1px solid #ffffff29;
  2478. }
  2479. #fsfb-ximport-cont{
  2480. display: flex;
  2481. justify-content: space-around;
  2482. margin-top: 7px;
  2483. }
  2484. .fsfb-eximport{
  2485. background-color: #df901c;
  2486. color: white;
  2487. padding: 5px 17px;
  2488. border-radius: 25px;
  2489. cursor: pointer;
  2490. }
  2491. .hideMegaphone{
  2492. display: none !important;
  2493. }
  2494. .fsfb-fake{
  2495. color: #cbff4e !important;
  2496. }
  2497. #fsfb-extra-info{
  2498. margin: 10% 0 0 90%;
  2499. cursor: pointer;
  2500. }
  2501. #linesplit-markers div {
  2502. background-color: transparent;
  2503. height: 15px;
  2504. aspect-ratio: 1;
  2505. position: fixed;
  2506. z-index: 999;
  2507. border: 2px solid rgb(255 255 255 / 80%);
  2508. border-radius: 50%;
  2509. display: none;
  2510. }#linesplit-top {
  2511. top: -7.5px;
  2512. transform: translateX(-50%);
  2513. left: 50%;
  2514. }
  2515. #stats-container{
  2516. background: rgba(0,0,0,.5);
  2517. top: 200px;
  2518. position: absolute;
  2519. border: 1px white solid;
  2520. border-radius: 12px;
  2521. color:white;
  2522. left:30px;
  2523. }
  2524. #stats-info{
  2525. display: flex;
  2526. flex-direction: column;
  2527. justify-content: center;
  2528. font-size: 1.5vh;
  2529. }
  2530. #stats-main{
  2531. padding: 10px;
  2532. }
  2533. #stats-extra-info{
  2534. color: #00bbff;
  2535. font-size: 1.1vh;
  2536. margin-bottom: 2px;
  2537. display: block;
  2538. }
  2539. #stats-info div{
  2540. display:flex;
  2541. }
  2542. #stats-info div p{
  2543. margin: 0;
  2544. }
  2545. .stats-label{
  2546. min-width: 12.5vh;
  2547. }
  2548. .stats-completed{
  2549. margin: 0.35vh 0.3vh 0;
  2550. font-size: 1vh;
  2551. bottom: 0;
  2552. color: rgb(255, 255, 255, .8);
  2553. }
  2554. #stats-title{
  2555. display: flex;
  2556. align-items: center;
  2557. }
  2558. #stats-title div{
  2559. display: flex;
  2560. margin-left: auto;
  2561. font-size: 1.1vh;
  2562. cursor: pointer;
  2563. }
  2564. #linesplit-right {
  2565. right: -7.5px;
  2566. transform: translateY(-50%);
  2567. top: 50%;
  2568. }
  2569. #linesplit-bottom {
  2570. bottom: -7.5px;
  2571. transform: translateX(-50%);
  2572. left: 50%;
  2573. }
  2574. #linesplit-left {
  2575. left: -7.5px;
  2576. transform: translateY(-50%);
  2577. top: 50%;
  2578. }
  2579. .fuckAds{
  2580. transform: translateX(9999%) !important;
  2581. }
  2582. `
  2583. document.querySelector('body').append(styles);
  2584.  
  2585. const scripts = document.createElement('script');
  2586. scripts.innerHTML = `
  2587. function onlyNumberKey(e) {
  2588. const key = e.which ? e.which : e.keyCode;
  2589. return !(key > 31 && (key < 48 || key > 57));
  2590. }
  2591. `
  2592. document.querySelector('body').append(scripts);
  2593. // $('#gameSettingsTab a')[0].click();
  2594. // $('#settingTab4')[0].click()
  2595. };
  2596.  
  2597. document.readyState === 'complete' ? afterLoaded() : document.addEventListener("DOMContentLoaded", afterLoaded);