// ==UserScript== // @name fsfb scripts // @namespace http://tampermonkey.net/ // @version 1.1.1 // @description a script for agma.io with features such as Copy Chat, Linesplit Toggle, Anti-AFK, Show Portal Mass, Change Food/Virus Color, and more! // @author fishy & firebone // @match *://agma.io/* // @run-at document-start // @icon https://i.imgur.com/8AASK55.png // @license GPL-3.0-or-later // @grant unsafeWindow // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== /* settings that you can't change in UI but might interfere with other scripts */ let hideAds = true, improvedShop = true, extraBotPacks = true, rightClickCopyChat = true, rightClickCopyInfo = true, showRemainingAbilityTime = true, unlockFreeSkins = true, hoverShowSkinID = true, coinXPstats = true, saveStatsBoxPosition = true, showXPdecimals = true, whiteBorder4BlackCells = true, overrideFastsplitDelay = false, // delays are set automatically, set to "true" if you want custom delays fastSplitDelay1 = 60, // delay before first freeze (milliseconds) fastSplitDelay2 = 60, // delay before last freeze (milliseconds) sortWearablesByOwned = true, linesplitClosestSide = false, // make the linespli go to the closest side (adjusted) instead of closest bubble inventorySingleRow = false; // ~~~~~~~~~ Don't change anything below this unless you know what you are doing ~~~~~~~~~ let settings = { hotkeys: [ {title: "Shoot 7 Ejected", id: "fsfb-key7Feed", key: 0, active: false}, // 0 {title: "Linesplit Lock", id: "fsfb-linesplit", key: 0, active: false}, // 1 {title: "Macro Split Bots", id: "fsfb-MacroSplitBots", key: 0, active: false}, // 2 {title: "Hide UI", id: "fsfb-hideUI", key: 0, active: false}, // 3 {title: "Toggle Cursor", id: "fsfb-togglecursor", key: 0, active: false} // 4 ], fastsplit_hotkeys: [ {title: "Fast Onesplit", id: "fsfb-fsOne", keyName: "", keyCode: 0, active: false}, {title: "Fast Doublesplit", id: "fsfb-fsTwo", keyName: "", keyCode: 0, active: false} ], checkboxes: [ {title: "Chat Copy/Cut/Paste", id: "fsfb-copycutpaste", active: false}, // 0 {title: "Anti-AFK", id: "fsfb-antiAFK", active: false}, // 1 {title: "Anti-Invis", id: "fsfb-anticloak", active: false}, // 2 {title: "Linesplit Toggle", id: "fsfb-linetoggle", active: false}, // 3 {title: "Change Page Title", id: "fsfb-changetitle", active: false}, // 4 {title: "Hide Shouts", id: "fsfb-hideshouts", active: false}, // 5 {title: "Hold To Spam Rec/Spd", id: "fsfb-recospeed", active: false}, // 6 {title: "Show Portal Mass", id: "fsfb-portalmass", active: false}, // 7 {title: "Power Spawns Overlay", id: "fsfb-pwsoverlay", active: false}, // 8 {title: "Quick Buy", id: "fsfb-qBuy", active: false}, // 9 ], slowFeed: [ {title: "Toggle Feed", id: "fsfb-slowFeed", key: 0, active: false}, {title: "Feed Speed", id: "fsfb-slowfeedtimer", val: 100, active: false} ], quickSettings: [ {id: "fsfb-quick-hotkey1", id1: "fsfb-quick-select1", set: "cSkins", key: 0, active: false}, {id: "fsfb-quick-hotkey2", id1: "fsfb-quick-select2", set: "cWearables", key: 0, active: false}, {id: "fsfb-quick-hotkey3", id1: "fsfb-quick-select3", set: "cFood", key: 0, active: false}, {id: "fsfb-quick-hotkey4", id1: "fsfb-quick-select4", set: "cBubbleCells", key: 0, active: false} ], uiScaling: [ // {title: "Chat Size", id: "fsfb-chatSize", level: 5}, {title: "Inventory Size", id: "fsfb-invSize", level: 5}, {title: "Statsbox Size", id: "fsfb-statsSize", level: 5} ], theme: [ {title: "Food Color", id: "fsfb-check-foodcolor", id1: "fsfb-color-foodcolor", color: "#FFFFFF", active: false}, {title: "Virus Color", id: "fsfb-check-viruscolor", id1: "fsfb-color-viruscolor", color: "#00ff00", active: false}, {title: "Virus Stroke", id: "fsfb-check-virusstroke", id1: "fsfb-color-virusstroke", color: "#00ff00", active: false}, {title: "Mothercell Color", id: "fsfb-check-msColor", id1: "fsfb-color-msColor", color: "#cd5564", active: false}, {title: "Mothercell Stroke", id: "fsfb-check-msStroke", id1: "fsfb-color-msStroke", color: "#cd5564", active: false} ], theme_boxes: [ {title: "Fancy Bubble Cells", id: "fsfb-bublecell", active: false}, // 0 {title: "Show Player Mass", id: "fsfb-showmass", active: false}, // 1 {title: "Only My Skin", id: "fsfb-myskins", active: false}, // 2 {title: "Only Party Skins", id: "fsfb-partyskins", active: false}, // 3 {title: "Only My Nick", id: "fsfb-mynick", active: false}, // 4 {title: "Only Party Nicks", id: "fsfb-partynicks", active: false}, // 5 {title: "Spiked Cells", id: "fsfb-spikedcells", active: false} // 6 ], export_import: [ {title: "Game Settings", id: "fsfb-game-settings", active: false}, {title: "Game Controls", id: "fsfb-game-controls", active: false}, {title: "Script Settings", id: "fsfb-script-settings", active: false}, {title: "Script Theme", id: "fsfb-theme-settings", active: false} ] } 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 } 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: "'"}; const set = (name, obj) => typeof GM_setValue != "function" ? localStorage.setItem(name, JSON.stringify(obj)) : GM_setValue(name, obj), 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); if(typeof unsafeWindow === 'undefined') unsafeWindow = window; const saveSettings = () => set("fsfb-scripts", settings); const getSettings = () => { let settingsPrev = get("fsfb-scripts", settings); for(let i in settingsPrev) { for(let j in settingsPrev[i]) { for(let x in settings){ for(let y in settings[x]){ if(settingsPrev[i][j].id == settings[x][y].id) settings[x][y] = settingsPrev[i][j]; } } } } } getSettings(); const getKey = id => { const name = $("#" + id).text(); return txtMappings[name] == null ? name.charCodeAt(0) : txtMappings[name]; } const getName = key => keyCodeMappings[key] == null ? String.fromCharCode(key) : keyCodeMappings[key]; const levelSum = lvl => lvl * (lvl - 1) / 2, range = arr => Math.max(...arr) - Math.min(...arr), sigma = arr => arr.reduce((a, b) => a + b), mean = arr => sigma(arr) / arr.length, variance = arr => arr.reduce((a, b) => a + (b - mean(arr)) ** 2, 0) / arr.length, standardDeviation = arr => Math.sqrt(variance(arr)), ascending = arr => arr.sort((a, b) => a - b), getIQR = arr => quartile(arr, .75) - quartile(arr, .25), round = (num, places) => Math.round(num * +("1e" + places)) / +("1e" + places); const median = arr => { const mid = ~~(arr.length / 2), asc = ascending(arr); return arr.length % 2 !== 0 ? asc[mid] : (asc[mid - 1] + asc[mid]) / 2; } const getProperty = (arr, property) => { let newArr = []; for (let i of arr) newArr.push(i[property]); return newArr; } const quartile = (arr, q) => { const sorted = ascending(arr), pos = (sorted.length - 1) * q, base = ~~pos, rest = pos - base; return sorted[base + 1] !== null ? sorted[base] + rest * (sorted[base + 1] - sorted[base]) : sorted[base] } const checkOutliers = (arr, returnOutliers) => { let nonOutliers = [], outliers = []; const IQR = getIQR(arr), Q1 = quartile(arr, .25), Q3 = quartile(arr, .75); for (let i of arr) i < Q1 - 1.5 * IQR || i > Q3 + 1.5 * IQR ? outliers.push(i) : nonOutliers.push(i); return returnOutliers ? outliers : nonOutliers; } const msToTime = ms => { let sec = ~~((ms / 1e3) % 60), min = ~~((ms / 6e4) % 60), hr = ~~(ms / 36e5); return (hr < 10 ? "0" + hr : hr) + ":" + (min < 10 ? "0" + min : min) + ":" + (sec < 10 ? "0" + sec : sec); } const changeTitle = title => { if(document.title != title) document.title = title; }; if(!settings.checkboxes[5].active) changeTitle('Agma.io'); if(unlockFreeSkins){ const ytSkins = ["", 56, 1657, 2281, 2282, 2297, 2331, 2529, 2626, 2683, 2816, 2832]; for (let i of ytSkins) localStorage.setItem('ytSkin' + i, '1'); localStorage.setItem('fbSkin', '1'); } ['paste', 'copy', 'cut'].forEach(a => { unsafeWindow.addEventListener(a, e => { if(!$('#fsfb-copycutpaste').is(':checked')) return; e.stopImmediatePropagation(); }, true) }); const afterLoaded = () => { // attempt to prevent the script from being active on subpages of agma.io if($('#friendResizer').length < 1 || $('#megaholder').length < 1 || $('#preroll').length < 1) return; $('.setting-tablink').css({'width' : '30%', "font-size" : "font-size: calc(0.3vw + 7.5px);"}); $('#settingTab2').after(``); $('#settingPage3').after(`
Script Features
`); // add checkbox HTML for(let i of settings.checkboxes){ $('#fsfb-sect-checkbox').append(``); $( "#" + i.id).change(function() { changeSettings(this.id, $(this).is(':checked')); }); } // add import/export HTML $('#fsfb-sect-imexport').append(`Import/Export
`); for(let i of settings.export_import){ $('#fsfb-sect-imexport').append(``); $( "#" + i.id).change(function() { changeSettings(this.id, $(this).is(':checked')); }); } $('#fsfb-sect-imexport').append(`Game Theme
${i.title}
`); $( "#" + i.id).change(function() { changeSettings(this.id, $(this).is(':checked')); }); $( "#" + i.id1).change(function() { changeSettings(this.id, this.value); $(this).parent().css('background-color', this.value); // bcs the regular [input="color"] looks rly shit, change color of overlayed div instead }); } for(let i of settings.theme_boxes){ $('#fsfb-sect-theme').append(``); $( "#" + i.id).change(function() { changeSettings(this.id, $(this).is(':checked')); }); } $('#fsfb-sect-hotkeys').append(`Script Hotkeys
`); const checkHotkeyClicked = (e, thing) => { if (e.target.id == thing.id && !thing.active){ $('#' + thing.id).addClass('selected'); thing.active = true; keysChanging = true; // prevent features from triggering when setting hotkey } else { thing.active = false; $('#' + thing.id).removeClass('selected'); } } const checkNewHotkey = (e, thing) => { if (!thing.active) return; thing.key = e.keyCode; $('#' + thing.id).text(getName(e.keyCode)); $('#' + thing.id).removeClass('selected'); thing.active = false; saveSettings(); e.preventDefault(); } const checkFsHotkey = (e, thing) => { if (!thing.active) return; thing.key = e.keyCode; thing.keyName = e.key; $('#' + thing.id).text(getName(e.keyCode)); $('#' + thing.id).removeClass('selected'); thing.active = false; saveSettings(); e.preventDefault(); } const checkPowerupClicked = e => { if(!quickBuying || $(e.target).attr('class') == 'purchase-btn confirmation' || $(e.target).attr('class') == 'megaphone-btn') return; let pwID; switch (e.target.id) { case 'invWall': pwID = 33; break; case 'invAntiFreeze': pwID = 35; break; case 'invAntiRecombine': pwID = 34; break; case 'invShield': pwID = 38; break; case 'invFrozenVirus': pwID = 36; break; case 'invRecombine': pwID = 1; break; case 'invSpeed': pwID = 2; break; case 'invGrowth': pwID = 6; break; case 'invSpawnVirus': pwID = 7; break; case 'invSpawnMothercell': pwID = 8; break; case 'invSpawnPortal': pwID = 9; break; case 'invSpawnGoldOre': pwID = 10; break; case 'invFreeze': pwID = 5; break; case 'inv360Shot': pwID = 30; break; case 'inv360Shot': pwID = 30; break; case 'fsfb-minionNuker': pwID = 39; break; case 'fsfb-quickMega': pwID = 14; break; case 'fsfb-quickbuy-img': quickBuying = true; return; default: quickBuying = false; $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block'); $('#fsfb-quickbuy').removeClass('activatedInv') curserMsg('Quick buy deactivated.', 'red'); return; } if(pwID == 14) $('.megaphone-btn')[0].click(); else $('.purchase-btn.confirmation[item="' + pwID + '"]')[0].click(); $('.inventory-box').removeClass('fsfb-shown').find('p').css('display', 'block'); $('#fsfb-quickbuy').removeClass('activatedInv') quickBuying = false; } const slowfeedhotkey = settings.slowFeed[0]; for(let i of settings.hotkeys){ $('#fsfb-sect-hotkeys').append(`${i.title}
`); $('#' + i.id).on('contextmenu', e => { $('#' + i.id).text(''); i.key = 0; saveSettings(); e.preventDefault(); }); } for(let i of settings.fastsplit_hotkeys){ $('#fsfb-sect-hotkeys').append(`${i.title}
`); $('#' + i.id).on('contextmenu', e => { $('#' + i.id).text(''); i.key = 0; i.keyName = ''; saveSettings(); e.preventDefault(); }); } const typing = () => $('input, textarea').is(':focus'); const sleep = ms => new Promise(r => setTimeout(r, ms)); const press = key => { unsafeWindow.onkeydown({ keyCode: key }); unsafeWindow.onkeyup({ keyCode: key }); } let fsCheck; const fastSplit = async(a) => { if(!fsCheck) return void(fsCheck = !0); const fps = +$('#fps').text(); let delay1, delay2; // i think slower cpu speeds can make the keypress times funky so this tries to make it fail less if cpu is slow (low fps) if(fps > 55){ // 55+ fps delay1 = 60; delay2 = 60; } else if(fps > 30 && fps < 55){ // 31-54 fps delay1 = 65; delay2 = 65; } else if(fps > 10 && fps < 31){ // 11 - 30 fps delay1 = 70; delay2 = 70; } else if(fps < 11){ // less than 11 fps delay1 = 80; delay2 = 80; } if(overrideFastsplitDelay){ delay1 = fastSplitDelay1; delay2 = fastSplitDelay1; } if([39, 37, 2, 4, 6].indexOf(currentServerId) != -1 || !a) await sleep(delay1); press(getKey("keyFreezeSelf")); await sleep(delay2); press(getKey("keyFreezeSelf")); } setTimeout(fastSplit, 120); let cursorLockActivated = false, _onblur; setTimeout(() => { let oldBlur = unsafeWindow.onblur unsafeWindow.onblur = function(){ linesplitting = false; spamRec = false; spamSpeed = false; splittingbots = false; $("#linesplit-markers div").hide(); return oldBlur.apply(this, arguments); } _onblur = unsafeWindow.onblur }, 4e3); const toggleCursorLock = () => { cursorLockActivated = !cursorLockActivated; cursorLockActivated ? unsafeWindow.onblur = function(){ $("#linesplit-markers div").hide(); unsafeWindow.onkeyup({keyCode: getKey('keyMacroSplit')}); unsafeWindow.onkeyup({keyCode: getKey('keyMacroFeed')}); unsafeWindow.onkeyup({keyCode: getKey('keyMultiFeed')}); linesplitting = false; spamRec = false; spamSpeed = false; splittingbots = false; } : unsafeWindow.onblur = _onblur; cursorLockActivated ? unsafeWindow.onkeydown({keyCode: 67}) : unsafeWindow.onkeyup({keyCode: 67}); } Object.defineProperty(KeyboardEvent.prototype, 'keyCode', { get: function() { switch (this.key.toLowerCase()) { case settings.fastsplit_hotkeys[0].keyName.toLowerCase(): return getKey("keySplit"); case settings.fastsplit_hotkeys[1].keyName.toLowerCase(): return getKey("keyDoubleSplit"); default: return this.which; } } }); let slowfeeding = !1, linesplitting = !1, hiddenUI = !1, splittingbots = !1, spamRec = !1, spamSpeed = !1; const pressed = e => { const key = e.which ? e.which : e.keyCode; if($('textarea').is(':focus')) e.stopImmediatePropagation(); if(typing() || keysChanging || e.key == undefined || e.keyCode == undefined) return; if(key == settings.hotkeys[0].key){ // 7 feed let i = 1; let interval = setInterval(() => { press(getKey("keyMacroFeed")); if(++i > 7) clearInterval(interval); }, 85); e.preventDefault(); } if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock linesplitting = true; linesplit(); $("#linesplit-markers div").show(); e.preventDefault(); } if(key == settings.hotkeys[1].key && $('#fsfb-linetoggle').is(':checked')){ // linesplit lock linesplitting = !linesplitting; if(linesplitting){ $("#linesplit-markers div").show(); linesplit(); } else { $("#linesplit-markers div").hide(); $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is } e.preventDefault(); } if(key == settings.hotkeys[2].key){ // macro split bots splittingbots = true; const splittingBots = () => { if(!splittingbots) return; press(getKey("keySplitBots")); setTimeout(splittingBots, 50); } splittingBots(); e.preventDefault(); } if(key == settings.hotkeys[3].key){ // hide ui hiddenUI = !hiddenUI; hiddenUI ? _replaceCSS('hideUI-css', '.hideUI{ display: none !important;}') : _replaceCSS('hideUI-css', ''); // replacing CSS bcs class is less likely to be overriden e.preventDefault(); } if(key == settings.hotkeys[4].key){ // toggle cursor lock toggleCursorLock(); e.preventDefault(); } if(key == getKey("keyFixedMouse")){ // real cursor lock key is pressed cursorLockActivated = false; unsafeWindow.onblur = _onblur; } if(settings.fastsplit_hotkeys[0].keyName != undefined && e.key.toLowerCase() == settings.fastsplit_hotkeys[0].keyName.toLowerCase() && e.keyCode != 0){ // fast onesplit fastSplit(!0); } if(settings.fastsplit_hotkeys[1].keyName != undefined && e.key.toLowerCase() == settings.fastsplit_hotkeys[1].keyName.toLowerCase() && e.keyCode != 0){ // fast doublesplit fastSplit(!1); } if(key == settings.slowFeed[0].key){ // toggle feed slowfeeding = !slowfeeding; const feeding = () => { if(!slowfeeding) return; press(getKey("keyMacroFeed")); setTimeout(feeding, settings.slowFeed[1].val); } feeding(); e.preventDefault(); } if(key == settings.quickSettings[0].key){ // quick settings 1 let el = $('#' + settings.quickSettings[0].set); if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change'); else el.unbind().click(); e.preventDefault(); } if(key == settings.quickSettings[1].key){ // quick settings 2 let el = $('#' + settings.quickSettings[1].set); if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change'); else el.unbind().click(); e.preventDefault(); } if(key == settings.quickSettings[2].key){ // quick settings 3 let el = $('#' + settings.quickSettings[2].set); if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change'); else el.unbind().click(); e.preventDefault(); } if(key == settings.quickSettings[3].key){ // quick settings 4 let el = $('#' + settings.quickSettings[3].set); if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change'); else el.unbind().click(); e.preventDefault(); } if($('#fsfb-recospeed').is(':checked') && key == getKey("keyRecombine")){ spamRec = true; const spammingRec = () => { if(!spamRec) return; press(getKey("keyRecombine")); setTimeout(spammingRec, 10); } spammingRec(); e.preventDefault(); } if($('#fsfb-recospeed').is(':checked') && key == getKey("keySpeed")){ spamSpeed = true; const spammingSpeed = () => { if(!spamSpeed) return; press(getKey("keySpeed")); setTimeout(spammingSpeed, 10); } spammingSpeed(); e.preventDefault(); } } const released = key => { if(typing() || keysChanging) return; if(key == settings.hotkeys[2].key) splittingbots = false; // macro split bots if(key == settings.hotkeys[1].key && !$('#fsfb-linetoggle').is(':checked')){ // linesplit lock linesplitting = false; $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is $("#linesplit-markers div").hide(); } if(key == getKey("keyRecombine")) spamRec = false; if(key == getKey("keySpeed")) spamSpeed = false; } let pwSpawnCheck = false; const changeSettings = (ID, a) => { for(let i of settings.uiScaling) if(i.id == ID) i.level = a; for(let i of settings.checkboxes) if(i.id == ID) i.active = a; for(let i of settings.export_import) if(i.id == ID) i.active = a; for(let i of settings.theme_boxes) if(i.id == ID) i.active = a; for(let i of settings.theme){ if(i.id == ID) i.active = a if(i.id1 == ID) i.color = a; } customCells = $("#fsfb-sect-theme>label>input, #fsfb-portalmass, #fsfb-pwsoverlay, #fsfb-anticloak").is(":checked"); if(ID == "fsfb-hideshouts") a ? $('#megaholder').addClass('hideMegaphone') : $('#megaholder').removeClass('hideMegaphone'); if(ID == "fsfb-qBuy") a ? $('#fsfb-quickbuy').css('display', 'flex') : $('#fsfb-quickbuy').css('display', 'none'); if(ID == "fsfb-bublecell" && !$("#cBubbleCells").is(":checked") && a) $('#cBubbleCells').unbind().click(); if(ID == "fsfb-showmass" && !$("#cMass").is(":checked") && a) $('#cMass').unbind().click(); if((ID == "fsfb-myskins" || ID == "fsfb-partyskins") && !$("#cSkins").is(":checked") && a) $('#cSkins').unbind().click(); if((ID == "fsfb-mynick" || ID == "fsfb-partynicks") && !$("#cNames").is(":checked") && a) $('#cNames').unbind().click(); if(ID == "fsfb-myskins" && a) $('#fsfb-partyskins').prop('checked', false).trigger('change'); if(ID == "fsfb-partyskins" && a) $('#fsfb-myskins').prop('checked', false).trigger('change'); if(ID == "fsfb-mynick" && a) $('#fsfb-partynicks').prop('checked', false).trigger('change'); if(ID == "fsfb-partynicks" && a) $('#fsfb-mynick').prop('checked', false).trigger('change'); if(ID == "fsfb-pwsoverlay"){ if(!a && pwSpawnCheck) curserMsg('To hide powerup spawns, you need to respawn or switch servers.', 'red'); pwSpawnCheck = true; } if(ID == "fsfb-pwsoverlay") svSwitch = true; let zoomLvl = "100%"; switch(+a) { case 1: zoomLvl = "50%"; break; case 2: zoomLvl = "70%"; break; case 3: zoomLvl = "80%"; break; case 4: zoomLvl = "90%"; break; case 5: zoomLvl = "100%"; break; case 6: zoomLvl = "110%"; break; case 7: zoomLvl = "125%"; break; case 8: zoomLvl = "150%"; break; case 9: zoomLvl = "200%"; break; default: zoomLvl = "100%"; } if(ID == "fsfb-invSize") $('#inventory').css('zoom', zoomLvl); if(ID == "fsfb-statsSize") $('#stats-container').css('zoom', zoomLvl); saveSettings(); } // add slowfeed HTML $('#fsfb-sect-slowfeed').append(`Slow-Feed
`); $('#fsfb-sect-slowfeed').append(`${slowfeedhotkey.title}
`); $('#fsfb-sect-slowfeed').append(`${settings.slowFeed[1].title}
`); $('#' + slowfeedhotkey.id).on('contextmenu', e => { $('#' + slowfeedhotkey.id).text(''); slowfeedhotkey.key = 0; saveSettings(); e.preventDefault(); }); document.getElementById(settings.slowFeed[1].id).addEventListener("keypress", function(e){ setTimeout(() => { // goes too fast or smth settings.slowFeed[1].val = +$('#' + settings.slowFeed[1].id).val(); if($('#' + settings.slowFeed[1].id).val() == "") settings.slowFeed[1].val = 0; saveSettings(); }, 5); }); // add quick settings HTML $('#fsfb-sect-quickSettings').append(`Quick Settings
`); for(let i of settings.quickSettings){ $('#fsfb-sect-quickSettings').append(``); $('#' + i.id).on('contextmenu', e =>{ $('#' + i.id).text(''); i.key = 0; saveSettings(); e.preventDefault(); }); }; $('.fsfb-quickchange').on("change", function(){ settings.quickSettings[+this.id.replace('fsfb-quick-select', '') - 1].set = this.value; saveSettings(); }); // add UI scaling $('#fsfb-sect-uiScale').append(`UI Scaling
`); for(let i of settings.uiScaling){ $('#fsfb-sect-uiScale').append(` `); $( "#" + i.id).change(function() { changeSettings(this.id, $(this).val()); }); }; // add event listeners let mosX, mosY, keys = {}, keysChanging = false; $(document).on('click', e => { for(let i = 0; i < settings.hotkeys.length; i++) checkHotkeyClicked(e, settings.hotkeys[i]); for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkHotkeyClicked(e, settings.fastsplit_hotkeys[i]); for(let i = 0; i < settings.quickSettings.length; i++) checkHotkeyClicked(e, settings.quickSettings[i]); checkHotkeyClicked(e, settings.slowFeed[0]); checkPowerupClicked(e); }) .on('mousemove', e => { if(e.originalEvent == null || !e.originalEvent.isTrusted) return; ({clientX: mosX, clientY: mosY} = e); if (linesplitting) linesplit(); }) .on("keydown", e => { if(e.originalEvent == null || !e.originalEvent.isTrusted) return; for(let i = 0; i < settings.hotkeys.length; i++) checkNewHotkey(e, settings.hotkeys[i]); for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkFsHotkey(e, settings.fastsplit_hotkeys[i]); for(let i = 0; i < settings.quickSettings.length; i++) checkNewHotkey(e, settings.quickSettings[i]); checkNewHotkey(e, settings.slowFeed[0]); if (!(e.keyCode in keys)){ keys[e.keyCode] = !0; pressed(e); } keysChanging = false; }) .on("keyup", e => { if(e.originalEvent == null || !e.originalEvent.isTrusted) return; delete keys[e.keyCode]; released(e.keyCode); }); $('#fsfb-export-btn').on('click', () => { let script_settings = {}, script_themes = {}; for (let i in settings) { // put the settings & themes into different objects if (i == "theme" || i == "theme_boxes") script_themes[i] = settings[i]; else if(i == "export_import") {} else script_settings[i] = settings[i]; } let obj = { selected: { game_settings: $('#fsfb-game-settings').is(':checked'), game_controls: $('#fsfb-game-controls').is(':checked'), script_settings: $('#fsfb-script-settings').is(':checked'), script_theme: $('#fsfb-theme-settings').is(':checked') }, game_settings: localStorage.settings, game_controls: localStorage.hotkeys, script_settings: script_settings, script_theme: script_themes } // if the setting is turned off, then dont need to export it - set it to null if(!obj.selected.game_settings) obj.game_settings = null; if(!obj.selected.game_controls) obj.game_controls = null; if(!obj.selected.script_settings) obj.script_settings = null; if(!obj.selected.script_theme) obj.script_theme = null; const a = document.createElement('a'), file = new Blob([JSON.stringify(obj)], {type: "text/plain"}); a.href = URL.createObjectURL(file), a.download = "fishy & firebone script settings", a.click(), URL.revokeObjectURL(a.href); // download a txt file of exported settings }); $('#fsfb-import-btn').on('click', () => { swal({ title: "Import Settings", text: "Add your exported settings below and press OK to continue.", type: "input", showCancelButton: true, closeOnConfirm: false, animation: "slide-from-top", inputPlaceholder: "Paste exported settings here" }, function(inputVal){ if (inputVal == null) return false; if (inputVal == "") { swal.showInputError("Please don't leave the input empty!"); return false } try { let val = JSON.parse(inputVal); if(val.selected.script_settings && $('#fsfb-script-settings').is(':checked')){ for (let i in val.script_settings) { for (let j in val.script_settings[i]) { for(let x in settings){ for(let y in settings[x]){ if(val.script_settings[i][j].id == settings[x][y].id) settings[x][y] = val.script_settings[i][j]; } } } } } if(val.selected.script_theme && $('#fsfb-theme-settings').is(':checked')){ for (let i in val.script_theme) { for (let j in val.script_theme[i]) { for(let x in settings){ for(let y in settings[x]){ if(val.script_theme[i][j].id == settings[x][y].id) settings[x][y] = val.script_theme[i][j]; } } } } } if(val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) localStorage.setItem('settings', val.game_settings); if(val.selected.game_controls && $('#fsfb-game-controls').is(':checked')) localStorage.setItem('hotkeys', val.game_controls); // if any agma controls were imported, need to refresh bc it's set using localstorage if((val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) || (val.selected.game_controls && $('#fsfb-game-controls').is(':checked'))){ swal({ title: "Please Refresh!", text: "Refreshing the page is required for your imported agma settings to take effect", type: "warning", }); } else swal({ title: "Settings Successfully Imported!", type: "success" }); saveSettings(); updateScriptSettingsUI(); } catch (error){ swal({ title: "Something went wrong!", text: "Please make sure you've entered in valid settings", type: "error" }); } }); }); $('#fsfb-settings-right').append(``) // PUT MODAL HERE localStorage.ad_l_time = "9e99"; // smth like time since last ad $('[id^="agma-io_"], [id^="adWrapper"], #preroll').addClass("fuckAds"); // move ads way off the screen let width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight; $(unsafeWindow).on('resize', function(){ width = unsafeWindow.innerWidth, height = unsafeWindow.innerHeight; }); let pointMove; const linesplit = () => { if(!linesplitting) return; let closest, points = [{n: "#linesplit-top", x: width / 2, y: 0, nx: width / 2, ny: -10e6}, {n: "#linesplit-bottom", x: width / 2, y: height, nx: width / 2, ny: 10e6}, {n: "#linesplit-left", x: 0, y: height / 2, nx: -10e6, ny: height / 2}, {n: "#linesplit-right", x: width, y: height / 2, nx: 10e6, ny: height / 2}]; if(linesplitClosestSide){ let closestSide = [mosY / height, (height - mosY) / height, mosX / width, (width - mosX) / width]; // top, bottom, left, right closest = points[closestSide.indexOf(Math.min(...closestSide))]; } else { let distance = p => Math.sqrt(Math.pow(mosX - p.x, 2) + Math.pow(mosY - p.y, 2)), closestPoint = points.reduce((a, b) => distance(a) < distance(b) ? a : b); for (let i = 0; i < points.length; i++) { if (closestPoint.x == points[i].x && closestPoint.y == points[i].y) closest = points[i] } } pointMove = {x: closest.nx, y: closest.ny}; $('canvas').trigger($.Event('mousemove', { clientX: closest.nx, clientY: closest.ny })); $("#linesplit-markers div").css('background-color', 'transparent'); $(closest.n).css('background-color', '#e25615'); } let confBtns = document.getElementsByClassName('purchase-btn confirmation'); const btnsArr = Array.from(document.getElementsByClassName('purchase-btn confirmation')); const changeHTML = (index, price, id, name) => { setTimeout(() => { const amtDropdown = document.getElementById('shopAmountDropdown') 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.'; const dropdownChange = () => { if (amtDropdown.value == "custom") return buyCstmAmt(price, id, name); let priceSum = (amtDropdown.value * price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); 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.'; }; try { // try to remove old event listener before adding new one so they don't stack (no idea if this does anything bcs the event listener might be deleted anyway) amtDropdown.removeEventListener('change', dropdownChange); amtDropdown.addEventListener('change', dropdownChange); } catch (error){ amtDropdown.addEventListener('change', dropdownChange); }; }, 30); }; const buyCstmAmt = (price, id, name) => { swal({ title: "Enter Purchase Amount", text: "How many " + name + " would you like to buy?", html: true, type: "input", showCancelButton: true, closeOnConfirm: false, inputPlaceholder: "Input amount here" }, function(input){ let pwAmt = +input, priceTotal = pwAmt * price; if (input == null) return false; if (input == "") { swal.showInputError("Please don't leave the input empty!"); return false } if(!/^[0-9]+$/.test(input) || !(+input >>> 0 === parseFloat(+input))){ swal.showInputError("Please only enter positive integers!"); return false } swal({ title: 'Confirm', text: 'If you click "Buy", you will purchase this item. It will cost ' + priceTotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' in total.
You chose to purchase ' + pwAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' ' + name + '
Lvl Completed:
0/0Remaining:
0Projected (hr):
0Last Hour:
0(0/60)Last Minute:
0(0/5)Last 12s:
0Minute Mean:
0Minute Median:
0Minute Sd:
0Session XP:
0Session Length:
00:00:00Lifetime XP:
00
Lvl Completed:
${lvlCompleted.toLocaleString('en-US')}Remaining:
${xpRemaining.toLocaleString('en-US')}Projected (hr):
${projectedHr.toLocaleString('en-US')}Last Hour:
${lastHr.toLocaleString('en-US')}(${lastHrCompleted}/60)Last Minute:
${lastMin.toLocaleString('en-US')}(${lastMinCompleted + "/" + lastMinTotal})Last 12s:
${last12sec.toLocaleString('en-US')}Minute Mean:
${xBar.toLocaleString('en-US')}Minute Median:
${xTilde.toLocaleString('en-US')}Minute Sd:
${standardDev.toLocaleString('en-US')}Session XP:
${sessionXP.toLocaleString('en-US')}Session Length:
${sessionLength}Lifetime XP:
${lifetimeXP.toLocaleString('en-US')}Remaining:
${coinsRemaining.toLocaleString('en-US')}Projected (hr):
${projectedHr.toLocaleString('en-US')}Last Hour:
${lastHr.toLocaleString('en-US')}(${lastHrCompleted}/60)Last Minute:
${lastMin.toLocaleString('en-US')}(${lastMinCompleted + "/" + lastMinTotal})Minute Mean:
${xBar.toLocaleString('en-US')}Minute Median:
${xTilde.toLocaleString('en-US')}Minute Sd:
${standardDev.toLocaleString('en-US')}Session Coins:
${sessionXP.toLocaleString('en-US')}Session Length:
${sessionLength}Copy Chat Messages