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-10-13 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name fsfb scripts
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2.0
  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.  
  17. /* settings that you can't change in UI but might interfere with other scripts */
  18. let hideAds = true,
  19. improvedShop = true,
  20. extraBotPacks = true,
  21. rightClickCopyChat = true,
  22. rightClickCopyInfo = true,
  23. showRemainingAbilityTime = true,
  24. unlockFreeSkins = true,
  25. hoverShowSkinID = true,
  26. coinXPstats = true,
  27. saveStatsBoxPosition = true,
  28. showXPdecimals = true,
  29. whiteBorder4BlackCells = true,
  30. sortWearablesByOwned = true,
  31. linesplitClosestSide = false, // make the linespli go to the closest side (adjusted) instead of closest bubble
  32. inventorySingleRow = false,
  33. friendDeclineAll = true,
  34. rainbowMapBorder = false,
  35. rainbowBorderSpeed = 5,
  36. extraChatCommands = true,
  37. chatPrefix = '/f ';
  38.  
  39.  
  40.  
  41. // ~~~~~~~~~ Don't change anything below this unless you know what you are doing ~~~~~~~~~
  42. const version = '1.2.0';
  43. let settings = {
  44. hotkeys: [
  45. {title: "Shoot 7 Ejected", id: "fsfb-key7Feed", key: 0, active: false}, // 0
  46. {title: "Linesplit Lock", id: "fsfb-linesplit", key: 0, active: false}, // 1
  47. {title: "Macro Split Bots", id: "fsfb-MacroSplitBots", key: 0, active: false}, // 2
  48. {title: "Hide UI", id: "fsfb-hideUI", key: 0, active: false}, // 3
  49. {title: "Toggle Cursor", id: "fsfb-togglecursor", key: 0, active: false} // 4
  50. ],
  51. fastsplit_hotkeys: [
  52. {title: "Fast Onesplit", id: "fsfb-fsOne", keyName: "", keyCode: 0, active: false}, // 0
  53. {title: "Fast Doublesplit", id: "fsfb-fsTwo", keyName: "", keyCode: 0, active: false}, // 1
  54. {title: "1st Delay (ms)", id: "fsfb-firstdelay", val: 60, active: false}, // 2
  55. {title: "2nd Delay (ms)", id: "fsfb-secdelay", val: 60, active: false} // 3
  56. ],
  57. checkboxes: [
  58. {title: "Chat Copy/Cut/Paste", id: "fsfb-copycutpaste", active: false}, // 0
  59. {title: "Anti-AFK", id: "fsfb-antiAFK", active: false}, // 1
  60. {title: "Anti-Invis", id: "fsfb-anticloak", active: false}, // 2
  61. {title: "Linesplit Toggle", id: "fsfb-linetoggle", active: false}, // 3
  62. {title: "Change Page Title", id: "fsfb-changetitle", active: false}, // 4
  63. {title: "Hide Shouts", id: "fsfb-hideshouts", active: false}, // 5
  64. {title: "Hold To Spam Rec/Spd", id: "fsfb-recospeed", active: false}, // 6
  65. {title: "Show Portal Mass", id: "fsfb-portalmass", active: false}, // 7
  66. {title: "Pow Spawns Overlay", id: "fsfb-powsoverlay", active: false}, // 8
  67. {title: "Quick Buy", id: "fsfb-qBuy", active: false}, // 9
  68. ],
  69. slowFeed: [
  70. {title: "Toggle Feed", id: "fsfb-slowFeed", key: 0, active: false},
  71. {title: "Feed Speed", id: "fsfb-slowfeedtimer", val: 100, active: false}
  72. ],
  73. quickSettings: [
  74. {id: "fsfb-quick-hotkey1", id1: "fsfb-quick-select1", set: "cSkins", key: 0, active: false},
  75. {id: "fsfb-quick-hotkey2", id1: "fsfb-quick-select2", set: "cWearables", key: 0, active: false},
  76. {id: "fsfb-quick-hotkey3", id1: "fsfb-quick-select3", set: "cFood", key: 0, active: false},
  77. {id: "fsfb-quick-hotkey4", id1: "fsfb-quick-select4", set: "cBubbleCells", key: 0, active: false}
  78. ],
  79. uiScaling: [
  80. // {title: "Chat Size", id: "fsfb-chatSize", level: 5},
  81. {title: "Inventory Size", id: "fsfb-invSize", level: 5},
  82. {title: "Statsbox Size", id: "fsfb-statsSize", level: 5}
  83. ],
  84. theme: [
  85. {title: "Food Color", id: "fsfb-check-foodcolor", id1: "fsfb-color-foodcolor", color: "#FFFFFF", active: false}, // 0
  86. {title: "Virus Color", id: "fsfb-check-viruscolor", id1: "fsfb-color-viruscolor", color: "#00ff00", active: false}, // 1
  87. {title: "Virus Stroke", id: "fsfb-check-virusstroke", id1: "fsfb-color-virusstroke", color: "#00ff00", active: false}, // 2
  88. {title: "Mothercell Color", id: "fsfb-check-msColor", id1: "fsfb-color-msColor", color: "#cd5564", active: false}, // 3
  89. {title: "Mothercell Stroke", id: "fsfb-check-msStroke", id1: "fsfb-color-msStroke", color: "#cd5564", active: false}, // 4
  90. {title: "Border Color", id: "fsfb-check-border", id1: "fsfb-color-border", color: "#CC3030", active: false} // 5
  91. ],
  92. theme_boxes: [
  93. {title: "Fancy Bubble Cells", id: "fsfb-bublecell", active: false}, // 0
  94. {title: "Show Player Mass", id: "fsfb-showmass", active: false}, // 1
  95. {title: "Only My Skin", id: "fsfb-myskins", active: false}, // 2
  96. {title: "Only Party Skins", id: "fsfb-partyskins", active: false}, // 3
  97. {title: "Only My Nick", id: "fsfb-mynick", active: false}, // 4
  98. {title: "Only Party Nicks", id: "fsfb-partynicks", active: false}, // 5
  99. {title: "Spiked Cells", id: "fsfb-spikedcells", active: false}, // 6
  100. {title: "Reverse Cell Order", id: "fsfb-revcell", active: false}, // 7
  101. {title: "Render Portals Top", id: "fsfb-portalstop", active: false}, // 8
  102. ],
  103. export_import: [
  104. {title: "Game Settings", id: "fsfb-game-settings", active: false},
  105. {title: "Game Controls", id: "fsfb-game-controls", active: false},
  106. {title: "Custom Background", id: "fsfb-custom-bg", active: false},
  107. {title: "Script Settings", id: "fsfb-script-settings", active: false},
  108. {title: "Script Theme", id: "fsfb-theme-settings", active: false}
  109. ]
  110. }, misc_settings = {
  111. abil: {},
  112. bots: {},
  113. statsPos: null,
  114. statsSettings: {
  115. xp: {
  116. lvlcomp: true,
  117. rem: true,
  118. projhr: true,
  119. lasthr: true,
  120. lastmin: true,
  121. lastsec: true,
  122. mean: true,
  123. median: true,
  124. sd: true,
  125. sesh: true,
  126. seshlength: true,
  127. lifetime: true
  128. },
  129. coins: {
  130. rem: true,
  131. projhr: true,
  132. lasthr: true,
  133. lastmin: true,
  134. mean: true,
  135. median: true,
  136. sd: true,
  137. sesh: true,
  138. seshlength: true
  139. }
  140. }
  141. }
  142.  
  143. 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 }
  144. 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: "'"};
  145.  
  146. const set = (name, obj) => typeof GM_setValue != "function" ? localStorage.setItem(name, JSON.stringify(obj)) : GM_setValue(name, obj),
  147. 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);
  148.  
  149. if(typeof unsafeWindow === 'undefined') unsafeWindow = window;
  150.  
  151. const saveSettings = () => set("fsfb-scripts", settings);
  152. const getSettings = () => {
  153. let settingsPrev = get("fsfb-scripts", settings);
  154. for(let i in settingsPrev) {
  155. for(let j in settingsPrev[i]) {
  156. for(let x in settings){
  157. for(let y in settings[x]){
  158. if(settingsPrev[i][j].id == settings[x][y].id) settings[x][y] = settingsPrev[i][j];
  159. }
  160. }
  161. }
  162. }
  163. }
  164. const getMiscSettings = () => {
  165. let prevSettings = get("fsfb-misc", misc_settings);
  166. misc_settings = {...misc_settings, ... prevSettings};
  167. }
  168. getSettings();
  169. getMiscSettings();
  170. const getKey = id => {
  171. const $ = unsafeWindow.jQuery;
  172. const name = $("#" + id).text();
  173. return txtMappings[name] == null ? name.charCodeAt(0) : txtMappings[name];
  174. }
  175.  
  176. const getName = key => keyCodeMappings[key] == null ? String.fromCharCode(key) : keyCodeMappings[key];
  177.  
  178. const levelSum = lvl => lvl * (lvl - 1) / 2,
  179. range = arr => Math.max(...arr) - Math.min(...arr),
  180. sigma = arr => arr.reduce((a, b) => a + b),
  181. mean = arr => sigma(arr) / arr.length,
  182. variance = arr => arr.reduce((a, b) => a + (b - mean(arr)) ** 2, 0) / arr.length,
  183. standardDeviation = arr => Math.sqrt(variance(arr)),
  184. ascending = arr => arr.sort((a, b) => a - b),
  185. getIQR = arr => quartile(arr, .75) - quartile(arr, .25),
  186. round = (num, places) => Math.round(num * +("1e" + (places ?? 0))) / +("1e" + (places ?? 0));
  187. const median = arr => {
  188. const mid = ~~(arr.length / 2),
  189. asc = ascending(arr);
  190. return arr.length % 2 !== 0 ? asc[mid] : (asc[mid - 1] + asc[mid]) / 2;
  191. }
  192. const getProperty = (arr, property) => {
  193. let newArr = [];
  194. for (let i of arr) newArr.push(i[property]);
  195. return newArr;
  196. }
  197. const quartile = (arr, q) => {
  198. const sorted = ascending(arr),
  199. pos = (sorted.length - 1) * q,
  200. base = ~~pos,
  201. rest = pos - base;
  202. return sorted[base + 1] !== null ? sorted[base] + rest * (sorted[base + 1] - sorted[base]) : sorted[base]
  203. }
  204. const checkOutliers = (arr, returnOutliers) => {
  205. let nonOutliers = [], outliers = [];
  206. const IQR = getIQR(arr),
  207. Q1 = quartile(arr, .25),
  208. Q3 = quartile(arr, .75);
  209. for (let i of arr) i < Q1 - 1.5 * IQR || i > Q3 + 1.5 * IQR ? outliers.push(i) : nonOutliers.push(i);
  210. return returnOutliers ? outliers : nonOutliers;
  211. }
  212. const msToTime = ms => {
  213. let sec = ~~((ms / 1e3) % 60),
  214. min = ~~((ms / 6e4) % 60),
  215. hr = ~~(ms / 36e5);
  216. return (hr < 10 ? "0" + hr : hr) + ":" + (min < 10 ? "0" + min : min) + ":" + (sec < 10 ? "0" + sec : sec);
  217. }
  218. const changeTitle = title => {
  219. if(document.title != title) document.title = title;
  220. };
  221.  
  222. if(!settings.checkboxes[5].active) changeTitle('Agma.io');
  223.  
  224. if(unlockFreeSkins){
  225. const ytSkins = ["", 56, 1657, 2281, 2282, 2297, 2331, 2529, 2626, 2683, 2816, 2832];
  226. for (let i of ytSkins) localStorage.setItem('ytSkin' + i, '1');
  227. localStorage.setItem('fbSkin', '1');
  228. }
  229.  
  230. ['paste', 'copy', 'cut'].forEach(a => {
  231. unsafeWindow.addEventListener(a, e => {
  232. const $ = unsafeWindow.jQuery;
  233. if(!$('#fsfb-copycutpaste').is(':checked')) return;
  234. e.stopImmediatePropagation();
  235. }, true)
  236. });
  237.  
  238. const afterLoaded = () => {
  239. const $ = unsafeWindow.jQuery,
  240. swal = unsafeWindow.swal;
  241. // attempt to prevent the script from being active on subpages of agma.io
  242. if($ == null || $('#friendResizer').length < 1 || $('#megaholder').length < 1 || $('#preroll').length < 1) return;
  243.  
  244. $('.setting-tablink').css({'width' : '30%', "font-size" : "font-size: calc(0.3vw + 7.5px);"});
  245. $('#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>`);
  246. $('#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-fastsplit" 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>`);
  247. $('.container').eq(0).css("max-width", "1250px");
  248. $('#fsfb-sect-checkbox').append(`<p class="hotkey-paragraph">Script Features</p>`);
  249.  
  250. // add checkbox HTML
  251. for(let i of settings.checkboxes){
  252. $('#fsfb-sect-checkbox').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  253. $( "#" + i.id).change(function() {
  254. changeSettings(this.id, $(this).is(':checked'));
  255. });
  256. }
  257.  
  258. // add import/export HTML
  259. $('#fsfb-sect-imexport').append(`<p class="hotkey-paragraph">Import/Export</p>`);
  260. for(let i of settings.export_import){
  261. $('#fsfb-sect-imexport').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  262. $( "#" + i.id).change(function() {
  263. changeSettings(this.id, $(this).is(':checked'));
  264. });
  265. }
  266. $('#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>`);
  267.  
  268. $('#fsfb-sect-theme').append(`<p class="hotkey-paragraph">Game Theme</p`)
  269. for(let i of settings.theme){
  270. $('#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>`);
  271. $( "#" + i.id).change(function() {
  272. changeSettings(this.id, $(this).is(':checked'));
  273. });
  274. $( "#" + i.id1).change(function() {
  275. changeSettings(this.id, this.value);
  276. $(this).parent().css('background-color', this.value); // bcs the regular [input="color"] looks rly shit, change color of overlayed div instead
  277. });
  278. }
  279. for(let i of settings.theme_boxes){
  280. $('#fsfb-sect-theme').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  281. $( "#" + i.id).change(function() {
  282. changeSettings(this.id, $(this).is(':checked'));
  283. });
  284. }
  285.  
  286. $('#fsfb-sect-hotkeys').append(`<p class="hotkey-paragraph">Script Hotkeys</p>`);
  287.  
  288. const checkHotkeyClicked = (e, thing) => {
  289. if (e.target.id == thing.id && !thing.active){
  290. $('#' + thing.id).addClass('selected');
  291. thing.active = true;
  292. keysChanging = true; // prevent features from triggering when setting hotkey
  293. } else {
  294. thing.active = false;
  295. $('#' + thing.id).removeClass('selected');
  296. }
  297. }
  298. const checkNewHotkey = (e, thing) => {
  299. if (!thing.active) return;
  300. thing.key = e.keyCode;
  301. $('#' + thing.id).text(getName(e.keyCode));
  302. $('#' + thing.id).removeClass('selected');
  303. thing.active = false;
  304. saveSettings();
  305. e.preventDefault();
  306. }
  307. const checkFsHotkey = (e, thing) => {
  308. if (!thing.active) return;
  309. thing.key = e.keyCode;
  310. thing.keyName = e.key;
  311. $('#' + thing.id).text(getName(e.keyCode));
  312. $('#' + thing.id).removeClass('selected');
  313. thing.active = false;
  314. saveSettings();
  315. e.preventDefault();
  316. }
  317.  
  318. const checkPowerupClicked = e => {
  319. if(!quickBuying || !e?.originalEvent?.isTrusted || $(e.target).attr('class') == 'purchase-btn confirmation' || $(e.target).attr('class') == 'megaphone-btn') return;
  320. let pwID;
  321. switch (e.target.id) {
  322. case 'invWall':
  323. pwID = 33;
  324. break;
  325. case 'invAntiFreeze':
  326. pwID = 35;
  327. break;
  328. case 'invAntiRecombine':
  329. pwID = 34;
  330. break;
  331. case 'invShield':
  332. pwID = 38;
  333. break;
  334. case 'invFrozenVirus':
  335. pwID = 36;
  336. break;
  337. case 'invRecombine':
  338. pwID = 1;
  339. break;
  340. case 'invSpeed':
  341. pwID = 2;
  342. break;
  343. case 'invGrowth':
  344. pwID = 6;
  345. break;
  346. case 'invSpawnVirus':
  347. pwID = 7;
  348. break;
  349. case 'invSpawnMothercell':
  350. pwID = 8;
  351. break;
  352. case 'invSpawnPortal':
  353. pwID = 9;
  354. break;
  355. case 'invSpawnGoldOre':
  356. pwID = 10;
  357. break;
  358. case 'invFreeze':
  359. pwID = 5;
  360. break;
  361. case 'inv360Shot':
  362. pwID = 30;
  363. break;
  364. case 'fsfb-minionNuker':
  365. pwID = 39;
  366. break;
  367. case 'fsfb-quickMega':
  368. pwID = 14;
  369. break;
  370. case 'fsfb-quickbuy-img':
  371. quickBuying = true;
  372. return;
  373. default:
  374. quickBuying = false;
  375. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  376. $('#fsfb-quickbuy').removeClass('activatedInv')
  377. curserMsg('Quick buy deactivated.', 'red');
  378. return;
  379. }
  380. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  381. const waitUntil1 = (condition) => new Promise(resolve => {
  382. let interval = setInterval(() => {
  383. $('.confirm')[0].click();
  384. condition() && (clearInterval(interval), resolve());
  385. }, 25);
  386. setTimeout(() => { (clearInterval(interval), resolve()) }, 1e4);
  387. });
  388. setTimeout(() => {
  389. $('.confirm')[0].addEventListener('click', async e => {
  390. if(!e.isTrusted) return;
  391. $('.sweet-alert, .sweet-overlay').addClass('fsfb-hidden');
  392. setTimeout(async() => {
  393. await waitUntil1(() => !$('.sweet-alert').hasClass('visible'));
  394. if($('.sweet-alert').hasClass('visible')) return;
  395. await sleep(100);
  396. $('.sweet-alert, .sweet-overlay').removeClass('fsfb-hidden');
  397. }, 1e3);
  398. })
  399. }, 500);
  400. setTimeout(() => $('.confirm').removeAttr('disabled'), 600);
  401.  
  402. if(pwID == 14) $('.megaphone-btn')[0].click();
  403. else $('.purchase-btn.confirmation[item="' + pwID + '"]')[0].click();
  404.  
  405. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  406. $('#fsfb-quickbuy').removeClass('activatedInv')
  407. quickBuying = false;
  408. }
  409.  
  410. const slowfeedhotkey = settings.slowFeed[0];
  411.  
  412. for(let i of settings.hotkeys){
  413. $('#fsfb-sect-hotkeys').append(`<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>`);
  414. $('#' + i.id).on('contextmenu', e => {
  415. $('#' + i.id).text('');
  416. i.key = 0;
  417. saveSettings();
  418. e.preventDefault();
  419. });
  420. }
  421.  
  422.  
  423. const typing = () => $('input, textarea').is(':focus');
  424. const sleep = ms => new Promise(r => setTimeout(r, ms));
  425. const press = key => {
  426. unsafeWindow.onkeydown({ keyCode: key });
  427. unsafeWindow.onkeyup({ keyCode: key });
  428. }
  429. let fsCheck;
  430. const fastSplit = async(a) => {
  431. if(!fsCheck) return void(fsCheck = !0);
  432. /* const fps = +$('#fps').text();
  433. 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)
  434. if(fps > 55){ // 55+ fps
  435. delay1 = 60;
  436. delay2 = 60;
  437. } else if(fps > 30 && fps < 55){ // 31-54 fps
  438. delay1 = 65;
  439. delay2 = 65;
  440. } else if(fps > 10 && fps < 31){ // 11 - 30 fps
  441. delay1 = 70;
  442. delay2 = 70;
  443. } else if(fps < 11){ // less than 11 fps
  444. delay1 = 80;
  445. delay2 = 80;
  446. }
  447. if(overrideFastsplitDelay){
  448. delay1 = fastSplitDelay1;
  449. delay2 = fastSplitDelay2;
  450. } */
  451. if([39, 37, 2, 4, 6].indexOf(currentServerId) != -1 || !a) await sleep(settings.fastsplit_hotkeys[2].val);
  452. press(getKey("keyFreezeSelf"));
  453. await sleep(settings.fastsplit_hotkeys[3].val);
  454. press(getKey("keyFreezeSelf"));
  455. }
  456. setTimeout(fastSplit, 120);
  457.  
  458. let cursorLockActivated = false, _onblur;
  459. const waitForBlur = () => {
  460. if(unsafeWindow.onblur != null){
  461. const oldBlur = unsafeWindow.onblur
  462. unsafeWindow.onblur = function(){
  463. spamRec = false;
  464. spamSpeed = false;
  465. splittingbots = false;
  466. if(!$('#fsfb-linetoggle').is(':checked')){
  467. $("#linesplit-markers div").hide();
  468. linesplitting = false;
  469. }
  470. return oldBlur.apply(this, arguments);
  471. }
  472. _onblur = unsafeWindow.onblur
  473. } else {
  474. setTimeout(waitForBlur, 400);
  475. }
  476. };
  477. waitForBlur();
  478.  
  479. // hook for typing in chat w/ cursor lock
  480. const waitForKeydown = () => {
  481. if(unsafeWindow.onkeyup != null){
  482. const _keydown = unsafeWindow.onkeyup;
  483. unsafeWindow.onkeyup = function(){
  484. if(arguments[0]?.keyCode != getKey('keyFixedMouse') || arguments[0]?.target?.id != 'chtbox' || !cursorLockActivated) _keydown.apply(this, arguments);
  485. }
  486. } else {
  487. setTimeout(waitForKeydown, 400);
  488. }
  489. };
  490. waitForKeydown();
  491.  
  492. const toggleCursorLock = () => {
  493. cursorLockActivated = !cursorLockActivated;
  494. if(cursorLockActivated){
  495. unsafeWindow.onblur = function(){
  496. unsafeWindow.onkeyup({keyCode: getKey('keyMacroSplit')});
  497. unsafeWindow.onkeyup({keyCode: getKey('keyMacroFeed')});
  498. unsafeWindow.onkeyup({keyCode: getKey('keyMultiFeed')});
  499. spamRec = false;
  500. spamSpeed = false;
  501. splittingbots = false;
  502. if(!$('#fsfb-linetoggle').is(':checked')){
  503. $("#linesplit-markers div").hide();
  504. linesplitting = false;
  505. }
  506. }
  507. } else {
  508. unsafeWindow.onblur = _onblur;
  509. }
  510. cursorLockActivated ? unsafeWindow.onkeydown({keyCode: 67}) : unsafeWindow.onkeyup({keyCode: 67});
  511. }
  512.  
  513. Object.defineProperty(KeyboardEvent.prototype, 'keyCode', {
  514. get: function() {
  515. switch (this.key.toLowerCase()) {
  516. case settings.fastsplit_hotkeys[0].keyName.toLowerCase(): return getKey("keySplit");
  517. case settings.fastsplit_hotkeys[1].keyName.toLowerCase(): return getKey("keyDoubleSplit");
  518. default: return this.which;
  519. }
  520. }
  521. });
  522.  
  523. let slowfeeding = !1, linesplitting = !1, hiddenUI = !1, splittingbots = !1, spamRec = !1, spamSpeed = !1;
  524. const pressed = e => {
  525. const key = e.which ? e.which : e.keyCode;
  526. if($('textarea').is(':focus')) e.stopImmediatePropagation();
  527. if(typing() || keysChanging || e.key == undefined || e.keyCode == undefined) return;
  528. if(key == 27 && quickBuying){ // esc pressed
  529. quickBuying = false;
  530. $('#fsfb-quickbuy').removeClass('activatedInv');
  531. curserMsg('Quick buy deactivated.', 'red');
  532. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  533. e.preventDefault();
  534. e.stopImmediatePropagation();
  535. }
  536. if(key == settings.hotkeys[0].key){ // 7 feed
  537. let i = 1;
  538. let interval = setInterval(() => {
  539. press(getKey("keyMacroFeed"));
  540. if(++i > 7) clearInterval(interval);
  541. }, 85);
  542. e.preventDefault();
  543. }
  544. if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  545. linesplitting = true;
  546. linesplit();
  547. $("#linesplit-markers div").show();
  548. e.preventDefault();
  549. }
  550. if(key == settings.hotkeys[1].key && $('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  551. linesplitting = !linesplitting;
  552. if(linesplitting){
  553. $("#linesplit-markers div").show();
  554. linesplit();
  555. } else {
  556. $("#linesplit-markers div").hide();
  557. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  558. }
  559. e.preventDefault();
  560. }
  561. if(key == settings.hotkeys[2].key){ // macro split bots
  562. splittingbots = true;
  563. const splittingBots = () => {
  564. if(!splittingbots) return;
  565. press(getKey("keySplitBots"));
  566. setTimeout(splittingBots, 50);
  567. }
  568. splittingBots();
  569. e.preventDefault();
  570. }
  571. if(key == settings.hotkeys[3].key){ // hide ui
  572. hiddenUI = !hiddenUI;
  573. hiddenUI ? _replaceCSS('hideUI-css', '.hideUI{ display: none !important;}') : _replaceCSS('hideUI-css', ''); // replacing CSS bcs class is less likely to be overriden
  574. e.preventDefault();
  575. }
  576. if(key == settings.hotkeys[4].key){ // toggle cursor lock
  577. toggleCursorLock();
  578. e.preventDefault();
  579. }
  580. if(key == getKey("keyFixedMouse")){ // real cursor lock key is pressed
  581. cursorLockActivated = false;
  582. unsafeWindow.onblur = _onblur;
  583. }
  584. if(settings.fastsplit_hotkeys[0].keyName != undefined && e.key.toLowerCase() == settings.fastsplit_hotkeys[0].keyName.toLowerCase() && e.keyCode != 0){ // fast onesplit
  585. fastSplit(!0);
  586. }
  587. if(settings.fastsplit_hotkeys[1].keyName != undefined && e.key.toLowerCase() == settings.fastsplit_hotkeys[1].keyName.toLowerCase() && e.keyCode != 0){ // fast doublesplit
  588. fastSplit(!1);
  589. }
  590. if(key == settings.slowFeed[0].key){ // toggle feed
  591. slowfeeding = !slowfeeding;
  592. const feeding = () => {
  593. if(!slowfeeding) return;
  594. press(getKey("keyMacroFeed"));
  595. setTimeout(feeding, settings.slowFeed[1].val);
  596. }
  597. feeding();
  598. e.preventDefault();
  599. }
  600. if(key == settings.quickSettings[0].key){ // quick settings 1
  601. let el = $('#' + settings.quickSettings[0].set);
  602. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  603. else el.unbind().click();
  604. e.preventDefault();
  605. }
  606. if(key == settings.quickSettings[1].key){ // quick settings 2
  607. let el = $('#' + settings.quickSettings[1].set);
  608. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  609. else el.unbind().click();
  610. e.preventDefault();
  611. }
  612. if(key == settings.quickSettings[2].key){ // quick settings 3
  613. let el = $('#' + settings.quickSettings[2].set);
  614. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  615. else el.unbind().click();
  616. e.preventDefault();
  617. }
  618. if(key == settings.quickSettings[3].key){ // quick settings 4
  619. let el = $('#' + settings.quickSettings[3].set);
  620. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  621. else el.unbind().click();
  622. e.preventDefault();
  623. }
  624. if($('#fsfb-recospeed').is(':checked') && key == getKey("keyRecombine")){
  625. spamRec = true;
  626. const spammingRec = () => {
  627. if(!spamRec) return;
  628. press(getKey("keyRecombine"));
  629. setTimeout(spammingRec, 10);
  630. }
  631. spammingRec();
  632. e.preventDefault();
  633. }
  634. if($('#fsfb-recospeed').is(':checked') && key == getKey("keySpeed")){
  635. spamSpeed = true;
  636. const spammingSpeed = () => {
  637. if(!spamSpeed) return;
  638. press(getKey("keySpeed"));
  639. setTimeout(spammingSpeed, 10);
  640. }
  641. spammingSpeed();
  642. e.preventDefault();
  643. }
  644. }
  645.  
  646. const released = key => {
  647. if(typing() || keysChanging) return;
  648. if(key == settings.hotkeys[2].key) splittingbots = false; // macro split bots
  649. if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock
  650. linesplitting = false;
  651. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  652. $("#linesplit-markers div").hide();
  653. }
  654. if(key == getKey("keyRecombine")) spamRec = false;
  655. if(key == getKey("keySpeed")) spamSpeed = false;
  656. }
  657. let pwSpawnCheck = false;
  658. const changeSettings = (ID, a) => {
  659. for(let i of settings.uiScaling) if(i.id == ID) i.level = a;
  660. for(let i of settings.checkboxes) if(i.id == ID) i.active = a;
  661. for(let i of settings.export_import) if(i.id == ID) i.active = a;
  662. for(let i of settings.theme_boxes) if(i.id == ID) i.active = a;
  663. for(let i of settings.theme){
  664. if(i.id == ID) i.active = a
  665. if(i.id1 == ID) i.color = a;
  666. }
  667. customCells = $("#fsfb-sect-theme>label>input, #fsfb-powsoverlay, #fsfb-anticloak").is(":checked");
  668. if(ID == "fsfb-hideshouts") a ? $('#megaholder').addClass('hideMegaphone') : $('#megaholder').removeClass('hideMegaphone');
  669. if(ID == "fsfb-qBuy") a ? $('#fsfb-quickbuy').css('display', 'flex') : $('#fsfb-quickbuy').css('display', 'none');
  670. if(ID == "fsfb-bublecell" && !$("#cBubbleCells").is(":checked") && a) $('#cBubbleCells').unbind().click();
  671. if(ID == "fsfb-showmass" && !$("#cMass").is(":checked") && a) $('#cMass').unbind().click();
  672. if((ID == "fsfb-myskins" || ID == "fsfb-partyskins") && !$("#cSkins").is(":checked") && a) $('#cSkins').unbind().click();
  673. if((ID == "fsfb-mynick" || ID == "fsfb-partynicks") && !$("#cNames").is(":checked") && a) $('#cNames').unbind().click();
  674. if(ID == "fsfb-myskins" && a) $('#fsfb-partyskins').prop('checked', false).trigger('change');
  675. if(ID == "fsfb-partyskins" && a) $('#fsfb-myskins').prop('checked', false).trigger('change');
  676. if(ID == "fsfb-mynick" && a) $('#fsfb-partynicks').prop('checked', false).trigger('change');
  677. if(ID == "fsfb-partynicks" && a) $('#fsfb-mynick').prop('checked', false).trigger('change');
  678.  
  679. if(ID == "fsfb-revcell" && a) $('#fsfb-portalstop').prop('checked', false).trigger('change');
  680. if(ID == "fsfb-portalstop" && a) $('#fsfb-revcell').prop('checked', false).trigger('change');
  681.  
  682. if(ID == "fsfb-powsoverlay"){
  683. if(!a && pwSpawnCheck) curserMsg('To hide powerup spawns, you need to respawn or switch servers.', 'red');
  684. pwSpawnCheck = true;
  685. }
  686. if(ID == "fsfb-powsoverlay") svSwitch = true;
  687. let zoomLvl = "100%";
  688. switch(+a) {
  689. case 1:
  690. zoomLvl = "50%";
  691. break;
  692. case 2:
  693. zoomLvl = "70%";
  694. break;
  695. case 3:
  696. zoomLvl = "80%";
  697. break;
  698. case 4:
  699. zoomLvl = "90%";
  700. break;
  701. case 5:
  702. zoomLvl = "100%";
  703. break;
  704. case 6:
  705. zoomLvl = "110%";
  706. break;
  707. case 7:
  708. zoomLvl = "125%";
  709. break;
  710. case 8:
  711. zoomLvl = "150%";
  712. break;
  713. case 9:
  714. zoomLvl = "200%";
  715. break;
  716. default:
  717. zoomLvl = "100%";
  718. }
  719. if(ID == "fsfb-invSize") $('#inventory').css('zoom', zoomLvl);
  720. if(ID == "fsfb-statsSize") $('#stats-container').css('zoom', zoomLvl);
  721. saveSettings();
  722. }
  723.  
  724.  
  725. // add slowfeed HTML
  726. $('#fsfb-sect-slowfeed').append(`<p class="hotkey-paragraph">Slow-Feed</p>`);
  727. $('#fsfb-sect-slowfeed').append(`<br><p>${slowfeedhotkey.title}</p><div id="${slowfeedhotkey.id}" class="fsfb-hotkey"></div>`);
  728. $('#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>`);
  729.  
  730. $('#' + slowfeedhotkey.id).on('contextmenu', e => {
  731. $('#' + slowfeedhotkey.id).text('');
  732. slowfeedhotkey.key = 0;
  733. saveSettings();
  734. e.preventDefault();
  735. });
  736.  
  737. document.getElementById(settings.slowFeed[1].id).addEventListener("keypress", function(e){
  738. setTimeout(() => { // goes too fast or smth
  739. settings.slowFeed[1].val = +$('#' + settings.slowFeed[1].id).val();
  740. if($('#' + settings.slowFeed[1].id).val() == "") settings.slowFeed[1].val = 0;
  741. saveSettings();
  742. }, 5);
  743. });
  744.  
  745.  
  746. // add fastsplit HTML
  747. $('#fsfb-sect-fastsplit').append(`<p class="hotkey-paragraph">Fast-Split</p>`); // bookmark
  748. // for(let i of settings.fastsplit_hotkeys){
  749. for(let j = 0; j < settings.fastsplit_hotkeys.length; j++){
  750. let i = settings.fastsplit_hotkeys[j];
  751. $('#fsfb-sect-fastsplit').append(i.val == null ? `<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>` : `<br><p>${i.title}</p><input id="${i.id}" class="fsfb-hotkey" onkeypress="return onlyNumberKey(event)" maxlength="3"></input>`)
  752. if(i.val == null){
  753. $('#' + i.id).on('contextmenu', e => {
  754. $('#' + i.id).text('');
  755. i.key = 0;
  756. i.keyName = '';
  757. saveSettings();
  758. e.preventDefault();
  759. });
  760. } else {
  761. document.getElementById(i.id).addEventListener("keypress", function(e){
  762. setTimeout(() => { // goes too fast or smth
  763. settings.fastsplit_hotkeys[j].val = +$('#' + i.id).val();
  764. if($('#' + i.id).val() == "") settings.fastsplit_hotkeys[j].val = 0;
  765. saveSettings();
  766. }, 5);
  767. });
  768. }
  769. }
  770.  
  771. // add quick settings HTML
  772. $('#fsfb-sect-quickSettings').append(`<p class="hotkey-paragraph">Quick Settings</p>`);
  773.  
  774. for(let i of settings.quickSettings){
  775. $('#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><option value="fsfb-revcell">Rev Order</option><option value="fsfb-portalstop">Portals Top</option></select><div id="${i.id}" class="fsfb-hotkey"></div>`);
  776. $('#' + i.id).on('contextmenu', e =>{
  777. $('#' + i.id).text('');
  778. i.key = 0;
  779. saveSettings();
  780. e.preventDefault();
  781. });
  782. };
  783.  
  784. $('.fsfb-quickchange').on("change", function(){
  785. settings.quickSettings[+this.id.replace('fsfb-quick-select', '') - 1].set = this.value;
  786. saveSettings();
  787. });
  788.  
  789. // add UI scaling
  790. $('#fsfb-sect-uiScale').append(`<p class="hotkey-paragraph">UI Scaling</p>`);
  791. for(let i of settings.uiScaling){
  792. $('#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>`);
  793. $( "#" + i.id).change(function() {
  794. changeSettings(this.id, $(this).val());
  795. });
  796. };
  797.  
  798. // add event listeners
  799. let mosX, mosY,
  800. keys = {},
  801. keysChanging = false;
  802.  
  803. $(document).on('click', e => {
  804. for(let i = 0; i < settings.hotkeys.length; i++) checkHotkeyClicked(e, settings.hotkeys[i]);
  805. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) settings.fastsplit_hotkeys[i].val == null && checkHotkeyClicked(e, settings.fastsplit_hotkeys[i]);
  806. for(let i = 0; i < settings.quickSettings.length; i++) checkHotkeyClicked(e, settings.quickSettings[i]);
  807. checkHotkeyClicked(e, settings.slowFeed[0]);
  808. checkPowerupClicked(e);
  809. })
  810. .on('mousemove', e => {
  811. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  812. ({clientX: mosX, clientY: mosY} = e);
  813. if (linesplitting) linesplit();
  814. })
  815.  
  816. .on("keydown", e => {
  817. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  818. for(let i = 0; i < settings.hotkeys.length; i++) checkNewHotkey(e, settings.hotkeys[i]);
  819. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkFsHotkey(e, settings.fastsplit_hotkeys[i]);
  820. for(let i = 0; i < settings.quickSettings.length; i++) checkNewHotkey(e, settings.quickSettings[i]);
  821. checkNewHotkey(e, settings.slowFeed[0]);
  822. if (!(e.keyCode in keys)){
  823. keys[e.keyCode] = !0;
  824. pressed(e);
  825. }
  826. keysChanging = false;
  827. })
  828. .on("keyup", e => {
  829. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  830. delete keys[e.keyCode];
  831. released(e.keyCode);
  832. });
  833.  
  834.  
  835. const hashCode = (str, shift) => {
  836. let char, hash = 0;
  837. if (str.length == 0) return hash;
  838. for (let i = 0; i < str.length; i++) hash = (hash << shift) - hash + (char = str.charCodeAt(i)), hash |= 0;
  839. return hash;
  840. };
  841.  
  842. const RNG = (min, max) => Math.random() * (max - min) + min;
  843.  
  844. // chat cmds
  845. if(extraChatCommands){
  846. const $chtbox = $('#chtbox');
  847. $chtbox.on('keydown', e => {
  848. if(e.keyCode != 13) return;
  849. let newMsg = '', params, command, firstMatch = $chtbox.val().match(new RegExp(`(?<=((^|(^\/party +)|(^\/pm +\\S+ ))${chatPrefix}))\\S+(\\s+\\S+)*(?=($|\\s+))`, 'gmi'));
  850. if(firstMatch != null) {
  851. [command, ...params] = firstMatch[0].replace(/\s+/g, ' ').split(' ');
  852. } else return;
  853. const originalMsg = $chtbox.val().replace(new RegExp(`(?<=((^|(^\/party +)|(^\/pm +\\S+ ))))${chatPrefix}${firstMatch[0]}(?=($|\\s+))`, 'gmi'), '');
  854. coinsInfo();
  855. xpInfo();
  856. switch(command.toLowerCase()){
  857. case 'help':
  858. $('#fsfb-extra-info')[0].click();
  859. setTimeout(() => $('.fsfb-modal-body').scrollTop(1850), 200);
  860. newMsg = '';
  861. break;
  862. case 'bots':
  863. case 'bot':
  864. case 'min':
  865. case 'mins':
  866. case 'minion':
  867. case 'minions': {
  868. let minInfo = misc_settings.bots?.[currentUser];
  869. if((minsChatAmt[currentUser] != null && minsChatAmt[currentUser]?.amt && !minsChatAmt[currentUser]?.started) && (minInfo == null || (minInfo && Date.now() > minInfo.currMs + minInfo.rem))){ /* || (minInfo && Date.now() > minInfo.currMs + minInfo.rem) */
  870. newMsg = `${originalMsg}Minion Pack Unstarted: ${minsChatAmt[currentUser].amt}`;
  871. } else if(minsChatAmt[currentUser] != null && minsChatAmt[currentUser]?.started && minsChatAmt[currentUser]?.amt && minInfo == null ){
  872. newMsg = `${originalMsg}Minion Pack Activated: ${minsChatAmt[currentUser].amt}`;
  873. } else if(minsChatAmt[currentUser] != null && minsChatAmt[currentUser].amt && minInfo != null && (minInfo.active || minsChatAmt[currentUser].started) && minInfo.rem - (Date.now() - minInfo.currMs) > 0){
  874. newMsg = `${originalMsg}Minion Pack Activated: ${minsChatAmt[currentUser].amt}, with ${msToTime(minInfo.rem - (Date.now() - minInfo.currMs))} remaining`;
  875. } else {
  876. newMsg = `${originalMsg}Minion Pack Activated: none`;
  877. }
  878. break;
  879. }
  880. case 'pws':
  881. case 'pw':
  882. case 'powers':
  883. case 'power':
  884. case 'inv':
  885. case 'inventory': {
  886. curserMsg(`It's recommended to use ${chatPrefix}${command}1 and ${chatPrefix}${command}2 instead, so your chat messages aren't cut-off by the chat maxlength`, 'red', 8e3);
  887. updatePwCount();
  888. newMsg = `${originalMsg}Inv: `;
  889. for(let i in pws){ // rly shitty solution but can't think of a way better way to do it rn
  890. const amt = pws[i];
  891. newMsg += (amt + (amt == '' ? '' : ' ') + (amt == '' ? '' : (i + ', ')));
  892. }
  893. if(newMsg.length > 100){
  894. newMsg = `${originalMsg}Inv: `;
  895. for(let i in pws){
  896. const amt = pws[i];
  897. newMsg += (amt + (amt == '' ? '' : (i + ', ')));
  898. }
  899. if(newMsg.length > 100){
  900. newMsg = `${originalMsg}Inv: `;
  901. for(let i in pws){
  902. const amt = pws[i];
  903. newMsg += (amt + (amt == '' ? '' : (i + ',')));
  904. }
  905. if(newMsg.length > 100){
  906. newMsg = `${originalMsg}Inv: `;
  907. for(let i in pws){
  908. const amt = pws[i];
  909. newMsg += (amt + (amt == '' ? '' : '') + (amt == '' ? '' : (i[0] + i[1] + i[2]) + ','));
  910. }
  911. if(newMsg.length > 100){
  912. newMsg = `${originalMsg}Inv: `;
  913. for(let i in pws){
  914. const amt = pws[i];
  915. newMsg += (amt + (amt == '' ? '' : (i[0] + i[1]) + ','));
  916. }
  917. if(newMsg.length > 100){
  918. newMsg = `${originalMsg}Inv: `;
  919. for(let i in pws){
  920. const amt = pws[i];
  921. newMsg += (amt + (amt == '' ? '' : (i[0] + ',')));
  922. }
  923. }
  924. }
  925.  
  926. }
  927. }
  928. }
  929. newMsg = newMsg.replace(/,[^,]*$/g, '');
  930. if(newMsg == 'Inv: ') newMsg = 'Inv: no powers';
  931. break;
  932. }
  933. case 'totalpws':
  934. case 'totalpw':
  935. case 'totalpowers':
  936. case 'totalpower':
  937. case 'total':
  938. case 'totpw':
  939. newMsg = `${originalMsg}Total Powerups: ${$('.inventory-box>p').toArray().map(x => +x.innerText).reduce((a, b) => a + b)}`
  940. break;
  941. case 'xplevel':
  942. case 'levelxp':
  943. case 'lvlxp':
  944. case 'xpcompleted':
  945. case 'xp':
  946. newMsg = `${originalMsg}XP Completed: ${currentPercent ? String(Math.round(currentPercent * currentLevel * 1e3, 1)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "/" + (currentLevel * 1e3).toLocaleString('en-US') : "0/0"}`
  947. break;
  948. case 'level':
  949. case 'levels':
  950. case 'lvls':
  951. case 'lvl':
  952. case 'lvlcompleted':
  953. case 'lvlscompleted':
  954. newMsg = `${originalMsg}Level: ${currentLevel}, with ${round(currentPercent * 100, 3)}% completed`
  955. break;
  956. case 'coin':
  957. case 'coins':
  958. newMsg = `${originalMsg}Coins: ${String(currentCoins).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`
  959. break;
  960. case 'hours':
  961. case 'hrs':
  962. case 'hour':
  963. case 'hr':
  964. case 'timeplayed':
  965. newMsg = originalMsg + $('.timePlayed>span').text();
  966. break;
  967. case 'rank':
  968. case 'lvlrank':
  969. newMsg = `${originalMsg}My Rank: ${$('.ranking.text-left>span').text().match(/(?<=^Your rank: )\d+$/gm)?.[0]}`
  970. break;
  971. case 'ping':
  972. case 'delay':
  973. case 'ms':
  974. newMsg = `${originalMsg}My Ping: ${$('#ping').text()}`
  975. break;
  976. case 'fps':
  977. case 'frames':
  978. newMsg = `${originalMsg}My FPS: ${$('#fps').text()}`
  979. break;
  980. case 'topmass':
  981. case 'highscore':
  982. case 'highmass':
  983. case 'highestmass':
  984. newMsg = `${originalMsg}My Top Mass: ${$('#topMass').text()}`
  985. break;
  986. case 'cells':
  987. case 'cellcount':
  988. case 'cell':
  989. newMsg = `${originalMsg}My Cell Count: ${$('#cellsAmount').text()}`
  990. break;
  991. case 'pw1':
  992. case 'pws1':
  993. case 'power1':
  994. case 'powers1':
  995. case 'inv1':
  996. case 'inventory1':
  997. newMsg = getPowerMessage(1, originalMsg);
  998. break;
  999. case 'pw2':
  1000. case 'pws2':
  1001. case 'power2':
  1002. case 'powers2':
  1003. case 'inv2':
  1004. case 'inventory2':
  1005. newMsg = getPowerMessage(2, originalMsg);
  1006. break;
  1007. case 'pw3':
  1008. case 'pws3':
  1009. case 'power3':
  1010. case 'powers3':
  1011. case 'inv3':
  1012. case 'inventory3':
  1013. newMsg = getPowerMessage(3, originalMsg);
  1014. break;
  1015. case 'friends':
  1016. case 'friend':
  1017. case 'friendsonline':
  1018. case 'friendonline':
  1019. newMsg = `${originalMsg}Friends Online: ${$('#friendsLoggedInAmt').text() + $('#friendsTotalAmt').text()}`;
  1020. break;
  1021. case 'request':
  1022. case 'requests':
  1023. case 'friendrequest':
  1024. case 'friendrequests':
  1025. case 'friendreq':
  1026. case 'req':
  1027. newMsg = `${originalMsg}Friend Requests: ${$('#friendsRequestsAmt').text() === '' ? 'none' : $('#friendsRequestsAmt').text()}`;
  1028. break;
  1029. case 'gold':
  1030. case 'goldmem':
  1031. case 'goldmember':
  1032. case 'golddays':
  1033. case 'gm': {
  1034. const obj = accGoldMem[currentUser];
  1035. if(obj?.has == null){
  1036. newMsg = `${originalMsg}Days of Goldmember Remaining: none`;
  1037. break;
  1038. }
  1039. newMsg = `${originalMsg}Days Of Goldmember Remaining: ${obj.has || obj.days != null ? (obj.days + (obj.days == 1 ? ' Day' : ' Days')) : 'none'}`;
  1040. break;
  1041. }
  1042. case 'alive':
  1043. case 'alivetime':
  1044. case 'timealive':
  1045. newMsg = `${originalMsg}Time Alive: ${playerIsAlive() ? msToTime(Date.now() - timeAlive) : 'not alive'}`;
  1046. break;
  1047. case 'mass':
  1048. case 'currentmass':
  1049. newMsg = `${originalMsg}Current Mass: ${playerIsAlive() ? currentMass.toLocaleString('en-US') : 'none, not alive'}`;
  1050. break;
  1051. case 'user':
  1052. case 'username':
  1053. case 'usr':
  1054. case 'account':
  1055. case 'acc':
  1056. newMsg = `${originalMsg}My Username: ${currentUser == "Please Login First" ? "logged out" : currentUser}`
  1057. break;
  1058. case 'custom':
  1059. case 'customs':
  1060. case 'customskins':
  1061. case 'totalcustoms':
  1062. case 'totalskins':
  1063. if($('#publicSkinsPage').children().length == 0){
  1064. curserMsg(`Please load your custom skins before using this command`, 'red', 6e3);
  1065. newMsg = '';
  1066. break;
  1067. }
  1068. newMsg = `${originalMsg}My Total Custom Skins: ${$('[id^="skinCustomImg"').length}`
  1069. break;
  1070. case 'ownedwearables':
  1071. case 'wearables':
  1072. case 'wears':
  1073. case 'totalwearables':
  1074. case 'totalwears': {
  1075. if($('#phpWearables li').length <= 55){
  1076. curserMsg(`Please load your wearables before using this command`, 'red', 6e3);
  1077. newMsg = '';
  1078. break;
  1079. }
  1080. let wearsPrice = [0];
  1081. $('[id^="wearableUseBtn"]').each(function(){
  1082. wearsPrice.push(+$(this).parents().eq(0).siblings('span.win-price').text().replace(/,/g, ''))
  1083. });
  1084. newMsg = `${originalMsg}My Total Wearables: ${$('[id^="wearableUseBtn"]').length}, worth ${sigma(wearsPrice).toLocaleString('en-US')} coins`
  1085. break;
  1086. }
  1087. case 'cloak':
  1088. case 'invis':
  1089. case 'invisibility': {
  1090. let status, time;
  1091. $('#infoContent>p').each(function(){
  1092. if($(this).text().includes('Cloaked: ')) status = $(this).text().match(/(?<=Cloaked: ).+/gm);
  1093. if($(this).text().includes('Cloak Time: ')) time = $(this).text().match(/(?<=Cloak Time: ).+/gm);
  1094. })
  1095. newMsg = status == null || time == null ? `${originalMsg}Cloak inactive` : `${originalMsg}Cloak ${status}, with ${time} remaining`
  1096. break;
  1097. }
  1098. case 'addfriend':
  1099. case 'add':
  1100. if(params?.length == 0){
  1101. curserMsg(`Please add a username after the command, such as: ${chatPrefix}${command} Fishyyy`, 'red', 6e3);
  1102. newMsg = '';
  1103. break;
  1104. }
  1105. unsafeWindow.friendAdd(params[0]);
  1106. break;
  1107. case 'partymembers':
  1108. case 'partymember':
  1109. newMsg = $('#partyContent').children().length - 1 > 0 ? `${originalMsg}In a party, with ${$('#partyContent').children().length - 1} members` : `${originalMsg}Not in a party`;
  1110. break;
  1111. case 'players':
  1112. case 'ply':
  1113. case 'plyrs':
  1114. case 'serverplayers':
  1115. case 'totalplayers':
  1116. case 'online': {
  1117. let players = [], max = [];
  1118. $('[id^="serverPlayers"]').toArray().map(a => a.innerText).forEach( e => {
  1119. let [plys, mx] = e.split('/')
  1120. players.push(+plys);
  1121. max.push(+mx);
  1122. })
  1123. newMsg = `${originalMsg}Server Players: ${$('[id^="serverRow"].active>[id^="serverPlayers"]').text()}, Total Players: ${sigma(players) + ' / ' + sigma(max)}`
  1124. break;
  1125. }
  1126. case 'server':
  1127. newMsg = `${originalMsg}Currently playing in ${$('[id^="serverRow"].active>*').first().text()}`;
  1128. break;
  1129. case 'abil':
  1130. case 'abils':
  1131. case 'ability':
  1132. case 'abilities': { // not finished
  1133. let arr = [], newStr = '';
  1134. $('.checkmark').each(function(){
  1135. if($(this).css('display') == 'block') arr.push($(this).siblings().eq(1).attr('item'));
  1136. })
  1137. if(misc_settings.abil?.[currentUser] != null || arr.length){
  1138. const abil = misc_settings.abil?.[currentUser],
  1139. map = {
  1140. 18: 'Freeze',
  1141. 22: 'Invis Cloak',
  1142. 20: '2x Spawn',
  1143. 23: '2x Exp'
  1144. }
  1145. if(currentUser == "Please Login First"){
  1146. newMsg = `${originalMsg}Active Abilities: none`;
  1147. break;
  1148. }
  1149. for(let i of arr) newStr += map[i] + (abil?.[i] != null && 8.64e7 - (Date.now() - abil[i]) > 0 ? (' with ' + msToTime(8.64e7 - (Date.now() - abil[i])) + ' left, ') : ', ');
  1150. newMsg = `${originalMsg}Active Abilities: ${newStr == '' ? 'none' : newStr}`;
  1151. newMsg = newMsg.replace(/,[^,]*$/g, '');
  1152. } else {
  1153. newMsg = `${originalMsg}Active Abilities: none`;
  1154. }
  1155. break;
  1156. }
  1157. case 'xpproj':
  1158. case 'xpprojected':
  1159. case 'projectedxp':
  1160. case 'projxp':
  1161. case 'levelprojected':
  1162. case 'lvlproj':
  1163. case 'lvlprojected': {
  1164. const projectedHr = lastHrXP.length > 0 ? sigma(getProperty(lastHrXP.slice(-5), "gained")) * 12 : 0;
  1165. newMsg = `${originalMsg}Next Hour Projected XP: ${xpStatsInPercentages ? round(convertToPerc(projectedHr, currentLevel) * 100, 2) + '%' : round(projectedHr).toLocaleString('en-US')}`;
  1166. break;
  1167. }
  1168. case 'projcoins':
  1169. case 'projcoin':
  1170. case 'projectedcoin':
  1171. case 'projectedcoins':
  1172. case 'coinsproj':
  1173. case 'coinproj':
  1174. case 'coinprojected':
  1175. case 'coinsprojected': {
  1176. const projectedHr = lastHrCoins.length > 5 ? Math.round(sigma(getProperty(lastHrCoins.slice(-5), "gained")) * 12) : 0;
  1177. newMsg = `${originalMsg}Next Hour Projected Coins: ${projectedHr.toLocaleString('en-US')}`;
  1178. break;
  1179. }
  1180. case 'xpremaining':
  1181. case 'xprem':
  1182. case 'remainingxp':
  1183. case 'remxp': {
  1184. const xpRemaining = currentLevel ? currentLevel * 1e3 - currentPercent * currentLevel * 1e3 : 0,
  1185. newMsg = `${originalMsg}XP Remanining: ${xpStatsInPercentages ? round(convertToPerc(xpRemaining, currentLevel) * 100, 2) + '%' : round(xpRemaining).toLocaleString('en-US')}`;
  1186. break;
  1187. }
  1188. case 'coinsremaining':
  1189. case 'coinsrem':
  1190. case 'remainingcoins':
  1191. case 'remcoins': {
  1192. const coinsRemaining = currentCoins ? 25e4 - currentCoins % 25e4 : 0;
  1193. newMsg = `${originalMsg}Coins Remanining: ${coinsRemaining.toLocaleString('en-US')}`;
  1194. break;
  1195. }
  1196. case 'xplasthour':
  1197. case 'lasthourxp':
  1198. case 'hourxp':
  1199. case 'xphour': {
  1200. const lastHr = lastHrXP.length > 0 ? sigma(getProperty(lastHrXP, "gained")) : 0,
  1201. newMsg = `${originalMsg}XP Last Hour: ${xpStatsInPercentages ? round(convertToPerc(lastHr, currentLevel) * 100, 2) + '%' : round(lastHr).toLocaleString('en-US')}`;
  1202. break;
  1203. }
  1204. case 'coinslasthour':
  1205. case 'lasthourcoins':
  1206. case 'hourcoins':
  1207. case 'coinshour': {
  1208. const lastHr = lastHrCoins.length > 0 ? Math.round(sigma(getProperty(lastHrCoins, "gained"))) : 0
  1209. newMsg = `${originalMsg}Coins Last Hour: ${lastHr.toLocaleString('en-US')}`;
  1210. break;
  1211. }
  1212. case 'xplastmin':
  1213. case 'xplastminute':
  1214. case 'lastminxp':
  1215. case 'lastminutexp':
  1216. case 'minxp':
  1217. case 'minutexp':
  1218. case 'xpmin': {
  1219. const lastMin = lastMinXP.length > 0 ? sigma(getProperty(lastMinXP, "gained")) : 0;
  1220. newMsg = `${originalMsg}XP Last Minute: ${xpStatsInPercentages ? round(convertToPerc(lastMin, currentLevel) * 100, 2) + '%' : round(lastMin).toLocaleString('en-US')}`;
  1221. break;
  1222. }
  1223. case 'coinslastmin':
  1224. case 'coinslastminute':
  1225. case 'lastmincoins':
  1226. case 'lastminutecoins':
  1227. case 'coinsxp':
  1228. case 'minutecoins':
  1229. case 'coinsmin': {
  1230. const lastMin = lastMinCoins.length > 0 ? Math.round(sigma(getProperty(lastMinCoins, "gained"))) : 0;
  1231. newMsg = `${originalMsg}Coins Last Minute: ${lastMin.toLocaleString('en-US')}`;
  1232. break;
  1233. }
  1234. case 'xplast12s':
  1235. case 'xplast12sec':
  1236. case 'xplast12seconds':
  1237. case 'last12secondsxp':
  1238. case 'lastminutexp':
  1239. case 'xp12s':
  1240. case '12sxp':
  1241. case 'xp12sec': {
  1242. const last12sec = lastMinXP.length > 0 ? lastMinXP[lastMinXP.length - 1].gained : 0;
  1243. newMsg = `${originalMsg}XP Last 12 Seconds: ${xpStatsInPercentages ? round(convertToPerc(last12sec, currentLevel) * 100, 2) + '%' : round(last12sec).toLocaleString('en-US')}`;
  1244. break;
  1245. }
  1246. case 'xpsession':
  1247. case 'sessionxp':
  1248. case 'xpsesh':
  1249. case 'sesh':
  1250. case 'session':
  1251. case 'seshxp': {
  1252. const sessionXP = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0;
  1253. newMsg = `${originalMsg}Session XP: ${xpStatsInPercentages ? round(currentLevel && accounts[currentUser] ? ((round(currentPercent, 3) + currentLevel) - accounts[currentUser].lvl) * 100 : 0, 2) + '%' : round(sessionXP).toLocaleString('en-US')}, Session Length: ${msToTime(Date.now() - scriptStartXP)}`;
  1254. break;
  1255. }
  1256. case 'lifetimexp':
  1257. case 'xplifetime':
  1258. newMsg = `${originalMsg}Lifetime XP: ${round(currentXP ?? 0)}`;
  1259. break;
  1260. case 'coinssession':
  1261. case 'sessioncoins':
  1262. case 'coinssesh':
  1263. case 'seshcoins': {
  1264. const sessionCoins = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0;
  1265. newMsg = `${originalMsg}Session Coins: ${sessionCoins}, Session Length:${msToTime(Date.now() - scriptStartCoins)}`;
  1266. break;
  1267. }
  1268. case 'ratewaifu':
  1269. case 'waifu':
  1270. case 'waifurating':
  1271. case 'waifurate':
  1272. case 'howwaifu':
  1273. if(params?.length == 0){
  1274. if(currentUser == "Please Login First"){
  1275. newMsg = `${originalMsg}My Waifu Rating: 0 / 10`;
  1276. break;
  1277. }
  1278. newMsg = `${originalMsg}My Waifu Rating: ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 102.2)).slice(-3, -1) / 10)} / 10`;
  1279. break;
  1280. }
  1281. newMsg = `${originalMsg}${params[0]}'s Waifu Rating: ${Math.round(+String(Math.round(hashCode(params[0], 5) * 102.2)).slice(-3, -1) / 10)} / 10`;
  1282. break;
  1283. case 'ratepro':
  1284. case 'pro':
  1285. case 'prorating':
  1286. case 'prorate':
  1287. case 'howpro':
  1288. if(params?.length == 0){
  1289. if(currentUser == "Please Login First"){
  1290. newMsg = `${originalMsg}I am 0% pro`;
  1291. break;
  1292. }
  1293. newMsg = `${originalMsg}I am ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 194.3)).slice(-4, -1) / 10)}% pro`;
  1294. break;
  1295. }
  1296. newMsg = `${originalMsg}${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 5) * 194.3)).slice(-4, -1) / 10)}% pro`;
  1297. break;
  1298. case 'ratedog':
  1299. case 'dog':
  1300. case 'dograting':
  1301. case 'dograte':
  1302. case 'howdog':
  1303. if(params?.length == 0){
  1304. if(currentUser == "Please Login First"){
  1305. newMsg = `${originalMsg}I am 0% dog`;
  1306. break;
  1307. }
  1308. newMsg = `${originalMsg}I am ${Math.round(+String(Math.round(hashCode(currentUser, 6) * 189.3)).slice(-4, -1) / 10)}% dog`;
  1309. break;
  1310. }
  1311. newMsg = `${originalMsg}${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 6) * 189.3)).slice(-4, -1) / 10)}% dog`;
  1312. break;
  1313. case 'rateking':
  1314. case 'king':
  1315. case 'kingrating':
  1316. case 'kingrate':
  1317. case 'howking':
  1318. if(params?.length == 0){
  1319. if(currentUser == "Please Login First"){
  1320. newMsg = `${originalMsg}I am 0% king`;
  1321. break;
  1322. }
  1323. newMsg = `${originalMsg}I am ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 389.3)).slice(-4, -1) / 10)}% king`;
  1324. break;
  1325. }
  1326. newMsg = `${originalMsg}${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 5) * 389.3)).slice(-4, -1) / 10)}% king`;
  1327. break;
  1328. case 'dice':
  1329. case 'die':
  1330. case 'roll':
  1331. case 'rolldice': {
  1332. const sides = params?.length == 0 || isNaN(+params[0]) ? 6 : +params[0];
  1333. newMsg = `${originalMsg}Rolled a dice with ${sides.toLocaleString('en-US')}, landed on ${Math.round(RNG(1, sides)).toLocaleString('en-US')}`;
  1334. break;
  1335. }
  1336. case 'rng':
  1337. case 'random':
  1338. case 'randomnumber':
  1339. case 'number':
  1340. case 'num': {
  1341. const min = params?.length < 1 || isNaN(+params[0]) ? 0 : +params[0];
  1342. const max = params?.length < 2 || isNaN(+params[1]) ? 10 : +params[1];
  1343. if(min > max){
  1344. curserMsg(`Please make sure your minimum (${min}) is less than your maximum (${max})`, 'red', 5e3);
  1345. newMsg = '';
  1346. break;
  1347. }
  1348. newMsg = `${originalMsg}Generated a random number between ${min.toLocaleString('en-US')} and ${max.toLocaleString('en-US')}, chose: ${Math.round(RNG(min, max)).toLocaleString('en-US')}`;
  1349. break;
  1350. }
  1351. case 'flip':
  1352. case 'coinflip':
  1353. case 'heads':
  1354. case 'tails':
  1355. case 'flipcoin': {
  1356. newMsg = `${originalMsg}Coin flipped! Landed on ${Math.round(RNG(0, 1)) ? 'heads' : 'tails'}`;
  1357. break;
  1358. }
  1359. case 'script':
  1360. case 'version':
  1361. newMsg = `${originalMsg}Using fsfb script! Version ${version}`
  1362. break;
  1363. case 'time':
  1364. case 'localtime':
  1365. case 'localetime':
  1366. case 'date':
  1367. newMsg = `${originalMsg}My Time: ${new Date().toLocaleString()}`
  1368. break;
  1369. default:
  1370. newMsg = $chtbox.val();
  1371. break;
  1372. }
  1373. // (unsafeWindow.kfjsdafl != null) ? $chtbox.val(newMsg) : $chtbox.val(''), console.log(newMsg);;
  1374. $chtbox.val(newMsg)
  1375. })
  1376. }
  1377.  
  1378. // check if player is alive
  1379. let playerAlive = false, timeAlive;
  1380. unsafeWindow.playerIsAlive = () => playerAlive && $('#advert').css('display') != 'none' ? false : playerAlive;
  1381. const playerIsAlive = unsafeWindow.playerIsAlive;
  1382. const _setNick = unsafeWindow.setNick
  1383. unsafeWindow.setNick = function(){
  1384. if(arguments[1] || !playerAlive) timeAlive = Date.now();// respawned
  1385. playerAlive = true;
  1386. return _setNick.apply(this, arguments);
  1387. }
  1388. const _closeAdvert = unsafeWindow.closeAdvert
  1389. unsafeWindow.closeAdvert = function(){
  1390. playerAlive = false;
  1391. return _closeAdvert.apply(this, arguments);
  1392. }
  1393.  
  1394. const getPowerMessage = (line, firstMsg) => {
  1395. let obj = {
  1396. string1: firstMsg + 'Inv (1/?): ',
  1397. string2: firstMsg + 'Inv (2/?): ',
  1398. string3: firstMsg + 'Inv (3/?): '
  1399. }
  1400. updatePwCount();
  1401. const newPws = {
  1402. Recombine: pws.rec,
  1403. Speed: pws.spd,
  1404. Growth: pws.grw,
  1405. Virus: pws.vrs,
  1406. Mothercell: pws.mtcl,
  1407. Portal: pws.prtl,
  1408. 'Gold Block': pws.gblk,
  1409. Freeze: pws.fz,
  1410. Push: pws.psh,
  1411. Wall: pws.wall,
  1412. 'Anti-Freeze': pws.afz,
  1413. 'Anti-Recombine': pws.arc,
  1414. Shield: pws.shld,
  1415. 'Frozen Virus': pws.fzvs
  1416. }
  1417. for(let i in newPws){
  1418. let add = '';
  1419. add += newPws[i] == '' ? '' : newPws[i];
  1420. add += newPws[i] == '' ? '' : ' ';
  1421. add += newPws[i] == '' ? '' : (i + ', ');
  1422. if(obj.string1.length + add.length <= 100) obj.string1 += add;
  1423. else if(obj.string2.length + add.length <= 100) obj.string2 += add;
  1424. else obj.string3 += add;
  1425. }
  1426. if(obj.string1 == firstMsg + `Inv (1/?): ` && line == 1) return 'Inv (1/1): no powers'
  1427. if(obj['string' + line].str == firstMsg + `Inv (${line}/?): `){
  1428. curserMsg(`This inventory line doesn't exist! Try a smaller number`, 'red', 6e3);
  1429. return ''
  1430. }
  1431. let totalLines = 1;
  1432. if(obj.string3 == firstMsg + 'Inv (3/?): ' && obj.string2 != firstMsg + 'Inv (2/?): ') totalLines = 2;
  1433. else if(obj.string3 != firstMsg + 'Inv (3/?): ' && obj.string2 != firstMsg + 'Inv (2/?): ') totalLines = 3;
  1434.  
  1435. return line == 1 ? obj.string1.replace(/,[^,]*$/g, '').replace(/\?/g, totalLines) : line == 2 ? obj.string2.replace(/,[^,]*$/g, '').replace(/\?/g, totalLines) : obj.string3.replace(/,[^,]*$/g, '').replace(/\?/g, totalLines);
  1436. }
  1437.  
  1438. let pws = {rec: '', spd: '', grw: '', vrs: '', mtcl: '', prtl: '', gblk: '', fz: '', psh: '', wall: '', afz: '', arc: '', shld: '', fzvs: ''};
  1439. const updatePwCount = () => {
  1440. $('.inventory-box').each(function(){
  1441. const val = $(this).css('display') != 'none' ? $(this).children().eq(0).text() || '1' : '';
  1442. switch($(this)[0].id){
  1443. case 'invWall':
  1444. pws.wall = val;
  1445. break;
  1446. case 'invAntiFreeze':
  1447. pws.afz = val;
  1448. break;
  1449. case 'invAntiRecombine':
  1450. pws.arc = val;
  1451. break;
  1452. case 'invShield':
  1453. pws.shld = val;
  1454. break;
  1455. case 'invFrozenVirus':
  1456. pws.fzvs = val;
  1457. break;
  1458. case 'invRecombine':
  1459. pws.rec = val;
  1460. break;
  1461. case 'invSpeed':
  1462. pws.spd = val;
  1463. break;
  1464. case 'invGrowth':
  1465. pws.grw = val;
  1466. break;
  1467. case 'invSpawnVirus':
  1468. pws.vrs = val;
  1469. break;
  1470. case 'invSpawnMothercell':
  1471. pws.mtcl = val;
  1472. break;
  1473. case 'invSpawnPortal':
  1474. pws.prtl = val;
  1475. break;
  1476. case 'invSpawnGoldOre':
  1477. pws.gblk = val;
  1478. break;
  1479. case 'invFreeze':
  1480. pws.fz = val;
  1481. break;
  1482. case 'inv360Shot':
  1483. pws.psh = val;
  1484. break;
  1485. }
  1486.  
  1487. })
  1488. }
  1489.  
  1490. $('#fsfb-export-btn').on('click', () => {
  1491. if(!$('#fsfb-sect-imexport>label>input').is(':checked')) return void(curserMsg('You need to select at least one setting to export!', 'red'));
  1492. if($('#fsfb-custom-bg').is(':checked')) curserMsg('Exporting settings with custom background included is likely to increase the file size', 'red', 4e3);
  1493. let script_settings = {},
  1494. script_themes = {};
  1495. for (let i in settings) { // put the settings & themes into different objects
  1496. if (i == "theme" || i == "theme_boxes") script_themes[i] = settings[i];
  1497. else if (i == "export_import") {}
  1498. else script_settings[i] = settings[i];
  1499. }
  1500. let bgImg = null;
  1501. const downloadFile = () => {
  1502. let obj = {
  1503. selected: {
  1504. game_settings: $('#fsfb-game-settings').is(':checked'),
  1505. game_controls: $('#fsfb-game-controls').is(':checked'),
  1506. game_background: $('#fsfb-custom-bg').is(':checked'),
  1507. script_settings: $('#fsfb-script-settings').is(':checked'),
  1508. script_theme: $('#fsfb-theme-settings').is(':checked')
  1509. },
  1510. game_settings: localStorage.settings,
  1511. game_controls: localStorage.hotkeys,
  1512. game_background: bgImg,
  1513. script_settings: script_settings,
  1514. script_theme: script_themes
  1515. }
  1516. // if the setting is turned off, then dont need to export it - set it to null
  1517. if(!obj.selected.game_settings) obj.game_settings = null;
  1518. if(!obj.selected.game_controls) obj.game_controls = null;
  1519. if(!obj.selected.game_background) obj.game_background = null;
  1520. if(!obj.selected.script_settings) obj.script_settings = null;
  1521. if(!obj.selected.script_theme) obj.script_theme = null;
  1522.  
  1523. const a = document.createElement('a'),
  1524. file = new Blob([JSON.stringify(obj)], {type: "text/plain"});
  1525. a.href = URL.createObjectURL(file), a.download = "fsfb script settings", a.click(), URL.revokeObjectURL(a.href); // download a txt file of exported settings
  1526. }
  1527. if($('#fsfb-custom-bg').is(':checked')){
  1528. let db, req = unsafeWindow.indexedDB.open("AgmaDB", 1);
  1529. req.onsuccess = function (x) {
  1530. db = req.result;
  1531. db.onclose = (c) => { db = null; }
  1532. db.onversionchange = (c) => { db.close(), db = null; }
  1533. let _ = db.transaction("general", "readonly").objectStore("general").get("cbgDataURL");
  1534. _.onsuccess = () => {
  1535. bgImg = _.result;
  1536. downloadFile();
  1537. }
  1538. }, req.onupgradeneeded = function (c) {
  1539. let req = c.target.result;
  1540. if (!req.objectStoreNames.contains("general")) {
  1541. req.createObjectStore("general");
  1542. }
  1543. };
  1544. } else {
  1545. downloadFile();
  1546. }
  1547. });
  1548.  
  1549. $('#fsfb-import-btn').on('click', () => {
  1550. if(!$('#fsfb-sect-imexport>label>input').is(':checked')) return void(curserMsg('You need to select at least one setting to import!', 'red'));
  1551. if($('#fsfb-custom-bg').is(':checked')) curserMsg('Pasting in settings that include a background image is likely to cause initial lag', 'red', 0);
  1552. swal({
  1553. title: "Import Settings",
  1554. text: "Add your exported settings below and press OK to continue.",
  1555. type: "input",
  1556. showCancelButton: true,
  1557. closeOnConfirm: false,
  1558. animation: "slide-from-top",
  1559. inputPlaceholder: "Paste exported settings here"
  1560. },
  1561. function(inputVal){
  1562. if (inputVal == null) return false;
  1563. if (inputVal == "") {
  1564. swal.showInputError("Please don't leave the input empty!");
  1565. return false
  1566. }
  1567. try {
  1568. let val = JSON.parse(inputVal);
  1569. if(val.selected.script_settings && $('#fsfb-script-settings').is(':checked')){
  1570. for (let i in val.script_settings) {
  1571. for (let j in val.script_settings[i]) {
  1572. for(let x in settings){
  1573. for(let y in settings[x]){
  1574. if(val.script_settings[i][j].id == settings[x][y].id) settings[x][y] = val.script_settings[i][j];
  1575. }
  1576. }
  1577. }
  1578. }
  1579. }
  1580. if(val.selected.script_theme && $('#fsfb-theme-settings').is(':checked')){
  1581. for (let i in val.script_theme) {
  1582. for (let j in val.script_theme[i]) {
  1583. for(let x in settings){
  1584. for(let y in settings[x]){
  1585. if(val.script_theme[i][j].id == settings[x][y].id) settings[x][y] = val.script_theme[i][j];
  1586. }
  1587. }
  1588. }
  1589. }
  1590. }
  1591. if(val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) localStorage.setItem('settings', val.game_settings);
  1592. if(val.selected.game_controls && $('#fsfb-game-controls').is(':checked')) localStorage.setItem('hotkeys', val.game_controls);
  1593. if(val.selected.game_background && $('#fsfb-custom-bg').is(':checked')){
  1594. let db, req = unsafeWindow.indexedDB.open("AgmaDB", 1);
  1595. req.onsuccess = function (x) {
  1596. db = req.result;
  1597. db.onclose = (c) => { db = null; }
  1598. db.onversionchange = (c) => { db.close(), db = null; }
  1599. let _ = db.transaction("general", "readwrite").objectStore("general").put(val.game_background, "cbgDataURL");
  1600. }, req.onupgradeneeded = function (c) {
  1601. let req = c.target.result;
  1602. if (!req.objectStoreNames.contains("general")) {
  1603. req.createObjectStore("general");
  1604. }
  1605. };
  1606. }
  1607. // if any agma controls were imported, need to refresh bc it's set using localstorage
  1608. if((val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) || (val.selected.game_controls && $('#fsfb-game-controls').is(':checked')) || (val.selected.game_background && $('#fsfb-custom-bg').is(':checked'))){
  1609. swal({
  1610. title: "Please Refresh!",
  1611. text: "Refreshing the page is required for your imported agma settings to take effect",
  1612. type: "warning",
  1613. });
  1614. } else swal({ title: "Settings Successfully Imported!", type: "success" });
  1615. saveSettings();
  1616. updateScriptSettingsUI();
  1617. } catch (error){
  1618. swal({
  1619. title: "Something went wrong!",
  1620. text: "Please make sure you've entered in valid settings",
  1621. type: "error"
  1622. });
  1623. }
  1624. });
  1625.  
  1626. });
  1627.  
  1628. $('#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>`)
  1629.  
  1630.  
  1631. localStorage.ad_l_time = "9e99"; // smth like time since last ad
  1632. $('[id^="agma-io_"], [id^="adWrapper"], #preroll').addClass("fuckAds"); // move ads way off the screen
  1633.  
  1634. let width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight;
  1635. $(unsafeWindow).on('resize', function(){
  1636. width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight;
  1637. });
  1638.  
  1639. let pointMove;
  1640. const linesplit = () => {
  1641. if(!linesplitting) return;
  1642. 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}];
  1643. if(linesplitClosestSide){
  1644. let closestSide = [mosY / height, (height - mosY) / height, mosX / width, (width - mosX) / width]; // top, bottom, left, right
  1645. closest = points[closestSide.indexOf(Math.min(...closestSide))];
  1646. } else {
  1647. let distance = p => Math.sqrt(Math.pow(mosX - p.x, 2) + Math.pow(mosY - p.y, 2)),
  1648. closestPoint = points.reduce((a, b) => distance(a) < distance(b) ? a : b);
  1649. for (let i = 0; i < points.length; i++) {
  1650. if (closestPoint.x == points[i].x && closestPoint.y == points[i].y) closest = points[i]
  1651. }
  1652. }
  1653. pointMove = {x: closest.nx, y: closest.ny};
  1654. $('canvas').trigger($.Event('mousemove', { clientX: closest.nx, clientY: closest.ny }));
  1655. $("#linesplit-markers div").css('background-color', 'transparent');
  1656. $(closest.n).css('background-color', '#e25615');
  1657. }
  1658.  
  1659. let confBtns = document.getElementsByClassName('purchase-btn confirmation');
  1660. const btnsArr = Array.from(document.getElementsByClassName('purchase-btn confirmation'));
  1661.  
  1662. const changeHTML = (index, price, id, name) => {
  1663. setTimeout(() => {
  1664. const amtDropdown = document.getElementById('shopAmountDropdown')
  1665. 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.';
  1666. const dropdownChange = () => {
  1667. if (amtDropdown.value == "custom") return buyCstmAmt(price, id, name);
  1668. let priceSum = (amtDropdown.value * price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  1669. 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.';
  1670. };
  1671. 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)
  1672. amtDropdown.removeEventListener('change', dropdownChange);
  1673. amtDropdown.addEventListener('change', dropdownChange);
  1674. }
  1675. catch (error){
  1676. amtDropdown.addEventListener('change', dropdownChange);
  1677. };
  1678. }, 30);
  1679. };
  1680. const buyCstmAmt = (price, id, name) => {
  1681. swal({
  1682. title: "Enter Purchase Amount",
  1683. text: "<span>How many <b>" + name + "</b> would you like to buy?</span>",
  1684. html: true,
  1685. type: "input",
  1686. showCancelButton: true,
  1687. closeOnConfirm: false,
  1688. inputPlaceholder: "Input amount here"
  1689. },
  1690. function(input){
  1691. let pwAmt = +input,
  1692. priceTotal = pwAmt * price;
  1693. if (input == null) return false;
  1694. if (input == "") {
  1695. swal.showInputError("Please don't leave the input empty!");
  1696. return false
  1697. }
  1698. if(!/^[0-9]+$/.test(input) || !(+input >>> 0 === parseFloat(+input))){
  1699. swal.showInputError("Please only enter positive integers!");
  1700. return false
  1701. }
  1702. swal({
  1703. title: 'Confirm',
  1704. 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>',
  1705. html: true,
  1706. type: 'warning',
  1707. showCancelButton: true,
  1708. closeOnConfirm: false,
  1709. confirmButtonColor: '#4CAF50',
  1710. confirmButtonText: 'Yes, confirm purchase',
  1711. cancelButtonText: 'No, cancel purchase'
  1712. }, function(confirmed){
  1713. if(confirmed) buyPw(id, pwAmt);
  1714. })
  1715.  
  1716. });
  1717. };
  1718. // buy a certain amount of powers including > 255
  1719. const buyPw = (shopID, pwAmt) => {
  1720. if (pwAmt < 1) return;
  1721. if (pwAmt > 255) {
  1722. for (let i = 0; i < ~~(pwAmt / 255); i++) setTimeout(() => purchaseItem(shopID, 255), 250 * i + 250);
  1723. purchaseItem(shopID, pwAmt % 255);
  1724. } else purchaseItem(shopID, pwAmt);
  1725. };
  1726.  
  1727.  
  1728. if(improvedShop){
  1729. // add event listeners to dropdown buttons
  1730. for (let i = 0; i < confBtns.length; i++) {
  1731. confBtns[i].onclick = function () {
  1732. setTimeout(() => {
  1733. 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>';
  1734. }, 5);
  1735. }
  1736. }
  1737. // add event listeners to shop buttons
  1738. for (let i = 0; i < 16; i++) {
  1739. if (i != 10 && i != 11){
  1740. btnsArr[i].addEventListener('click', () => {
  1741. let index = i;
  1742. changeHTML(index, btnsArr[index].getAttribute('price'), btnsArr[index].getAttribute('item'), $('.purchase-btn.confirmation[item="' + btnsArr[index].getAttribute('item') + '"]').prev().find('h3').eq(0).text());
  1743. });
  1744. }
  1745. }
  1746. }
  1747.  
  1748.  
  1749. // add extra bot packs
  1750. const newBots = [
  1751. {title: "100 Bots", time: "24 HOURS", price: "700,000", id: 9},
  1752. {title: "125 Bots", time: "48 HOURS", price: "900,000", id: 10},
  1753. {title: "300 Bots", time: "24 HOURS", price: "900,000", id: 7},
  1754. {title: "100 MASS Bots", time: "1 HOURS", price: "800,000", id: 8},
  1755. {title: "300 Bots", time: "72 HOURS", price: "2,000,000", id: 11},
  1756. {title: "100 MASS Bots", time: "24 HOURS", price: "2,600,000", id: 12}
  1757. ]
  1758.  
  1759. const minul = document.getElementsByClassName('tab-container-section minion scroll')[0].children[0].children[0]
  1760. $('.confirm-minion[item=7], .confirm-minion[item=8]').parent().hide();
  1761. document.getElementById('extraTab').childNodes[0].setAttribute('onclick', '');
  1762.  
  1763. function createEl(i) {
  1764. const botEl = document.createElement('li');
  1765. botEl.setAttribute('class', 'masterTooltip extra-min');
  1766. 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.');
  1767. minul.appendChild(botEl);
  1768. botEl.innerHTML = `
  1769. <div class="title_prch">
  1770. <img src="img/store/minions/minions_tab.png" width="70px" height="60px">
  1771. <div class="minionDescription">
  1772. <h4 style="font-size: 18px;">` + i.title + `</h4>
  1773. <h3 style="margin-top:10px;color:white;"> ` + i.time + `</h3>
  1774. </div> <span class="win-price">` + i.price + `</span>
  1775. </div>
  1776. <a href="#" price="` + i.price + `" item="` + i.id + `" class="purchase-btn2 confirm-minion extra-min">Buy</a>
  1777. `;
  1778. }
  1779. if(extraBotPacks){
  1780. for(let i of newBots) createEl(i);
  1781. }
  1782.  
  1783. function warnBeforeMinion(linkURL, priceK,itemId) {
  1784. swal({
  1785. title: "Confirm",
  1786. text: 'If you click "Buy", you will purchase these minions. They cost ' + priceK,
  1787. type: "warning",
  1788. showCancelButton: true,
  1789. confirmButtonColor: "#4CAF50",
  1790. confirmButtonText: "Yes, confirm purchase",
  1791. cancelButtonText: "No, cancel purchase"
  1792. }, function() {
  1793. purchaseMinion(itemId);
  1794. });
  1795. }
  1796.  
  1797. // listen for when a min pack is bought
  1798. let minBoughtAmt = {};
  1799. if(extraChatCommands){
  1800. let lastClickedPrice, currentPrice, lastID;
  1801. const confirmClicked = () => {
  1802. setTimeout(() => {
  1803. if($('.sweet-alert h2').text() != "Success!" || lastClickedPrice != currentPrice) return;
  1804. const map = {
  1805. 1: '10 Bots 1 Hour',
  1806. 2: '40 Bots 1 Hour',
  1807. 3: '50 Bots 2 Hours',
  1808. 4: '80 Bots 1 Hour',
  1809. 5: '100 Bots 4 Hours',
  1810. 6: '125 Bots 8 Hours',
  1811. 7: '300 Bots 24 Hours',
  1812. 8: '100 MASS Bots 1 Hour',
  1813. 9: '100 Bots 24 Hours',
  1814. 10: '125 Bots 48 Hours',
  1815. 11: '300 Bots 72 Hours',
  1816. 12: '100 MASS Bots 24 Hours'
  1817. }
  1818. minBoughtAmt[currentUser] = {...minsChatAmt[currentUser], ... {chatAmt: map[lastID], started: false}};
  1819. }, 900);
  1820. };
  1821. $('.purchase-btn2.confirm-minion[item]').on('click', function () {
  1822. lastClickedPrice = this.getAttribute('price').replace(/,/g, '');
  1823. lastID = this.getAttribute('item');
  1824. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  1825. setTimeout(() => {
  1826. $('.confirm').removeAttr('disabled');
  1827. currentPrice = $('.sweet-alert.showSweetAlert.visible p').eq(0).text().replaceAll(/\D+/g, '');
  1828. }, 750);
  1829. setTimeout(() => $('.confirm')[0].addEventListener('click', confirmClicked), 500);
  1830. })
  1831. }
  1832.  
  1833. // context menu: click on skin -> skin ID to clipboard, click on name -> name to clipboard
  1834. $('#contextPlayer').on('click', e => {
  1835. if(!rightClickCopyInfo) return;
  1836. if($('#contextPlayerSkin').width() + $('#contextPlayerSkin').offset().left + 5 > e.pageX){ // bcs #contextMenu event :dog:
  1837. // cell was clicked
  1838. if($('#contextPlayerSkin').css('background-image') != "none"){
  1839. 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
  1840. navigator.clipboard.writeText(skinID).then(function() {
  1841. curserMsg('Skin ID of ' + skinID + ' was copied to your clipboard.', 'green');
  1842. }, function() {
  1843. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  1844. });
  1845. } else if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  1846. else curserMsg('No skin equipped. Nothing was added to your clipboard.', 'red');
  1847. } else { // name was clicked
  1848. if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  1849. else {
  1850. navigator.clipboard.writeText($('#contextPlayerName').text()).then(function() {
  1851. curserMsg('Nickname: "' + $('#contextPlayerName').text() + '" was copied to your clipboard', 'green');
  1852. }, function() {
  1853. curserMsg("Something went wrong. Nothing was added to your clipboard.", "red");
  1854. });
  1855. }
  1856. }
  1857. });
  1858.  
  1859.  
  1860. // little bar at the top of the screen that tells u stuff
  1861. const curserMsg = (msg, color, time) => {
  1862. if(color == "green") color = "rgb(0, 192, 0)";
  1863. if(color == "red") color = "rgb(255, 0, 0)";
  1864. if(color == "gray") color = "rgb(153, 153, 153)";
  1865. $('#curser').text(msg).show().css('color', color)
  1866. if(time != 0) setTimeout(() => $('#curser').fadeOut(400), time ?? 4e3);
  1867. }
  1868.  
  1869. let minTimeRemaining = 0;
  1870. const startMin = unsafeWindow.strMin;
  1871. unsafeWindow.strMin = function(){
  1872. minsStart();
  1873. return startMin.apply(this, arguments);
  1874. }
  1875. let minsChatAmt = {},
  1876. accGoldMem = {};
  1877. const minsStart = async() => {
  1878. let minAmt, minsStarted = false;
  1879. const waitUntil1 = (condition) => new Promise(resolve => {
  1880. let interval = setInterval(() => {
  1881. $('#infoContent').children().each(function(){
  1882. if($(this).text().includes('Minion Time:')) minsStarted = true;
  1883. })
  1884. condition() && (clearInterval(interval), resolve());
  1885. }, 100);
  1886. setTimeout(() => { (clearInterval(interval), resolve()) }, 1e4);
  1887. });
  1888. await waitUntil1(() => minsStarted == true);
  1889. if(!minsStarted) return;
  1890. $('#infoContent').children().each(function(){
  1891. if($(this).text().includes('Minion Time:')) minTimeRemaining = $(this).find('span').text();
  1892. if($(this).text().includes('Minions:')) minAmt = $(this).find('span').text()
  1893. })
  1894. let timeArr = minTimeRemaining.split(':'), msBotsTime = (3.6e6 * +timeArr[0]) + (6e4 * +timeArr[1]) + (1e3 * +timeArr[2]);
  1895. misc_settings.bots[currentUser] = {...misc_settings.bots[currentUser], ...{active: true, amt: minAmt, chatAmt: null, rem: msBotsTime, currMs: Date.now()}};
  1896. set("fsfb-misc", misc_settings);
  1897. }
  1898.  
  1899. // ability time remaining
  1900. if(showRemainingAbilityTime){
  1901. let lastClickedPrice, currentPrice, lastID;
  1902. const confirmClicked = () => {
  1903. setTimeout(() => {
  1904. if($('.sweet-alert h2').text() != "Success!" || lastClickedPrice != currentPrice) return;
  1905. misc_settings.abil[currentUser] = {...misc_settings.abil[currentUser], ...{[lastID] : Date.now()}};
  1906. set("fsfb-misc", misc_settings);
  1907. }, 900);
  1908. };
  1909. [18, 20, 22, 23].forEach(el => {
  1910. let h5 = $(`.purchase-btn.confirmation[item="${el}"]`).parents().eq(0).find('div h5');
  1911. h5.clone().insertAfter(h5).addClass('fsfb-fake').hide();
  1912. $(`.purchase-btn[item="${el}"]`).on('click', function () {
  1913. lastClickedPrice = this.getAttribute('price');
  1914. lastID = this.getAttribute('item');
  1915. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  1916. setTimeout(() => {
  1917. $('.confirm').removeAttr('disabled');
  1918. currentPrice = $('.sweet-alert.showSweetAlert.visible p').eq(0).text().replaceAll(/\D+/g, '');
  1919. }, 750);
  1920. setTimeout(() => $('.confirm')[0].addEventListener('click', confirmClicked), 500);
  1921. })
  1922. });
  1923. }
  1924.  
  1925. // sort wearables by owned
  1926. const waitUntil = condition => new Promise(resolve => {
  1927. let interval = setInterval(() => {
  1928. condition() && (clearInterval(interval), resolve());
  1929. }, 100);
  1930. setTimeout(() => { (clearInterval(interval), resolve()) }, 15e3);
  1931. });
  1932. if(sortWearablesByOwned){
  1933. $('#wearablesTab').on('click', async()=> {
  1934. await waitUntil(() => $('#phpWearables li').length > 55);
  1935. if($('#phpWearables li').length <= 55) return;
  1936. for(let i = 0; i < 2; i++){
  1937. $('[id^="wearableUseBtn"]').each(function(){
  1938. $($(this).parents().get(2)).insertBefore($("#phpWearables li:eq(0)"));
  1939. })
  1940. }
  1941. });
  1942. }
  1943. // https://stackoverflow.com/questions/2424191/how-do-i-make-an-element-draggable-in-jquery
  1944. $.fn.draggable = function(){
  1945. var $this = this,
  1946. ns = 'draggable_'+(Math.random()+'').replace('.',''),
  1947. mm = 'mousemove.'+ns,
  1948. mu = 'mouseup.'+ns,
  1949. $w = $(window),
  1950. isFixed = ($this.css('position') === 'fixed'),
  1951. adjX = 0, adjY = 0;
  1952.  
  1953. $this.mousedown(function(ev){
  1954. var pos = $this.offset();
  1955. if (isFixed) {
  1956. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  1957. }
  1958. var ox = (ev.pageX - pos.left), oy = (ev.pageY - pos.top);
  1959. $this.data(ns,{ x : ox, y: oy });
  1960. $w.on(mm, function(ev){
  1961. ev.preventDefault();
  1962. ev.stopPropagation();
  1963. if (isFixed) {
  1964. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  1965. }
  1966. var offset = $this.data(ns);
  1967. $this.css({left: ev.pageX - adjX - offset.x, top: ev.pageY - adjY - offset.y});
  1968. });
  1969. $w.on(mu, function(){
  1970. $w.off(mm + ' ' + mu).removeData(ns);
  1971. });
  1972. });
  1973. return this;
  1974. };
  1975.  
  1976.  
  1977. /* xp/coins statistics */
  1978.  
  1979. const updateTimeXP = 12e3; // xp bar updates every 12 seconds, don't change
  1980. let lastMinXP = [];
  1981. let lastHrXP = [];
  1982. let currentPercent, currentLevel, currentXP, currentCoins;
  1983.  
  1984. unsafeWindow.logStatsScriptXP = !1;
  1985. unsafeWindow.logStatsScriptCoins = !1;
  1986. let scriptStartCoins = Date.now();
  1987. let scriptStartXP = Date.now();
  1988. let accounts = {};
  1989. const guiDisplay = "none";
  1990. let coinsHTMLactive = false;
  1991.  
  1992. const updateTimeCoins = 6e3;
  1993. let lastMinCoins = [];
  1994. let lastHrCoins = [];
  1995.  
  1996. // add stats box html
  1997.  
  1998. const statsBody = document.createElement('div');
  1999. statsBody.setAttribute('id', 'stats-container');
  2000. statsBody.style.display = guiDisplay;
  2001. statsBody.innerHTML = `<div id="stats-main"><div id="stats-title"><title id="stats-extra-info">XP Stats - Updating Every 12s</title><div><div title="Toggle Percentages Shown" id="stats-perc-btn" class="fa fa-percent"></div><div title="Toggle Stats Shown" id="stats-change-shown" class="fa fa-eye-slash"></div><div title="Reset Stats" class="fa fa-refresh" id="stats-reset-btn"></div></div></div><div><table id="stats-table"><tbody><tr><td><label><input type="checkbox">Lvl Completed:</label></td><td>0/0</td></tr><tr><td><label><input type="checkbox">Remaining:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Projected (hr):</label></td><td>0</td></tr><tr><td><label><input type="checkbox">Last Hour:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Last Minute:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Last 12s:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Minute Mean:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Minute Median:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Minute Sd:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Latest Outliers:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Session XP:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Session Length:</label></td><td>100,000</td></tr><tr><td><label><input type="checkbox">Lifetime XP:</label></td><td>100,000</td></tr></tbody></table></div></div>`;
  2002. document.querySelector('body').append(statsBody)
  2003.  
  2004. $("#stats-container").draggable();
  2005. let statsboxPos = misc_settings?.statsPos ?? {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left};
  2006. if(saveStatsBoxPosition && statsboxPos) $("#stats-container").css({'top' : statsboxPos.top, 'left' : statsboxPos.left});
  2007.  
  2008. const convertToPerc = (xpAmt, lvl = 0) => isNaN(xpAmt / (lvl * 1000)) ? 0 : xpAmt / (lvl * 1000);
  2009.  
  2010. $('#stats-reset-btn').on('click', () => {
  2011. if(coinsHTMLactive){
  2012. lastMinCoins = [];
  2013. lastHrCoins = [];
  2014. for(let i in accounts) accounts[i].coins = 0;
  2015. if(accounts[currentUser] !== null && currentUser !== 'Please Login First') accounts[currentUser].coins = currentCoins;
  2016. scriptStartCoins = Date.now();
  2017. } else {
  2018. lastMinXP = [];
  2019. lastHrXP = [];
  2020. for(let i in accounts) accounts[i].xp = 0;
  2021. if(accounts[currentUser] !== null && currentUser !== 'Please Login First') accounts[currentUser].xp = currentXP;
  2022. scriptStartXP = Date.now();
  2023. }
  2024. updateUI();
  2025. });
  2026. let xpStatsInPercentages = false;
  2027. $('#stats-perc-btn').on('click', () => {
  2028. xpStatsInPercentages = !xpStatsInPercentages;
  2029. updateUI();
  2030. });
  2031.  
  2032. let changingShownStats = false;
  2033. $('#stats-change-shown').on('click', () => {
  2034. changingShownStats = !changingShownStats;
  2035. if(changingShownStats){
  2036. $('#stats-table tr').show();
  2037. _replaceCSS('stats-input-css', '#stats-table input{ display: unset; }');
  2038. } else {
  2039. for(let i in misc_settings.statsSettings[coinsHTMLactive ? 'coins' : 'xp']){
  2040. misc_settings.statsSettings[coinsHTMLactive ? 'coins' : 'xp'][i] = $('#stats-' + i + ' input[type="checkbox"]').is(':checked');
  2041. $('#stats-' + i + ' input[type="checkbox"').is(':checked') ? $('#stats-' + i).show() : $('#stats-' + i).hide();
  2042. }
  2043. set("fsfb-misc", misc_settings);
  2044. _replaceCSS('stats-input-css', '#stats-table input{ display: none; }');
  2045. }
  2046. });
  2047.  
  2048. class record {
  2049. constructor(val, lvl, user, arr) {
  2050. this.type = this.findWhich(arr); // mostly for debugging
  2051. this.id = this.getID(arr);
  2052. this.user = user;
  2053. this.amount = val;
  2054. this.gained = this.calcGain(val, arr, this.id);
  2055. this.lvl = lvl;
  2056. // this.timestamp = Date.now(); // mostly for debugging
  2057. }
  2058. findWhich(arr) {
  2059. return ((arr == lastMinXP || arr == lastHrXP ? "xp " : "coins " ) + (arr == lastHrXP || arr == lastHrCoins ? "hour" : "minute"));
  2060. }
  2061. calcGain(val, arr, id){
  2062. const prevObj = arr[arr.length - 1];
  2063. if(prevObj && arr == lastHrXP && id == 1) return round(sigma(getProperty(lastMinXP, "gained")), 3);
  2064. if(prevObj && arr == lastHrCoins && id == 1) return round(sigma(getProperty(lastMinCoins, "gained")), 3);
  2065. return prevObj && val - prevObj.amount >= 0 && prevObj.user == this.user && prevObj.amount != 0 ? round(val - prevObj.amount, 3) : 0;
  2066. }
  2067. getID(arr) {
  2068. return arr[arr.length - 1] ? arr[arr.length - 1].id + 1 : 1;
  2069. }
  2070.  
  2071. }
  2072.  
  2073. const xpInfo = () => {
  2074. currentPercent = $('.progress-bar[role=progressbar]')[0].style.width.slice(0, -1) / 100;
  2075. currentLevel = +$('#level.user-level')[0].textContent;
  2076. currentXP = (levelSum(currentLevel) + currentLevel * currentPercent) * 1e3;
  2077. }
  2078. const coinsInfo = () => {
  2079. currentCoins = +($('#coinsDash')[0].textContent.replaceAll(' ', ''));
  2080. }
  2081.  
  2082. const updateUI = () => {
  2083. if(unsafeWindow.stopAllUI != null || changingShownStats) return;
  2084. if(!coinsHTMLactive){
  2085. const xpHr = lastHrXP.length,
  2086. xpMin = lastMinXP.length,
  2087. lvlCompleted = currentPercent ? String(Math.round(currentPercent * currentLevel * 1e3, 1)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "/" + (currentLevel * 1e3).toLocaleString('en-US') : "0/0",
  2088. xpRemaining = currentLevel ? currentLevel * 1e3 - currentPercent * currentLevel * 1e3 : 0,
  2089. projectedHr = xpHr > 0 ? sigma(getProperty(lastHrXP.slice(-5), "gained")) * 12 : 0,
  2090. lastHr = xpHr > 0 ? sigma(getProperty(lastHrXP, "gained")) : 0,
  2091. lastHrCompleted = xpHr > 0 ? xpHr : 0,
  2092. lastMin = xpMin > 0 ? sigma(getProperty(lastMinXP, "gained")) : 0,
  2093. lastMinCompleted = xpMin > 0 ? xpMin : 0,
  2094. lastMinTotal = 6e4 / updateTimeXP,
  2095. last12sec = xpMin > 0 ? lastMinXP[lastMinXP.length - 1].gained : 0,
  2096. xBar = xpHr > 0 ? mean(getProperty(lastHrXP, "gained")) : 0,
  2097. xTilde = xpHr > 0 ? median(getProperty(lastHrXP, "gained")) : 0,
  2098. standardDev = xpHr > 0 ? standardDeviation(getProperty(lastHrXP, "gained")) : 0,
  2099. outliers = xpHr > 0 ? checkOutliers(getProperty(lastHrXP, "gained")) : 0,
  2100. sessionXP = currentXP && accounts[currentUser] ? currentXP - accounts[currentUser].xp : 0,
  2101. sessionLength = msToTime(Date.now() - scriptStartXP),
  2102. lifetimeXP = currentXP ? Math.round(currentXP) : 0,
  2103. updateTime = updateTimeXP;
  2104. // 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>`;
  2105. document.getElementById('stats-table').innerHTML = `<tbody><tr id="stats-lvlcomp"><td><label><input type="checkbox">Lvl Completed:</label></td><td>${lvlCompleted.toLocaleString('en-US')}</td></tr><tr id="stats-rem"><td><label><input type="checkbox">Remaining:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(xpRemaining, currentLevel) * 100, 2) + '%' : round(xpRemaining).toLocaleString('en-US')}</td></tr><tr id="stats-projhr"><td><label><input type="checkbox">Projected (hr):</label></td><td>${xpStatsInPercentages ? round(convertToPerc(projectedHr, currentLevel) * 100, 2) + '%' : round(projectedHr).toLocaleString('en-US')}</td></tr><tr id="stats-lasthr"><td><label><input type="checkbox">Last Hour:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(lastHr, currentLevel) * 100, 2) + '%' : round(lastHr).toLocaleString('en-US')}<span class="stats-completed">(${lastHrCompleted}/60)</span></td></tr><tr id="stats-lastmin"><td><label><input type="checkbox">Last Minute:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(lastMin, currentLevel) * 100, 2) + '%' : round(lastMin).toLocaleString('en-US')}<span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></td></tr><tr id="stats-lastsec"><td><label><input type="checkbox">Last 12s:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(last12sec, currentLevel) * 100, 2) + '%' : round(last12sec).toLocaleString('en-US')}</td></tr><tr id="stats-mean"><td><label><input type="checkbox">Minute Mean:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(xBar, currentLevel) * 100, 2) + '%' : round(xBar).toLocaleString('en-US')}</td></tr><tr id="stats-median"><td><label><input type="checkbox">Minute Median:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(xTilde, currentLevel) * 100, 2) + '%' : round(xTilde).toLocaleString('en-US')}</td></tr><tr id="stats-sd"><td><label><input type="checkbox">Minute Sd:</label></td><td>${xpStatsInPercentages ? round(convertToPerc(standardDev, currentLevel) * 100, 2) + '%' : round(standardDev).toLocaleString('en-US')}</td></tr><tr id="stats-sesh"><td><label><input type="checkbox">Session XP:</label></td><td>${xpStatsInPercentages ? round(currentLevel && accounts[currentUser] ? ((round(currentPercent, 3) + currentLevel) - accounts[currentUser].lvl) * 100 : 0, 2) + '%' : round(sessionXP).toLocaleString('en-US')}</td></tr><tr id="stats-seshlength"><td><label><input type="checkbox">Session Length:</label></td><td id="stats-sesh-length">${sessionLength}</td></tr><tr id="stats-lifetime"><td><label><input type="checkbox">Lifetime XP:</label></td><td>${lifetimeXP.toLocaleString('en-US')}</td></tr></tbody>`;
  2106. for(let i in misc_settings.statsSettings.xp){
  2107. misc_settings.statsSettings.xp[i] ? $('#stats-' + i).show() : $('#stats-' + i).hide();
  2108. $('#stats-' + i + ' input[type="checkbox"').prop("checked", misc_settings.statsSettings.xp[i]);
  2109. }
  2110. $('#stats-extra-info').text(`XP Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#00bbff');
  2111. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartXP));
  2112. $('#stats-perc-btn').show();
  2113. } else {
  2114. const coinsHr = lastHrCoins.length,
  2115. coinsMin = lastMinCoins.length,
  2116. coinGoalCompleted = currentCoins ? currentCoins.toLocaleString('en-US') + "/" + Math.ceil(currentCoins / 25e4).toLocaleString('en-US') * 25e4 : 0,
  2117. coinsRemaining = currentCoins ? 25e4 - currentCoins % 25e4 : 0,
  2118. projectedHr = coinsHr > 5 ? Math.round(sigma(getProperty(lastHrCoins.slice(-5), "gained")) * 12) : 0,
  2119. lastHr = coinsHr > 0 ? Math.round(sigma(getProperty(lastHrCoins, "gained"))) : 0,
  2120. lastHrCompleted = coinsHr > 0 ? coinsHr : 0,
  2121. lastMin = coinsMin > 0 ? Math.round(sigma(getProperty(lastMinCoins, "gained"))) : 0,
  2122. lastMinCompleted = coinsMin > 0 ? coinsMin : 0,
  2123. lastMinTotal = 6e4 / updateTimeCoins,
  2124. last12sec = coinsMin > 0 ? getProperty(lastHrCoins.slice(-5), "amount")[0] : 0,
  2125. xBar = coinsHr > 0 ? Math.round(mean(getProperty(lastHrCoins, "gained"))) : 0,
  2126. xTilde = coinsHr > 0 ? Math.round(median(getProperty(lastHrCoins, "gained"))) : 0,
  2127. standardDev = coinsHr > 0 ? Math.round(standardDeviation(getProperty(lastHrCoins, "gained"))) : 0,
  2128. outliers = coinsHr > 0 ? checkOutliers(getProperty(lastHrCoins, "gained")) : 0,
  2129. sessionXP = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0,
  2130. sessionLength = msToTime(Date.now() - scriptStartCoins),
  2131. updateTime = updateTimeCoins;
  2132. // 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>`;
  2133. document.getElementById('stats-table').innerHTML = `<tbody><tr id="stats-rem"><td><label><input type="checkbox">Remaining:</label></td><td>${coinsRemaining.toLocaleString('en-US')}</td></tr><tr id="stats-projhr"><td><label><input type="checkbox">Projected (hr):</label></td><td>${projectedHr.toLocaleString('en-US')}</td></tr><tr id="stats-lasthr"><td><label><input type="checkbox">Last Hour:</label></td><td>${lastHr.toLocaleString('en-US')}<span class="stats-completed">(${lastHrCompleted}/60)</span></td></tr><tr id="stats-lastmin"><td><label><input type="checkbox">Last Minute:</label></td><td>${lastMin.toLocaleString('en-US')}<span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></td></tr><tr id="stats-mean"><td><label><input type="checkbox">Minute Mean:</label></td><td>${xBar.toLocaleString('en-US')}</td></tr><tr id="stats-median"><td><label><input type="checkbox">Minute Median:</label></td><td>${xTilde.toLocaleString('en-US')}</td></tr><tr id="stats-sd"><td><label><input type="checkbox">Minute Sd:</label></td><td>${standardDev.toLocaleString('en-US')}</td></tr><tr id="stats-sesh"><td><label><input type="checkbox">Session Coins:</label></td><td>${sessionXP.toLocaleString('en-US')}</td></tr><tr id="stats-seshlength"><td><label><input type="checkbox">Session Length:</label></td><td id="stats-sesh-length">${sessionLength}</td></tr></tbody>`;
  2134. for(let i in misc_settings.statsSettings.coins){
  2135. misc_settings.statsSettings.coins[i] ? $('#stats-' + i).show() : $('#stats-' + i).hide();
  2136. $('#stats-' + i + ' input[type="checkbox"').prop("checked", misc_settings.statsSettings.coins[i]);
  2137. }
  2138. $('#stats-extra-info').text(`Coin Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#ffc800');
  2139. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartCoins));
  2140. $('#stats-perc-btn').hide();
  2141. }
  2142. }
  2143.  
  2144. $('.progress-bar').eq(1).parent()[0].style.cursor = "pointer";
  2145.  
  2146. if(coinXPstats){
  2147. $('.progress-bar').eq(1).parent().on("click", () => {
  2148. const statsCont = $('#stats-container');
  2149. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  2150. else if(!coinsHTMLactive) statsCont.fadeOut(400);
  2151. coinsHTMLactive = false;
  2152. updateUI();
  2153. }), [$(".dash-coin.dcTopBar").eq(0), $("#coinsTopLeft"), $(".progress-bar-coins").eq(1)].forEach(el => {
  2154. el.on('click', (e) => {
  2155. const statsCont = $('#stats-container');
  2156. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  2157. else if(coinsHTMLactive) statsCont.fadeOut(400);
  2158. coinsHTMLactive = true;
  2159. updateUI();
  2160. e.stopImmediatePropagation();
  2161. });
  2162. });
  2163. }
  2164.  
  2165. // copy chat msgs
  2166. if(rightClickCopyChat){
  2167. $('#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>`)
  2168. $('#contextCopyChat').on('click', () => {
  2169. let arr = chatmsgs, str = "";
  2170. if(arr != null){
  2171. for(let i of arr.reverse()) str += ((new Date(i.time).toLocaleTimeString()) + " " + i.name + ': ' + i.message + "\n");
  2172. navigator.clipboard.writeText(str).then(function() {
  2173. curserMsg('Chat messages were successfully added to clipboard.', 'green');
  2174. }, function() {
  2175. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  2176. });
  2177. }
  2178. $('#contextMenu').hide();
  2179. });
  2180. }
  2181.  
  2182. let quickBuying = false;
  2183. $('#invCloak').after(`<div class="inventory-box" id="fsfb-quickMega" style="background-image: url(../img/store/megaphone_shout.png); display: none;"></div>`);
  2184. $('#invCloak').after(`<div class="inventory-box" id="fsfb-minionNuker" style="background-image: url(../img/store/minion_nuker.png); display: none;"></div>`);
  2185. $(inventorySingleRow ? '#fsfb-quickMega' : '#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>`);
  2186. $('#fsfb-quickbuy').on('click', function(){
  2187. quickBuying = !quickBuying;
  2188. if (quickBuying){
  2189. $(this).addClass('activatedInv');
  2190. curserMsg('Quick buy activated, click the powerup you would like to buy.', 'green');
  2191. $('.inventory-box').addClass('fsfb-shown').find('p').css('display', 'none');
  2192. $('#invCloak').removeClass('fsfb-shown');
  2193. $('#fsfb-quickbuy').removeClass('fsfb-shown');
  2194. } else {
  2195. $(this).removeClass('activatedInv');
  2196. curserMsg('Quick buy deactivated.', 'red');
  2197. $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block');
  2198. }
  2199. });
  2200.  
  2201. // add linesplit bubbles
  2202. $('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
  2203. // add class to all elements that need to behidden
  2204. setTimeout(() => $('#inventory, #chat, #minionUi, #infection_remain_zombie, #party, #challengeInfoBox, #gamemodeBox, #infoBox, #brGameContainer, #infGameContainer, #curser, #leaderboard, #minimap, #btnFriends, .innerBoxDashboard2, #fpsBox, #settingsBtn, #megaholder, #keyboard-layout, div[style^="position: fixed; right: 20px; bottom: 230px; z-index: 998;"]').addClass("hideUI"), 4e3);
  2205.  
  2206. // put inventory onto a single line
  2207. if(inventorySingleRow){
  2208. for (let i = 1; i < 3; i++) $("#inventory" + i).addClass("fsfb-inventories").css("order", i);
  2209. }
  2210.  
  2211. const addFriendDecline = () => {
  2212. if(!friendDeclineAll || currentUser == 'Please Login First') return;
  2213. $('#friendAcceptAll').text('Reject All').addClass('fsfb-temp').clone().insertAfter($('#friendAcceptAll')).attr('style', 'right: 93px;').text('Accept All').removeClass('fsfb-temp');
  2214. $('.fsfb-temp').attr('id', 'friendRejectAll').removeAttr('onclick').removeClass('fsfb-temp');
  2215. $('#friendRejectAll').on('click', () => {
  2216. $('#requestList>.friend>.btn-friends.remove').each(function(){ $(this)[0].click() })
  2217. });
  2218. }
  2219.  
  2220. if(friendDeclineAll){ // $('#friendAcceptAll').length
  2221. $('#btnFriends').on('click', async() => {
  2222. await waitUntil(() => $('#friendAcceptAll').length > 0);
  2223. if($('#friendAcceptAll').length == 0) return;
  2224. await sleep(50);
  2225. addFriendDecline();
  2226. })
  2227. }
  2228.  
  2229. let pushFn = Array.prototype.push,
  2230. spliceFn = Array.prototype.splice,
  2231. prop = null,
  2232. customCells = !0,
  2233. specialCells = !0,
  2234. customDc = false,
  2235. cellProto,
  2236. avgFps = 0,
  2237. fpsArr = [],
  2238. svSwitch = false,
  2239. entArr = null,
  2240. chatmsgs;
  2241.  
  2242. let r1Portal = {
  2243. portal: null,
  2244. lastMass: 0,
  2245. lastMassChange: 0,
  2246. lastValue: 0,
  2247. room: 1
  2248. }, r2Portal = {
  2249. portal: null,
  2250. lastMass: 0,
  2251. lastMassChange: 0,
  2252. lastValue: 0,
  2253. room: 2
  2254. };
  2255.  
  2256. let svInfo = {
  2257. "default": {
  2258. ejPortalMass: 12,
  2259. r1Id: 1,
  2260. r2Id: 7,
  2261. r3Id: null,
  2262. r1StartMass: 500,
  2263. r2StartMass: 500,
  2264. entities: []
  2265. },
  2266. 1: { // POPSPLIT
  2267. entities: [
  2268. // A1
  2269. {type: 1, x: 2500, y: 2500, size: 45},
  2270. // r1
  2271. {type: 0, x: 3400, y: 15300, size: 195},
  2272. {type: 1, x: 2500, y: 15000, size: 45},
  2273. {type: 2, x: 3000, y: 14500, size: 35},
  2274. {type: 3, x: 2700, y: 14600, size: 29},
  2275. // r2
  2276. {type: 0, x: 12000, y: 15500, size: 195},
  2277. {type: 1, x: 11000, y: 15000, size: 29},
  2278. {type: 2, x: 12600, y: 14900, size: 35},
  2279. {type: 2, x: 12000, y: 15200, size: 35},
  2280. {type: 2, x: 11300, y: 14900, size: 35},
  2281. {type: 3, x: 12800, y: 14500, size: 29}
  2282. ]
  2283. },
  2284. 2: { // SLOWSPLIT
  2285. ejPortalMass: 20,
  2286. r1Id: 1,
  2287. r2Id: 14, // rightmost portal
  2288. r3Id: 6,
  2289. r1StartMass: 500,
  2290. r2StartMass: 500,
  2291. entities: [
  2292. // A1
  2293. {type: 1, x: 2500, y: 2500, size: 45},
  2294. // r1
  2295. {type: 0, x: 7400, y: 21300, size: 195},
  2296. {type: 1, x: 3500, y: 21000, size: 45},
  2297. {type: 2, x: 5000, y: 20500, size: 35},
  2298. {type: 3, x: 3700, y: 20600, size: 29},
  2299. // r2
  2300. {type: 0, x: 14000, y: 22000, size: 195},
  2301. {type: 1, x: 11000, y: 21000, size: 29},
  2302. {type: 2, x: 11300, y: 20900, size: 35},
  2303. {type: 2, x: 12000, y: 21200, size: 35},
  2304. {type: 2, x: 12600, y: 20900, size: 35},
  2305. {type: 3, x: 12800, y: 20500, size: 29},
  2306. // r2 (2nd?)
  2307. {type: 0, x: 22000, y: 21500, size: 195},
  2308. {type: 2, x: 21300, y: 21000, size: 45}
  2309. ]
  2310. },
  2311. 4: { // FASTSPLIT
  2312. ejPortalMass: 20,
  2313. r1Id: 1,
  2314. r2Id: 14, // rightmost portal
  2315. r3Id: 6,
  2316. r1StartMass: 500,
  2317. r2StartMass: 500,
  2318. entities: [
  2319. // A1
  2320. {type: 1, x: 2500, y: 2500, size: 45},
  2321. // r1
  2322. {type: 0, x: 7400, y: 21300, size: 195},
  2323. {type: 1, x: 3500, y: 21000, size: 45},
  2324. {type: 2, x: 5000, y: 20500, size: 35},
  2325. {type: 3, x: 3700, y: 20600, size: 29},
  2326. // r2
  2327. {type: 0, x: 14000, y: 22000, size: 195},
  2328. {type: 1, x: 11000, y: 21000, size: 29},
  2329. {type: 2, x: 11300, y: 20900, size: 35},
  2330. {type: 2, x: 12000, y: 21200, size: 35},
  2331. {type: 2, x: 12600, y: 20900, size: 35},
  2332. {type: 3, x: 12800, y: 20500, size: 29},
  2333. // r2 (2nd?)
  2334. {type: 0, x: 22000, y: 21500, size: 195},
  2335. {type: 2, x: 21300, y: 21000, size: 35}
  2336. ]
  2337. },
  2338. 5: { // SPLITRUN
  2339. entities: [
  2340. // A1
  2341. {type: 1, x: 2500, y: 2500, size: 45},
  2342. // r1
  2343. {type: 0, x: 3400, y: 15300, size: 195},
  2344. {type: 1, x: 2500, y: 15000, size: 45},
  2345. {type: 2, x: 3000, y: 14500, size: 35},
  2346. {type: 3, x: 2700, y: 14600, size: 29},
  2347. // r2
  2348. {type: 0, x: 12000, y: 15500, size: 195},
  2349. {type: 1, x: 11000, y: 15000, size: 29},
  2350. {type: 2, x: 12600, y: 14900, size: 35},
  2351. {type: 2, x: 11300, y: 14900, size: 35},
  2352. {type: 2, x: 12000, y: 15200, size: 35},
  2353. {type: 3, x: 12800, y: 14500, size: 29}
  2354. ]
  2355. },
  2356. 6: { // XINSTA
  2357. ejPortalMass: 12,
  2358. r1Id: 1,
  2359. r2Id: 6,
  2360. r1StartMass: 500,
  2361. r2StartMass: 500,
  2362. entities: [
  2363. // A1
  2364. {type: 1, x: 2500, y: 2500, size: 45},
  2365. // r1
  2366. {type: 0, x: 3400, y: 26300, size: 195},
  2367. {type: 1, x: 2500, y: 26000, size: 45},
  2368. {type: 2, x: 3000, y: 25500, size: 45},
  2369. {type: 3, x: 2700, y: 25600, size: 29},
  2370. // r2
  2371. {type: 0, x: 15000, y: 26500, size: 195},
  2372. {type: 1, x: 14000, y: 26000, size: 29},
  2373. {type: 2, x: 14300, y: 25900, size: 45},
  2374. {type: 2, x: 15000, y: 26200, size: 45},
  2375. {type: 2, x: 15600, y: 25900, size: 45},
  2376. {type: 3, x: 15800, y: 25500, size: 29}
  2377. ]
  2378. },
  2379. 7: { // XY
  2380. entities: [
  2381. // A1
  2382. {type: 1, x: 2500, y: 2500, size: 45},
  2383. // r1
  2384. {type: 0, x: 3400, y: 15300, size: 195},
  2385. {type: 1, x: 2500, y: 15000, size: 45},
  2386. {type: 2, x: 3000, y: 14500, size: 35},
  2387. {type: 3, x: 2700, y: 14600, size: 29},
  2388. // r2
  2389. {type: 0, x: 12000, y: 15500, size: 195},
  2390. {type: 1, x: 11000, y: 15000, size: 29},
  2391. {type: 2, x: 11300, y: 14900, size: 35},
  2392. {type: 2, x: 12000, y: 15200, size: 35},
  2393. {type: 2, x: 12600, y: 14900, size: 35},
  2394. {type: 3, x: 12800, y: 14500, size: 29}
  2395. ]
  2396. },
  2397. 8: { // INSTANT EU
  2398. entities: [
  2399. // A1
  2400. {type: 1, x: 2500, y: 2500, size: 45},
  2401. // r1
  2402. {type: 0, x: 3400, y: 15300, size: 195},
  2403. {type: 1, x: 2500, y: 15000, size: 45},
  2404. {type: 2, x: 3000, y: 14500, size: 35},
  2405. {type: 3, x: 2700, y: 14600, size: 29},
  2406. // r2
  2407. {type: 0, x: 12000, y: 15500, size: 195},
  2408. {type: 1, x: 11000, y: 15000, size: 29},
  2409. {type: 2, x: 11300, y: 14900, size: 35},
  2410. {type: 2, x: 12000, y: 15200, size: 35},
  2411. {type: 2, x: 12600, y: 14900, size: 35},
  2412. {type: 3, x: 12800, y: 14500, size: 29}
  2413. ]
  2414. },
  2415. 9: { // CR EU
  2416. entities: [
  2417. // A1
  2418. {type: 1, x: 2500, y: 2500, size: 45},
  2419. // r1
  2420. {type: 0, x: 3400, y: 27300, size: 195},
  2421. {type: 1, x: 2500, y: 27000, size: 45},
  2422. {type: 2, x: 3000, y: 26500, size: 35},
  2423. {type: 3, x: 2700, y: 26600, size: 29},
  2424. // r2
  2425. {type: 0, x: 12000, y: 27500, size: 195},
  2426. {type: 1, x: 11000, y: 27000, size: 29},
  2427. {type: 2, x: 11300, y: 26900, size: 35},
  2428. {type: 2, x: 12000, y: 27200, size: 35},
  2429. {type: 2, x: 12600, y: 26900, size: 35},
  2430. {type: 3, x: 12800, y: 26500, size: 29}
  2431. ]
  2432. },
  2433. 11: { // GIGANTIC 1
  2434. entities: [
  2435. {type: 1, x: 2500, y: 2500, size: 45},
  2436. {type: 3, x: 5000, y: 33000, size: 45},
  2437. {type: 1, x: 18000, y: 18000, size: 45},
  2438. {type: 3, x: 24000, y: 12000, size: 45}
  2439. ]
  2440. },
  2441. 12: { // GIANT NA
  2442. entities: [
  2443. {type: 1, x: 2500, y: 2500, size: 45},
  2444. {type: 3, x: 5000, y: 33000, size: 45},
  2445. {type: 1, x: 18000, y: 18000, size: 45},
  2446. {type: 3, x: 24000, y: 12000, size: 45}
  2447. ]
  2448. },
  2449. 13: { // SS EU
  2450. ejPortalMass: 13.5,
  2451. r1Id: 12, //Lower room
  2452. r2Id: 11,
  2453. r1StartMass: 500,
  2454. r2StartMass: 500,
  2455. entities: [
  2456. // r1
  2457. {type: 0, x: 1500, y: 27500, size: 195},
  2458. {type: 1, x: 14000, y: 32000, size: 45},
  2459. {type: 3, x: 13200, y: 33500, size: 45},
  2460. {type: 4, x: 12500, y: 32200, size: 142},
  2461. {type: 4, x: 14500, y: 32200, size: 142},
  2462. // r2
  2463. {type: 0, x: 16000, y: 33500, size: 195},
  2464. {type: 1, x: 500, y: 24000, size: 45},
  2465. {type: 3, x: 2500, y: 24000, size: 45},
  2466. {type: 4, x: 900, y: 22000, size: 142},
  2467. {type: 4, x: 500, y: 15000, size: 224},
  2468. // r3 (?)
  2469. {type: 4, x: 1200, y: 5500, size: 224},
  2470. {type: 4, x: 2000, y: 3000, size: 224},
  2471. {type: 4, x: 4000, y: 6000, size: 224},
  2472. {type: 4, x: 4500, y: 3000, size: 224},
  2473. // on map
  2474. {type: 4, x: 8000, y: 3500, size: 224},
  2475. {type: 4, x: 10000, y: 4500, size: 224},
  2476. {type: 4, x: 16000, y: 3000, size: 224},
  2477. {type: 4, x: 15400, y: 2400, size: 224},
  2478. {type: 4, x: 7500, y: 19000, size: 224},
  2479. {type: 4, x: 19200, y: 14000, size: 224},
  2480. {type: 4, x: 24400, y: 24000, size: 224},
  2481. {type: 4, x: 17500, y: 14000, size: 142},
  2482. {type: 4, x: 30000, y: 16000, size: 142}
  2483. ]
  2484. },
  2485. 14: { // SS NA
  2486. ejPortalMass: 13.5,
  2487. r1Id: 12, //Lower room
  2488. r2Id: 11,
  2489. r1StartMass: 500,
  2490. r2StartMass: 500,
  2491. entities: [
  2492. // r1
  2493. {type: 0, x: 1500, y: 27500, size: 195},
  2494. {type: 1, x: 14000, y: 32000, size: 45},
  2495. {type: 3, x: 13200, y: 33500, size: 45},
  2496. {type: 4, x: 12500, y: 32200, size: 142},
  2497. {type: 4, x: 14500, y: 32200, size: 142},
  2498. // r2
  2499. {type: 0, x: 16000, y: 33500, size: 195},
  2500. {type: 1, x: 500, y: 24000, size: 45},
  2501. {type: 3, x: 2500, y: 24000, size: 45},
  2502. {type: 4, x: 900, y: 22000, size: 142},
  2503. {type: 4, x: 500, y: 15000, size: 224},
  2504. // r3 (?)
  2505. {type: 4, x: 1200, y: 5500, size: 224},
  2506. {type: 4, x: 2000, y: 3000, size: 224},
  2507. {type: 4, x: 4000, y: 6000, size: 224},
  2508. {type: 4, x: 4500, y: 3000, size: 224},
  2509. // on map
  2510. {type: 4, x: 8000, y: 3500, size: 224},
  2511. {type: 4, x: 10000, y: 4500, size: 224},
  2512. {type: 4, x: 16000, y: 3000, size: 224},
  2513. {type: 4, x: 15400, y: 2400, size: 224},
  2514. {type: 4, x: 7500, y: 19000, size: 224},
  2515. {type: 4, x: 19200, y: 14000, size: 224},
  2516. {type: 4, x: 24400, y: 24000, size: 224},
  2517. {type: 4, x: 17500, y: 14000, size: 142},
  2518. {type: 4, x: 30000, y: 16000, size: 142}
  2519. ]
  2520. },
  2521. 17: { // CR AS
  2522. entities: [
  2523. // A1
  2524. {type: 1, x: 2500, y: 2500, size: 45},
  2525. // r1
  2526. {type: 0, x: 3400, y: 27300, size: 195},
  2527. {type: 1, x: 2500, y: 27000, size: 45},
  2528. {type: 2, x: 3000, y: 26500, size: 35},
  2529. {type: 3, x: 2700, y: 26600, size: 29},
  2530. // r2
  2531. {type: 0, x: 12000, y: 27500, size: 195},
  2532. {type: 1, x: 11000, y: 27000, size: 29},
  2533. {type: 2, x: 11300, y: 26900, size: 35},
  2534. {type: 2, x: 12000, y: 27200, size: 35},
  2535. {type: 2, x: 12600, y: 26900, size: 35},
  2536. {type: 3, x: 12800, y: 26500, size: 29}
  2537. ]
  2538. },
  2539. 18: { // GIGA 1
  2540. entities: [
  2541. {type: 1, x: 2500, y: 2500, size: 45},
  2542. {type: 3, x: 5000, y: 33000, size: 45},
  2543. {type: 1, x: 18000, y: 18000, size: 45},
  2544. {type: 3, x: 24000, y: 12000, size: 45}
  2545. ]
  2546. },
  2547. 19: { // GIGANTIC 2
  2548. entities: [
  2549. {type: 1, x: 2500, y: 2500, size: 45},
  2550. {type: 3, x: 5000, y: 33000, size: 45},
  2551. {type: 1, x: 18000, y: 18000, size: 45},
  2552. {type: 3, x: 24000, y: 12000, size: 45}
  2553. ]
  2554. },
  2555. 20: { // CR NA
  2556. entities: [
  2557. // A1
  2558. {type: 1, x: 2500, y: 2500, size: 45},
  2559. // r1
  2560. {type: 0, x: 3400, y: 27300, size: 195},
  2561. {type: 1, x: 2500, y: 27000, size: 45},
  2562. {type: 2, x: 3000, y: 26500, size: 35},
  2563. {type: 3, x: 2700, y: 26600, size: 29},
  2564. // r2
  2565. {type: 0, x: 12000, y: 27500, size: 195},
  2566. {type: 1, x: 11000, y: 27000, size: 29},
  2567. {type: 2, x: 11300, y: 26900, size: 35},
  2568. {type: 2, x: 12000, y: 27200, size: 35},
  2569. {type: 2, x: 12600, y: 26900, size: 35},
  2570. {type: 3, x: 12800, y: 26500, size: 29}
  2571. ]
  2572. },
  2573. 23: { // GIGANTIC 3
  2574. entities: [
  2575. {type: 1, x: 2500, y: 2500, size: 45},
  2576. {type: 3, x: 5000, y: 33000, size: 45},
  2577. {type: 1, x: 18000, y: 18000, size: 45},
  2578. {type: 3, x: 24000, y: 12000, size: 45}
  2579. ]
  2580. },
  2581. 24: { // GIGANTIC 4
  2582. entities: [
  2583. {type: 1, x: 2500, y: 2500, size: 45},
  2584. {type: 3, x: 5000, y: 33000, size: 45},
  2585. {type: 1, x: 18000, y: 18000, size: 45},
  2586. {type: 3, x: 24000, y: 12000, size: 45}
  2587. ]
  2588. },
  2589. 25: { // GIANT 2 NA
  2590. entities: [
  2591. {type: 1, x: 2500, y: 2500, size: 45},
  2592. {type: 3, x: 5000, y: 33000, size: 45},
  2593. {type: 1, x: 18000, y: 18000, size: 45},
  2594. {type: 3, x: 24000, y: 12000, size: 45}
  2595. ]
  2596. },
  2597. 26: { // GIGA 2
  2598. entities: [
  2599. {type: 1, x: 2500, y: 2500, size: 45},
  2600. {type: 3, x: 5000, y: 33000, size: 45},
  2601. {type: 1, x: 18000, y: 18000, size: 45},
  2602. {type: 3, x: 24000, y: 12000, size: 45}
  2603. ]
  2604. },
  2605. 38: { // Solo Agf
  2606. ejPortalMass: 12,
  2607. r1Id: 1,
  2608. r2Id: 6,
  2609. r1StartMass: 500,
  2610. r2StartMass: 400,
  2611. entities: [
  2612. // A1
  2613. {type: 1, x: 2500, y: 2500, size: 45},
  2614. // room 1
  2615. {type: 0, x: 3500, y: 11500, size: 195},
  2616. {type: 1, x: 2500, y: 11500, size: 45},
  2617. {type: 2, x: 3000, y: 11000, size: 35},
  2618. {type: 3, x: 2700, y: 11100, size: 29},
  2619. // room 2
  2620. {type: 0, x: 9000, y: 11800, size: 180},
  2621. {type: 1, x: 8200, y: 10500, size: 29},
  2622. {type: 2, x: 8300, y: 10900, size: 35},
  2623. {type: 2, x: 9000, y: 11200, size: 35},
  2624. {type: 2, x: 9600, y: 10900, size: 35},
  2625. {type: 3, x: 9800, y: 10500, size: 29}
  2626. ]
  2627. },
  2628. 39: { // MEGASPLIT AS
  2629. entities: [
  2630. ]
  2631. },
  2632. 42: { // GIANT 3 NA
  2633. entities: [
  2634. {type: 1, x: 2500, y: 2500, size: 45},
  2635. {type: 3, x: 5000, y: 33000, size: 45},
  2636. {type: 1, x: 18000, y: 18000, size: 45},
  2637. {type: 3, x: 24000, y: 12000, size: 45}
  2638. ]
  2639. },
  2640. 43: { // Instant AS
  2641. ejPortalMass: 11, //might have to reevaluate
  2642. r1Id: 1,
  2643. r2Id: 13, // rightmost portal
  2644. r3Id: 7,
  2645. r1StartMass: 1004,
  2646. r2StartMass: 250,
  2647. r3StartMass: 1004,
  2648. entities: [
  2649. // A1
  2650. {type: 1, x: 2500, y: 2500, size: 45},
  2651. // r1
  2652. {type: 0, x: 3400, y: 20300, size: 275},
  2653. {type: 1, x: 2500, y: 20000, size: 45},
  2654. {type: 2, x: 3000, y: 19500, size: 35},
  2655. {type: 3, x: 2700, y: 19600, size: 29},
  2656. // r2
  2657. {type: 0, x: 13000, y: 21000, size: 150},
  2658. {type: 1, x: 11000, y: 20000, size: 45},
  2659. {type: 2, x: 11300, y: 19900, size: 35},
  2660. {type: 2, x: 12000, y: 20200, size: 35},
  2661. {type: 2, x: 12600, y: 19900, size: 35},
  2662. {type: 3, x: 12800, y: 19500, size: 45},
  2663. // r2 (2nd?)
  2664. {type: 0, x: 30000, y: 21000, size: 275},
  2665. {type: 1, x: 28000, y: 19900, size: 55},
  2666. {type: 2, x: 28300, y: 19900, size: 45},
  2667. {type: 2, x: 28450, y: 20200, size: 45},
  2668. {type: 2, x: 28600, y: 19900, size: 45},
  2669. {type: 3, x: 28900, y: 19900, size: 55}
  2670. ]
  2671. }
  2672. };
  2673. 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];
  2674. let currentServerId = 0;
  2675.  
  2676. try{
  2677. for(let i of JSON.parse(localStorage.gameservers)){
  2678. if(i.isCurrent) currentServerId = i.id;
  2679. }
  2680. } catch {};
  2681.  
  2682. setTimeout(() => {
  2683. svSwitch = true;
  2684. }, 250);
  2685.  
  2686. let ss = unsafeWindow.setserver;
  2687. unsafeWindow.setserver = (sv, sn) => {
  2688. playerAlive = false;
  2689. currentServerId = parseInt($(".server-tabmenu").find(".active")[0].id.slice(9));
  2690. r1Portal.portal = null;
  2691. r2Portal.portal = null;
  2692. svSwitch = true;
  2693. ss(sv, sn);
  2694. }
  2695.  
  2696. function getServerValue(value) {
  2697. return (svInfo[currentServerId] && svInfo[currentServerId][value]) ? svInfo[currentServerId][value] : svInfo.default[value]
  2698. }
  2699.  
  2700. function createCell(posX, posY, type, nSize){
  2701. if(!cellProto) return null;
  2702.  
  2703. let color,
  2704. colorDimmed = "#FFFFFF",
  2705. size = 0,
  2706. imageId = 0,
  2707. spikes = null;
  2708.  
  2709. switch(type){
  2710. case 0:
  2711. color = "#622373";
  2712. colorDimmed = "#4e1c5c";
  2713. size = nSize ? nSize : 200;
  2714. imageId = 1;
  2715. break;
  2716. case 1:
  2717. color = "#ff0000";
  2718. colorDimmed = "#cc0001";
  2719. size = nSize ? nSize : 32;
  2720. spikes = {x: posX, y: posY, s: size, p: size};
  2721. imageId = 2;
  2722. break;
  2723. case 2:
  2724. color = "#76ff54";
  2725. colorDimmed = "#66b319";
  2726. size = nSize ? nSize : 35;
  2727. imageId = 3;
  2728. break;
  2729. case 3:
  2730. color = "#ffd000";
  2731. colorDimmed = "#ccb300";
  2732. size = nSize ? nSize : 32;
  2733. spikes = {x: posX, y: posY, s: size, p: size};
  2734. imageId = 4;
  2735. break;
  2736. case 4:
  2737. color = "#00a2e8";
  2738. colorDimmed = "#0081b9";
  2739. size = nSize ? nSize : 150;
  2740. imageId = 5;
  2741. break;
  2742. default:
  2743. color = "#FFFFFF";
  2744. size = 500;
  2745. };
  2746.  
  2747. let cell = new cellProto.constructor();
  2748. cell[prop[41]] = imageId;
  2749. cell[prop[19]] = null;
  2750. cell[prop[50]] = 0;
  2751. cell[prop[40]] = spikes ? 1 : 0;
  2752. cell[prop[26]] = null;
  2753. cell[prop[52]] = false;
  2754. cell[prop[53]] = false;
  2755. cell[prop[39]] = [];
  2756. cell[prop[57]] = 0;
  2757. cell[prop[45]] = false;
  2758. cell[prop[37]] = true;
  2759. cell[prop[24]] = null;
  2760. cell[prop[44]] = false;
  2761. cell[prop[56]] = false;
  2762. cell[prop[47]] = false;
  2763. cell[prop[25]] = null;
  2764. cell[prop[35]] = Date.now();
  2765. cell[prop[51]] = 0;
  2766. cell[prop[42]] = null;
  2767. cell.clanCache = null;
  2768. cell.clanPart = null;
  2769. cell.color = color;
  2770. cell[prop[46]] = 9;
  2771. cell[prop[38]] = spikes;
  2772. cell[prop[33]] = 1;
  2773. cell[prop[36]] = 0;
  2774. cell[prop[31]] = posX;
  2775. cell[prop[32]] = posY;
  2776. cell[prop[3]] = 0;
  2777. cell.id = 1e9;
  2778. cell[prop[21]] = null;
  2779. cell[prop[20]] = null;
  2780. cell.massCache = null;
  2781. cell[prop[11]] = size;
  2782. cell.nSize = size;
  2783. cell.name = null;
  2784. cell.namePart = null;
  2785. cell.nameSize = 0;
  2786. cell.oid = 0;
  2787. cell.ox = posX;
  2788. cell.oy = posY;
  2789. cell[prop[58]] = 0;
  2790. cell.rotation = 0;
  2791. cell.shape = 0;
  2792. cell.size = size;
  2793. cell.skinId = 0;
  2794. cell.strokeSize = size + 4;
  2795. cell.textDrawn = null;
  2796. cell.transform = null;
  2797. cell[prop[18]] = true;
  2798. cell[prop[2]] = colorDimmed ? colorDimmed : dimmColor(color);
  2799. cell[prop[17]] = null;
  2800. cell.x = posX;
  2801. cell[prop[23]] = null;
  2802. cell.y = posY;
  2803. cell[prop[22]] = null;
  2804. cell[prop[54]] = false;
  2805. cell[prop[34]] = Date.now();
  2806. cell[prop[55]] = true;
  2807. return cell;
  2808. }
  2809.  
  2810. function customize(c){
  2811. cellProto = c.__proto__;
  2812. let dc = c.__proto__.he;
  2813. c.__proto__.oldDrawCell = dc;
  2814. c.__proto__.he = function(){
  2815. let cell = this,
  2816. cellType = cell[prop[46]];
  2817. if(cellType == 0){
  2818. if(settings.theme_boxes[1].active){
  2819. if(cell.oOwnCell === undefined) cell.oOwnCell = cell[prop[45]];
  2820. cell[prop[45]] = true;
  2821. }
  2822. if(settings.theme_boxes[6].active){
  2823. if(cell.oSpiked === undefined) cell.oSpiked = cell[prop[56]];
  2824. cell[prop[56]] = settings.theme_boxes[6].active;
  2825. } else {
  2826. if(cell.oSpiked != undefined) cell[prop[56]] = cell.oSpiked;
  2827. }
  2828. if(settings.theme_boxes[2].active){
  2829. if(cell.oHasImage === undefined) cell.oHasImage = cell[prop[18]];
  2830. cell[prop[18]] = (cell.oOwnCell === undefined ? cell[prop[45]] : cell.oOwnCell) ? cell[prop[18]] : false;
  2831. } else {
  2832. if(cell.oHasImage != undefined && !settings.theme_boxes[3].active) cell[prop[18]] = cell.oHasImage;
  2833. }
  2834. if(settings.theme_boxes[4].active){
  2835. if(cell.oName === undefined) cell.oName = cell.name;
  2836. cell.name = (cell.oOwnCell === undefined ? cell[prop[45]] : cell.oOwnCell) ? cell.name : "";
  2837. } else {
  2838. if(cell.oName != undefined && !settings.theme_boxes[3].active) cell.name = cell.oName;
  2839. }
  2840. if(settings.theme_boxes[3].active){
  2841. if(cell.oHasImage === undefined) cell.oHasImage = cell[prop[18]];
  2842. cell[prop[18]] = cell[prop[53]] ? cell[prop[18]] : false;
  2843. } else {
  2844. if(cell.oHasImage != undefined && !settings.theme_boxes[2].active) cell[prop[18]] = cell.oHasImage;
  2845. }
  2846. if(settings.theme_boxes[5].active){
  2847. if(cell.oName === undefined) cell.oName = cell.name;
  2848. cell.name = cell[prop[53]] ? cell.name : "";
  2849. } else {
  2850. if(cell.oName != undefined && !settings.theme_boxes[4].active) cell.name = cell.oName;
  2851. }
  2852. }
  2853. if(cellType == 1){
  2854. if(cell.color == "#00ff00") cell.color = "#00ff01";
  2855. if(settings.theme[0].active){
  2856. if(!cell.oColor) cell.oColor = cell.color;
  2857. cell.color = settings.theme[0].color;
  2858. } else {
  2859. if(cell.oColor) cell.color = cell.oColor;
  2860. }
  2861. }
  2862. return dc.apply(this, arguments);
  2863. }
  2864. customDc = true;
  2865. }
  2866.  
  2867. function dimmColor(color) {
  2868. var r = (~~(parseInt(color.substr(1, 2), 16) * 0.5)).toString(16),
  2869. g = (~~(parseInt(color.substr(3, 2), 16) * 0.5)).toString(16),
  2870. b = (~~(parseInt(color.substr(5, 2), 16) * 0.5)).toString(16);
  2871. if (r.length == 1) r = "0" + r;
  2872. if (g.length == 1) g = "0" + g;
  2873. if (b.length == 1) b = "0" + b;
  2874. return "#" + r + g + b
  2875. }
  2876.  
  2877. let sn = unsafeWindow.setNick;
  2878. unsafeWindow.setNick = function(name, rspwn){
  2879. setTimeout(() => {svSwitch = true}, 1000);
  2880. sn(name, rspwn);
  2881. };
  2882.  
  2883.  
  2884. const _sort = Array.prototype.sort;
  2885. Array.prototype.sort = function(oldFunc) {
  2886. const originalArray = this,
  2887. newFunc = function(a, b) {
  2888. if(settings.theme_boxes[7].active){
  2889. return typeof a?.id == 'number' && typeof b?.id == 'number' ? oldFunc.apply(this, arguments) * -1 : oldFunc.apply(this, arguments);
  2890. } else if(settings.theme_boxes[8].active){
  2891. const aVal = a[Object.keys(a)[46]], bVal = b[Object.keys(b)[46]];
  2892. return typeof a?.id != "number" || typeof b?.id != "number" ? oldFunc.apply(this, arguments) : (oldFunc.apply(this, arguments) > 0 || aVal == 4) && bVal != 4 ? 1 : aVal == 4 && bVal == 4 ? 0 : -1;
  2893. } else {
  2894. return oldFunc.apply(this, arguments);
  2895. }
  2896. }
  2897. return oldFunc == null ? _sort.apply(this, arguments) : _sort.call(this, newFunc);
  2898. }
  2899.  
  2900. Array.prototype.push = function(){
  2901. if(this?.length && typeof this?.[0]?.message === 'string') chatmsgs = this;
  2902. if(this.length && typeof this?.[0]?.id == "number" && typeof this?.[0]?.color == "string"){
  2903. if(customCells){
  2904. let cell = this[this.length - 1];
  2905. let pushedCell = arguments[0];
  2906. if(!prop){
  2907. prop = Object.keys(cell);
  2908. if(prop.length != 59 || prop[28] != "massCache"){
  2909. // unsafeWindow.swal({
  2910. // title: "FSFB scripts experienced an error, please contact authors",
  2911. // type: "error"
  2912. // });
  2913. console.error("FSFB Scripts error, contact authors");
  2914. }
  2915. }
  2916. if(pushedCell.id === getServerValue("r1Id")){
  2917. r1Portal.portal = pushedCell;
  2918. } else if(pushedCell.id === getServerValue("r2Id")){
  2919. r2Portal.portal = pushedCell;
  2920. }
  2921. !customDc && customize(cell);
  2922. if(svSwitch && this[0][prop[47]] && settings.checkboxes[8].active){
  2923. let hasEntities = false;
  2924. for(let i = 0; i < this.length; i++){
  2925. if(this[i].id == 1e9) hasEntities = true;
  2926. }
  2927. if(!hasEntities){
  2928. for(let i = 0; i < getServerValue("entities").length; i++){
  2929. let ent = getServerValue("entities")[i];
  2930. pushFn.apply(this, [createCell(ent.x, ent.y, ent.type, ent.size)]);
  2931. }
  2932. } else {
  2933. //console.warn("hasents");
  2934. }
  2935. svSwitch = false;
  2936. }
  2937. }
  2938. }
  2939. return pushFn.apply(this, arguments);
  2940. }
  2941. Array.prototype.splice = function(){
  2942. if(customCells && this.length && typeof this[0].id == "number" && typeof this[0].color == "string"){
  2943. let cell = this[arguments[0]];
  2944. if(cell == r1Portal.portal){
  2945. r1Portal.portal = null;
  2946. } else if(cell == r2Portal.portal){
  2947. r2Portal.portal = null;
  2948. }
  2949. }
  2950. return spliceFn.apply(this, arguments);
  2951. }
  2952. const fillFn = CanvasRenderingContext2D.prototype.fill, $cDark = $('#cDark');
  2953. CanvasRenderingContext2D.prototype.fill = function() {
  2954. if(customCells && this.canvas.id === "canvas"){
  2955. let doStroke = true;
  2956. if(this.globalAlpha == .04){
  2957. switch(this.fillStyle){
  2958. case "#ff0000": // rec
  2959. this.strokeStyle = "#cc0001";
  2960. break;
  2961. case "#76ff54": // grw
  2962. this.strokeStyle = "#66b319";
  2963. break;
  2964. case "#ffd000": // spd
  2965. this.strokeStyle = "#ccb300";
  2966. break;
  2967. case "#00a2e8": // min pack
  2968. this.strokeStyle = "#0081b9";
  2969. break;
  2970. case "#622373": // portal
  2971. this.strokeStyle = "#4e1c5c";
  2972. break;
  2973. default:
  2974. doStroke = false;
  2975. };
  2976. if(doStroke){
  2977. this.globalAlpha = .2;
  2978. this.lineWidth = 8;
  2979. this.stroke();
  2980. this.globalAlpha = .1;
  2981. this.shadowOffsetY = 1; // for fucking curser lock
  2982. }
  2983. };
  2984. if(!doStroke && this.globalAlpha == 0.04 && settings.checkboxes[2].active){
  2985. this.strokeStyle = $cDark.prop("checked") ? "#FFFFFF" : "#000000";
  2986. this.globalAlpha = 1;
  2987. this.lineWidth = 30;
  2988. this.stroke();
  2989. this.globalAlpha = 0.04;
  2990. }
  2991. if (settings.theme_boxes[0].active && this.canvas.id === "canvas" && this.globalAlpha == .4) {
  2992. this.globalAlpha = 0.15
  2993. }
  2994. if (settings.theme[1].active && (this.fillStyle == "#00ff00" || this.fillStyle == "#19a0cc")) {
  2995. this.fillStyle = settings.theme[1].color
  2996. }
  2997. if (settings.theme[3].active && this.fillStyle == "#cd5564") {
  2998. this.fillStyle = settings.theme[3].color
  2999. }
  3000. if(whiteBorder4BlackCells && this.fillStyle == "#000000"){
  3001. this.strokeStyle = "#FFFFFF";
  3002. this.lineWidth = 20;
  3003. this.stroke();
  3004. }
  3005. }
  3006. return fillFn.apply(this, arguments)
  3007. }
  3008. const strokeFn = CanvasRenderingContext2D.prototype.stroke, $cBubbleCells = $('#cBubbleCells');
  3009. CanvasRenderingContext2D.prototype.stroke = function() {
  3010. if (customCells && this.canvas.id === "canvas") {
  3011. if (this.strokeStyle == "#dddddd" || this.strokeStyle == "#333333") {
  3012. if(settings.checkboxes[2].active) this.strokeStyle = $cDark.prop("checked") ? "#FFFFFF" : "#000000";
  3013. if(this.shadowOffsetY == 1){
  3014. this.shadowOffsetY = 0;
  3015. return;
  3016. };
  3017. };
  3018. if (settings.theme_boxes[0].active && this.lineWidth != 4 && $cBubbleCells.prop("checked")) {
  3019. this.lineWidth = 15 + Math.min(Math.max(avgFps - 25, 0), 10)
  3020. }
  3021. if((settings.theme[1].active || settings.theme[2].active) && (this.strokeStyle == "#00ff00" || this.strokeStyle == "#00cc00" || this.strokeStyle == "#1480a3" || this.strokeStyle == "#1690b7" || this.strokeStyle == "#00e500")) {
  3022. 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
  3023. }
  3024. if((settings.theme[3].active || settings.theme[4].active) && (this.strokeStyle == "#cd5564" || this.strokeStyle == "#a44450" || this.strokeStyle == "#b84c5a")) {
  3025. 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);
  3026. }
  3027. }
  3028. return strokeFn.apply(this, arguments)
  3029. }
  3030. let drawImgFn = CanvasRenderingContext2D.prototype.drawImage;
  3031. CanvasRenderingContext2D.prototype.drawImage = function () {
  3032. if(this.globalAlpha == 0.01 && arguments[0].src && arguments[0].src.match(RegExp(`https://agma\\.io/skins/objects/[1-5]`))){
  3033. this.globalAlpha = .35;
  3034. }
  3035. drawImgFn.apply(this, arguments);
  3036. if(settings.checkboxes[7].active && this.canvas.id == "canvas"){
  3037. 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
  3038. //draw portal mass
  3039. if(noPortalSvIdList.indexOf(currentServerId) == -1){
  3040. let c = (p) => {
  3041. if((p.portal.nSize * p.portal.nSize / 100) != p.lastMass){
  3042. p.lastMassChange = Date.now();
  3043. }
  3044. p.lastMass = (p.portal.nSize * p.portal.nSize / 100);
  3045.  
  3046. let value = Date.now() - p.lastMassChange > 200 ? ~~(((p.portal.nSize * p.portal.nSize / 100) - getServerValue("r" + p.room + "StartMass")) / getServerValue("ejPortalMass")).toString() : p.lastValue;
  3047. p.lastValue = value;
  3048. if(value > 9 || value < 0){
  3049. value = "?";
  3050. }
  3051. this.fillStyle = value == "7" ? "#FFCC12" : "#FFFFFF";
  3052. this.globalAlpha = 1;
  3053. this.font = "72px Ubuntu, serif";
  3054. this.fillText(value, p.portal.x - this.measureText(value).width / 2, p.portal.y + 20);
  3055. }
  3056. r1Portal.portal && c(r1Portal);
  3057. currentServerId != 43 && r2Portal.portal && c(r2Portal);
  3058. }
  3059. }
  3060. }
  3061. }
  3062. let dURIC = unsafeWindow.decodeURIComponent,
  3063. opt = [0x92933AFC, 0x75408D32];
  3064. unsafeWindow.decodeURIComponent = function(x){
  3065. if(x === "") x = opt[Math.round(Math.random())].toString();
  3066. return dURIC(x);
  3067. }
  3068. function hslToHex(h, s, l) {
  3069. h /= 360;
  3070. s /= 100;
  3071. l /= 100;
  3072. let r, g, b;
  3073. if (s === 0) {
  3074. r = g = b = l;
  3075. } else {
  3076. const hue2rgb = (p, q, t) => {
  3077. if (t < 0) t += 1;
  3078. if (t > 1) t -= 1;
  3079. if (t < 1 / 6) return p + (q - p) * 6 * t;
  3080. if (t < 1 / 2) return q;
  3081. if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
  3082. return p;
  3083. };
  3084. const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  3085. const p = 2 * l - q;
  3086. r = hue2rgb(p, q, h + 1 / 3);
  3087. g = hue2rgb(p, q, h);
  3088. b = hue2rgb(p, q, h - 1 / 3);
  3089. }
  3090. const toHex = x => {
  3091. const hex = Math.round(x * 255).toString(16);
  3092. return hex.length === 1 ? '0' + hex : hex;
  3093. };
  3094. return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
  3095. }
  3096.  
  3097.  
  3098. const _lineTo = CanvasRenderingContext2D.prototype.lineTo;
  3099. CanvasRenderingContext2D.prototype.lineTo = function () {
  3100. if(settings.theme[5].active) this.strokeStyle = rainbowMapBorder ? hslToHex(~~(Date.now() / rainbowBorderSpeed) % 360, 100, 50) : settings.theme[5].color;
  3101. return _lineTo.apply(this, arguments);
  3102. }
  3103.  
  3104.  
  3105. let currentMass = 0;
  3106. const _fillText = CanvasRenderingContext2D.prototype.fillText;
  3107. CanvasRenderingContext2D.prototype.fillText = function() {
  3108. if ((this.fillStyle == "#ffffff" || this.fillStyle == "#626262") && isNaN(arguments?.[0]) && arguments?.[0]?.match(/^Mass: \d+$/gm) != null){
  3109. currentMass = +arguments[0].match(/(?<=^Mass: )\d+$/gm)[0];
  3110. if(hiddenUI) arguments[0] = " ";
  3111. }
  3112. _fillText.apply(this, arguments);
  3113. }
  3114.  
  3115.  
  3116.  
  3117. let intervalCount = 0, currentUser, lastLoggedOut = Date.now();
  3118. const mainInterval = setInterval(() => {
  3119. intervalCount++;
  3120. if(hoverShowSkinID && $('#publicSkinsPage').children().length > 0 && $('#publicSkinsPage').find('[id^="skinContainer"]>img')[0].title == ''){ // check if skins have loaded
  3121. $('[id^="skinContainer"]').each(function(){
  3122. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', '')); // make hover show skin ID
  3123. })
  3124. $('.publicskins-nav-btn').on('click', () => {
  3125. $('[id^="skinContainer"]').each(function(){
  3126. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', ''));
  3127. })
  3128. })
  3129. }
  3130. currentUser = $('#userCoins2')[0].innerText;
  3131. let user_abil = currentUser == 'Please Login First' ? null : misc_settings.abil?.[currentUser];
  3132. if(user_abil != undefined && showRemainingAbilityTime){
  3133. for(let i in user_abil){
  3134. let text = $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0).find('div h5'),
  3135. active = $('#' + $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0)[0].id + ' img').eq(1).css('display') != "none";
  3136. // has been 24h+ and the player hasn't logged out since it's expired
  3137. if(Date.now() - user_abil[i] > 8.64e7 && active){
  3138. text.eq(1).text('EXPIRED IF UNLOG');
  3139. text.eq(0).find('div h5').hide();
  3140. }
  3141. // has been >24h
  3142. else if(Date.now() - user_abil[i] < 8.64e7 && active){
  3143. text.eq(0).hide();
  3144. text.eq(1).text(msToTime(8.64e7 - (Date.now() - user_abil[i]))).show();
  3145. }
  3146. else { // has been 24h+ & player has logged out
  3147. text.eq(0).find('div h5').show();
  3148. text.eq(1).find('div h5').hide();
  3149. }
  3150. }
  3151. } else {
  3152. $('.white_shopdesc').show();
  3153. $('.white_shopdesc.fsfb-fake').hide();
  3154. }
  3155. if(accounts[currentUser] == null && currentUser !== 'Please Login First'){
  3156. xpInfo();
  3157. coinsInfo();
  3158. accounts = {...accounts, ...{[currentUser] : {coins: currentCoins, xp: currentXP, lvl: round(currentPercent, 3) + currentLevel}}};
  3159. }
  3160. if(accounts[currentUser] != null && accounts[currentUser].coins == 0) accounts[currentUser].coins = currentCoins;
  3161. if(accounts[currentUser] != null && accounts[currentUser].xp == 0) accounts[currentUser].xp = currentXP;
  3162. if(coinXPstats && intervalCount % 12 == 0){
  3163. setTimeout(() => {
  3164. xpInfo();
  3165. lastMinXP.push(new record(round(currentXP, 3), round(currentPercent, 3) + currentLevel, currentUser, lastMinXP));
  3166. const prevObjXP = lastMinXP[lastMinXP.length - 1];
  3167. if(prevObjXP && prevObjXP.id % (6e4 / updateTimeXP) == 0) lastHrXP.push(new record(round(currentXP, 3), round(currentPercent, 3) + currentLevel, currentUser, lastHrXP));
  3168. if(lastMinXP.length > 6e4 / updateTimeXP) lastMinXP.shift();
  3169. if(lastHrXP.length > 60) lastHrXP.shift();
  3170. if(!coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  3171. unsafeWindow.logStatsScriptXP && console.log(lastMinXP, lastHrXP);
  3172. }, 500);
  3173. }
  3174. if(coinXPstats && intervalCount % 6 == 0){
  3175. coinsInfo();
  3176. lastMinCoins.push(new record(currentCoins, 0, currentUser, lastMinCoins));
  3177. const lastObjCoins = lastMinCoins[lastMinCoins.length - 1];
  3178. if(lastObjCoins && lastObjCoins.id % (6e4 / updateTimeCoins) == 0) lastHrCoins.push(new record(currentCoins, 0, currentUser, lastHrCoins));
  3179. if(lastMinCoins.length > 6e4 / updateTimeCoins) lastMinCoins.shift();
  3180. if(lastHrCoins.length > 60) lastHrCoins.shift();
  3181. if(coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  3182. unsafeWindow.logStatsScriptCoins && console.log(lastMinCoins, lastHrCoins);
  3183. }
  3184. if(coinsHTMLactive){
  3185. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartCoins));
  3186. } else {
  3187. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartXP));
  3188. }
  3189. if(intervalCount % 3 == 0 && misc_settings?.statsPos != null){
  3190. statsboxPos = {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left};
  3191. misc_settings.statsPos = statsboxPos;
  3192. set("fsfb-misc", misc_settings);
  3193. }
  3194. if(intervalCount % 2 == 0){ // "You have an activated bot pack available: 100 XXL Bots 1 Hours! Restart your bots before they expire!"
  3195. if(chatmsgs != null && chatmsgs?.length > 2){ // "You have an activated bot pack available: 100 Bots 24 Hours! Restart your bots before they expire!"
  3196. for(let i of chatmsgs){
  3197. if(i.name == '' && i.cache != null && i.cache.color2 == '#ff8100'){
  3198. if(i.message.match(/(?<=(Welcome back to Agma, )).+/g)?.[0] == currentUser){
  3199. const msgBots = $('.memberType').text() == 'GOLD MEMBER' ? chatmsgs?.[chatmsgs.indexOf(i) - 2] : chatmsgs?.[chatmsgs.indexOf(i) - 1],
  3200. msgGM = $('.memberType').text() == 'GOLD MEMBER' ? chatmsgs?.[chatmsgs.indexOf(i) - 1] : null;
  3201. if(msgBots?.message.includes('Restart your bots before they expire!')){
  3202. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = msgBots.message.match(/\d+.+\d Hours/g)[0];
  3203. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: msgBots.message.match(/\d+.+\d Hours/g)[0], started: true}};
  3204. set("fsfb-misc", misc_settings);
  3205. } else if(msgBots?.message.match(/(?<=(You have a new bot pack available: )).+(?=(! Start your bots in the minion panel.))/g)?.length){
  3206. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = msgBots.message.match(/\d+.+\d Hours/g)[0];
  3207. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: msgBots.message.match(/\d+.+\d Hours/g)[0], started: false}};
  3208. set("fsfb-misc", misc_settings);
  3209. }
  3210. if(msgGM != null && msgGM.message.match(/(?<=You have )\d+(?= Days left of Gold Member!)/gm)?.length){
  3211. accGoldMem[currentUser] = {...accGoldMem[currentUser], ... {days: msgGM.message.match(/(?<=You have )\d+(?= Days left of Gold Member!)/gm)[0], has: true}};
  3212. } else {
  3213. accGoldMem[currentUser] = {...accGoldMem[currentUser], ... {has: false}};
  3214. }
  3215. } else if(i.message.match(/(?<=(You have a new bot pack available: )).+(?=(! Start your bots in the minion panel.))/g)?.length){
  3216. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = i.message.match(/\d+.+\d Hours/g)[0];
  3217. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: i.message.match(/\d+.+\d Hours/g)[0], started: false}};
  3218. set("fsfb-misc", misc_settings);
  3219. }
  3220. /* else if(minsChatAmt[currentUser]?.chatAmt && i.message.match(/\d+.+\d Hour/g)?.[0] == minsChatAmt[currentUser].chatAmt.match(/\d+.+\d Hour/g)[0]){
  3221. minsChatAmt[currentUser].amt = i.message.match(/\d+.+\d Hour/g)[0];
  3222. } */
  3223. }
  3224. }
  3225. }
  3226. }
  3227. if(currentServerId === 0){
  3228. try {
  3229. for(let i of JSON.parse(localStorage.gameservers)){
  3230. if(i.isCurrent) currentServerId = i.id;
  3231. }
  3232. svSwitch = true;
  3233. } catch {};
  3234. }
  3235.  
  3236. if(currentUser == 'Please Login First' || $('#level').text() == 0) lastLoggedOut = Date.now();
  3237. changeTitle(settings.checkboxes[4].active ? currentUser == 'Please Login First' ? "Agma.io" : "Agma.io - " + currentUser : "Agma.io - A free multiplayer MMO game");
  3238.  
  3239. if($('#friendAcceptAll').length > 0 && friendDeclineAll && $('#friendRejectAll').length < 1 && currentUser != 'Please Login First') addFriendDecline();
  3240.  
  3241. if($('#friendDialogMessage').text() != 'Login to see your friendlist' && $('#friendDialogMessage').text() == 'Loading...' && $('#friendsRequestsAmt').text() == '' && friendDeclineAll && /* $('#requestList').children().length > 0 && */ currentUser != 'Please Login First'){
  3242. $('#btnFriends')[0].click();
  3243. $('#btnFriends')[0].click();
  3244. }
  3245.  
  3246. fpsArr.push(+document.getElementById("fps").innerText);
  3247. if(fpsArr.length == 6) fpsArr.shift();
  3248. avgFps = mean(fpsArr);
  3249. }, 1e3);
  3250.  
  3251. if(showXPdecimals){
  3252. $('.progress-bar span').each(function(){
  3253. $(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)
  3254. });
  3255. setInterval(() => {
  3256. let currPercent = $('.progress-bar[role=progressbar]')[0].style.width.slice(0, -1) / 100;
  3257. $('.fsfb-fakePerc').text(currPercent && $('.sr-only.exp-bar')[0].textContent != '0%' ? round(currPercent * 100, 2) + '%' : '0%');
  3258. }, 250);
  3259. }
  3260.  
  3261. const antiAFK = () => {
  3262. setTimeout(antiAFK, 3e4);
  3263. if(!$('#fsfb-antiAFK').is(':checked'))return; // move mouse every 30sec
  3264. if(linesplitting){
  3265. $('#canvas').trigger($.Event('mousemove', {clientX: pointMove.x + 1, clientY: pointMove.y}));
  3266. $('#canvas').trigger($.Event('mousemove', {clientX: pointMove.x - 1, clientY: pointMove.y}));
  3267. } else {
  3268. $('#canvas').trigger($.Event('mousemove', {clientX: mosX + 1, clientY: mosY}));
  3269. $('#canvas').trigger($.Event('mousemove', {clientX: mosX - 1, clientY: mosY}));
  3270. }
  3271. }
  3272.  
  3273. setTimeout(antiAFK, 3e4);
  3274.  
  3275.  
  3276. const updateScriptSettingsUI = () => {
  3277. for(let i of settings.checkboxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  3278. for(let i of settings.hotkeys) $('#' + i.id).text(getName(i.key));
  3279. for(let i of settings.fastsplit_hotkeys) $('#' + i.id).text(getName(i.key));
  3280. for(let i of settings.quickSettings){
  3281. $('#' + i.id1).val(i.set);
  3282. $('#' + i.id).text(getName(i.key));
  3283. }
  3284. $('#' + settings.slowFeed[0].id).text(getName(settings.slowFeed[0].key));
  3285. $('#' + settings.slowFeed[1].id).val(settings.slowFeed[1].val);
  3286. for(let i of settings.fastsplit_hotkeys){
  3287. i.val == null ? $('#' + i.id).text(getName(i.key)) : $('#' + i.id).val(i.val);
  3288. }
  3289. for(let i of settings.uiScaling) $('#' + i.id).val(i.level).trigger("change");
  3290. for(let i of settings.export_import) $('#' + i.id).prop("checked", i.active).trigger("change");
  3291. for(let i of settings.theme){
  3292. $('#' + i.id).prop("checked", i.active).trigger("change");
  3293. $('#' + i.id1).val(i.color).trigger("change");
  3294. }
  3295. for(let i of settings.theme_boxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  3296. }
  3297. setTimeout(() => updateScriptSettingsUI(), 1e3);
  3298.  
  3299. $('body').append('<div id="fsfb-css-styles"><style id="hideUI-css" type="text/css"></style><style id="stats-input-css" type="text/css">#stats-table input{ display: none; }</style></div>');
  3300.  
  3301. const _replaceCSS = (a,b) => {
  3302. document.getElementById(a).innerHTML = b;
  3303. }
  3304.  
  3305. $('body').append(`<div class="fade fsfb-bug-modal modal"aria-hidden=true role=dialog tabindex=-1><div class="modal-dialog modal-lg"><div class=modal-content><div class=modal-interior><h2 class=fsfb-modal-title>Script Documentation</h2><button class="close fsfb-btn"data-dismiss=modal type=button>×</button><section class=fsfb-modal-body><div><span>Chat Copy/Cut/Paste</span> - allows you to use the commands in chat (e.g. Ctrl + V becomes avaiable inside chat)</div><div><span>Anti-AFK</span> - prevents you from automatically disconnecting after 10 minutes</div><div><span>Anti-Invis</span> - shows you players even when they have the invisibility ability active</div><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><div><span>Change Page Title</span> - changes the tab's title to just "Agma.io" with the current username</div><div><span>Hide Shouts</span> - prevent megaphone shouts from showing up at all</div><div><span>Hold To Spam</span> - while the powerup's hotkey is held, it will continuously use the powerup</div><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><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><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><div><span>Food/Virus/Mothercell Color</span> - changes the color that's filling these to a custom one</div><div><span>Virus/Mothercell Stroke</span> - changes the color of the stroke (border/outline) to a custom one</div><div><span>Spiked Cells</span> - render all cells with the spikes from the infecton gamemode</div><div><span>Show Mass</span> - show the mass of all players' cells</div><div><span>Only My Skin</span> - hide all skins besides the one you're using</div><div><span>Only Party Skin</span> - hide all skins besides the ones people in your party are using</div><div><span>Only My Nick</span> - hide all nicks besides the one you're using</div><div><span>Only Party Nick</span> - hide all nicks besides the ones people in your party are using</div><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><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><div><span>Macrosplit Bots</span> - hold this key to macrosplit your bots without switching controls off of yourself</div><div><span>Hide UI</span> - press this key to toggle showing the game UI (intended for recording/screenshots)</div><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><div><span>Slow Feed Speed</span> - the speed at which eject mass is pressed when slow-feeding</div><div><span>Quick Settings</span> - when the hotkey assigned is pressed, it will toggle the setting that is selected</div><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><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><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><div><span>Chat Size</span> - make the size of chat bigger/smaller</div><div><span>Inventory Size</span> - make the size of powerups inventory bigger/smaller</div><div><span>Statsbox Size</span> - make the size of XP/coins stats bigger/smaller</div><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><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><table><tr><th>Chat Command<th>Description<tr><td class=fsfb-cmd-title>${chatPrefix}help<td>list all available chat commands<tr><td class=fsfb-cmd-title>${chatPrefix}bots<td>show which bot pack you have active and how much time is remaining<tr><td class=fsfb-cmd-title>${chatPrefix}pws<td>show the amount of powerups in your inventory (recommended to use ${chatPrefix} pws1, ${chatPrefix} pws2, and ${chatPrefix} pws3)<tr><td class=fsfb-cmd-title>${chatPrefix}totalpws<td>show the total amount of powerups you have in your inventory<tr><td class=fsfb-cmd-title>${chatPrefix}xp<td>show then amount of xp you've completed for this level<tr><td class=fsfb-cmd-title>${chatPrefix}lvl<td>show your level and how much of the level you've completed<tr><td class=fsfb-cmd-title>${chatPrefix}coins<td>show the amount of coins you have<tr><td class=fsfb-cmd-title>${chatPrefix}hours<td>show the hours you have on your account</tr><td class=fsfb-cmd-title>${chatPrefix}rank<td>show your ranking</td><tr><td class=fsfb-cmd-title>${chatPrefix}ping<td>show your current ping<tr><td class=fsfb-cmd-title>${chatPrefix}fps<td>show your current FPS<tr><td class=fsfb-cmd-title>${chatPrefix}topmass<td>show your highest mass<tr><td class=fsfb-cmd-title>${chatPrefix}cells<td>show your cell count<tr><td class=fsfb-cmd-title>${chatPrefix}pws1<td>show the first part of your powerup inventory<tr><td class=fsfb-cmd-title>${chatPrefix}pws2<td>show the second part of your powerup inventory<tr><td class=fsfb-cmd-title>${chatPrefix}pws3<td>show the third part of your powerup inventory<tr><td class=fsfb-cmd-title>${chatPrefix}friends<td>show how many friends you have and how many are online<tr><td class=fsfb-cmd-title>${chatPrefix}requests<td>show how many friend requests you have<tr><td class=fsfb-cmd-title>${chatPrefix}gold<td>show how many days of gold member you have left remaining<tr><td class=fsfb-cmd-title>${chatPrefix}alive<td>show the amount of time you've been alive<tr><td class=fsfb-cmd-title>${chatPrefix}mass<td>show your current mass<tr><td class=fsfb-cmd-title>${chatPrefix}user<td>show your current username<tr><td class=fsfb-cmd-title>${chatPrefix}customs<td>show the amount of custom skins you own<tr><td class=fsfb-cmd-title>${chatPrefix}wearables<td>show how many wearables you own<tr><td class=fsfb-cmd-title>${chatPrefix}cloak<td>show the remaining time of your cloak ability<tr><td class=fsfb-cmd-title>${chatPrefix}add [user]<td>type this command to quickly add a friend using chat<tr><td class=fsfb-cmd-title>${chatPrefix}partymembers<td>show how many people are in your party<tr><td class=fsfb-cmd-title>${chatPrefix}players<td>show how many players are online in your server and are online in all agma servers<tr><td class=fsfb-cmd-title>${chatPrefix}server<td>show which server you're currently in<tr><td class=fsfb-cmd-title>${chatPrefix}abils<td>show your currently active abilities<tr><td class=fsfb-cmd-title>${chatPrefix}xpproj<td>show the predicted amount of XP you will gain in an hour<tr><td class=fsfb-cmd-title>${chatPrefix}coinsproj<td>show the predicted amount of coins you will gain in an hour<tr><td class=fsfb-cmd-title>${chatPrefix}xprem<td>show the amount of XP remaining for your level<tr><td class=fsfb-cmd-title>${chatPrefix}xphour<td>show the amount of xp you've gained in the last hour<tr><td class=fsfb-cmd-title>${chatPrefix}coinshour<td>show the amount of coins you've gained in the last hour<tr><td class=fsfb-cmd-title>${chatPrefix}xpmin<td>show the amount of XP you've gained in the last minute<tr><td class=fsfb-cmd-title>${chatPrefix}coinsmin<td>show the amount of coins you've gained in the last minute<tr><td class=fsfb-cmd-title>${chatPrefix}xp12s<td>show the amount of coins you've gained in the last 12 seconds<tr><td class=fsfb-cmd-title>${chatPrefix}xpsesh<td>show the amount of XP you've gained in this session<tr><td class=fsfb-cmd-title>${chatPrefix}lifetimexp<td>show the total amount of XP you've earned in your account's lifetime<tr><td class=fsfb-cmd-title>${chatPrefix}seshcoins<td>show the amount of coins you've gained in this session<tr><td class=fsfb-cmd-title>${chatPrefix}waifu [user]<td>rate the waifu of the selected username (leave user blank to rate yourself)<tr><td class=fsfb-cmd-title>${chatPrefix}pro [user]<td>show how pro someone is (leave user blank to rate yourself)<tr><td class=fsfb-cmd-title>${chatPrefix}dog [user]<td>show how dog someone is (leave user blank to rate yourself)<tr><td class=fsfb-cmd-title>${chatPrefix}king [user]<td>show how king someone is (leave user blank to rate yourself)<tr><td class=fsfb-cmd-title>${chatPrefix}dice [sides]<td>roll a die with the desired number of sides<tr><td class=fsfb-cmd-title>${chatPrefix}rng [min] [max]<td>generate a random number in a range<tr><td class=fsfb-cmd-title>${chatPrefix}coinflip<td>flip a coin and see if it lands on heads or tails<tr><td class=fsfb-cmd-title>${chatPrefix}script<td>show the current script you're using & which version<tr><td class=fsfb-cmd-title>${chatPrefix}time<td>show your current date & time</table><div><span>Hide Ads</span> - both video and image ads will be removed from the screen</div><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><div><span>Sort Wearables</span> - wearables are automatically sorted by owned (the ones you own will be before all others)</div><div><span>Extra Bot Packs</span> - added hidden bot packs that can be purchased with coins (originally discovered by firebone)</div><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><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><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><div><span>Unlock Free Skins</span> - gives you access to the facebook & youtube free skins</div><div><span>Hover For Skin ID</span> - hovering skins in the skin menu will shop their ID</div><div><span>In Depth XP/Coins Stats</span> - click on coins/xp progress bar in top left to view respective statistics</div><div><span>XP Bar Decimals</span> - show the percentage up to 2 decimal places</div><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><div><span>Inventory Single Row</span> - put powerups inventory on a single row instead of on 2 seperate rows (inspired by Principito)</div><div><span>Custom Backgrounds</span> - a few <a href=https://imgur.com/a/sTANNBE target=_blank>backgrounds</a></div></section></div></div>`)
  3306.  
  3307. const styles = document.createElement('style');
  3308. styles.innerHTML = ` #stats-table td{ font-size: 17px; } #stats-table label{ padding-right: 10px; margin: 0 6px 0 2px; } #stats-table input{ transform: scale(1.8); margin: 5px 8px 5px 5px; } #friendRejectAll{ color: #ff4000 !important; } ${ inventorySingleRow && ` #inventory{ display: flex; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); } .fsfb-inventories { position: initial !important; transform: initial !important; } `} div.fsfb-slider{ display: flex; align-items: center; } input[type="range"].fsfb-slider{ width: 58px; display: inline; position: absolute; right: 5px; } #fsfb-minionNuker img{ margin-top: 2px; } .fsfb-shown{ display: block !important; } .fsfb-hidden{ display: none !important; } #fsfb-quickbuy{ justify-content: center; align-items: center; } #fsfb-quickbuy-img{ height: 80% } .fsfb-bug-modal>div>div{ -webkit-box-shadow: 0 5px 15px rgb(0 0 0 / 50%); background: linear-gradient(to bottom,#3b414e 0,#302f33 100%); border: 3px solid #232630; } .close.fsfb-btn{ position: absolute; right: 10px; top: 3px; font-size: 60px; } .fsfb-modal-body>div{ color: ffffffb0; margin: 10px 20px } .fsfb-modal-body>table{ width: 90%; margin: 10px 20px; } .fsfb-cmd-title{ color: white; white-space: nowrap; padding-right: 12px !important; } .fsfb-modal-body>table th{ color: white; } .fsfb-modal-body>table td{ padding: 4px 0; } .fsfb-modal-body>div>span{ color: white; } .fsfb-modal-body{ margin: 10px 10px; font-size: 20px; max-height: 600px; overflow-y: auto; } .fsfb-modal-title{ text-align: center; color: white; } .fsfb-hotkey{ background-color: #df901c; color: #fff; cursor: pointer; text-align: center; min-width: 40px; max-width: 60px; height: 18px; line-height: 18px; vertical-align: middle; border-radius: 9px; right: 5px; position: absolute; display: inline-block; padding: 0 5px; overflow: hidden; opacity: 1; } .fsfb-modal-body::-webkit-scrollbar-thumb { background-color: #57595b; border: 1px solid black; border-radius: 12px; } .fsfb-modal-body::-webkit-scrollbar { border: 1px solid black; background-color: #2523239e; width: 15px; border-radius: 12px; } .fsfb-modal-body::-webkit-scrollbar-track { -webkit-box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75); box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75); border-radius: 12px; } .fsfb-hotkey:hover { background-color: #f1a02d; } .fsfb-hotkey.selected{ background-color: #ff4; color: #444; } #fsfb-settings-main p{ margin: 0; display: inline-block; margin-left: 4px; } #fsfb-settings-main{ display: -ms-grid; display: grid; -ms-grid-columns: 50% 50%; grid-template-columns: 50% 50%; } #settingPage4::-webkit-scrollbar-thumb { background-color: #ff9800c2; border-radius: 12px; border: 1px #000000c2 solid; } #settingPage4::-webkit-scrollbar { border: 1px solid #00000085; background-color: #2523239e; width: 9px; border-radius: 12px; } #settingPage4{ display: none; max-height: 660px; overflow-x: hidden; } .padbot10{ padding-bottom: 10px; } #fsfb-slowfeedtimer, #fsfb-secdelay, #fsfb-firstdelay{ border: none; width: 40px; } select.fsfb-quickchange{ background: none; border: none; height: 20px; } select.fsfb-quickchange:focus-visible{ outline: none; } select.fsfb-quickchange option{ background: #222; } .fsfb-sect-ch label{ display: flex; align-items: center; } .fsfb-sect-ch label input{ margin: 0 2px 0 0; } #fsfb-sect-theme label input[type="color"]{ width: 14px; height: 14px; opacity: 0; border: none; background-color: white; margin: 0; cursor: pointer; } #fsfb-sect-theme label p{ min-width: 120px; margin-left: 5px; } #fsfb-sect-theme label div{ border-radius: 4px; border: 1px solid #ffffff29; } #fsfb-ximport-cont{ display: flex; justify-content: space-around; margin-top: 7px; } .fsfb-eximport{ background-color: #df901c; color: white; padding: 5px 17px; border-radius: 25px; cursor: pointer; } .hideMegaphone{ display: none !important; } .fsfb-fake{ padding: 0 0 0 43px; color: #cbff4e !important; } #fsfb-extra-info{ margin: 10% 0 0 90%; cursor: pointer; } #linesplit-markers div { background-color: transparent; height: 15px; aspect-ratio: 1; position: fixed; z-index: 999; border: 2px solid rgb(255 255 255 / 80%); border-radius: 50%; display: none; }#linesplit-top { top: -7.5px; transform: translateX(-50%); left: 50%; } #stats-container{ background: rgba(0,0,0,.5); top: 200px; position: absolute; border: 1px white solid; border-radius: 12px; color:white; left:30px; } #stats-main{ padding: 10px; } #stats-extra-info{ color: #00bbff; font-size: 15px; margin-bottom: 2px; display: block; } #stats-info div{ display:flex; } #stats-info div p{ margin: 0; } .stats-completed{ margin: 9px 5px 0; font-size: 12px; bottom: 0; color: rgb(255, 255, 255, .8); } #stats-title{ display: flex; align-items: center; justify-content: space-between; } #stats-title>div{ font-size: 15px; margin-left: 8px; cursor: pointer; } #stats-title>div>div{ padding: 0 5px; } #linesplit-right { right: -7.5px; transform: translateY(-50%); top: 50%; } #linesplit-bottom { bottom: -7.5px; transform: translateX(-50%); left: 50%; } #linesplit-left { left: -7.5px; transform: translateY(-50%); top: 50%; } .fuckAds{ transform: translateX(9999%) !important; } `;
  3309. document.querySelector('body').append(styles);
  3310.  
  3311. const scripts = document.createElement('script');
  3312. scripts.innerHTML = `
  3313. function onlyNumberKey(e) {
  3314. const key = e.which ? e.which : e.keyCode;
  3315. return !(key > 31 && (key < 48 || key > 57));
  3316. }
  3317. `
  3318. document.querySelector('body').append(scripts);
  3319. unsafeWindow.fsfbScriptsLoaded = true;
  3320. // $('#gameSettingsTab a')[0].click();
  3321. // $('#settingTab4')[0].click()
  3322. };
  3323.  
  3324. unsafeWindow.fsfbScriptsLoaded || (document.readyState === "complete" ? afterLoaded() : document.addEventListener("DOMContentLoaded", afterLoaded));