fsfb script

An agma.io script, which includes fastsplit, secret bot packs, linesplit lock, and many other amazing features!

目前为 2023-02-18 提交的版本。查看 最新版本

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