fsfb script

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

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

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