Greasy Fork 还支持 简体中文。

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-11-02 提交的版本,檢視 最新版本

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