Greasy Fork 支持简体中文。

fsfb scripts

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

目前為 2022-11-29 提交的版本,檢視 最新版本

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