fsfb script

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

目前为 2024-02-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name fsfb script
  3. // @namespace http://tampermonkey.net/
  4. // @homepage https://greasyfork.org/scripts/446564/
  5. // @version 1.5.0
  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. // @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJhIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNTE1IDUxNSI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJiIiBjeD0iMjg2LjgiIGN5PSIxMDYiIGZ4PSIyODYuOCIgZnk9IjEwNiIgcj0iMTEzLjI4NCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2VmNDYzMCIvPjxzdG9wIG9mZnNldD0iLjEyNSIgc3RvcC1jb2xvcj0iI2VjNGUzMSIvPjxzdG9wIG9mZnNldD0iLjI1IiBzdG9wLWNvbG9yPSIjZTk1ZDM1Ii8+PHN0b3Agb2Zmc2V0PSIuNTIxIiBzdG9wLWNvbG9yPSIjZTk4MjM2Ii8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iI2ZjYzczOSIvPjxzdG9wIG9mZnNldD0iLjk4MSIgc3RvcC1jb2xvcj0iI2YxZDIzNSIvPjwvcmFkaWFsR3JhZGllbnQ+PHJhZGlhbEdyYWRpZW50IGlkPSJjIiBjeD0iMzIxLjIiIGN5PSIxMzMuMiIgZng9IjMyMS4yIiBmeT0iMTMzLjIiIHI9IjM5LjUyNSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2U3NDQyZSIvPjxzdG9wIG9mZnNldD0iLjEyNSIgc3RvcC1jb2xvcj0iI2U1NGMyZiIvPjxzdG9wIG9mZnNldD0iLjI1IiBzdG9wLWNvbG9yPSIjZTM1YjMzIi8+PHN0b3Agb2Zmc2V0PSIuNTIxIiBzdG9wLWNvbG9yPSIjZTk4MjM2Ii8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iI2ZjYzczOSIvPjxzdG9wIG9mZnNldD0iLjk4MSIgc3RvcC1jb2xvcj0iI2ZjYzg0OSIvPjwvcmFkaWFsR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJkIiB4MT0iMTg4LjE0NiIgeTE9IjIzMi41NDYiIHgyPSIxNTMuNDc5IiB5Mj0iMjU3LjA3OSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2UzNDIyZSIvPjxzdG9wIG9mZnNldD0iLjExNyIgc3RvcC1jb2xvcj0iI2UyNGEyZiIvPjxzdG9wIG9mZnNldD0iLjI1IiBzdG9wLWNvbG9yPSIjZTI1YjMzIi8+PHN0b3Agb2Zmc2V0PSIuNTIxIiBzdG9wLWNvbG9yPSIjZTk4MjM2Ii8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iI2ZjYzczOSIvPjxzdG9wIG9mZnNldD0iLjk4MSIgc3RvcC1jb2xvcj0iI2ZjYzg0OSIvPjwvbGluZWFyR3JhZGllbnQ+PHJhZGlhbEdyYWRpZW50IGlkPSJlIiBjeD0iMTA1LjMzMyIgY3k9IjI2Ni42NjciIGZ4PSIxMDUuMzMzIiBmeT0iMjY2LjY2NyIgcj0iMjcwLjMwNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iLjExIiBzdG9wLWNvbG9yPSIjZmNjODQ5Ii8+PHN0b3Agb2Zmc2V0PSIuMTE0IiBzdG9wLWNvbG9yPSIjZmNjNzQ3Ii8+PHN0b3Agb2Zmc2V0PSIuMTczIiBzdG9wLWNvbG9yPSIjZmNjNzNjIi8+PHN0b3Agb2Zmc2V0PSIuMjM2IiBzdG9wLWNvbG9yPSIjZmNjNzM5Ii8+PHN0b3Agb2Zmc2V0PSIuNjEyIiBzdG9wLWNvbG9yPSIjZTk4MjM2Ii8+PHN0b3Agb2Zmc2V0PSIuNzgzIiBzdG9wLWNvbG9yPSIjZTk1ZDM1Ii8+PHN0b3Agb2Zmc2V0PSIuODgyIiBzdG9wLWNvbG9yPSIjZWU1NzM0Ii8+PHN0b3Agb2Zmc2V0PSIuODg2IiBzdG9wLWNvbG9yPSIjZWM1NjMzIi8+PHN0b3Agb2Zmc2V0PSIuOTE2IiBzdG9wLWNvbG9yPSIjZTU1MjJmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZTQ1MTJlIi8+PC9yYWRpYWxHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9ImYiIGN4PSIzNzAiIGN5PSIzMTIuMTMzIiBmeD0iMzcwIiBmeT0iMzEyLjEzMyIgcj0iMzguOTQyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZDk0MDJiIi8+PHN0b3Agb2Zmc2V0PSIuMTE3IiBzdG9wLWNvbG9yPSIjZGE0ODJkIi8+PHN0b3Agb2Zmc2V0PSIuMjUiIHN0b3AtY29sb3I9IiNkZDU5MzIiLz48c3RvcCBvZmZzZXQ9Ii41MjEiIHN0b3AtY29sb3I9IiNlOTgyMzYiLz48c3RvcCBvZmZzZXQ9Ii45IiBzdG9wLWNvbG9yPSIjZmNjNzM5Ii8+PHN0b3Agb2Zmc2V0PSIuOTgxIiBzdG9wLWNvbG9yPSIjZmNjODQ5Ii8+PC9yYWRpYWxHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9ImciIGN4PSIzODEuMiIgY3k9IjI1OCIgZng9IjM4MS4yIiBmeT0iMjU4IiByPSIxMTMuNjAzIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZWY0NjMwIi8+PHN0b3Agb2Zmc2V0PSIuMTI1IiBzdG9wLWNvbG9yPSIjZWM0ZTMxIi8+PHN0b3Agb2Zmc2V0PSIuMjUiIHN0b3AtY29sb3I9IiNlOTVkMzUiLz48c3RvcCBvZmZzZXQ9Ii40IiBzdG9wLWNvbG9yPSIjZTk4MjM2Ii8+PHN0b3Agb2Zmc2V0PSIuNDExIiBzdG9wLWNvbG9yPSIjZTk4NDM2Ii8+PHN0b3Agb2Zmc2V0PSIuNTM2IiBzdG9wLWNvbG9yPSIjZjFhMTM3Ii8+PHN0b3Agb2Zmc2V0PSIuNjYiIHN0b3AtY29sb3I9IiNmN2I2MzgiLz48c3RvcCBvZmZzZXQ9Ii43ODIiIHN0b3AtY29sb3I9IiNmYWMyMzgiLz48c3RvcCBvZmZzZXQ9Ii45IiBzdG9wLWNvbG9yPSIjZmNjNzM5Ii8+PHN0b3Agb2Zmc2V0PSIuOTgxIiBzdG9wLWNvbG9yPSIjZmNjODQ5Ii8+PC9yYWRpYWxHcmFkaWVudD48bGluZWFyR3JhZGllbnQgaWQ9ImgiIHgxPSIyNjkuOTQ0IiB5MT0iMjg3LjM0NSIgeDI9IjI2MC41MzciIHkyPSIyODkuMTE1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjN2U0NzBjIi8+PHN0b3Agb2Zmc2V0PSIuOTk2IiBzdG9wLWNvbG9yPSIjNWYyZjAwIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgaWQ9ImkiIHgxPSIzMzkuNTU2IiB5MT0iMjMzLjgwMSIgeDI9IjMyMi4yMjIiIHkyPSIxNzEuNDY4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZTlhZTM1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmVkNTczIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgaWQ9ImoiIHgxPSIyNTQuNDk3IiB5MT0iMTExLjkzNiIgeDI9IjIwMC4xNjQiIHkyPSIxODYuNjAzIiB4bGluazpocmVmPSIjaSIvPjwvZGVmcz48cmVjdCB3aWR0aD0iNTE1IiBoZWlnaHQ9IjUxNSIgcng9IjEwMCIgcnk9IjEwMCIgc3R5bGU9ImZpbGw6Izc1MmIxNjsiLz48cGF0aCBkPSJNMTUwLjYyMiw0NTkuOTU2YzAsOC41MzMsMjEyLjI2NywxMS4yLDIxMi4yNjcsMHMtMjEyLjI2Ny0xMi44LTIxMi4yNjcsMFoiIHN0eWxlPSJmaWxsOiM0ZTFmMTQ7IG9wYWNpdHk6Ljk7Ii8+PHBhdGggZD0iTTI2NS44NjcsNDYuOTMzczMzLjgwMSwxOS4zMzMsMzMuODAxLDQ1LjczM2MwLDMzLjYtMzIuMzM0LDQxLjQ2Ny01MC42MDEsNTYuNzM0LDAsMC00OS43MzMsMzkuNDY3LTM3LjczMyw5My42LDAsMC00MC4yNjctMzcuOTc5LTE1LjkxMS05MS40OSwxMi44LTM5LjY0NCw3Ni45NzgtNjMuNjQ0LDc2Ljk3OC04OC44ODksMCwwLDEuMTU2LTIuNC02LjUzMy0xNS42ODlaIiBzdHlsZT0iZmlsbDp1cmwoI2IpOyIvPjxwYXRoIGQ9Ik0zMjAuOCwxMjUuMmMxNS40LDE1LjQsMzAuMjY3LTEzLjMzMywyNy40NjctMTkuNDY3LTguNjY3LTMuMzMzLTI2LjgtNi4xMzMtMjcuNDY3LDE5LjQ2N1oiIHN0eWxlPSJmaWxsOnVybCgjYyk7Ii8+PHBhdGggZD0iTTE5Mi4zMzQsMjQ5LjczM2MtNy45MzQsMTEuODY3LTM4LjczNCwxOS4zMzMtNDYuNjAxLTguNTMzLDQuNDkxLTQuMzUsMTYuOTU3LTkuNjYxLDI3Ljg2OC05LjQxMiw5LjgyMywuMjI0LDE4LjM4NSwzLjk1MywxOC43MzMsMTcuOTQ1WiIgc3R5bGU9ImZpbGw6dXJsKCNkKTsiLz48cGF0aCBkPSJNMjI3LjcxNSwyNTMuNjhjLTEyLTczLjM3OCw1Ni4zODQtMTA2LjI1OCw5MC44MjgtMTEwLjQ4LDAsMC0zMy41MTEsMjYuNDg5LTMzLjUxMSw2My4wMjJzMzcuNiw2OC44LDM3LjYsNjguOGMwLDAsNDUuMzMzLDMzLjg2Nyw0NS4zMzMsODYuOTMzcy00Mi4zMTEsOTguMjIyLTExMS40MzMsOTguMjIyLTk2LjAzMy01MC44NDQtMTAwLjMtNjAuOTc4Yy00LjI2Ny0xMC4xMzMtMzguNzU2LTE2LTM4Ljc1Ni0xNiwwLDAsMy43MzMtMzQuMzExLDMzLjQyMi01Ni41MzMsMTcuNTExLTUwLjU1NSw1MS43MTgtNjcuOTg3LDc2LjgxNi03Mi45ODYsNi40OTktMS4yOTQsMTIuNDAyLTEuNjgsMTcuMjI4LTEuNjgsMTUuNjQ0LDMuOTExLDE4Ljg0NCw2NS44OSwxOC44NDQsNjUuODksMCwwLTMyLjcxMSwzLjc5OS00NS4zMzMtMi40MjMsOS43NzgsMTEuOTExLDQwLjg4OSwxNC43NTYsNDAuODg5LDE0Ljc1Ni0uNTMzLDIzLjExMS00MS42LDM5LjQ2Ny0zNS4yLDkzLjY4OSw2LjA0NCw5LjI0NCwzNS4wMjIsNy40NjcsMzUuMDIyLDcuNDY3LDQ0LjQ0OS03LjY1Myw0NS4zMzMtNjUuMTMzLDQuNjIyLTExMy40ODhtLTQwLjg4OS00NS4yNjdjLTUuNDQ5LDAtOS44NjcsNC40MTctOS44NjcsOS44NjdzNC40MTcsOS44NjcsOS44NjcsOS44NjcsOS44NjctNC40MTcsOS44NjctOS44NjctNC40MTctOS44NjctOS44NjctOS44NjdaIiBzdHlsZT0iZmlsbDp1cmwoI2UpOyIvPjxwYXRoIGQ9Ik0zNjUuMzMzLDMwNy4wNjdjLjEzMy0xOC44LDEzLjczMy0yNy4zMzMsMjcuNzMzLTE5LjQ2NywxLjMzMywxNi41MzMtMTguMjgxLDMyLjkzMy0yNy43MzMsMTkuNDY3WiIgc3R5bGU9ImZpbGw6dXJsKCNmKTsiLz48cGF0aCBkPSJNMzU2Ljg2NywyNzguNDY3czE2Ljk5OS04Ljg2NywxNi45OTktMjguMDY3LTE4LTM1LjItMTgtMzUuMmMwLDAtMTcuODY3LTE5LjYtMTcuODY3LTM4LjhzOC44LTMyLjgsOC44LTMyLjhjMCwwLTM5LjEyNCwxOC4wMDctMzkuODY3LDU2LjgsMCwwLTEuNiwyNS42LDE0LjUzMyw0NC4xMzMsMCwwLDI4LjEzNSwzMy45MzQsMzUuNDAxLDMzLjkzNFoiIHN0eWxlPSJmaWxsOnVybCgjZyk7Ii8+PHBhdGggZD0iTTI2My43ODgsMzE3Ljg5Yy0xLjQxNi0xNC40MDMtNC41MS01NS41NTYtMTYuNTUtNjUuMDc4LDMxLjkyOSwxMi4zNTUsMjMuMDAzLDczLjI4NCwyMy4wMDMsNzMuMjg0bC02LjQ1My04LjIwNloiIHN0eWxlPSJmaWxsOnVybCgjaCk7IG9wYWNpdHk6LjY7Ii8+PHBhdGggZD0iTTMyMi4xNjcsMzMxLjgzM2MxMi41LDI5LjgzMywxOC4zNTMsODMuODExLTM0LDEwNC44MzMsNDMuODMzLTI3Ljc3OCw0MC43NzgtODQuMjc4LDM0LTEwNC44MzNaIiBzdHlsZT0iZmlsbDojZjU4NjYzOyIvPjxwYXRoIGQ9Ik0yNzUuMjA4LDI2OS4zNjdjLTM1LjkzNC00MS4xNjYtMjQuMTExLTk1LjI3OCw0My4xNjctMTI2LjE2Ny01Ni4xNjcsMzUuNTU2LTcwLjE2Nyw2OC4zMzMtNDMuMTY3LDEyNi4xNjdaIiBzdHlsZT0iZmlsbDojZjlhMzVkOyIvPjxwYXRoIGQ9Ik0yMjQuMjA0LDQyMy44NjRsLS43MDItOC40MTlzLTM3LTE2LjY2Ny0zNy0zOGMwLDMyLjY2NywzNy43MDIsNDYuNDE5LDM3LjcwMiw0Ni40MTlaIiBzdHlsZT0iZmlsbDojZjhhYzVlOyIvPjxwYXRoIGQ9Ik0zNDMuMjIyLDIzMS42NjdjLTguNjA4LTEwLjI3Mi0zMS40NzItMzQuOTE3LTE1LjU1Ni02My40NDQtMy41ODMsMjQuOTQ0LDIuNjY3LDM5LjI3OCwxNS41NTYsNjMuNDQ0WiIgc3R5bGU9ImZpbGw6dXJsKCNpKTsiLz48cGF0aCBkPSJNMjA0LDE5MS44MzNjLTUuNS0xOC42NjcsMjYuMjUtNjIuNTgzLDQ5LjgzMy03Ny00NSw1NS41LTM5LjE2Nyw1MS4zMzMtNDkuODMzLDc3WiIgc3R5bGU9ImZpbGw6dXJsKCNqKTsiLz48L3N2Zz4=
  10. // @run-at document-start
  11. // @require https://greasyfork.org/scripts/459346-fsfb-facts/code/fsfb%20facts.js?version=1145073
  12. // @license GPL-3.0-or-later
  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. // @grant GM_registerMenuCommand
  20. // @grant GM_unregisterMenuCommand
  21. // ==/UserScript==
  22.  
  23.  
  24.  
  25. // ~~~~~~~~~ Don't change anything below this unless you know what you are doing ~~~~~~~~~
  26. const version = typeof GM_info != 'undefined' && GM_info?.script?.version || '1.5.0';
  27.  
  28. let settings = {
  29. hotkeys: [
  30. {title: "Shoot 7 Ejected", id: "fsfb-key7Feed", key: 0, active: false}, // 0
  31. {title: "Linesplit Lock", id: "fsfb-linesplit", key: 0, active: false}, // 1
  32. {title: "Macro Split Bots", id: "fsfb-MacroSplitBots", key: 0, active: false}, // 2
  33. {title: "Hide UI", id: "fsfb-hideUI", key: 0, active: false}, // 3
  34. {title: "Toggle Cursor", id: "fsfb-togglecursor", key: 0, active: false}, // 4
  35. {title: "Check Profile", id: "fsfb-checkprofile", key: 0, active: false} // 5
  36. ],
  37. fastsplit_hotkeys: [
  38. {title: "Fast Onesplit", id: "fsfb-fsOne", keyName: "", keyCode: 0, active: false}, // 0
  39. {title: "1st Delay (ms)", id: "fsfb-firstdelay", val: 60, active: false}, // 1
  40. {title: "2nd Delay (ms)", id: "fsfb-secdelay", val: 60, active: false}, // 2
  41. {title: "Fast Doublesplit", id: "fsfb-fsTwo", keyName: "", keyCode: 0, active: false}, // 3
  42. {title: "1st Delay (ms)", id: "fsfb-dubfirstdelay", val: 60, active: false}, // 4
  43. {title: "2nd Delay (ms)", id: "fsfb-dubsecdelay", val: 60, active: false} // 5
  44. ],
  45. frozenvirus: [
  46. {title: "Frozen Virus", id: "fsfb-frzvs", key: 0, active: false},
  47. {title: "Press Delay (ms)", id: "fsfb-fvsdelay", val: 100, active: false}
  48. ],
  49. checkboxes: [
  50. {title: "Chat Copy/Cut/Paste", id: "fsfb-copycutpaste", active: false}, // 0
  51. {title: "Anti-AFK", id: "fsfb-antiAFK", active: false}, // 1
  52. {title: "Anti-Invis", id: "fsfb-anticloak", active: false}, // 2
  53. {title: "Linesplit Toggle", id: "fsfb-linetoggle", active: false}, // 3
  54. {title: "Change Page Title", id: "fsfb-changetitle", active: false}, // 4
  55. {title: "Hide Shouts", id: "fsfb-hideshouts", active: false}, // 5
  56. {title: "Hold To Spam Rec/Spd", id: "fsfb-recospeed", active: false}, // 6
  57. {title: "Show Portal Mass", id: "fsfb-portalmass", active: false}, // 7
  58. {title: "Pow Spawns Overlay", id: "fsfb-powsoverlay", active: false}, // 8
  59. {title: "Mothercell Mass", id: "fsfb-mtchmass", active: false}, // 9
  60. {title: "Inventory One Row", id: "fsfb-pwsonerow", active: false}, // 10
  61. {title: "Quick Buy", id: "fsfb-qBuy", active: false} // 11
  62. ],
  63. slowFeed: [
  64. {title: "Toggle Feed", id: "fsfb-slowFeed", key: 0, active: false},
  65. {title: "Feed Delay (ms)", id: "fsfb-slowfeedtime", val: 100, active: false}
  66. ],
  67. quickSettings: [
  68. {id: "fsfb-quick-hotkey1", id1: "fsfb-quick-select1", set: "cSkins", key: 0, active: false},
  69. {id: "fsfb-quick-hotkey2", id1: "fsfb-quick-select2", set: "cWearables", key: 0, active: false},
  70. {id: "fsfb-quick-hotkey3", id1: "fsfb-quick-select3", set: "cFood", key: 0, active: false},
  71. {id: "fsfb-quick-hotkey4", id1: "fsfb-quick-select4", set: "cBubbleCells", key: 0, active: false},
  72. {id: "fsfb-quick-hotkey5", id1: "fsfb-quick-select5", set: "cNames", key: 0, active: false},
  73. {id: "fsfb-quick-hotkey6", id1: "fsfb-quick-select6", set: "cNameOutlines", key: 0, active: false}
  74. ],
  75. uiScaling: [
  76. // {title: "Chat Size", id: "fsfb-chatSize", level: 5},
  77. {title: "Inventory Size", id: "fsfb-invSize", level: 5}, // 0
  78. {title: "Food Size", id: "fsfb-foodSize", level: 1}, // 1
  79. {title: "Statsbox Size", id: "fsfb-statsSize", level: 5} // 2
  80. ],
  81. theme: [
  82. {title: "Food Color", id: "fsfb-check-foodcolor", id1: "fsfb-color-foodcolor", color: "#FFFFFF", active: false}, // 0
  83. {title: "Virus Color", id: "fsfb-check-viruscolor", id1: "fsfb-color-viruscolor", color: "#00ff00", active: false}, // 1
  84. {title: "Virus Stroke", id: "fsfb-check-virusstroke", id1: "fsfb-color-virusstroke", color: "#00ff00", active: false}, // 2
  85. {title: "Mothercell Color", id: "fsfb-check-msColor", id1: "fsfb-color-msColor", color: "#cd5564", active: false}, // 3
  86. {title: "Mothercell Stroke", id: "fsfb-check-msStroke", id1: "fsfb-color-msStroke", color: "#cd5564", active: false}, // 4
  87. {title: "Border Color", id: "fsfb-check-border", id1: "fsfb-color-border", color: "#CC3030", active: false}, // 5
  88. {title: "BR Hazard Zone", id: "fsfb-check-Hazard", id1: "fsfb-color-hazard", color: "#cc3030", active: false} // 6
  89. ],
  90. theme_boxes: [
  91. {title: "Fancy Bubble Cells", id: "fsfb-bublecell", active: false}, // 0
  92. {title: "Show Player Mass", id: "fsfb-showmass", active: false}, // 1
  93. {title: "Only My Skin", id: "fsfb-myskins", active: false}, // 2
  94. {title: "Only Party Skins", id: "fsfb-partyskins", active: false}, // 3
  95. {title: "Only My Nick", id: "fsfb-mynick", active: false}, // 4
  96. {title: "Only Party Nicks", id: "fsfb-partynicks", active: false}, // 5
  97. {title: "Spiked Cells", id: "fsfb-spikedcells", active: false}, // 6
  98. {title: "Reverse Cell Order", id: "fsfb-revcell", active: false}, // 7
  99. {title: "Render Portals Top", id: "fsfb-portalstop", active: false}, // 8
  100. ],
  101. name_color: [
  102. {title: "Public Name Color", id: "fsfb-nc-public", active: true}, // 0
  103. {title: "Name Color", id: "fsfb-check-nc", id1: "fsfb-nc-color", color: "#FFFFFF", active: false}, // 1
  104. {title: "Name Stroke", id: "fsfb-check-ncs", id1: "fsfb-nc-stroke", color: "#000000", active: false}, // 2
  105.  
  106. ],
  107. anti_lag: [
  108. {title: "Hide Small Minions", id: "fsfb-hideminions", active: false}, // 0
  109. {title: "No Minion Skins", id: "fsfb-nominionskins", active: false}, // 1
  110. {title: "Hide All Ejected", id: "fsfb-hideejected", active: false}, // 2
  111. {title: "Hide Static Ejected", id: "fsfb-hidestaticej", active: false}, // 3
  112. {title: "No Eat Anims", id: "fsfb-nodeathanims", active: false} // 4
  113. ],
  114. chat_translate: [
  115. {title: "Translate Chat", id: "fsfb-tranchat", active: false}, // 0
  116. {title: "Translate Server", id: "fsfb-tranplyr", active: false}, // 1
  117. {title: "Show Original", id: "fsfb-tranorig", active: false}, // 2
  118. {title: "Translate From:", id: "fsfb-tran1", set: "auto"}, // 3
  119. {title: "Translate To:", id: "fsfb-tran2", set: "auto"} // 4
  120. ],
  121. export_import: [
  122. {title: "Game Settings", id: "fsfb-game-settings", active: false},
  123. {title: "Game Controls", id: "fsfb-game-controls", active: false},
  124. {title: "Custom Background", id: "fsfb-custom-bg", active: false},
  125. {title: "Script Settings", id: "fsfb-script-settings", active: false},
  126. {title: "Script Theme", id: "fsfb-theme-settings", active: false}
  127. ]
  128. }, misc_settings = {
  129. abil: {},
  130. bots: {},
  131. statsPos: null,
  132. statsSettings: {
  133. xp: {
  134. lvlcomp: true,
  135. rem: true,
  136. projhr: true,
  137. lasthr: true,
  138. lastmin: true,
  139. lastsec: true,
  140. mean: true,
  141. median: true,
  142. sd: true,
  143. sesh: true,
  144. seshlength: true,
  145. lifetime: true
  146. },
  147. coins: {
  148. rem: true,
  149. projhr: true,
  150. lasthr: true,
  151. lastmin: true,
  152. mean: true,
  153. median: true,
  154. sd: true,
  155. sesh: true,
  156. seshlength: true
  157. }
  158. }
  159. }
  160. // Don't edit these settings directly (changing code) unless you aren't using tampermonkey or can't access the settings via the menu commands
  161. let userPreferences = {
  162. hideAds: true,
  163. improvedShop: true,
  164. extraBotPacks: true,
  165. rightClickCopyChat: true,
  166. rightClickCopyInfo: true,
  167. showRemainingAbilityTime: true,
  168. unlockFreeSkins: true,
  169. hoverShowSkinID: true,
  170. coinXPstats: true,
  171. saveStatsBoxPosition: true,
  172. showXPdecimals: true,
  173. whiteBorder4BlackCells: true,
  174. sortWearablesByOwned: true,
  175. linesplitClosestSide: false,
  176. friendDeclineAll: true,
  177. rainbowMapBorder: false,
  178. rainbowBorderSpeed: 5,
  179. rainbowBrHazard: false,
  180. rainbowBrHazardSpeed: 5,
  181. extraChatCommands: true,
  182. chatPrefix: '/f ',
  183. bypassConfirmChatRules: true,
  184. publicSkinSearch: true,
  185. extraOneFastSplitDelay: false,
  186. notifyNewUpdates: true,
  187. preventAutoLowGraphics: true,
  188. stylizeActiveSettings: true,
  189. removeMultiFeedPopup: true,
  190. level1kFix: true,
  191. messageBanWarning: true,
  192. removeModMessages: false,
  193. removeColorTagsInChat: true
  194. }
  195. 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: "'"}, cmap = { a: "а", e: "е", i: "і", o: "ο", u: "υ", y: "у", A: "А", E: "Е", I: "Ӏ", O: "Ο", U: "𝗨", Y: "Υ"};
  196. const invisUnicodeCharIds = [9, 32, 160, 847, 1564, 4447, 4448, 6068, 6069, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8232, 8239, 8287, 8289, 8290, 8291, 8292, 8298, 8299, 8300, 8301, 8302, 8303, 10240, 12288, 12644, 65440];
  197.  
  198. const setStorage = (name, obj) => typeof GM_setValue != "function" ? localStorage.setItem(name, JSON.stringify(obj)) : GM_setValue(name, obj),
  199. getStorage = (name, default_obj) => typeof GM_getValue != "function" ? localStorage.getItem(name) != null ? JSON.parse(localStorage.getItem(name)) : setStorage(name, default_obj) : GM_getValue(name, default_obj);
  200.  
  201. if(typeof unsafeWindow === 'undefined') unsafeWindow = window;
  202.  
  203. const saveSettings = () => setStorage("fsfb-scripts", settings);
  204. const getSettings = () => {
  205. let settingsPrev = getStorage("fsfb-scripts", settings);
  206. for(let i in settingsPrev) {
  207. for(let j in settingsPrev[i]) {
  208. for(let x in settings){
  209. for(let y in settings[x]){
  210. if(settingsPrev[i][j].id == settings[x][y].id) settings[x][y] = settingsPrev[i][j];
  211. }
  212. }
  213. }
  214. }
  215. }
  216.  
  217. let prevPreferences = getStorage('fsfb-user-settings', userPreferences);
  218.  
  219. for(let prevSetting in prevPreferences) {
  220. for(let currSetting in userPreferences){
  221. if(prevSetting == currSetting) userPreferences[currSetting] = prevPreferences[prevSetting]; //settings[x][y] = settingsPrev[i][j];
  222. }
  223. }
  224.  
  225. const getMiscSettings = () => {
  226. let prevSettings = getStorage("fsfb-misc", misc_settings);
  227. misc_settings = {...misc_settings, ... prevSettings};
  228. }
  229. getSettings();
  230. getMiscSettings();
  231.  
  232. const getName = key => key ? keyCodeMappings[key] ?? String.fromCharCode(key) : '';
  233.  
  234. const levelSum = lvl => lvl * --lvl / 2,
  235. range = arr => Math.max(...arr) - Math.min(...arr),
  236. sigma = arr => arr.reduce((a, b) => a + b),
  237. mean = arr => sigma(arr) / arr.length,
  238. variance = arr => arr.reduce((a, b) => a + (b - mean(arr)) ** 2, 0) / arr.length,
  239. standardDeviation = arr => Math.sqrt(variance(arr)),
  240. ascending = arr => arr.sort((a, b) => a - b),
  241. getIQR = arr => quartile(arr, .75) - quartile(arr, .25),
  242. round = (num, places = 0) => Math.round(num * +("1e" + places)) / +("1e" + places);
  243. const median = arr => {
  244. const mid = ~~(arr.length / 2),
  245. asc = ascending(arr);
  246. return arr.length % 2 !== 0 ? asc[mid] : (asc[mid - 1] + asc[mid]) / 2;
  247. }
  248. const getProperty = (arr, property) => {
  249. let newArr = [];
  250. for (let i of arr) newArr.push(i[property]);
  251. return newArr;
  252. }
  253. const quartile = (arr, q) => {
  254. const sorted = ascending(arr),
  255. pos = (sorted.length - 1) * q,
  256. base = ~~pos,
  257. rest = pos - base;
  258. return sorted[base + 1] !== null ? sorted[base] + rest * (sorted[base + 1] - sorted[base]) : sorted[base]
  259. }
  260. const checkOutliers = (arr, returnOutliers) => {
  261. let nonOutliers = [], outliers = [];
  262. const IQR = getIQR(arr),
  263. Q1 = quartile(arr, .25),
  264. Q3 = quartile(arr, .75);
  265. for (let i of arr) i < Q1 - 1.5 * IQR || i > Q3 + 1.5 * IQR ? outliers.push(i) : nonOutliers.push(i);
  266. return returnOutliers ? outliers : nonOutliers;
  267. }
  268. const msToTime = ms => {
  269. const pad = num => num < 10 ? '0' + ~~num : ~~num;
  270. return `${pad(ms / 36e5)}:${pad(ms / 6e4 % 60)}:${pad(ms / 1e3 % 60)}`; // hrs:mins:secs
  271. }
  272. const changeTitle = title => {
  273. if(document.title != title) document.title = title;
  274. };
  275.  
  276. if(settings.checkboxes[4].active && document.title == 'Agma.io - A free multiplayer MMO game') changeTitle('Agma.io');
  277.  
  278. if(userPreferences.unlockFreeSkins){
  279. ["", 56, 1657, 2281, 2282, 2297, 2331, 2529, 2626, 2683, 2816, 2832].forEach(id => localStorage.setItem('ytSkin' + id, '1'));
  280. localStorage.setItem('fbSkin', '1');
  281. }
  282.  
  283. const softSanitize = str => {
  284. const map = {
  285. '&': '&amp;',
  286. '<': '&lt;',
  287. '>': '&gt;',
  288. '"': '&quot;',
  289. "'": '&#x27;',
  290. "/": '&#x2F;',
  291. };
  292. return str.replace(/[&<>"'/]/ig, match => map[match]);
  293. }
  294.  
  295. const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  296.  
  297. ['paste', 'copy', 'cut'].forEach(a => {
  298. unsafeWindow.addEventListener(a, e => {
  299. if(document.querySelector('#fsfb-copycutpaste')?.checked) e.stopImmediatePropagation();
  300. }, true)
  301. });
  302.  
  303.  
  304. let agmaHotkeys = JSON.parse(localStorage.getItem('hotkeys'));
  305. let agmaSettings = JSON.parse(localStorage.getItem('settings'));
  306.  
  307. Object.defineProperty(unsafeWindow, 'localStorage', {
  308. value: new Proxy(localStorage, {
  309. set: function (ls, prop, val) {
  310. if(prop === 'hotkeys') agmaHotkeys = JSON.parse(val);
  311. else if(prop === 'settings'){
  312. let prevNick = agmaSettings?.nickName;
  313. agmaSettings = JSON.parse(val);
  314. if(settings.name_color[0].active && !!document.querySelector('#nick') && prevNick && prevNick != agmaSettings.nickName) val = JSON.stringify((agmaSettings.nickName = document.querySelector('#nick').value, agmaSettings));
  315. }
  316. return !void(ls[prop] = val);
  317. },
  318. get: function(ls, prop) {
  319. return prop == 'setItem' || typeof ls[prop] == 'function' ? ls[prop].bind(ls) : ls[prop];
  320. }
  321. }),
  322. configurable: true,
  323. enumerable: true
  324. });
  325.  
  326. const hotkeysMap = {
  327. 360: "W360",
  328. Split: "Space",
  329. DoubleSplit: "D",
  330. TripleSplit: "T",
  331. MacroSplit: "Z",
  332. MacroFeed: "W",
  333. FixedMouse: "C",
  334. Respawn: "M",
  335. MultiFeed: "V",
  336. Recombine: "E",
  337. Speed: "S",
  338. FreezeSelf: "F",
  339. Invisibility: "I",
  340. DropWall: "DW",
  341. ToggleCamera: "Q",
  342. FreezeCamera: "F",
  343. ToggleControlBots: "Q",
  344. SplitBots: "A",
  345. FeedBots: "X"
  346. }
  347. const getKey = id => agmaHotkeys && agmaHotkeys[hotkeysMap?.[id.replace(/^key/gm, '')]]?.c;
  348. unsafeWindow.getKey = getKey;
  349.  
  350. if(userPreferences.bypassConfirmChatRules) localStorage.setItem('crc', 'true');
  351.  
  352.  
  353. const insertCustomjQuery = $ => {
  354. // const { $ } = unsafeWindow;
  355.  
  356. if(userPreferences.extraBotPacks){
  357.  
  358. const newBots = [
  359. {title: "100 Bots", time: "24 HOURS", price: "700,000", id: 9},
  360. {title: "125 Bots", time: "48 HOURS", price: "900,000", id: 10},
  361. {title: "300 Bots", time: "24 HOURS", price: "900,000", id: 7},
  362. {title: "100 MASS Bots", time: "1 HOURS", price: "800,000", id: 8},
  363. {title: "300 Bots", time: "72 HOURS", price: "2,000,000", id: 11},
  364. {title: "100 MASS Bots", time: "24 HOURS", price: "2,600,000", id: 12},
  365. {title: "500 MASS Bots", time: "2 HOURS", price: "30,000,000", id: 17},
  366. {title: "500 MASS Bots", time: "12 HOURS", price: "40,000,000", id: 16}
  367. ]
  368.  
  369.  
  370. if(document.getElementsByClassName('tab-container-section minion scroll')?.[0]?.children?.[0].children.length){ // check if minions page has already been loaded
  371. $('.confirm-minion[item=7], .confirm-minion[item=8]').parent().hide();
  372. for(let i of newBots) createEl(i);
  373. document.getElementById('extraTab').childNodes[0].setAttribute('onclick', '');
  374. $('.confirm-minion.extra-min').click(function(e) {
  375. e.preventDefault(); // Prevent the href from redirecting directly
  376. const { setMinionUi, purchaseMinion } = unsafeWindow;
  377. let linkURL = $(this).attr("href"),
  378. priceK = $(this).attr("price"),
  379. itemId = $(this).attr("item");
  380. setMinionUi(true);
  381. unsafeWindow.swal({
  382. title: "Confirm",
  383. text: 'If you click "Buy", you will purchase these minions. They cost ' + priceK,
  384. type: "warning",
  385. showCancelButton: true,
  386. confirmButtonColor: "#4CAF50",
  387. confirmButtonText: "Yes, confirm purchase",
  388. cancelButtonText: "No, cancel purchase"
  389. }, function() {
  390. purchaseMinion(itemId);
  391. });
  392. });
  393. } else {
  394. const _$click = $.prototype.click;
  395.  
  396. $.prototype.click = function(){
  397. if(this.selector === ".confirm-minion" && typeof arguments[0] === 'function'){
  398. $('.confirm-minion[item=7], .confirm-minion[item=8]').parent().hide();
  399. for(let i of newBots) createEl(i);
  400. document.getElementById('extraTab').childNodes[0].setAttribute('onclick', '');
  401. return _$click.apply($('.confirm-minion'), arguments);
  402. }
  403. return _$click.apply(this, arguments);
  404. }
  405. }
  406. function createEl(i) {
  407. const botEl = document.createElement('li');
  408. botEl.setAttribute('class', 'masterTooltip extra-min');
  409. 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.');
  410. document.getElementsByClassName('tab-container-section minion scroll')[0].children[0].children[0].appendChild(botEl);
  411. botEl.innerHTML = `<div class="title_prch"><img src="img/store/minions/minions_tab.png" width="70px" height="60px"><div class="minionDescription"><h4 style="font-size: 18px;">${i.title}</h4><h3 style="margin-top:10px;color:white;"> ${i.time}</h3></div> <span class="win-price">${i.price}</span></div><a href="#" price="${i.price}" item="${i.id}" class="purchase-btn2 confirm-minion extra-min">Buy</a>`;
  412. }
  413. }
  414. }
  415.  
  416.  
  417. if(typeof unsafeWindow.$ === 'function'){
  418. insertCustomjQuery(unsafeWindow.$);
  419. } else {
  420. let setjQueryVal;
  421. Object.defineProperty(unsafeWindow, '$', { // intercept immediately after jQuery is defined on window
  422. set: function(val) {
  423. setjQueryVal = val;
  424. insertCustomjQuery(val);
  425. },
  426. get: function() {
  427. return setjQueryVal;
  428. },
  429. configurable: true
  430. });
  431. }
  432.  
  433.  
  434. const afterLoaded = () => {
  435.  
  436. unsafeWindow.fsfbStartedLoading = true;
  437. const { $, swal, purchaseItem, hotkeySetDefaults, setDefaults, uisdoa } = unsafeWindow;
  438.  
  439. // attempt to prevent the script from being active on subpages of agma.io
  440. if($ == null || $('#friendResizer').length < 1 || $('#megaholder').length < 1 || $('#preroll').length < 1) return;
  441.  
  442. if(!agmaHotkeys) hotkeySetDefaults();
  443. if(!agmaSettings) setDefaults();
  444.  
  445. if(typeof GM_registerMenuCommand === 'function' && typeof GM_unregisterMenuCommand === 'function'){
  446.  
  447. const addMenuCmd = (name, callback, accessKey) => GM_registerMenuCommand(name, callback, accessKey);
  448. const remMenuCmd = command_id => GM_unregisterMenuCommand(command_id);
  449.  
  450. let expandedUserPref = {
  451. hideAds: { title: 'Hide Ads', type: 'bool' },
  452. improvedShop: { title: 'Improved Shop', type: 'bool' },
  453. extraBotPacks: { title: 'Better Shop', type: 'bool' },
  454. rightClickCopyChat: { title: 'Right-Click Copy Chat', type: 'bool' },
  455. rightClickCopyInfo: { title: 'Right-Click Copy Info', type: 'bool' },
  456. showRemainingAbilityTime: { title: 'Show Remaining Abilities', type: 'bool' },
  457. unlockFreeSkins: { title: 'Unlock Free Skins', type: 'bool' },
  458. hoverShowSkinID: { title: 'Hover Show Skin ID', type: 'bool' },
  459. coinXPstats: { title: 'Coin/XP Statistics', type: 'bool' },
  460. saveStatsBoxPosition: { title: 'Save Stats-Box Position', type: 'bool' },
  461. showXPdecimals: { title: 'Show Decimals in % XP', type: 'bool' },
  462. whiteBorder4BlackCells: { title: 'White Border For Black Cells', type: 'bool' },
  463. sortWearablesByOwned: { title: 'Sort Owned Wearables', type: 'bool' },
  464. linesplitClosestSide: { title: 'Linesplit Closest Side', type: 'bool' },
  465. friendDeclineAll: { title: 'Friend Decline All', type: 'bool' },
  466. rainbowMapBorder: { title: 'Rainbow Map Border', type: 'bool' },
  467. rainbowBorderSpeed: { title: 'Rainbow Border Speed', type: 'num' },
  468. rainbowBrHazard: { title: 'Rainbow BR Hazard', type: 'bool' },
  469. rainbowBrHazardSpeed: { title: 'Rainbow Hazard Speed', type: 'num' },
  470. extraChatCommands: { title: 'FSFB Chat Commands', type: 'bool' },
  471. chatPrefix: { title: 'Chat Command Prefix', type: 'str' },
  472. bypassConfirmChatRules: { title: 'Bypass Chat Confirm', type: 'bool' },
  473. publicSkinSearch: { title: 'Public Skin Search', type: 'bool' },
  474. extraOneFastSplitDelay: { title: 'Extra Fastsplit Delay', type: 'bool' },
  475. notifyNewUpdates: { title: 'Notify New Updates', type: 'bool' },
  476. preventAutoLowGraphics: { title: 'Disable Auto-Low Graphics', type: 'bool' },
  477. stylizeActiveSettings: { title: 'Stylize Active Settings', type: 'bool' },
  478. removeMultiFeedPopup: { title: 'Remove MultiFeed Warning', type: 'bool' },
  479. level1kFix: { title: 'Fix Level 1000 Bug', type: 'bool'},
  480. messageBanWarning: { title: 'Censor Message To Mitigate Ban', type: 'bool' },
  481. removeModMessages: { title: 'Remove Server Mod Messages', type: 'bool' },
  482. removeColorTagsInChat: { title: 'Remove Custom Name Tags In Chat', type: 'bool' }
  483. }
  484.  
  485. function updateShownSettings(){
  486. for(let keyName in expandedUserPref){
  487. const expObj = expandedUserPref[keyName];
  488.  
  489. if('menu' in expObj){
  490. remMenuCmd(expObj.menu);
  491. }
  492.  
  493. let value = userPreferences[keyName],
  494. typeIndicator = expObj.type == 'bool' ? `[ ${value ? '✅' : '❌'} ] ` : `[ "${value}" ] `;
  495.  
  496. expObj.menu = addMenuCmd(typeIndicator + expObj.title, function(e){
  497. let newVal;
  498. if(expObj.type === 'bool'){
  499. newVal = !value;
  500. userPreferences[keyName] = newVal;
  501. } else {
  502. newVal = prompt('Please input the value you want to set:', value);
  503.  
  504. if(expObj.type === 'num' && !/^[0-9]+$/.test(newVal)){
  505. updateShownSettings();
  506. return alert('Please only enter numbers');
  507. }
  508. userPreferences[keyName] = expObj.type === 'num' ? Number(newVal) : newVal;
  509. }
  510. updateShownSettings();
  511. setStorage('fsfb-user-settings', userPreferences);
  512. alert(`Setting: "${expObj.title}" value changed to: ${expObj.type === 'bool' ? `[ ${newVal ? '✅' : '❌'} ] ` : `[ "${newVal}" ] `}.\nNote that some (not all) settings require a browser reload to take full effect.`);
  513. })
  514. }
  515. addHideAll();
  516. }
  517.  
  518. function addHideAll(){
  519. let hideAllBtn = addMenuCmd('Hide all settings', function(){
  520. for(let keyName in expandedUserPref){
  521. const expObj = expandedUserPref[keyName];
  522. if('menu' in expObj){
  523. remMenuCmd(expObj.menu);
  524. }
  525. }
  526. remMenuCmd(hideAllBtn);
  527. addShowMore();
  528. });
  529. }
  530. function addShowMore(){
  531. let showMoreBtn = addMenuCmd('Show all settings', function(){
  532. remMenuCmd(showMoreBtn);
  533. updateShownSettings();
  534. })
  535. }
  536. addShowMore();
  537. }
  538.  
  539. const _slideDown = $.prototype.slideDown;
  540. $.prototype.slideDown = function () {
  541. if(this.selector === '#curser'){
  542. let content = this[0].textContent;
  543. if(content?.includes("Your FPS seems to be low")) return;
  544. if(content?.includes("Connected to server")){
  545. playerAlive = false;
  546. svSwitch = true;
  547. try{
  548. currentServerId = 0;
  549. for(let { isCurrent, id } of JSON.parse(localStorage.gameservers)){
  550. if(isCurrent) currentServerId = id;
  551. }
  552. } catch {
  553. console.warn("FSFB: Failed to grab server id from localStorage")
  554. currentServerId = parseInt($(".server-tabmenu").find(".active")[0]?.id.slice(9));
  555. }
  556. }
  557. }
  558. return _slideDown.apply(this, arguments);
  559. }
  560.  
  561. const _$text = $.prototype.text;
  562. $.prototype.text = function(){
  563. if(this.selector === '.exp-bar' && userPreferences.showXPdecimals){
  564. arguments[0] = (~~(+this[0].parentElement.style.width.slice(0, -1) * 100) / 100) + '%';
  565. }
  566. if(this.selector == '#userCoins2' && typeof arguments[0] === 'string') currentUser = arguments[0];
  567. return _$text.apply(this, arguments);
  568. }
  569.  
  570. let swalUserColor = '#FF00D8',
  571. swalRoleTitle = 'Fsfb Developer',
  572. swalRoleColor = '#FF78EA';
  573.  
  574. unsafeWindow.swal = function() {
  575. if(typeof arguments[0] === 'object' && 'title' in arguments[0] && userPreferences.removeMultiFeedPopup && arguments[0].type === "error" && arguments[0].text === "Eject multiple cells (Multi Feed) is only available for users who purchased the Custom Skins Sale"){
  576. return void(curserMsg(arguments[0].text, 'red', 1e4));
  577. }
  578. if(typeof arguments[0] === 'object' && 'title' in arguments[0] && userPreferences.removeModMessages && arguments[0].title.includes("Mod Message") && arguments[0]?.customClass === "swal-title-green"){
  579. return void(curserMsg(`<b>${arguments[0].title}:</b>\n${arguments[0].text}`, 'purple', 1e4, true));
  580. }
  581. if (typeof arguments[0] === 'object' && 'title' in arguments[0] && /<img src="((skins\/\d+(_lo)?\.png\?(u=\d+)?)|img\/userprofile\.png)" width="\d+" height="\d+" style="border-radius:50%;"><br><br><span style=".*?">(Fishyyyy|firebonee|kidmaletteo)<\/span>/gm.test(arguments[0].title)) {
  582. arguments[0].title = arguments[0].title
  583. .replace(/(?<=<span style=").*(?=">(Fishyyyy|firebonee|kidmaletteo))/gm, 'color: ' + swalUserColor)
  584. .replace(/(?<=(?:<span style="display:block; margin:-10px 0px 15px; font-size:12px; line-height:normal;"><br>)|(?:<br><span style="padding:2px 5px; font-size:10px; background:#999; color:#000; border-radius:10px;">Hidden<\/span><br><br>))(?=<span)/gm, `<span style="color: ${swalRoleColor};">&#9734;&#9734; ${swalRoleTitle} &#9734;&#9734;</span><br>`);
  585. }
  586. return swal.apply(this, arguments);
  587. }
  588.  
  589. $('.setting-tablink').css({'width' : '30%'});
  590. $('#settingTab2').after(`<button id="settingTab4" class="setting-tablink" onclick="openSettingPage(4);" style="width: 9%; font-size: calc(0.3vw + 7.5px);"><div class="fa fa-cogs fa-lg" style="font-size: 15px; color: lightgray;"></div></button>`);
  591. $('#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-namecolor" class="fsfb-sect-ch padbot10"></section><section id="fsfb-sect-antilag" class="fsfb-sect-ch padbot10"></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-frzvrs" 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-translate"></section></div></div></div></div>`);
  592. $('.container').eq(0).css("max-width", "1250px");
  593. $('#fsfb-sect-checkbox').append(`<p class="hotkey-paragraph">Script Features</p>`);
  594.  
  595. // add checkbox HTML
  596. for(let i of settings.checkboxes){
  597. $('#fsfb-sect-checkbox').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  598. $( "#" + i.id).change(function(e) {
  599. changeSettings(this.id, $(this).is(':checked'), e);
  600. });
  601. }
  602.  
  603. // add import/export HTML
  604. $('#fsfb-sect-imexport').append(`<p class="hotkey-paragraph">Import/Export</p>`);
  605. for(let i of settings.export_import){
  606. $('#fsfb-sect-imexport').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  607. $( "#" + i.id).change(function() {
  608. changeSettings(this.id, $(this).is(':checked'));
  609. });
  610. }
  611. $('#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>`);
  612.  
  613. $('#fsfb-sect-theme').append(`<p class="hotkey-paragraph">Game Theme</p>`);
  614. for(let i of settings.theme){
  615. $('#fsfb-sect-theme').append(`<label class="fsfb-colors"><input id="${i.id}" type="checkbox"><p> ${i.title}</p><div style="background-color: black;"><input id="${i.id1}"type="color"></div></label>`);
  616. $( "#" + i.id).change(function() {
  617. changeSettings(this.id, $(this).is(':checked'));
  618. });
  619. $( "#" + i.id1).on('input', function() {
  620. changeSettings(this.id, this.value);
  621. $(this).parent().css('background-color', this.value); // bcs the regular [input="color"] looks rly shit, change color of overlayed div instead
  622. });
  623. }
  624. for(let i of settings.theme_boxes){
  625. $('#fsfb-sect-theme').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  626. $( "#" + i.id).change(function(e) {
  627. changeSettings(this.id, $(this).is(':checked'), e);
  628. });
  629. }
  630. // namecolor
  631. $('#fsfb-sect-namecolor').append(`<p class="hotkey-paragraph">Colored Name</p>`);
  632. for(let i of settings.name_color){
  633. if("color" in i){
  634.  
  635. $('#fsfb-sect-namecolor').append(`<label class="fsfb-colors"><input id="${i.id}" class="fsfb-ncustom" type="checkbox"><p> ${i.title}</p><div style="background-color: black;"><input id="${i.id1}"type="color"></div></label>`);
  636. $( "#" + i.id).change(function() {
  637. changeSettings(this.id, $(this).is(':checked'));
  638. });
  639. $( "#" + i.id1).on('input', function() {
  640. changeSettings(this.id, this.value);
  641. $(this).parent().css('background-color', this.value); // bcs the regular [input="color"] looks rly shit, change color of overlayed div instead
  642. });
  643. } else {
  644. $('#fsfb-sect-namecolor').append(`<label><input id="${i.id}" class="fsfb-ncustom" type="checkbox"><p> ${i.title} </p></label>`);
  645. $( "#" + i.id).change(function(e) {
  646. changeSettings(this.id, $(this).is(':checked'), e);
  647. });
  648. }
  649. }
  650.  
  651.  
  652.  
  653. // antilag
  654. $('#fsfb-sect-antilag').append(`<p class="hotkey-paragraph">Anti-Lag</p>`);
  655. for(let i of settings.anti_lag){
  656. $('#fsfb-sect-antilag').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  657. $( "#" + i.id).change(function(e) {
  658. changeSettings(this.id, $(this).is(':checked'), e);
  659. });
  660. }
  661.  
  662. $('#fsfb-sect-translate').append(`<p class="hotkey-paragraph">Chat Translate</p>`);
  663.  
  664. for(let i of settings.chat_translate){
  665. if(!('set' in i)){ //checkboxes
  666. $('#fsfb-sect-translate').append(`<label><input id="${i.id}" type="checkbox"><p> ${i.title} </p></label>`);
  667. $( "#" + i.id).change(function(e) {
  668. changeSettings(this.id, $(this).is(':checked'), e);
  669. });
  670. } else {
  671. $('#fsfb-sect-translate').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>`);
  672. }
  673. };
  674.  
  675. $('.fsfb-changelang').on("change", function(){
  676. for(let i = 0; i < settings.chat_translate.length; i++){
  677. if(settings.chat_translate[i].id == this.id) settings.chat_translate[i].set = this.value;
  678. }
  679. saveSettings();
  680. });
  681.  
  682. $('#fsfb-sect-hotkeys').append(`<p class="hotkey-paragraph">Script Hotkeys</p>`);
  683.  
  684. const checkHotkeyClicked = (e, thing) => {
  685. if (e.target.id == thing.id && !thing.active){
  686. $('#' + thing.id).addClass('selected');
  687. thing.active = true;
  688. keysChanging = true; // prevent features from triggering when setting hotkey
  689. } else {
  690. thing.active = false;
  691. $('#' + thing.id).removeClass('selected');
  692. }
  693. }
  694. const checkNewHotkey = (e, thing) => {
  695. if (!thing.active) return;
  696. thing.key = e.keyCode;
  697. $('#' + thing.id).text(getName(e.keyCode)).removeClass('selected');
  698. thing.active = false;
  699. saveSettings();
  700. styleActiveSettings();
  701. e.preventDefault();
  702. }
  703. const checkFsHotkey = (e, thing) => {
  704. if (!thing.active) return;
  705. thing.key = e.keyCode;
  706. thing.keyName = e.key;
  707. $('#' + thing.id).text(getName(e.keyCode)).removeClass('selected');
  708. thing.active = false;
  709. saveSettings();
  710. styleActiveSettings();
  711. e.preventDefault();
  712. }
  713.  
  714. const checkPowerupClicked = e => {
  715. if(!quickBuying || !e?.originalEvent?.isTrusted || $(e.target).attr('class') == 'purchase-btn confirmation' || $(e.target).attr('class') == 'megaphone-btn') return;
  716. let id = e.target.id;
  717. if (id == 'fsfb-quickbuy-img' || id == 'fsfb-quickbuy') return void(quickBuying = true);
  718. const map = {
  719. Wall: 33,
  720. AntiFreeze: 35,
  721. AntiRecombine: 34,
  722. Shield: 38,
  723. FrozenVirus: 36,
  724. Recombine: 1,
  725. Speed: 2,
  726. Growth: 6,
  727. SpawnVirus: 7,
  728. SpawnMothercell: 8,
  729. SpawnPortal: 9,
  730. SpawnGoldOre: 10,
  731. Freeze: 5,
  732. '360Shot': 30,
  733. minion_nuker: 39,
  734. megaphone_shout: 14,
  735. freeze_yourself: 18
  736. }
  737. let pwID = map[id.replace(/^(inv|fsfb-)/gm, '')] ?? (() => {
  738. quickBuying = false;
  739. $('.inventory-box').removeClass('fsfb-shown').find('p').show();
  740. $('#fsfb-quickbuy').removeClass('activatedInv')
  741. curserMsg('Quick buy deactivated.', 'red');
  742. })();
  743. if (!quickBuying || !pwID) return;
  744. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  745. const waitUntil1 = (condition) => new Promise(resolve => {
  746. let interval = setInterval(() => {
  747.  
  748. if($('.sweet-alert h2').text() == ' Confirm ') return;
  749.  
  750. $('.confirm')[0].click();
  751. condition() && (clearInterval(interval), resolve());
  752. }, 25);
  753. setTimeout(() => { (clearInterval(interval), resolve()) }, 1e4);
  754. });
  755. setTimeout(() => {
  756. if(pwID == 14) return;
  757. $('.confirm')[0].addEventListener('click', async e => {
  758. if(!e.isTrusted || $('.confirm').text() == 'OK') return;
  759. $('.sweet-alert, .sweet-overlay').addClass('fsfb-hidden');
  760. setTimeout(async() => {
  761. await waitUntil1(() => !$('.sweet-alert').hasClass('visible'));
  762. if($('.sweet-alert').hasClass('visible')) return;
  763. await sleep(100);
  764. $('.sweet-alert, .sweet-overlay').removeClass('fsfb-hidden');
  765. }, 1e3);
  766. })
  767. }, 500);
  768. setTimeout(() => $('.confirm').removeAttr('disabled'), 600);
  769.  
  770. if(pwID == 14) $('.megaphone-btn')[0].click();
  771. else $(`.purchase-btn.confirmation[item="${pwID}"]`)[0].click();
  772.  
  773. $('.inventory-box').removeClass('fsfb-shown').find('p').show();
  774. $('#fsfb-quickbuy').removeClass('activatedInv')
  775. quickBuying = false;
  776. }
  777.  
  778.  
  779. for(let i of settings.hotkeys){
  780. $('#fsfb-sect-hotkeys').append(`<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>`);
  781. $('#' + i.id).on('contextmenu', e => {
  782. $('#' + i.id).text('').removeClass('selected');
  783. i.active = false;
  784. i.key = 0;
  785. saveSettings();
  786. styleActiveSettings();
  787. e.preventDefault();
  788. });
  789. }
  790.  
  791. // const typing = () => $('input, textarea').is(':focus');
  792. const typing = () => {
  793. const focused = document.querySelector(":focus");
  794. return focused === document.activeElement && ['TEXTAREA', 'INPUT'].includes(focused?.tagName) && (!document.hasFocus || document.hasFocus()) && !!(focused.type || focused.href || ~focused.tabIndex);
  795. };
  796.  
  797. const sleep = ms => new Promise(r => setTimeout(r, ms));
  798. const press = key => ['down', 'up'].forEach(i => unsafeWindow[`onkey${i}`]({ keyCode: key }));
  799.  
  800. let fsWaiting = false;
  801. const fastSplit = async(a) => { // a = true: was fast onesplit; a = false: was fast doublesplit
  802. if(fsWaiting) return;
  803. fsWaiting = true;
  804. setTimeout(() => void(fsWaiting = false), settings.fastsplit_hotkeys[a ? 1 : 4].val + settings.fastsplit_hotkeys[a ? 2 : 5].val);
  805. if([39, 37, 2, 4, 6].includes(currentServerId) || !a || userPreferences.extraOneFastSplitDelay) await sleep(settings.fastsplit_hotkeys[a ? 1 : 4].val);
  806. press(getKey("FreezeSelf"));
  807. await sleep(settings.fastsplit_hotkeys[a ? 2 : 5].val);
  808. press(getKey("FreezeSelf"));
  809. }
  810.  
  811.  
  812.  
  813. let cursorLockActivated = false, holdAutoFeed = false, _onblur;
  814. const waitForBlur = () => {
  815. if(unsafeWindow.onblur != null){
  816. const oldBlur = unsafeWindow.onblur;
  817. unsafeWindow.onblur = function(){
  818. spamRec = spamSpeed = splittingbots = false;
  819. keys = {};
  820. if(!settings.checkboxes[3].active){
  821. $("#linesplit-markers div").hide();
  822. linesplitting = false;
  823. }
  824. return oldBlur.apply(this, arguments);
  825. }
  826. _onblur = unsafeWindow.onblur;
  827. } else {
  828. setTimeout(waitForBlur, 400);
  829. }
  830. };
  831. waitForBlur();
  832.  
  833. // hook for typing in chat w/ cursor lock
  834. const waitForKeyup = () => {
  835. if(unsafeWindow.onkeyup != null){
  836. const _keydown = unsafeWindow.onkeyup;
  837. unsafeWindow.onkeyup = function(){
  838. const keyCode = arguments[0]?.keyCode;
  839. if(arguments[0]?.target?.id === 'chtbox' && arguments[0]?.isTrusted && cursorLockActivated && keyCode === getKey('FixedMouse')) return;
  840. if(arguments[0]?.isTrusted && holdAutoFeed && [getKey('MacroFeed'), getKey('MultiFeed')].includes(keyCode)) return;
  841. return _keydown.apply(this, arguments);
  842. }
  843. } else {
  844. setTimeout(waitForKeyup, 400);
  845. }
  846. };
  847. waitForKeyup();
  848.  
  849. const waitForSetGraphics = () => {
  850. if(unsafeWindow.onkeyup != null){
  851. const _setGraphics = unsafeWindow.setGraphics;
  852. unsafeWindow.setGraphics = (a, b) => userPreferences.preventAutoLowGraphics && b ? $("#curser").hide() : _setGraphics(a, b);
  853. } else {
  854. setTimeout(waitForSetGraphics, 400);
  855. }
  856. };
  857. waitForSetGraphics();
  858.  
  859. const fsfbCustomBlur = function(){
  860. ['MacroSplit', ...(holdAutoFeed ? [] : ['MacroFeed', 'MultiFeed']), ...(cursorLockActivated ? [] : ['FixedMouse'])].forEach(id => unsafeWindow.onkeyup({keyCode: getKey(id)}));
  861. spamRec = spamSpeed = splittingbots = false;
  862. keys = {};
  863. if(!settings.checkboxes[3].active){
  864. $("#linesplit-markers div").hide();
  865. linesplitting = false;
  866. }
  867. }
  868.  
  869. const toggleHoldFeed = active => {
  870. holdAutoFeed = active ?? !holdAutoFeed;
  871. unsafeWindow.onblur = holdAutoFeed || cursorLockActivated ? fsfbCustomBlur : _onblur;
  872. unsafeWindow[`onkey${holdAutoFeed ? 'down' : 'up'}`]({ keyCode: getKey('MacroFeed') });
  873. }
  874.  
  875. const toggleCursorLock = active => {
  876. cursorLockActivated = active ?? !cursorLockActivated;
  877. unsafeWindow.onblur = holdAutoFeed || cursorLockActivated ? fsfbCustomBlur : _onblur;
  878. unsafeWindow[`onkey${cursorLockActivated ? 'down' : 'up'}`]({ keyCode: getKey('FixedMouse') });
  879. }
  880. unsafeWindow.fsfbCursorLock = toggleCursorLock;
  881.  
  882. const toggleSetting = index => {
  883. let el = $('#' + settings.quickSettings[index].set);
  884. if($('#fsfb-settings-main')[0].contains(el[0])) el.prop('checked', !el.prop('checked')).trigger('change');
  885. else el.unbind().click();
  886. }
  887.  
  888. Object.defineProperty(KeyboardEvent.prototype, 'keyCode', {
  889. get: function() {
  890. switch (this.key.toLowerCase()) {
  891. case settings.fastsplit_hotkeys[0]?.keyName.toLowerCase(): return getKey("Split");
  892. case settings.fastsplit_hotkeys[3]?.keyName.toLowerCase(): return getKey("DoubleSplit");
  893. default: return this.which;
  894. }
  895. }
  896. });
  897.  
  898. let slowfeeding = !1, linesplitting = !1, hiddenUI = !1, splittingbots = !1, spamRec = !1, spamSpeed = !1;
  899. const pressed = e => {
  900. const key = e.which ? e.which : e.keyCode;
  901. if(document.activeElement.type === 'textarea') e.stopImmediatePropagation();
  902. if(typing() || keysChanging || e.key == undefined || e.keyCode == undefined) return;
  903. if(key === 27 && quickBuying){ // esc pressed
  904. quickBuying = false;
  905. $('#fsfb-quickbuy').removeClass('activatedInv');
  906. curserMsg('Quick buy deactivated.', 'red');
  907. $('.inventory-box').removeClass('fsfb-shown').find('p').show();
  908. e.preventDefault();
  909. e.stopImmediatePropagation();
  910. }
  911. if(key === settings.hotkeys[0].key){ // 7 feed
  912. let i = 1;
  913. let interval = setInterval(() => {
  914. press(getKey("MacroFeed"));
  915. if(++i > 7) clearInterval(interval);
  916. }, 85);
  917. e.preventDefault();
  918. }
  919. if(key === settings.hotkeys[1].key && !settings.checkboxes[3].active){ // linesplit lock
  920. linesplitting = true;
  921. linesplit();
  922. $("#linesplit-markers div").show();
  923. e.preventDefault();
  924. }
  925. if(key === settings.hotkeys[1].key && settings.checkboxes[3].active){ // linesplit lock
  926. linesplitting = !linesplitting;
  927. if(linesplitting){
  928. $("#linesplit-markers div").show();
  929. linesplit();
  930. } else {
  931. $("#linesplit-markers div").hide();
  932. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  933. }
  934. e.preventDefault();
  935. }
  936. if(key === settings.hotkeys[2].key){ // macro split bots
  937. splittingbots = true;
  938. const splittingBots = () => {
  939. if(!splittingbots) return;
  940. press(getKey("SplitBots"));
  941. setTimeout(splittingBots, 50);
  942. }
  943. splittingBots();
  944. e.preventDefault();
  945. }
  946. if(key === settings.hotkeys[3].key){ // hide ui
  947. _replaceCSS('hideUI-css', (hiddenUI = !hiddenUI) ? '.hideUI{ display: none !important; }' : '');
  948. e.preventDefault();
  949. }
  950. if(key === settings.hotkeys[4].key){ // toggle cursor lock
  951. toggleCursorLock();
  952. e.preventDefault();
  953. }
  954. if(key === settings.hotkeys[5].key){ // check profile
  955. const swal = $('.sweet-alert'),
  956. swalText = swal.text();
  957. if((swalText.includes('Level: ') || swalText.includes('The selected player is not logged in or is playing in invisible mode.')) && swalText.includes('Not valid!')) $('button.confirm').click();
  958. if(mouseHoveringChat) $('#chtCanvas')[0].ondblclick({clientX: mosX, clientY: mosY, preventDefault: function(){}});
  959. else {
  960. let contextmenuShown = $('#contextMenu').css('display') == 'block';
  961. let evt = new MouseEvent("contextmenu", {
  962. bubbles: true,
  963. cancelable: true,
  964. view: unsafeWindow,
  965. clientX: mosX,
  966. clientY: mosY
  967. });
  968. document.body.dispatchEvent(evt);
  969. if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('Unable to show profile; no player was clicked on.', 'red');
  970. if(!contextmenuShown) $('#contextMenu').hide();
  971. $('#contextUserProfile').addClass('hover');
  972. $('#contextMenu')[0].onclick({stopPropagation: function(){}});
  973. }
  974. e.preventDefault();
  975. }
  976. if(key === getKey("FixedMouse")){ // real cursor lock key is pressed
  977. cursorLockActivated = false;
  978. unsafeWindow.onblur = _onblur;
  979. }
  980. if(e.keyCode != 0 && e.key.toLowerCase() === settings.fastsplit_hotkeys[0]?.keyName.toLowerCase()){ // fast onesplit
  981. fastSplit(!0);
  982. e.preventDefault();
  983. }
  984. if(e.keyCode != 0 && e.key.toLowerCase() === settings.fastsplit_hotkeys[3]?.keyName.toLowerCase()){ // fast doublesplit
  985. fastSplit(!1);
  986. e.preventDefault();
  987. }
  988. if(key === settings.slowFeed[0].key){ // toggle feed
  989. slowfeeding = !slowfeeding;
  990. const feeding = () => {
  991. if(!slowfeeding) return void(holdAutoFeed && toggleHoldFeed(false));
  992. unsafeWindow?.uisdoa?.foprw?.() || settings.slowFeed[1].val === 0 || press(getKey("MacroFeed"));
  993.  
  994. settings.slowFeed[1].val === 0 ? toggleHoldFeed(slowfeeding) : setTimeout(feeding, settings.slowFeed[1].val);
  995.  
  996. }
  997. feeding();
  998. e.preventDefault();
  999. }
  1000. if(key === settings.frozenvirus[0].key){
  1001. let fvEl = $('#invFrozenVirus'),
  1002. wasActive = fvEl.hasClass('activatedInv');
  1003. if(fvEl.css('display') === 'none') return void(curserMsg(`FSFB script can't click on the frozen virus powerup! Frozen viruses are needed before using this hotkey`, 'red'));
  1004. curserMsg();
  1005.  
  1006. wasActive || fvEl[0].onmousedown({ button: 0 });
  1007. press(getKey("MacroFeed"));
  1008. wasActive || setTimeout(() => fvEl[0].onmousedown({ button: 0 }), settings.frozenvirus[1].val);
  1009. }
  1010. if(key === settings.quickSettings[0].key){ // quick settings 1
  1011. toggleSetting(0);
  1012. e.preventDefault();
  1013. }
  1014. if(key === settings.quickSettings[1].key){ // quick settings 2
  1015. toggleSetting(1);
  1016. e.preventDefault();
  1017. }
  1018. if(key === settings.quickSettings[2].key){ // quick settings 3
  1019. toggleSetting(2);
  1020. e.preventDefault();
  1021. }
  1022. if(key === settings.quickSettings[3].key){ // quick settings 4
  1023. toggleSetting(3);
  1024. e.preventDefault();
  1025. }
  1026. if(key === settings.quickSettings[4].key){ // quick settings 5
  1027. toggleSetting(4);
  1028. e.preventDefault();
  1029. }
  1030. if(key === settings.quickSettings[5].key){ // quick settings 6
  1031. toggleSetting(5);
  1032. e.preventDefault();
  1033. }
  1034. if(!spamRec && uisdoa && settings.checkboxes[6].active && key === getKey("Recombine")){
  1035. spamRec = true;
  1036. const spammingRec = () => {
  1037. if(!spamRec) return;
  1038. // press(getKey("keyRecombine"));
  1039. if(unsafeWindow?.uisdoa?.foprc) uisdoa.foprc(1);
  1040. setTimeout(spammingRec, 10);
  1041. }
  1042. spammingRec();
  1043. e.preventDefault();
  1044. }
  1045. if(!spamSpeed && uisdoa && settings.checkboxes[6].active && key === getKey("Speed")){
  1046. spamSpeed = true;
  1047. const spammingSpeed = () => {
  1048. if(!spamSpeed) return;
  1049. // press(getKey("keySpeed"));
  1050. if(unsafeWindow?.uisdoa?.foprc) uisdoa.foprc(0);
  1051. setTimeout(spammingSpeed, 10);
  1052. }
  1053. spammingSpeed();
  1054. e.preventDefault();
  1055. }
  1056. }
  1057.  
  1058. const released = key => {
  1059. if(typing() || keysChanging) return;
  1060. if(key == settings.hotkeys[2].key) splittingbots = false; // macro split bots
  1061. if(key == settings.hotkeys[1].key && !settings.checkboxes[3].active){ // linesplit lock
  1062. linesplitting = false;
  1063. $('#canvas').trigger($.Event('mousemove', {clientX: mosX, clientY: mosY})); // return mouse to where the cursor is
  1064. $("#linesplit-markers div").hide();
  1065. }
  1066. if(spamRec && key === getKey("Recombine")) spamRec = false;
  1067. if(spamSpeed && key === getKey("Speed")) spamSpeed = false;
  1068. }
  1069.  
  1070.  
  1071. const slowfeedhotkey = settings.slowFeed[0];
  1072. // add slowfeed HTML
  1073. $('#fsfb-sect-slowfeed').append(`<p class="hotkey-paragraph">Auto-Feed</p>`)
  1074. .append(`<br><p>${slowfeedhotkey.title}</p><div id="${slowfeedhotkey.id}" class="fsfb-hotkey"></div>`)
  1075. .append(`<br><p>${settings.slowFeed[1].title}</p><input id="${settings.slowFeed[1].id}" class="fsfb-hotkey" onkeypress="return onlyNumberKey(event)" maxlength="3"></input>`);
  1076.  
  1077. $('#' + slowfeedhotkey.id).on('contextmenu', e => {
  1078. $('#' + slowfeedhotkey.id).text('').removeClass('selected');
  1079. slowfeedhotkey.active = false;
  1080. slowfeedhotkey.key = 0;
  1081. saveSettings();
  1082. styleActiveSettings();
  1083. e.preventDefault();
  1084. });
  1085.  
  1086. document.getElementById(settings.slowFeed[1].id).addEventListener("keypress", function(e){
  1087. setTimeout(() => { // goes too fast or smth
  1088. settings.slowFeed[1].val = +$('#' + settings.slowFeed[1].id).val();
  1089. saveSettings();
  1090. }, 5);
  1091. });
  1092.  
  1093. // add fastsplit HTML
  1094. $('#fsfb-sect-fastsplit').append(`<p class="hotkey-paragraph">Fast-Split</p>`);
  1095. // for(let i of settings.fastsplit_hotkeys){
  1096. for(let j = 0; j < settings.fastsplit_hotkeys.length; j++){
  1097. let i = settings.fastsplit_hotkeys[j];
  1098. $('#fsfb-sect-fastsplit').append('val' in i ? `<br><p>${i.title}</p><input id="${i.id}" class="fsfb-hotkey" onkeypress="return onlyNumberKey(event)" maxlength="3"></input>` : `<br><p>${i.title}</p><div id="${i.id}" class="fsfb-hotkey"></div>`);
  1099. if('val' in i){
  1100. document.getElementById(i.id).addEventListener("keypress", function(e){
  1101. setTimeout(() => { // goes too fast or smth
  1102. settings.fastsplit_hotkeys[j].val = +$('#' + i.id).val();
  1103. if($('#' + i.id).val() == "") settings.fastsplit_hotkeys[j].val = 0;
  1104. saveSettings();
  1105. }, 5);
  1106. });
  1107. } else {
  1108. $('#' + i.id).on('contextmenu', e => {
  1109. $('#' + i.id).text('').removeClass('selected');
  1110. i.active = false;
  1111. i.key = 0;
  1112. i.keyName = '';
  1113. saveSettings();
  1114. styleActiveSettings();
  1115. e.preventDefault();
  1116. });
  1117. }
  1118. }
  1119. $('#fsfb-sect-frzvrs').append(`<p class="hotkey-paragraph">Frozen-Virus</p>`)
  1120. .append(`<br><p>${settings.frozenvirus[0].title}</p><div id="${settings.frozenvirus[0].id}" class="fsfb-hotkey"></div>`)
  1121. .append(`<br><p>${settings.frozenvirus[1].title}</p><input id="${settings.frozenvirus[1].id}" class="fsfb-hotkey" onkeypress="return onlyNumberKey(event)" maxlength="3"></input>`);
  1122.  
  1123. $('#' + settings.frozenvirus[0].id).on('contextmenu', e => {
  1124. $('#' + settings.frozenvirus[0].id).text('').removeClass('selected');
  1125. settings.frozenvirus[0].active = false;
  1126. settings.frozenvirus[0].key = 0;
  1127. saveSettings();
  1128. styleActiveSettings();
  1129. e.preventDefault();
  1130. });
  1131.  
  1132. document.getElementById(settings.frozenvirus[1].id).addEventListener("keypress", function(e){
  1133. setTimeout(() => { // goes too fast or smth
  1134. settings.frozenvirus[1].val = +$('#' + settings.frozenvirus[1].id).val();
  1135. saveSettings();
  1136. }, 5);
  1137. });
  1138.  
  1139.  
  1140. // add quick settings HTML
  1141. $('#fsfb-sect-quickSettings').append(`<p class="hotkey-paragraph">Quick Settings</p>`);
  1142.  
  1143. for(let i of settings.quickSettings){
  1144. $('#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="cFoodHalf">Half 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="cChatSize">Chat Large</option><option value="cMinimap">Minimap</option><option value="cFPS">FPS/Ping</option><option value="cColors">Cell Colors</option><option value="cCellBorders">Cell Borders</option><option value="cCellSpikes">Cell Spikes</option><option value="cClassicViruses">Classic Virus</option><option value="cPolygonShapes">Polygon Cells</option><option value="cLineShapes">Line Cells</option><option value="cBubbleCells">Bubble Cells</option><option value="cVisibilityStatus">Prof Visiblity</option><option value="cAllowPartyInvite">Party Inv</option><option value="cAllowPartyAnimations">Party Anim</option><option value="cIconDRank">Dono Icon</option><option value="cGoldCrownChat">Gold Icon</option><option value="fsfb-revcell">Rev Order</option><option value="fsfb-portalstop">Portals Top</option><option value="fsfb-hideminions">Hide Minions</option><option value="fsfb-nominionskins">No Bot Skins</option><option value="fsfb-hideejected">Hide All Ej.</option><option value="fsfb-hidestaticej">Hide Static Ej.</option><option value="fsfb-nodeathanim">No Death Anim</option><option value="fsfb-hideshouts">Hide Shouts</option><option value="fsfb-tranchat">Chat Trans</option><option value="fsfb-nc-public">PubNameCol</option></select><div id="${i.id}" class="fsfb-hotkey"></div>`);
  1145. $('#' + i.id).on('contextmenu', e => {
  1146. $('#' + i.id).text('').removeClass('selected');
  1147. i.active = false;
  1148. i.key = 0;
  1149. saveSettings();
  1150. styleActiveSettings();
  1151. e.preventDefault();
  1152. });
  1153. };
  1154.  
  1155. $('.fsfb-quickchange').on("change", function(){
  1156. settings.quickSettings[+this.id.replace('fsfb-quick-select', '') - 1].set = this.value;
  1157. saveSettings();
  1158. });
  1159.  
  1160. // add UI scaling
  1161. $('#fsfb-sect-uiScale').append(`<p class="hotkey-paragraph">Game Scaling</p>`);
  1162. for(let i of settings.uiScaling){
  1163. $('#fsfb-sect-uiScale').append(`<div class="fsfb-slider"><p>${i.title}</p><input id="${i.id}" class="fsfb-slider" type="range" ${i.id == "fsfb-foodSize" ? `min="0.5" max="1.5" value="1" step="0.1"`: `min="1" max="9" value="5"`}></input></div>`);
  1164. // $('#fsfb-sect-uiScale').append(`<div class="fsfb-slider"><p>${i.title}</p><input id="${i.id}" class="fsfb-slider" type="range" ${i.id == "fsfb-foodSize" ? `min="0.5" max="1.5" value="1" step="0.1"`: `min="1" max="9" value="5"`}></input></div>`);
  1165. $( "#" + i.id).on('input', function() {
  1166. changeSettings(this.id, $(this).val());
  1167. });
  1168. };
  1169.  
  1170.  
  1171. let quickBuying = false;
  1172. ['megaphone_shout', 'minion_nuker', 'freeze_yourself'].forEach(elId => $('#invCloak').after(`<div class="inventory-box" id="fsfb-${elId}" style="display: none;"></div>`));
  1173. $(settings.checkboxes[10] ? '#fsfb-megaphone_shout' : '#inv360Shot').after(`<div class="inventory-box" id="fsfb-quickbuy" style="display: none;"></div>`);
  1174. $('#fsfb-quickbuy').on('click', function(){
  1175. quickBuying = !quickBuying;
  1176. if (quickBuying){
  1177. $(this).addClass('activatedInv');
  1178. curserMsg('Quick buy activated, click the powerup you would like to buy.', 'green');
  1179. $('.inventory-box').addClass('fsfb-shown').find('p').hide();
  1180. $('#invCloak').removeClass('fsfb-shown');
  1181. $('#fsfb-quickbuy').removeClass('fsfb-shown');
  1182. } else {
  1183. $(this).removeClass('activatedInv');
  1184. curserMsg('Quick buy deactivated.', 'red');
  1185. $('.inventory-box').removeClass('fsfb-shown').find('p').show();
  1186. }
  1187. });
  1188.  
  1189.  
  1190.  
  1191. const styleActiveSettings = () => {
  1192.  
  1193. // css selector :has() isn't fully supported at the moment, so gotta use jquery for the time being :(
  1194.  
  1195. // #fsfb-settings-main p:has(+.fsfb-hotkey:not(:empty)) {
  1196. // color:#df901c;
  1197. // }
  1198. // #fsfb-settings-main .fsfb-hotkey:not(:empty) ~ p:has(+input.fsfb-hotkey):not(div.fsfb-hotkey:empty + * + p):not(div.fsfb-hotkey:empty + * + p + * + * + p) {
  1199. // color: #df901c;
  1200. // }
  1201.  
  1202. if(!userPreferences.stylizeActiveSettings) return;
  1203. $('#fsfb-settings-main p:has(+div.fsfb-hotkey), #fsfb-settings-main select:has(+div.fsfb-hotkey)').each(function(){
  1204. $(this)[$(this).is(':has(+.fsfb-hotkey:empty)') ? 'removeClass' : 'addClass']('fsfb-active-setting');
  1205. })
  1206. $('#fsfb-settings-main .fsfb-hotkey~ p:has(+input.fsfb-hotkey)').each(function(){
  1207. $(this)[$(this).is('div.fsfb-hotkey:empty + * + p') || $(this).is('div.fsfb-hotkey:empty + * + p + * + * + p') ? 'removeClass' : 'addClass']('fsfb-active-setting');
  1208. });
  1209. $('input[type="range"].fsfb-slider').each(function(){
  1210. $(this).prev()[this.value == this.getAttribute('value') ? 'removeClass': 'addClass']('fsfb-active-setting');
  1211. })
  1212. }
  1213.  
  1214. // add lag detection settings to things
  1215. let customCells = false;
  1216.  
  1217. $("#fsfb-sect-theme>label>input").addClass('fsfb-ncustom');
  1218. $('#fsfb-powsoverlay, #fsfb-mtchmass').addClass('fsfb-ncustom');
  1219. $('#fsfb-check-Hazard, #fsfb-check-border').removeClass('fsfb-ncustom');
  1220. $("#fsfb-revcell, #fsfb-portalstop, #fsfb-bublecell").removeClass('fsfb-ncustom');
  1221. $('#fsfb-foodSize').prev().addClass('fsfb-lag');
  1222.  
  1223. let antilagCells = false;
  1224.  
  1225. let fillCells = false;
  1226. $('#fsfb-bublecell, #fsfb-showmass, #fsfb-spikedcells, #fsfb-mtchmass, #fsfb-powsoverlay, #fsfb-anticloak, #fsfb-portalmass, #fsfb-nc-public').addClass('fsfb-lag');
  1227.  
  1228. $('#fsfb-powsoverlay, #fsfb-bublecell, #fsfb-anticloak').addClass('fsfb-nfill');
  1229.  
  1230. let onlyCells = false;
  1231.  
  1232. let strokeCells = false;
  1233. $('#fsfb-bublecell, #fsfb-powsoverlay').addClass('fsfb-nstroke');
  1234.  
  1235. let foodSizeOn = false;
  1236.  
  1237. // let drawCells = false;
  1238. // $('#fsfb-powsoverlay, #fsfb-portalmass').addClass('fsfb-ndraw');
  1239. let customCellsChanged = false;
  1240.  
  1241. let translateChanged = false, pwOverlayChanged = false;
  1242. const changeSettings = (ID, a, e) => { // a = active, e = event (optional)
  1243. for(let i of settings.uiScaling) if(i.id == ID) i.level = a;
  1244. for(let i of settings.checkboxes) if(i.id == ID) i.active = a;
  1245. for(let i of settings.export_import) if(i.id == ID) i.active = a;
  1246. for(let i of settings.theme_boxes) if(i.id == ID) i.active = a;
  1247. for(let i of settings.anti_lag) if(i.id == ID) i.active = a;
  1248. for(let i of settings.chat_translate){
  1249. if(i.id == ID){
  1250. if(ID == "fsfb-tranchat" && (typeof GM_xmlhttpRequest != 'function') && e?.originalEvent?.isTrusted){
  1251. 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);
  1252. $('#' + ID).prop('checked', false);
  1253. return;
  1254. }
  1255. translateChanged = true;
  1256. i.active = a;
  1257. }
  1258. }
  1259. for(let i of settings.theme){
  1260. if(i.id == ID) i.active = a;
  1261. if(i.id1 == ID) i.color = a;
  1262. }
  1263. for(let i of settings.name_color){
  1264. if(i.id == ID) i.active = a;
  1265. if(i.id1 == ID) i.color = a;
  1266. }
  1267.  
  1268. if(ID == "fsfb-hideshouts") $('#megaholder')[`${a ? 'add' : 'remove'}Class`]('hideMegaphone');
  1269. if(ID == "fsfb-qBuy") $('#fsfb-quickbuy')[a ? 'show' : 'hide'](); //.css('display', a ? 'flex' : 'hide');
  1270. if(ID == "fsfb-pwsonerow"){
  1271. $('#fsfb-quickbuy').detach().appendTo(`#inventory${a ? 2 : 1}`);
  1272. [1, 2].forEach((i) => $("#inventory" + i).addClass("fsfb-inventories").css("order", a ? i : -i));
  1273. _replaceCSS("css-invsingleline", a ? `#inventory{ display: flex; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); } .fsfb-inventories { position: initial !important; transform: initial !important; }` : '');
  1274. }
  1275.  
  1276.  
  1277. let maxlen = $('#fsfb-nc-public').is(':checked') ? ($('#fsfb-check-ncs').is(':checked') ? 16 : 19) : 24;
  1278. $('#nick').attr('maxlength', maxlen);
  1279. if(ID == "fsfb-nc-public"){
  1280. if(!a) pubNameSwitch = true;
  1281. setTimeout(() => (pubNameSwitch = false), 25); // def nonoptimal, 2 lazy 2 fix
  1282. }
  1283.  
  1284. // client side colored name
  1285. if(["fsfb-check-nc", "fsfb-check-ncs", "fsfb-nc-color", "fsfb-nc-stroke", "fsfb-nc-public"].includes(ID) && nameColors?.set){
  1286. if(settings.name_color[0].active || ID === "fsfb-nc-public"){
  1287. if(a && ID === "fsfb-nc-public" && !settings.name_color[1].active){
  1288. nameColors.set(defaultColorsAmnt, "#FFFFFF");
  1289. nameStrokes.set(defaultColorsAmnt, "#000000");
  1290. } else {
  1291. nameColors.set(defaultColorsAmnt, settings.name_color[1].color);
  1292. nameStrokes.set(defaultColorsAmnt, settings.name_color[2].active ? settings.name_color[2].color : contrastColor(settings.name_color[1].color));
  1293. }
  1294. // warnings
  1295. if(playerIsAlive()){
  1296. curserMsg(`Respawn to update your name color!\nNote: FSFB Public Colored Name is <b>ONLY</b> visible to other FSFB script users!`, 'red', 1e4, true);
  1297. } else if(maxlen < 24 && ID == "fsfb-nc-public") {
  1298. curserMsg(`FSFB script's public custom name feature encodes the color in your clan tag; therefore, clan tags won't work with this feature enabled. The max nick length with the current settings is <b><u>${maxlen}</u></b>${settings.name_color[2].active ? `, deactivate Name Stroke to increase this to 19.` : '.'}\nPlease note: FSFB Public Colored Name is <b>ONLY</b> visible to other FSFB script users!`, "purple", 20e3, true);
  1299. }
  1300. } else {
  1301. if((ID === "fsfb-nc-color" && !a) || !settings.name_color[1].active){
  1302. nameColors.set(defaultColorsAmnt, "#FFFFFF");
  1303. nameStrokes.set(defaultColorsAmnt, "#000000"); // again won't revert bc lazy
  1304. } else {
  1305. nameColors.set(defaultColorsAmnt, settings.name_color[1].color);
  1306. nameStrokes.set(defaultColorsAmnt, settings.name_color[2].active ? settings.name_color[2].color : contrastColor(settings.name_color[1].color));
  1307. }
  1308. }
  1309. }
  1310.  
  1311. if(ID == "fsfb-bublecell" && $("#cBubbleCells").is(":checked") != a && e?.originalEvent?.isTrusted) $('#cBubbleCells').unbind().click();
  1312. if(ID == "fsfb-showmass" && $("#cMass").is(":checked") != a && e?.originalEvent?.isTrusted) $('#cMass').unbind().click();
  1313.  
  1314. if((ID == "fsfb-myskins" || ID == "fsfb-partyskins") && !$("#cSkins").is(":checked") && a) $('#cSkins').unbind().click();
  1315. if((ID == "fsfb-mynick" || ID == "fsfb-partynicks") && !$("#cNames").is(":checked") && a) $('#cNames').unbind().click();
  1316.  
  1317. if(ID == "fsfb-myskins" && a) $('#fsfb-partyskins').prop('checked', false).trigger('change');
  1318. if(ID == "fsfb-partyskins" && a) $('#fsfb-myskins').prop('checked', false).trigger('change');
  1319.  
  1320. if(ID == "fsfb-mynick" && a) $('#fsfb-partynicks').prop('checked', false).trigger('change');
  1321. if(ID == "fsfb-partynicks" && a) $('#fsfb-mynick').prop('checked', false).trigger('change');
  1322.  
  1323. if(ID == "fsfb-hideejected" && a) $('#fsfb-hidestaticej').prop('checked', false).trigger('change');
  1324. if(ID == "fsfb-hidestaticej" && a) $('#fsfb-hideejected').prop('checked', false).trigger('change');
  1325.  
  1326. if(ID == "fsfb-check-nc" && !a) $('#fsfb-check-ncs').prop('checked', false).trigger('change');
  1327.  
  1328.  
  1329. if(ID == "fsfb-powsoverlay") svSwitch = true;
  1330.  
  1331. let zoomLvl = "100%";
  1332. let map = {
  1333. 1: 50,
  1334. 2: 70,
  1335. 3: 80,
  1336. 4: 90,
  1337. 5: 100,
  1338. 6: 110,
  1339. 7: 125,
  1340. 8: 150,
  1341. 9: 200
  1342. }
  1343. if(ID == "fsfb-invSize") $('#inventory').css('zoom', (map[+a] ?? 100)+ '%');
  1344. if(ID == "fsfb-statsSize") $('#stats-container').css('zoom', (map[+a] ?? 100) + '%');
  1345.  
  1346.  
  1347. let prevCustomCells = customCells;
  1348.  
  1349. // lag settings
  1350. customCells = $(".fsfb-ncustom, #fsfb-nc-public").is(":checked") || $('#fsfb-foodSize').val() != '1'; // || userPreferences.whiteBorder4BlackCells;
  1351. fillCells = $('.fsfb-nfill').is(':checked');
  1352. strokeCells = $('.fsfb-nstroke').is(':checked');
  1353. onlyCells = $('#fsfb-myskins, #fsfb-partyskins, #fsfb-mynick, #fsfb-partynicks').is(':checked') || ($('#fsfb-check-nc').is(':checked') && !$('#fsfb-nc-public').is(':checked'));
  1354. antilagCells = $("#fsfb-sect-antilag>label>input").not('#fsfb-nodeathanim').is(':checked');
  1355. foodSizeOn = $('#fsfb-foodSize').val() != '1';
  1356.  
  1357. if(prevCustomCells != customCells && e?.originalEvent?.isTrusted) customCellsChanged = true;
  1358. // if(customCellsChanged && e?.originalEvent?.isTrusted) setTimeout(() => (customCellsChanged = false), 25);
  1359. if(customCellsChanged && e?.originalEvent?.isTrusted) setTimeout(() => (customCellsChanged = false), 25);
  1360.  
  1361. styleActiveSettings();
  1362. saveSettings();
  1363. }
  1364.  
  1365. // add event listeners
  1366. let mosX, mosY,
  1367. keys = {},
  1368. keysChanging = false,
  1369. mouseHoveringChat = false;
  1370.  
  1371.  
  1372. $(document).on('click', e => {
  1373. if(e.target.id.includes('fsfb')){
  1374. for(let i = 0; i < settings.hotkeys.length; i++) checkHotkeyClicked(e, settings.hotkeys[i]);
  1375. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) settings.fastsplit_hotkeys[i].val == null && checkHotkeyClicked(e, settings.fastsplit_hotkeys[i]);
  1376. for(let i = 0; i < settings.quickSettings.length; i++) checkHotkeyClicked(e, settings.quickSettings[i]);
  1377. checkHotkeyClicked(e, settings.slowFeed[0]); // slow feed
  1378. checkHotkeyClicked(e, settings.frozenvirus[0]);
  1379. }
  1380. checkPowerupClicked(e);
  1381. })
  1382. .on('mousemove', e => {
  1383. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  1384. mouseHoveringChat = e.target.id == 'chtCanvas';
  1385. ({clientX: mosX, clientY: mosY} = e);
  1386. if (linesplitting) linesplit();
  1387. })
  1388.  
  1389. .on("keydown", e => {
  1390. // if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  1391. if(keysChanging){
  1392. for(let i = 0; i < settings.hotkeys.length; i++) checkNewHotkey(e, settings.hotkeys[i]);
  1393. for(let i = 0; i < settings.fastsplit_hotkeys.length; i++) checkFsHotkey(e, settings.fastsplit_hotkeys[i]);
  1394. for(let i = 0; i < settings.quickSettings.length; i++) checkNewHotkey(e, settings.quickSettings[i]);
  1395. checkNewHotkey(e, settings.slowFeed[0]); // slow feed
  1396. checkNewHotkey(e, settings.frozenvirus[0]);
  1397. }
  1398. if (!(e.keyCode in keys)){
  1399. keys[e.keyCode] = !0;
  1400. pressed(e);
  1401. }
  1402. keysChanging = false;
  1403. })
  1404. .on("keyup", e => {
  1405. if(e.originalEvent == null || !e.originalEvent.isTrusted) return;
  1406. delete keys[e.keyCode];
  1407. released(e.keyCode);
  1408. if(cursorLockActivated && e.keyCode == getKey("FixedMouse")){
  1409. e.stopImmediatePropagation();
  1410. e.preventDefault();
  1411. }
  1412. });
  1413.  
  1414. let factsArr = typeof facts_list == 'undefined' ? null : facts_list.replace(/^\n|\n$/gm, '').split(/\n/gm);
  1415. const randomFact = index => factsArr && (factsArr[index] ?? factsArr[~~(Math.random() * factsArr.length)]);
  1416.  
  1417.  
  1418. const hashCode = (str, shift) => {
  1419. let hash = 0;
  1420. for (let i = 0; i < str.length; i++) hash = (hash << shift) - hash + str.charCodeAt(i), hash |= 0;
  1421. return str.length == 0 ? 0 : hash;
  1422. };
  1423.  
  1424. const RNG = (min, max) => Math.random() * (max - min) + min;
  1425.  
  1426. // chat cmds
  1427. if(userPreferences.extraChatCommands){
  1428. const $chtbox = $('#chtbox');
  1429. $chtbox.on('keydown', e => {
  1430. if(e.keyCode != 13) return;
  1431.  
  1432. if(userPreferences.messageBanWarning && /a\s*g\s*a\s*r\s*p\s*o\s*w\s*e\s*r/gmi.test($chtbox.val())){
  1433. curserMsg("FSFB WARNING: FSFB script has censored your message as it has detected that your message may've contained a word/phrase that agma.io gives a 24 hour IP ban for. This FSFB feature can be disabled in the tampermonkey script settings.", 'red', 1e4);
  1434. $chtbox.val($chtbox.val().replace(/a\s*g\s*a\s*r\s*p\s*o\s*w\s*e\s*r/gmi, match => '*'.repeat(match.length)));
  1435. }
  1436.  
  1437. let newMsg = '', cmdVerif, customCmd = false, firstMatch = $chtbox.val().match(new RegExp(`(?<=((^|(^\/party +)|(^\/pm +\\S+ ))${escapeRegExp(userPreferences.chatPrefix)}))\\S+(\\s+\\S+)*(?=($|\\s+))`, 'gmi'));
  1438. if(firstMatch == null) return;
  1439. let[command, ...params] = firstMatch[0].split(/\s+/g);
  1440. const originalMsg = $chtbox.val().replace(new RegExp(`(?<=((^|(^\/party +)|(^\/pm +\\S+ ))))${escapeRegExp(userPreferences.chatPrefix)}${escapeRegExp(firstMatch[0])}(?=($|\\s+))`, 'gmi'), ''),
  1441. isolatedMsg = firstMatch[0].replace(new RegExp(command + '\\s', 'gi'), '');
  1442. coinsInfo();
  1443. xpInfo();
  1444.  
  1445. /* ~~~ example of external chat cmds (can be used by other scripts) ~~~ */
  1446. /*
  1447. externalChatCmds = [
  1448. {
  1449. commands: ['test1', 'test2', 'test3'],
  1450. callback: (command, isolatedMsg, params) => {
  1451. let newMsg = '';
  1452. return newMsg;
  1453. }
  1454. },
  1455. {
  1456. commands: ['eg1', 'eg2'],
  1457. callback: (cmd, isoMsg, params) => {
  1458. console.log(cmd, isoMsg, params);
  1459. alert('bru')
  1460. return '';
  1461. }
  1462. }
  1463. ]
  1464. */
  1465.  
  1466. let { externalChatCmds } = unsafeWindow;
  1467. if(externalChatCmds?.length){
  1468. for(let i of externalChatCmds){
  1469. if(i.commands.includes(command.toLowerCase())){
  1470. customCmd = true;
  1471. newMsg = i.callback(command.toLowerCase(), isolatedMsg, params);
  1472. }
  1473. }
  1474. }
  1475.  
  1476.  
  1477. if(!customCmd && (cmdVerif ??= true)){
  1478. switch(command.toLowerCase()){
  1479. case 'help':
  1480. $('#fsfb-extra-info')[0].click();
  1481. setTimeout(() => $('.fsfb-modal-body').scrollTop(1850), 200);
  1482. newMsg = '';
  1483. break;
  1484. case 'bots': case 'bot': case 'min': case 'mins': case 'minion': case 'minions': {
  1485. let minInfo = misc_settings.bots?.[currentUser], minsAmt, minsTimeRem;
  1486. $('#infoContent').children().each(function(){
  1487. if($(this).text().includes('Minion Time:')) minsTimeRem = $(this).find('span').text();
  1488. if($(this).text().includes('Minions:')) minsAmt = $(this).find('span').text();
  1489. });
  1490. 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) */
  1491. newMsg = `Minion Pack Unstarted: ${minsChatAmt[currentUser].amt}`;
  1492. } else if(minsChatAmt[currentUser] != null && minsChatAmt[currentUser]?.started && minsChatAmt[currentUser]?.amt && minInfo == null ){
  1493. newMsg = `Minion Pack Activated: ${minsChatAmt[currentUser].amt}`;
  1494. } else if(!(minsAmt == '0' && minsTimeRem == '00:00:00') && minsChatAmt[currentUser] != null && minsChatAmt[currentUser].amt && minInfo != null && (minInfo.active || minsChatAmt[currentUser].started) && minInfo.rem - (Date.now() - minInfo.currMs) > 0){
  1495. newMsg = `Minion Pack Activated: ${minsChatAmt[currentUser].amt}, with ${msToTime(minInfo.rem - (Date.now() - minInfo.currMs))} remaining`;
  1496. } else if(!(minsAmt == '0' && minsTimeRem == '00:00:00') && minsAmt != null && minsTimeRem != null){
  1497. let timeArr = minsTimeRem.split(':'), msBotsTime = (3.6e6 * +timeArr[0]) + (6e4 * +timeArr[1]) + (1e3 * +timeArr[2]);
  1498. newMsg = `Minion Pack Activated: ${minsAmt}, with ${msToTime(msBotsTime)} remaining`;
  1499. } else {
  1500. newMsg = `Minion Pack Activated: none`;
  1501. }
  1502. break;
  1503. }
  1504. case 'pws': case 'pw': case 'powers': case 'power': case 'inv': case 'inventory': {
  1505. curserMsg(`It's recommended to use ${userPreferences.chatPrefix + command}1, ${userPreferences.chatPrefix + command}2, and ${userPreferences.chatPrefix + command}3 instead, so your chat messages aren't cut-off by the chat maxlength`, 'red', 8e3);
  1506. updatePwCount();
  1507. newMsg = 'Inv: ';
  1508. for (let i = 0; i < 6; i++) {
  1509. newMsg = 'Inv: ';
  1510. for (let pw in pws) {
  1511. const check = index => i < index ? ' ' : '';
  1512. if (pws[pw] != '') newMsg += `${pws[pw]}${check(1)}${(i > 2 ? pw.slice(0, 6 - i) : pw)},${check(2)}`;
  1513. }
  1514. newMsg = newMsg.replace(/,[^,]*$/g, '');
  1515. if (newMsg.length <= 100) i = 6;
  1516. }
  1517. if (newMsg == 'Inv: ') newMsg = 'Inv: no powers';
  1518. break;
  1519. }
  1520. case 'totalpws': case 'totalpw': case 'totalpowers': case 'totalpower': case 'total': case 'totpw':
  1521. newMsg = `Total Powerups: ${$('.inventory-box>p').toArray().map(x => +x.innerText).reduce((a, b) => a + b).toLocaleString('en-US')}`
  1522. break;
  1523. case 'xplevel': case 'levelxp': case 'lvlxp': case 'xpcompleted': case 'xp':
  1524. newMsg = `XP Completed: ${currentPercent ? String(Math.round(currentPercent * currentLevel * 1e3, 1)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "/" + (currentLevel * 1e3).toLocaleString('en-US') : "0/0"}`
  1525. break;
  1526. case 'level': case 'levels': case 'lvls': case 'lvl': case 'lvlcompleted': case 'lvlscompleted':
  1527. newMsg = `Level ${currentLevel}, with ${round(currentPercent * 100, 3)}% completed`
  1528. break;
  1529. case 'coin': case 'coins':
  1530. newMsg = `Coins: ${String(currentCoins).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`
  1531. break;
  1532. case 'hours': case 'hrs': case 'hour': case 'hr': case 'timeplayed':
  1533. newMsg = (isLogged() ? $('.timePlayed>span').text().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : 'Time Played: 0, not logged in');
  1534. break;
  1535. case 'rank': case 'lvlrank':
  1536. newMsg = `My Rank: ${isLogged() ? $('.ranking.text-left>span').text().match(/(?<=^Your rank: )\d+$/gm)?.[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") : '∞, not logged in'}`;
  1537. break;
  1538. case 'ping': case 'delay': case 'ms':
  1539. newMsg = `My Ping: ${$('#ping').text().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`
  1540. break;
  1541. case 'fps': case 'frames':
  1542. newMsg = `My FPS: ${$('#fps').text().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`
  1543. break;
  1544. case 'topmass': case 'highscore': case 'highmass': case 'highestmass':
  1545. newMsg = `My Top Mass: ${$('#topMass').text()}`
  1546. break;
  1547. case 'cells': case 'cellcount': case 'cell':
  1548. newMsg = `My Cell Count: ${$('#cellsAmount').text()}`
  1549. break;
  1550. case 'pw1': case 'pws1': case 'power1': case 'powers1': case 'inv1': case 'inventory1':
  1551. newMsg = getPowerMessage(1);
  1552. break;
  1553. case 'pw2': case 'pws2': case 'power2': case 'powers2': case 'inv2': case 'inventory2':
  1554. newMsg = getPowerMessage(2);
  1555. break;
  1556. case 'pw3': case 'pws3': case 'power3': case 'powers3': case 'inv3': case 'inventory3':
  1557. newMsg = getPowerMessage(3);
  1558. break;
  1559. case 'friends': case 'friend': case 'friendsonline': case 'friendonline':
  1560. newMsg = `Friends Online: ${$('#friendsLoggedInAmt').text() + $('#friendsTotalAmt').text()}`;
  1561. break;
  1562. case 'request': case 'requests': case 'friendrequest': case 'friendrequests': case 'friendreq': case 'req':
  1563. newMsg = `Friend Requests: ${$('#friendsRequestsAmt').text() === '' ? 'none' : $('#friendsRequestsAmt').text()}`;
  1564. break;
  1565. case 'gold': case 'goldmem': case 'goldmember': case 'golddays': case 'gm': {
  1566. const obj = accGoldMem[currentUser];
  1567. if(obj?.has == null){
  1568. newMsg = `Days of Goldmember Remaining: none`;
  1569. break;
  1570. }
  1571. newMsg = `Days Of Goldmember Remaining: ${obj.has || obj.days != null ? (obj.days + (obj.days == 1 ? ' Day' : ' Days')) : 'none'}`;
  1572. break;
  1573. }
  1574. case 'alive': case 'alivetime': case 'timealive':
  1575. newMsg = `Time Alive: ${playerIsAlive() ? msToTime(Date.now() - timeAlive) : 'not alive'}`;
  1576. break;
  1577. case 'mass': case 'currentmass':
  1578. newMsg = `Current Mass: ${playerIsAlive() ? currentMass.toLocaleString('en-US') : 'none, not alive'}`;
  1579. break;
  1580. case 'user': case 'username': case 'usr': case 'account': case 'acc':
  1581. newMsg = `My Username: ${currentUser == "Please Login First" ? "logged out" : currentUser}`
  1582. break;
  1583. case 'custom': case 'customs': case 'customskins': case 'totalcustoms':
  1584. if($('#publicSkinsPage').children().length == 0){
  1585. curserMsg(`Please load your custom skins before using this command`, 'red', 6e3);
  1586. newMsg = '';
  1587. break;
  1588. }
  1589. newMsg = `My Total Custom Skins: ${$('[id^="skinCustomImg"').length}, worth ${($('[id^="skinCustomImg"').length * 1e6).toLocaleString('en-US')}`
  1590. break;
  1591. case 'skins': case 'boughtskins': case 'ownedskins': case 'totalskins': {
  1592. if($('#skinsBuy [id^="skinContainer"]').length == 0){
  1593. curserMsg(`Please load your owned skins from the agma.io skin store`, 'red', 6e3);
  1594. newMsg = '';
  1595. break;
  1596. }
  1597. let ownedSkinsArr = [], edSkins = 0, totalValue = 0;
  1598. $('#skinsBuy [id^="skinUseBtn"]').each(function(){
  1599. ownedSkinsArr.push(+$(this)[0].id.match(/\d+$/gm)[0]);
  1600. })
  1601. for(let i of skinsArr){
  1602. if(ownedSkinsArr.includes(i.id)){
  1603. i.price > 2e6 ? ++edSkins : totalValue += i.price;
  1604. }
  1605. }
  1606. newMsg = `My Total Bought Skins: ${$('#skinsBuy [id^="skinUseBtn"').length}, worth ${totalValue.toLocaleString('en-US')} coins (${edSkins} lim. ed.)`;
  1607. break;
  1608. }
  1609. case 'ownedwearables': case 'wearables': case 'wears': case 'totalwearables': case 'totalwears': {
  1610. if(!$('#fsfb-wearsloaded').length){
  1611. curserMsg(`Please load your wearables before using this command`, 'red', 6e3);
  1612. newMsg = ''; // aft
  1613. break;
  1614. }
  1615. let wearsPrice = [0], edSkins = 0;
  1616. $('[id^="wearableUseBtn"]').each(function(){
  1617. if ($(this).parents().eq(0).siblings('p').text() == '(Limited Edition)') edSkins++;
  1618. wearsPrice.push(+$(this).parents().eq(0).siblings('span.win-price').text().replace(/,/g, ''));
  1619. });
  1620. newMsg = `My Total Wearables: ${$('[id^="wearableUseBtn"]').length}, worth ${sigma(wearsPrice).toLocaleString('en-US')} coins (${edSkins} lim. ed.)`;
  1621. break;
  1622. }
  1623. case 'cloak': case 'invis': case 'invisibility': {
  1624. let status, time;
  1625. $('#infoContent>p').each(function(){
  1626. if($(this).text().includes('Cloaked: ')) status = $(this).text().match(/(?<=Cloaked: ).+/gm);
  1627. if($(this).text().includes('Cloak Time: ')) time = $(this).text().match(/(?<=Cloak Time: ).+/gm);
  1628. })
  1629. newMsg = status == null || time == null ? `Cloak: inactive` : `Cloak ${status}, with ${time} remaining`;
  1630. break;
  1631. }
  1632. case 'addfriend': case 'add':
  1633. if(params?.length == 0){
  1634. curserMsg(`Please add a username after the command, such as: ${userPreferences.chatPrefix}${command} Fishyyy`, 'red', 6e3);
  1635. newMsg = '';
  1636. break;
  1637. }
  1638. unsafeWindow.friendAdd(params[0]);
  1639. break;
  1640. case 'partymembers': case 'partymember': case 'party':
  1641. newMsg = $('#partyContent').children().length - 1 > 0 ? `In a party, with ${$('#partyContent').children().length - 1} members` : `Party members: not in a party`;
  1642. break;
  1643. case 'players': case 'ply': case 'plyrs': case 'serverplayers': case 'totalplayers':{
  1644. let plyr_max = [0, 0]; // players[0] | maxplayers[1]
  1645. $('[id^="serverPlayers"]').each(function(){
  1646. plyr_max = plyr_max.map((n, i) => n + +this.innerText.split('/')[i]);
  1647. });
  1648. let serverBots = getServerValue('bots') ?? 0, totalbots = 0;
  1649. for(let server in svInfo){
  1650. totalbots += (svInfo[server].bots ?? 0);
  1651. }
  1652. newMsg = `Server Players: ${$('[id^="serverRow"].active>[id^="serverPlayers"]').text()}${serverBots ? ` (${serverBots} bots)` : ''}, Total Players: ${plyr_max[0].toLocaleString('en-US') + '/' + plyr_max[1].toLocaleString('en-US')} ${totalbots ? `(${totalbots} bots)` : ''}`;
  1653. break;
  1654. }
  1655. case 'server':
  1656. newMsg = `Currently playing in ${$('[id^="serverRow"].active>*').first().text()}`;
  1657. break;
  1658. case 'abil': case 'abils': case 'ability': case 'abilities': { // not finished
  1659. let arr = [], newStr = '';
  1660. $('.checkmark').each(function(){
  1661. if($(this).css('display') == 'block') arr.push($(this).siblings().eq(1).attr('item'));
  1662. })
  1663. if(misc_settings.abil?.[currentUser] != null || arr.length){
  1664. const abil = misc_settings.abil?.[currentUser],
  1665. map = {
  1666. 18: 'Freeze',
  1667. 22: 'Invis Cloak',
  1668. 20: '2x Spawn',
  1669. 23: '2x Exp'
  1670. }
  1671. if(currentUser == "Please Login First"){
  1672. newMsg = `Active Abilities: none`;
  1673. break;
  1674. }
  1675. 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, ') : ', ');
  1676. newMsg = `Active Abilities: ${newStr == '' ? 'none' : newStr}`;
  1677. newMsg = newMsg.replace(/,[^,]*$/g, '');
  1678. } else {
  1679. newMsg = `Active Abilities: none`;
  1680. }
  1681. break;
  1682. }
  1683. case 'xpproj': case 'xpprojected': case 'projectedxp': case 'projxp': case 'levelprojected': case 'lvlproj': case 'lvlprojected': {
  1684. const projectedHr = lastHrXP.length > 0 ? sigma(getProperty(lastHrXP.slice(-5), "gained")) * 12 : 0;
  1685. newMsg = `Next Hour Projected XP: ${xpStatsInPercentages ? round(convertToPerc(projectedHr, currentLevel) * 100, 2) + '%' : round(projectedHr).toLocaleString('en-US')}`;
  1686. break;
  1687. }
  1688. case 'projcoins': case 'projcoin': case 'projectedcoin': case 'projectedcoins': case 'coinsproj': case 'coinproj': case 'coinprojected': case 'coinsprojected': {
  1689. const projectedHr = lastHrCoins.length > 5 ? Math.round(sigma(getProperty(lastHrCoins.slice(-5), "gained")) * 12) : 0;
  1690. newMsg = `Next Hour Projected Coins: ${projectedHr.toLocaleString('en-US')}`;
  1691. break;
  1692. }
  1693. case 'xpremaining': case 'xprem': case 'remainingxp': case 'remxp': {
  1694. const xpRemaining = currentLevel ? currentLevel * 1e3 - currentPercent * currentLevel * 1e3 : 0,
  1695. newMsg = `XP Remanining: ${xpStatsInPercentages ? round(convertToPerc(xpRemaining, currentLevel) * 100, 2) + '%' : round(xpRemaining).toLocaleString('en-US')}`;
  1696. break;
  1697. }
  1698. case 'coinsremaining': case 'coinsrem': case 'remainingcoins': case 'remcoins': {
  1699. const coinsRemaining = currentCoins ? 25e4 - currentCoins % 25e4 : 0;
  1700. newMsg = `Coins Remanining: ${coinsRemaining.toLocaleString('en-US')}`;
  1701. break;
  1702. }
  1703. case 'xplasthour': case 'lasthourxp': case 'hrxp': case 'xphr': case 'hourxp': case 'xphour': {
  1704. const lastHr = lastHrXP.length > 0 ? sigma(getProperty(lastHrXP, "gained")) : 0;
  1705. newMsg = `XP Last Hour: ${xpStatsInPercentages ? round(convertToPerc(lastHr, currentLevel) * 100, 2) + '%' : round(lastHr).toLocaleString('en-US')}`;
  1706. break;
  1707. }
  1708. case 'coinslasthour': case 'lasthourcoins': case 'hrcoins': case 'coinshr': case 'hourcoins': case 'coinshour': {
  1709. const lastHr = lastHrCoins.length > 0 ? Math.round(sigma(getProperty(lastHrCoins, "gained"))) : 0
  1710. newMsg = `Coins Last Hour: ${lastHr.toLocaleString('en-US')}`;
  1711. break;
  1712. }
  1713. case 'xplastmin': case 'xplastminute': case 'lastminxp': case 'lastminutexp': case 'minxp': case 'minutexp': case 'xpmin': {
  1714. const lastMin = lastMinXP.length > 0 ? sigma(getProperty(lastMinXP, "gained")) : 0;
  1715. newMsg = `XP Last Minute: ${xpStatsInPercentages ? round(convertToPerc(lastMin, currentLevel) * 100, 2) + '%' : round(lastMin).toLocaleString('en-US')}`;
  1716. break;
  1717. }
  1718. case 'coinslastmin': case 'coinslastminute': case 'lastmincoins': case 'lastminutecoins': case 'coinsxp': case 'minutecoins': case 'coinsmin': {
  1719. const lastMin = lastMinCoins.length > 0 ? Math.round(sigma(getProperty(lastMinCoins, "gained"))) : 0;
  1720. newMsg = `Coins Last Minute: ${lastMin.toLocaleString('en-US')}`;
  1721. break;
  1722. }
  1723. case 'xplast12s': case 'xplast12sec': case 'xplast12seconds': case 'last12secondsxp': case 'lastminutexp': case 'xp12s': case '12sxp': case 'xp12sec': {
  1724. const last12sec = lastMinXP.length > 0 ? lastMinXP[lastMinXP.length - 1].gained : 0;
  1725. newMsg = `XP Last 12 Seconds: ${xpStatsInPercentages ? round(convertToPerc(last12sec, currentLevel) * 100, 2) + '%' : round(last12sec).toLocaleString('en-US')}`;
  1726. break;
  1727. }
  1728. case 'xpsession': case 'sessionxp': case 'xpsesh': case 'sesh': case 'seshxp': case 'online': {
  1729. const sessionXP = currentXP && accounts[currentUser] ? currentXP - accounts[currentUser].xp : 0;
  1730. newMsg = `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)}`;
  1731. break;
  1732. }
  1733. case 'lifetimexp': case 'xplifetime':
  1734. newMsg = `Lifetime XP: ${round(currentXP ?? 0).toLocaleString('en-US')}`;
  1735. break;
  1736. case 'coinssession': case 'sessioncoins': case 'coinssesh': case 'seshcoins': {
  1737. const sessionCoins = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0;
  1738. newMsg = `Session Coins: ${sessionCoins.toLocaleString('en-US')}, Session Length: ${msToTime(Date.now() - scriptStartCoins)}`;
  1739. break;
  1740. }
  1741. case 'ratewaifu': case 'waifu': case 'waifurating': case 'waifurate': case 'howwaifu':
  1742. cmdVerif = false;
  1743. if(params?.length == 0){
  1744. if(currentUser == "Please Login First"){
  1745. newMsg = `My Waifu Rating: 0 / 10`;
  1746. break;
  1747. }
  1748. newMsg = `My Waifu Rating: ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 102.2)).slice(-3, -1) / 10)} / 10`;
  1749. break;
  1750. }
  1751. newMsg = `${params[0]}'s Waifu Rating: ${Math.round(+String(Math.round(hashCode(params[0], 5) * 102.2)).slice(-3, -1) / 10)} / 10`;
  1752. break;
  1753. case 'ratepro': case 'pro': case 'prorating': case 'prorate': case 'howpro':
  1754. cmdVerif = false;
  1755. if(params?.length == 0){
  1756. if(currentUser == "Please Login First"){
  1757. newMsg = `I am 0% pro`;
  1758. break;
  1759. }
  1760. newMsg = `I am ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 194.3)).slice(-4, -1) / 10)}% pro`;
  1761. break;
  1762. }
  1763. newMsg = `${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 5) * 194.3)).slice(-4, -1) / 10)}% pro`;
  1764. break;
  1765. case 'ratedog': case 'dog': case 'dograting': case 'dograte': case 'howdog':
  1766. cmdVerif = false;
  1767. if(params?.length == 0){
  1768. if(currentUser == "Please Login First"){
  1769. newMsg = `I am 0% dog`;
  1770. break;
  1771. }
  1772. newMsg = `I am ${Math.round(+String(Math.round(hashCode(currentUser, 6) * 189.3)).slice(-4, -1) / 10)}% dog`;
  1773. break;
  1774. }
  1775. newMsg = `${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 6) * 189.3)).slice(-4, -1) / 10)}% dog`;
  1776. break;
  1777. case 'rateking': case 'king': case 'kingrating': case 'kingrate': case 'howking':
  1778. cmdVerif = false;
  1779. if(params?.length == 0){
  1780. if(currentUser == "Please Login First"){
  1781. newMsg = `I am 0% king`;
  1782. break;
  1783. }
  1784. newMsg = `I am ${Math.round(+String(Math.round(hashCode(currentUser, 5) * 389.3)).slice(-4, -1) / 10)}% king`;
  1785. break;
  1786. }
  1787. newMsg = `${params[0]} is ${Math.round(+String(Math.round(hashCode(params[0], 5) * 389.3)).slice(-4, -1) / 10)}% king`;
  1788. break;
  1789. case 'dice': case 'die': case 'roll': case 'rolldice': {
  1790. const sides = params?.length == 0 || isNaN(+params[0]) ? 6 : +params[0];
  1791. newMsg = `Rolled a dice with ${sides.toLocaleString('en-US')} sides, landed on ${Math.round(RNG(1, sides)).toLocaleString('en-US')}`;
  1792. break;
  1793. }
  1794. case 'rng': case 'random': case 'randomnumber': case 'number': case 'num': {
  1795. const min = params?.length < 1 || isNaN(+params[0]) ? 0 : +params[0];
  1796. const max = params?.length < 2 || isNaN(+params[1]) ? min + 10 : +params[1];
  1797. if(min > max){
  1798. curserMsg(`Please make sure your minimum (${min}) is less than your maximum (${max})`, 'red', 5e3);
  1799. newMsg = '';
  1800. break;
  1801. }
  1802. newMsg = `Generated a random number between ${min.toLocaleString('en-US')} and ${max.toLocaleString('en-US')}, chose: ${Math.round(RNG(min, max)).toLocaleString('en-US')}`;
  1803. break;
  1804. }
  1805. case 'ratefriends': case 'friendsrating': case 'friendsrate': case 'howfriends':
  1806. cmdVerif = false;
  1807. if(params?.length == 0){
  1808. if(currentUser == "Please Login First"){
  1809. newMsg = `I am 0% friends with a frog`;
  1810. break;
  1811. }
  1812. newMsg = `I am ${Math.round(+String(Math.round(hashCode(currentUser, 4) * 283.7)).slice(-4, -1) / 10)}% friends with a frog`;
  1813. break;
  1814. }
  1815. if(params?.length == 1){
  1816. if(currentUser == "Please Login First"){
  1817. newMsg = `I am 0% friends with a ${params[0]}`;
  1818. break;
  1819. }
  1820. newMsg = `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]}`;
  1821. break;
  1822. } else {
  1823. newMsg = `${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]}`;
  1824. break;
  1825. }
  1826. case 'rateenemies': case 'enemiesrating': case 'enemiesrate': case 'howenemies': case 'enemies':
  1827. cmdVerif = false;
  1828. if(params?.length == 0){
  1829. if(currentUser == "Please Login First"){
  1830. newMsg = `I am 0% enemies with a frog`;
  1831. break;
  1832. }
  1833. newMsg = `I am ${Math.round(+String(Math.round(hashCode(currentUser, 4) * 164.45)).slice(-5, -2) / 10)}% enemies with a frog`;
  1834. break;
  1835. }
  1836. if(params?.length == 1){
  1837. if(currentUser == "Please Login First"){
  1838. newMsg = `I am 0% enemies with a ${params[0]}`;
  1839. break;
  1840. }
  1841. newMsg = `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]}`;
  1842. break;
  1843. } else {
  1844. newMsg = `${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]}`;
  1845. break;
  1846. }
  1847. case 'flip': case 'coinflip': case 'heads': case 'tails': case 'flipcoin': {
  1848. newMsg = `Coin flipped! Landed on ${Math.round(RNG(0, 1)) ? 'heads' : 'tails'}`;
  1849. break;
  1850. }
  1851. case 'script': case 'version': case 'fsfb':
  1852. newMsg = `Using fsfb script! Version ${version}`
  1853. break;
  1854. case 'time': case 'localtime': case 'localetime': case 'date':
  1855. newMsg = `My Time: ${new Date().toLocaleString()}`
  1856. break;
  1857. case 'leaderboard': case 'leader': case 'lb':
  1858. newMsg = `My leaderboard position: ${!playerIsAlive() || leaderboardPos == null ? 'none, not alive' : leaderboardPos}`;
  1859. break;
  1860. case 'altcaps': case 'altcap': case 'altscaps': case 'altscap':
  1861. newMsg = isolatedMsg.toLowerCase().split('').map((v, i) => i % 2 == 0 ? v : v.toUpperCase()).join('');
  1862. cmdVerif = false;
  1863. break;
  1864. case 'sparkles': case 'sprk':
  1865. newMsg = '✨' + isolatedMsg + '✨';
  1866. cmdVerif = false;
  1867. break;
  1868. case 'cfix': case 'canvasfix': {
  1869. document.querySelectorAll('canvas').forEach(canvas => ({ innerWidth: canvas.width, innerHeight: canvas.height } = unsafeWindow));
  1870. // const canvas = document.querySelector('#canvas');
  1871. // ({ innerWidth: canvas.width, innerHeight: canvas.height } = unsafeWindow);
  1872. curserMsg('Canvas was reset.', 'green', 5e3);
  1873. newMsg = '';
  1874. break;
  1875. }
  1876. case 'solo': case 'soloserver': // message from Miracle Scripts (another great agma script) - https://greasyfork.org/scripts/391142
  1877. newMsg = ':warning: SOLO SERVER :warning: No teaming!! No hay equipo!! Pas d\'équipe!! Kein Teaming!! لا فريق';
  1878. cmdVerif = false;
  1879. break;
  1880. case 'facts': case 'fact': case 'funfact': {
  1881. const fact = randomFact();
  1882. newMsg = fact ? randomFact() : '';
  1883. fact ?? curserMsg(`Fsfb is unable to access the list of facts. Possible cause: not using tampermonkey or not using the latest version of tampermonkey.`, 'red', 6e3);
  1884. break;
  1885. }
  1886. case 'fastsplit': case 'fs': case 'fastsplits': case 'fastsplitdelay': case 'delay': {
  1887. const fs = settings.fastsplit_hotkeys;
  1888. newMsg = `My fast onesplit delays: ${fs[1].val}, ${fs[2].val}; Fast double delays: ${fs[4].val}, ${fs[5].val}`;
  1889. break;
  1890. }
  1891. case "dailyprogress": case "dailychallenge": case "progress": case "challengeprogress": case "challenge": case "challenges": {
  1892. let progress = +$("#challengeProgress").text();
  1893. let goal = +$("#challengeGoal").text();
  1894. let percent = ((progress / goal) * 100).toFixed(1);
  1895. newMsg = `Daily Challenge Progress: ${progress.toLocaleString('en-US')} / ${goal.toLocaleString('en-US')} (${percent}% completed)`;
  1896. break;
  1897. }
  1898. case "sp": case "sorapoint": case "sorapoints": case "sps": {
  1899. let soraPoints = +$('.sora-points-inv.chall-mythic').text();
  1900. newMsg = `Sora Points: ${soraPoints.toLocaleString('en-US')}`;
  1901. break;
  1902. }
  1903. case "keys": case "key": case "challengekeys": case "challengekey": {
  1904. let challengeKeys = +$('.mystery-keys.chall-mythic').text();
  1905. newMsg = `Challenge Keys: ${challengeKeys.toLocaleString('en-US')}`;
  1906. break;
  1907. }
  1908. case "stars": case "challengestars": case "challengestar": case "star": {
  1909. let challengeStars = +$('.challenge-stars.chall-mythic').text();
  1910. newMsg = `Challenge Stars: ${challengeStars.toLocaleString('en-US')}`;
  1911. break;
  1912. }
  1913. default:
  1914. newMsg = $chtbox.val();
  1915. return;
  1916. }
  1917. }
  1918. // (unsafeWindow.kfjsdafl != null) ? $chtbox.val(newMsg) : $chtbox.val(''), console.log(newMsg);;
  1919. $chtbox.val(newMsg == '' ? '' : originalMsg + (newMsg?.[cmdVerif ? 'replace' : '']?.(/[youaie](?!.: )/gmi, m => cmap[m]) || newMsg));
  1920. })
  1921. }
  1922.  
  1923. // check if player is alive
  1924. let playerAlive = false, timeAlive;
  1925. const playerIsAlive = () => playerAlive && $('#advert').css('display') != 'none' ? false : playerAlive;
  1926. unsafeWindow.playerIsAlive = playerIsAlive;
  1927.  
  1928.  
  1929. const _setNick = unsafeWindow.setNick
  1930. unsafeWindow.setNick = function(){
  1931. if(userPreferences.messageBanWarning && /a\s*g\s*a\s*r\s*p\s*o\s*w\s*e\s*r/gmi.test(arguments[0])){
  1932. curserMsg("FSFB WARNING: FSFB script has censored your message as it has detected that your nickname may've contained a word/phrase that agma.io gives a 24 hour IP ban for. This FSFB feature can be disabled in the tampermonkey script settings.", 'red', 1e4);
  1933. const newNick = (arguments[0].replace(/a\s*g\s*a\s*r\s*p\s*o\s*w\s*e\s*r/gmi, match => '*'.repeat(match.length)));
  1934. arguments[0] = newNick;
  1935. document.getElementById('nick').value = newNick;
  1936. }
  1937. if(settings.name_color[0].active && settings.name_color[1].active && (!/^\[(?:\W{3}|\W{6})\]/gmi.test(arguments[0]) || arguments[0] === document.querySelector('#nick')?.value)){ // check if name already has color tag
  1938. const tag = `[${encodeCustomNameColor(settings.name_color[1].color)}${settings.name_color[2].active ? encodeCustomNameColor(settings.name_color[2].color) : ''}]`;
  1939. arguments[0] = tag + arguments[0];
  1940. }
  1941.  
  1942. if(arguments[1] || !playerAlive) timeAlive = Date.now(); // respawned
  1943. playerAlive = true;
  1944. setTimeout(() => { svSwitch = true }, 1000);
  1945. return _setNick.apply(this, arguments);
  1946. }
  1947.  
  1948. const _closeAdvert = unsafeWindow.closeAdvert
  1949. unsafeWindow.closeAdvert = function(){
  1950. playerAlive = false;
  1951. return _closeAdvert.apply(this, arguments);
  1952. }
  1953.  
  1954. const getPowerMessage = line => {
  1955. let obj = {};
  1956. [1, 2, 3].forEach(n => (obj[`string${n}`] = `Inv (${n}/?): `));
  1957. updatePwCount();
  1958. const newPws = {
  1959. Recombine: pws.rec,
  1960. Speed: pws.spd,
  1961. Growth: pws.grw,
  1962. Virus: pws.vrs,
  1963. Mothercell: pws.mtcl,
  1964. Portal: pws.prtl,
  1965. 'Gold Block': pws.gblk,
  1966. Freeze: pws.fz,
  1967. Push: pws.psh,
  1968. Wall: pws.wall,
  1969. 'Anti-Freeze': pws.afz,
  1970. 'Anti-Recombine': pws.arc,
  1971. Shield: pws.shld,
  1972. 'Frozen Virus': pws.fvs
  1973. }
  1974. for(let i in newPws){
  1975. let add = newPws[i] == '' ? '' : `${newPws[i]} ${i}, `;
  1976. if(obj.string1.length + add.length <= 100) obj.string1 += add;
  1977. else if(obj.string2.length + add.length <= 100) obj.string2 += add;
  1978. else obj.string3 += add;
  1979. }
  1980. if(obj.string1 == `Inv (1/?): ` && line == 1) return 'Inv (1/1): no powers';
  1981. if(obj['string' + line] == `Inv (${line}/?): `){
  1982. curserMsg(`This inventory line doesn't exist! Try a smaller number`, 'red', 6e3);
  1983. return '';
  1984. }
  1985. let totalLines = 1;
  1986. if(obj.string3 == 'Inv (3/?): ' && obj.string2 != 'Inv (2/?): ') totalLines = 2;
  1987. else if(obj.string3 != 'Inv (3/?): ' && obj.string2 != 'Inv (2/?): ') totalLines = 3;
  1988. return obj['string' + line].replace(/,[^,]*$/g, '').replace(/\?/g, totalLines);
  1989. }
  1990.  
  1991. let pws = {rec: '', spd: '', grw: '', vrs: '', mtcl: '', prtl: '', gblk: '', fz: '', psh: '', wall: '', afz: '', arc: '', shld: '', fvs: ''};
  1992. const updatePwCount = () => {
  1993. $('.inventory-box').each(function(){
  1994. const map = {
  1995. Wall : 'wall',
  1996. AntiFreeze: 'afz',
  1997. AntiRecombine: 'arc',
  1998. Shield: 'shld',
  1999. FrozenVirus: 'fvs',
  2000. Recombine: 'rec',
  2001. Speed: 'spd',
  2002. Growth: 'grw',
  2003. SpawnVirus: 'vrs',
  2004. SpawnMothercell: 'mtcl',
  2005. SpawnPortal: 'prtl',
  2006. SpawnGoldOre: 'gblk',
  2007. Freeze: 'fz',
  2008. '360Shot': 'psh'
  2009. }
  2010. if(map[$(this)[0]?.id.slice(3)] != null) pws[map[$(this)[0].id.slice(3)]] = $(this).css('display') != 'none' ? $(this).children().eq(0).text() || '1' : '';
  2011. })
  2012. }
  2013.  
  2014. $('#fsfb-export-btn').on('click', () => {
  2015. if(!$('#fsfb-sect-imexport>label>input').is(':checked')) return void(curserMsg('You need to select at least one setting to export!', 'red'));
  2016. if($('#fsfb-custom-bg').is(':checked')) curserMsg('Exporting settings with a custom background is likely to increase the file size', 'red', 8e3);
  2017. let script_settings = {},
  2018. script_themes = {};
  2019. for (let i in settings) { // put the settings & themes into different objects
  2020. if (i == "theme" || i == "theme_boxes" || i == "name_color") script_themes[i] = settings[i];
  2021. else if (i != "export_import") script_settings[i] = settings[i];
  2022. }
  2023. let bgImg = null;
  2024. const downloadFile = () => {
  2025. let obj = {
  2026. selected: {
  2027. game_settings: $('#fsfb-game-settings').is(':checked'),
  2028. game_controls: $('#fsfb-game-controls').is(':checked'),
  2029. game_background: $('#fsfb-custom-bg').is(':checked'),
  2030. script_settings: $('#fsfb-script-settings').is(':checked'),
  2031. script_theme: $('#fsfb-theme-settings').is(':checked')
  2032. },
  2033. game_settings: localStorage.settings,
  2034. game_controls: localStorage.hotkeys,
  2035. game_background: bgImg,
  2036. script_settings: script_settings,
  2037. script_theme: script_themes
  2038. }
  2039. // if the setting is turned off, then dont need to export it - set it to null
  2040. for(let i in obj){
  2041. if(i != 'selected' && !obj.selected[i]) obj[i] = null;
  2042. }
  2043. const a = document.createElement('a'),
  2044. file = new Blob([JSON.stringify(obj)], {type: "text/plain"});
  2045. a.href = URL.createObjectURL(file);
  2046. a.download = "fsfb script settings";
  2047. a.click();
  2048. URL.revokeObjectURL(a.href); // download a txt file of exported settings
  2049. }
  2050. if($('#fsfb-custom-bg').is(':checked')){
  2051. let db, req = unsafeWindow.indexedDB.open("AgmaDB", 1);
  2052. req.onsuccess = function (x) {
  2053. db = req.result;
  2054. db.onclose = (c) => { db = null; }
  2055. db.onversionchange = (c) => { db.close(), db = null; }
  2056. let _ = db.transaction("general", "readonly").objectStore("general").get("cbgDataURL");
  2057. _.onsuccess = () => {
  2058. bgImg = _.result;
  2059. downloadFile();
  2060. }
  2061. }, req.onupgradeneeded = function (c) {
  2062. let req = c.target.result;
  2063. if (!req.objectStoreNames.contains("general")) {
  2064. req.createObjectStore("general");
  2065. downloadFile();
  2066. } else downloadFile();
  2067. };
  2068. } else {
  2069. downloadFile();
  2070. }
  2071. });
  2072.  
  2073. $('#fsfb-import-btn').on('click', () => {
  2074. if(!$('#fsfb-sect-imexport>label>input').is(':checked')) return void(curserMsg('You need to select at least one setting to import!', 'red'));
  2075. if($('#fsfb-custom-bg').is(':checked')) curserMsg('Pasting in settings that include a background image is likely to cause initial lag', 'red', 0);
  2076. swal({
  2077. title: "Import Settings",
  2078. text: "Add your exported settings below and press OK to continue.",
  2079. type: "input",
  2080. showCancelButton: true,
  2081. closeOnConfirm: false,
  2082. animation: "slide-from-top",
  2083. inputPlaceholder: "Paste exported settings here"
  2084. },
  2085. function(inputVal){
  2086. if (inputVal == null) return false;
  2087. if (inputVal == "") {
  2088. swal.showInputError("Please don't leave the input empty!");
  2089. return false
  2090. }
  2091. try {
  2092. let val = JSON.parse(inputVal);
  2093. if(val.selected.script_settings && $('#fsfb-script-settings').is(':checked')){
  2094. for (let i in val.script_settings) {
  2095. for (let j in val.script_settings[i]) {
  2096. for(let x in settings){
  2097. for(let y in settings[x]){
  2098. if(val.script_settings[i][j].id == settings[x][y].id) settings[x][y] = val.script_settings[i][j];
  2099. }
  2100. }
  2101. }
  2102. }
  2103. }
  2104. if(val.selected.script_theme && $('#fsfb-theme-settings').is(':checked')){
  2105. for (let i in val.script_theme) {
  2106. for (let j in val.script_theme[i]) {
  2107. for(let x in settings){
  2108. for(let y in settings[x]){
  2109. if(val.script_theme[i][j].id == settings[x][y].id) settings[x][y] = val.script_theme[i][j];
  2110. }
  2111. }
  2112. }
  2113. }
  2114. }
  2115. if(val.selected.game_settings && $('#fsfb-game-settings').is(':checked')) localStorage.setItem('settings', val.game_settings);
  2116. if(val.selected.game_controls && $('#fsfb-game-controls').is(':checked')) localStorage.setItem('hotkeys', val.game_controls);
  2117. if(val.selected.game_background && $('#fsfb-custom-bg').is(':checked')){
  2118. let db, req = unsafeWindow.indexedDB.open("AgmaDB", 1);
  2119. req.onsuccess = function (x) {
  2120. db = req.result;
  2121. db.onclose = (c) => { db = null; }
  2122. db.onversionchange = (c) => { db.close(), db = null; }
  2123. let _ = db.transaction("general", "readwrite").objectStore("general").put(val.game_background, "cbgDataURL");
  2124. }, req.onupgradeneeded = function (c) {
  2125. let req = c.target.result;
  2126. if (!req.objectStoreNames.contains("general")) {
  2127. req.createObjectStore("general");
  2128. }
  2129. };
  2130. }
  2131. // if any agma controls were imported, need to refresh bc it's set using localstorage
  2132. 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'))){
  2133. swal({
  2134. title: "Please Refresh!",
  2135. text: "Refreshing the page is required for your imported agma settings to take effect",
  2136. type: "warning",
  2137. });
  2138. } else swal({ title: "Settings Successfully Imported!", type: "success" });
  2139. saveSettings();
  2140. styleActiveSettings();
  2141. updateScriptSettingsUI();
  2142. } catch (error){
  2143. swal({
  2144. title: "Something went wrong!",
  2145. text: "Please make sure you've entered in valid settings",
  2146. type: "error"
  2147. });
  2148. }
  2149. });
  2150.  
  2151. });
  2152.  
  2153. $('#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>`)
  2154.  
  2155. if(userPreferences.hideAds){
  2156. localStorage.ad_l_time = "9e99"; // smth like time since last ad
  2157. $('[id^="agma-io_"], [id^="adWrapper"], #preroll').addClass("fsfb-removeAds"); // move ads way off the screen
  2158. } else if(localStorage.ad_l_time == "9e99")localStorage.ad_l_time = Date.now();
  2159.  
  2160. let {innerWidth: width, innerHeight: height} = unsafeWindow;
  2161. $(unsafeWindow).on('resize', () => ({innerWidth: width, innerHeight: height} = unsafeWindow));
  2162.  
  2163. let pointMove;
  2164. const linesplit = () => {
  2165. if(!linesplitting) return;
  2166. 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}];
  2167. if(userPreferences.linesplitClosestSide){
  2168. let closestSide = [mosY / height, (height - mosY) / height, mosX / width, (width - mosX) / width]; // top, bottom, left, right
  2169. closest = points[closestSide.indexOf(Math.min(...closestSide))];
  2170. } else {
  2171. let distance = p => Math.sqrt(Math.pow(mosX - p.x, 2) + Math.pow(mosY - p.y, 2)),
  2172. closestPoint = points.reduce((a, b) => distance(a) < distance(b) ? a : b);
  2173. for (let i = 0; i < points.length; i++) {
  2174. if (closestPoint.x == points[i].x && closestPoint.y == points[i].y) closest = points[i]
  2175. }
  2176. }
  2177. pointMove = {x: closest.nx, y: closest.ny};
  2178. $('#canvas').trigger($.Event('mousemove', { clientX: closest.nx, clientY: closest.ny }));
  2179. $("#linesplit-markers div").css('background-color', 'transparent');
  2180. $('#linesplit-' + closest.n).css('background-color', '#e25615');
  2181. }
  2182.  
  2183. let confBtns = document.getElementsByClassName('purchase-btn confirmation');
  2184. const btnsArr = Array.from(document.getElementsByClassName('purchase-btn confirmation'));
  2185.  
  2186. const changeHTML = (index, price, id, name) => {
  2187. setTimeout(() => {
  2188. const amtDropdown = document.getElementById('shopAmountDropdown')
  2189. 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.';
  2190. const dropdownChange = () => {
  2191. if (amtDropdown.value == "custom") return buyCstmAmt(price, id, name);
  2192. let priceSum = (amtDropdown.value * price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  2193. 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.';
  2194. };
  2195. amtDropdown.addEventListener('change', dropdownChange);
  2196. }, 50);
  2197. };
  2198. const buyCstmAmt = (price, id, name) => {
  2199. swal({
  2200. title: "Enter Purchase Amount",
  2201. text: "<span>How many <b>" + name + "</b> would you like to buy?</span>",
  2202. html: true,
  2203. type: "input",
  2204. showCancelButton: true,
  2205. closeOnConfirm: false,
  2206. inputPlaceholder: "Input amount here"
  2207. },
  2208. function(input){
  2209. let pwAmt = +input,
  2210. priceTotal = pwAmt * price;
  2211. if (input == null) return false;
  2212. if (input == "") {
  2213. swal.showInputError("Please don't leave the input empty!");
  2214. return false
  2215. }
  2216. if(!/^[0-9]+$/.test(input) || !(+input >>> 0 === parseFloat(+input))){
  2217. swal.showInputError("Please only enter positive integers!");
  2218. return false
  2219. }
  2220. swal({
  2221. title: ' Confirm ',
  2222. 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>',
  2223. html: true,
  2224. type: 'warning',
  2225. showCancelButton: true,
  2226. closeOnConfirm: true,
  2227. confirmButtonColor: '#4caf51',
  2228. confirmButtonText: 'Yes, confirm purchase',
  2229. cancelButtonText: 'No, cancel purchase'
  2230. }, function(confirmed){
  2231. if(confirmed && $('.confirm').is(':visible')) buyPw(id, pwAmt);
  2232. })
  2233.  
  2234. });
  2235. };
  2236. // buy a certain amount of powers including > 255
  2237. const buyPw = (shopID, pwAmt) => {
  2238. if (pwAmt < 1) return;
  2239. if (pwAmt > 255) {
  2240. for (let i = 0; i < ~~(pwAmt / 255); i++) setTimeout(() => purchaseItem(shopID, 255), 500 * i + 250);
  2241. purchaseItem(shopID, pwAmt % 255);
  2242. } else purchaseItem(shopID, pwAmt);
  2243. };
  2244.  
  2245.  
  2246. if(userPreferences.improvedShop){
  2247. // add event listeners to dropdown buttons
  2248. for (let i = 0; i < confBtns.length; i++) {
  2249. confBtns[i].onclick = function () {
  2250. setTimeout(() => {
  2251. 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>';
  2252. }, 5);
  2253. }
  2254. }
  2255. // add event listeners to shop buttons
  2256. for (let i = 0; i < 16; i++) {
  2257. if (i != 10 && i != 11){
  2258. btnsArr[i].addEventListener('click', function(e){
  2259. if(!e.isTrusted && !quickBuying) return;
  2260. let index = i;
  2261. changeHTML(index, btnsArr[index].getAttribute('price'), btnsArr[index].getAttribute('item'), $('.purchase-btn.confirmation[item="' + btnsArr[index].getAttribute('item') + '"]').prev().find('h3').eq(0).text());
  2262. });
  2263. }
  2264. }
  2265. }
  2266.  
  2267.  
  2268. // listen for when a min pack is bought
  2269. let minBoughtAmt = {};
  2270. if(userPreferences.extraChatCommands){
  2271. let lastClickedPrice, currentPrice, lastID;
  2272. const confirmClicked = () => {
  2273. setTimeout(() => {
  2274. if($('.sweet-alert h2').text() != "Success!" || lastClickedPrice != currentPrice) return;
  2275. const map = {
  2276. 1: '10 Bots 1 Hour',
  2277. 2: '40 Bots 1 Hour',
  2278. 3: '50 Bots 2 Hours',
  2279. 4: '80 Bots 1 Hour',
  2280. 5: '100 Bots 4 Hours',
  2281. 6: '125 Bots 8 Hours',
  2282. 7: '300 Bots 24 Hours',
  2283. 8: '100 MASS Bots 1 Hour',
  2284. 9: '100 Bots 24 Hours',
  2285. 10: '125 Bots 48 Hours',
  2286. 11: '300 Bots 72 Hours',
  2287. 12: '100 MASS Bots 24 Hours'
  2288. }
  2289. minBoughtAmt[currentUser] = {...minsChatAmt[currentUser], ... {chatAmt: map[lastID], started: false}};
  2290. }, 900);
  2291. };
  2292. $('.purchase-btn2.confirm-minion[item]').on('click', function () {
  2293. lastClickedPrice = this.getAttribute('price').replace(/,/g, '');
  2294. lastID = this.getAttribute('item');
  2295. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  2296. setTimeout(() => {
  2297. $('.confirm').removeAttr('disabled');
  2298. currentPrice = $('.sweet-alert.showSweetAlert.visible p').eq(0).text().replace(/\D+/g, '');
  2299. }, 750);
  2300. setTimeout(() => $('.confirm')[0].addEventListener('click', confirmClicked), 500);
  2301. })
  2302. }
  2303.  
  2304. // context menu: click on skin -> skin ID to clipboard, click on name -> name to clipboard
  2305. $('#contextPlayer').on('click', e => {
  2306. if(!userPreferences.rightClickCopyInfo) return;
  2307. if($('#contextPlayerSkin').width() + $('#contextPlayerSkin').offset().left + 5 > e.pageX){ // bcs #contextMenu event :dog:
  2308. // cell was clicked
  2309. if($('#contextPlayerSkin').css('background-image') != "none"){
  2310. let skinID = $('#contextPlayerSkin').css('background-image').match(/(?<=\/skins\/)[0-9]+/gm)[0]; // get the skin image, then match only the skin's ID
  2311. navigator.clipboard.writeText(skinID).then(function() {
  2312. curserMsg('Skin ID of ' + skinID + ' was copied to your clipboard.', 'green');
  2313. }, function() {
  2314. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  2315. });
  2316. } else if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  2317. else curserMsg('No skin equipped. Nothing was added to your clipboard.', 'red');
  2318. } else { // name was clicked
  2319. if($('#contextPlayerSkin').css('background-color') == 'rgb(51, 51, 51)') curserMsg('No player selected. Nothing was added to your clipboard.', 'red');
  2320. else {
  2321. navigator.clipboard.writeText($('#contextPlayerName').text()).then(function() {
  2322. curserMsg('Nickname: "' + $('#contextPlayerName').text() + '" was copied to your clipboard', 'green');
  2323. }, function() {
  2324. curserMsg("Something went wrong. Nothing was added to your clipboard.", "red");
  2325. });
  2326. }
  2327. }
  2328. });
  2329.  
  2330.  
  2331. // little bar at the top of the screen that tells u stuff
  2332. let curserTimeout;
  2333. function curserMsg(msg, color, time, html){
  2334. let colorTable = {
  2335. "green": "rgb(0, 192, 0)",
  2336. "red": "rgb(255, 0, 0)",
  2337. "gray": "rgb(153, 153, 153)",
  2338. "yellow": "rgb(255, 170, 0)",
  2339. "lightgray": "rgb(194, 194, 194)",
  2340. "white": "rgb(255, 255, 255)",
  2341. "purple": "rgb(190, 138, 255)"
  2342. }
  2343. color = colorTable[color];
  2344. clearTimeout(curserTimeout);
  2345. $('#curser')[(html ?? false) ? "html" : "text"](msg).show().css('color', color)
  2346. if(time != 0) curserTimeout = setTimeout(() => $('#curser').fadeOut(400), time ?? 4e3);
  2347. }
  2348. unsafeWindow.curserMsg = curserMsg;
  2349.  
  2350. let minTimeRemaining = 0;
  2351. const startMin = unsafeWindow.strMin;
  2352. unsafeWindow.strMin = function(){
  2353. minsStart();
  2354. return startMin.apply(this, arguments);
  2355. }
  2356. let minsChatAmt = {},
  2357. accGoldMem = {};
  2358. const minsStart = async() => {
  2359. let minAmt, minsStarted = false;
  2360. const waitUntil1 = (condition) => new Promise(resolve => {
  2361. let interval = setInterval(() => {
  2362. $('#infoContent').children().each(function(){
  2363. if($(this).text().includes('Minion Time:')) minsStarted = true;
  2364. })
  2365. condition() && (clearInterval(interval), resolve());
  2366. }, 100);
  2367. setTimeout(() => { (clearInterval(interval), resolve()); }, 1e4);
  2368. });
  2369. await waitUntil1(() => minsStarted == true);
  2370. if(!minsStarted) return;
  2371. $('#infoContent').children().each(function(){
  2372. if($(this).text().includes('Minion Time:')) minTimeRemaining = $(this).find('span').text();
  2373. if($(this).text().includes('Minions:')) minAmt = $(this).find('span').text();
  2374. })
  2375. let timeArr = minTimeRemaining.split(':'), msBotsTime = (3.6e6 * +timeArr[0]) + (6e4 * +timeArr[1]) + (1e3 * +timeArr[2]);
  2376. misc_settings.bots[currentUser] = {...misc_settings.bots[currentUser], ...{active: true, amt: minAmt, chatAmt: null, rem: msBotsTime, currMs: Date.now()}};
  2377. setStorage("fsfb-misc", misc_settings);
  2378. }
  2379.  
  2380. // ability time remaining
  2381. if(userPreferences.showRemainingAbilityTime){
  2382. let lastClickedPrice, currentPrice, lastID;
  2383. const confirmClicked = () => {
  2384. setTimeout(() => {
  2385. if($('.sweet-alert h2').text() != "Success!" || lastClickedPrice != currentPrice) return;
  2386. misc_settings.abil[currentUser] = {...misc_settings.abil[currentUser], ...{[lastID] : Date.now()}};
  2387. setStorage("fsfb-misc", misc_settings);
  2388. }, 900);
  2389. };
  2390. [18, 20, 22, 23].forEach(el => {
  2391. let h5 = $(`.purchase-btn.confirmation[item="${el}"]`).parents().eq(0).find('div h5');
  2392. h5.clone().insertAfter(h5).addClass('fsfb-fake').hide();
  2393. $(`.purchase-btn[item="${el}"]`).on('click', function () {
  2394. lastClickedPrice = this.getAttribute('price');
  2395. lastID = this.getAttribute('item');
  2396. $('.confirm').attr('disabled', 'true'); // disable so user doesn't buy early - swal is slow to load text
  2397. setTimeout(() => {
  2398. $('.confirm').removeAttr('disabled');
  2399. currentPrice = $('.sweet-alert.showSweetAlert.visible p').eq(0).text().replace(/\D+/g, '');
  2400. }, 750);
  2401. setTimeout(() => $('.confirm')[0].addEventListener('click', confirmClicked), 500);
  2402. })
  2403. });
  2404. }
  2405.  
  2406. // sort wearables by owned
  2407. const waitUntil = condition => new Promise(resolve => {
  2408. let interval = setInterval(() => {
  2409. condition() && (clearInterval(interval), resolve());
  2410. }, 100);
  2411. setTimeout(() => { (clearInterval(interval), resolve()) }, 15e3);
  2412. });
  2413. if(userPreferences.sortWearablesByOwned){
  2414. $('#wearablesTab').on('click', async() => {
  2415. await waitUntil(() => $('#phpWearables li').length > 55);
  2416. if($('#phpWearables li').length <= 55) return;
  2417. $($('[id^="wearableUseBtn"]').get().reverse()).each(function(){
  2418. $($(this).parents().get(2)).insertBefore($("#phpWearables li:eq(0)"));
  2419. })
  2420. $('#phpWearables').append('<div id="fsfb-wearsloaded"></div>');
  2421. });
  2422. }
  2423. // https://stackoverflow.com/questions/2424191/how-do-i-make-an-element-draggable-in-jquery
  2424. $.fn.draggable = function(){
  2425. var $this = this,
  2426. ns = 'draggable_'+(Math.random()+'').replace('.',''),
  2427. mm = 'mousemove.'+ns,
  2428. mu = 'mouseup.'+ns,
  2429. $w = $(unsafeWindow),
  2430. isFixed = ($this.css('position') === 'fixed'),
  2431. adjX = 0, adjY = 0;
  2432.  
  2433. $this.mousedown(function(ev){
  2434. var pos = $this.offset();
  2435. if (isFixed) {
  2436. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  2437. }
  2438. var ox = (ev.pageX - pos.left), oy = (ev.pageY - pos.top);
  2439. $this.data(ns,{ x : ox, y: oy });
  2440. $w.on(mm, function(ev){
  2441. ev.preventDefault();
  2442. ev.stopPropagation();
  2443. if (isFixed) {
  2444. adjX = $w.scrollLeft(); adjY = $w.scrollTop();
  2445. }
  2446. var offset = $this.data(ns);
  2447. $this.css({left: Math.round(ev.pageX - adjX - offset.x), top: Math.round(ev.pageY - adjY - offset.y)});
  2448. });
  2449. $w.on(mu, function(){
  2450. $w.off(mm + ' ' + mu).removeData(ns);
  2451. });
  2452. });
  2453. return this;
  2454. };
  2455.  
  2456.  
  2457. /* xp/coins statistics */
  2458.  
  2459. const updateTimeXP = 12e3; // xp bar updates every 12 seconds, don't change
  2460. let lastMinXP = [];
  2461. let lastHrXP = [];
  2462. let currentPercent, currentLevel, currentXP, currentCoins;
  2463.  
  2464. unsafeWindow.logStatsScriptXP = !1;
  2465. unsafeWindow.logStatsScriptCoins = !1;
  2466. let scriptStartCoins = Date.now();
  2467. let scriptStartXP = Date.now();
  2468. let accounts = {};
  2469. const guiDisplay = "none";
  2470. let coinsHTMLactive = false;
  2471.  
  2472. const updateTimeCoins = 6e3;
  2473. let lastMinCoins = [];
  2474. let lastHrCoins = [];
  2475.  
  2476. // add stats box html
  2477. const statsBody = document.createElement('div');
  2478. statsBody.setAttribute('id', 'stats-container');
  2479. statsBody.style.display = guiDisplay;
  2480. statsBody.innerHTML = `
  2481. <div id="stats-main">
  2482. <div id="stats-title">
  2483. <title id="stats-extra-info">XP Stats - Updating Every 12s</title>
  2484. <div>
  2485. <div title="Toggle Percentages Shown" id="stats-perc-btn" class="fa fa-percent"></div>
  2486. <div title="Toggle Stats Shown" id="stats-change-shown" class="fa fa-eye-slash"></div>
  2487. <div title="Reset Stats" class="fa fa-refresh" id="stats-reset-btn"></div>
  2488. </div>
  2489. </div>
  2490. <div>
  2491. <table id="stats-table">
  2492. <tbody>
  2493. <tr>
  2494. <td><label><input type="checkbox">Lvl Completed:</label></td>
  2495. <td>0/0</td>
  2496. </tr>
  2497. <tr>
  2498. <td><label><input type="checkbox">Remaining:</label></td>
  2499. <td>100,000</td>
  2500. </tr>
  2501. <tr>
  2502. <td><label><input type="checkbox">Projected (hr):</label></td>
  2503. <td>0</td>
  2504. </tr>
  2505. <tr>
  2506. <td><label><input type="checkbox">Last Hour:</label></td>
  2507. <td>100,000</td>
  2508. </tr>
  2509. <tr>
  2510. <td><label><input type="checkbox">Last Minute:</label></td>
  2511. <td>100,000</td>
  2512. </tr>
  2513. <tr>
  2514. <td><label><input type="checkbox">Last 12s:</label></td>
  2515. <td>100,000</td>
  2516. </tr>
  2517. <tr>
  2518. <td><label><input type="checkbox">Minute Mean:</label></td>
  2519. <td>100,000</td>
  2520. </tr>
  2521. <tr>
  2522. <td><label><input type="checkbox">Minute Median:</label></td>
  2523. <td>100,000</td>
  2524. </tr>
  2525. <tr>
  2526. <td><label><input type="checkbox">Minute Sd:</label></td>
  2527. <td>100,000</td>
  2528. </tr>
  2529. <tr>
  2530. <td><label><input type="checkbox">Latest Outliers:</label></td>
  2531. <td>100,000</td>
  2532. </tr>
  2533. <tr>
  2534. <td><label><input type="checkbox">Session XP:</label></td>
  2535. <td>100,000</td>
  2536. </tr>
  2537. <tr>
  2538. <td><label><input type="checkbox">Session Length:</label></td>
  2539. <td>100,000</td>
  2540. </tr>
  2541. <tr>
  2542. <td><label><input type="checkbox">Lifetime XP:</label></td>
  2543. <td>100,000</td>
  2544. </tr>
  2545. </tbody>
  2546. </table>
  2547. </div>
  2548. </div>`;
  2549. document.querySelector('body').append(statsBody);
  2550.  
  2551. $("#stats-container").draggable();
  2552. let statsboxPos = misc_settings?.statsPos ?? {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left};
  2553. if(userPreferences.saveStatsBoxPosition && statsboxPos) $("#stats-container").css({'top' : statsboxPos.top, 'left' : statsboxPos.left});
  2554.  
  2555. const convertToPerc = (xpAmt, lvl = 0) => isNaN(xpAmt / (lvl * 1000)) ? 0 : xpAmt / (lvl * 1000);
  2556.  
  2557. $('#stats-reset-btn').on('click', () => {
  2558. if(coinsHTMLactive){
  2559. lastMinCoins = [];
  2560. lastHrCoins = [];
  2561. for(let i in accounts) accounts[i].coins = 0;
  2562. if(accounts[currentUser] !== null && currentUser !== 'Please Login First') accounts[currentUser].coins = currentCoins;
  2563. scriptStartCoins = Date.now();
  2564. } else {
  2565. lastMinXP = [];
  2566. lastHrXP = [];
  2567. for(let i in accounts){
  2568. accounts[i].xp = 0;
  2569. accounts[i].lvl = 0;
  2570. }
  2571. if(accounts[currentUser] !== null && currentUser !== 'Please Login First'){
  2572. accounts[currentUser].xp = currentXP;
  2573. accounts[currentUser].lvl = round(currentPercent, 3) + currentLevel;
  2574. }
  2575. scriptStartXP = Date.now();
  2576. }
  2577. updateUI();
  2578. });
  2579. let xpStatsInPercentages = false;
  2580. $('#stats-perc-btn').on('click', () => {
  2581. xpStatsInPercentages = !xpStatsInPercentages;
  2582. updateUI();
  2583. });
  2584.  
  2585. let changingShownStats = false;
  2586. $('#stats-change-shown').on('click', () => {
  2587. changingShownStats = !changingShownStats;
  2588. if(changingShownStats){
  2589. $('#stats-table tr').show();
  2590. _replaceCSS('stats-input-css', '#stats-table input{ display: unset; }');
  2591. } else {
  2592. for(let i in misc_settings.statsSettings[coinsHTMLactive ? 'coins' : 'xp']){
  2593. misc_settings.statsSettings[coinsHTMLactive ? 'coins' : 'xp'][i] = $(`#stats-${i} input[type="checkbox"]`).is(':checked');
  2594. $('#stats-' + i)[$(`#stats-${i} input[type="checkbox"]`).is(':checked') ? 'show' : 'hide']();
  2595. }
  2596. setStorage("fsfb-misc", misc_settings);
  2597. _replaceCSS('stats-input-css', '#stats-table input{ display: none; }');
  2598. }
  2599. });
  2600.  
  2601. class StatLog {
  2602. constructor(val, lvl, user, arr) {
  2603. this.type = this.findWhich(arr); // mostly for debugging
  2604. this.id = this.getID(arr);
  2605. this.user = user;
  2606. this.amount = val;
  2607. this.gained = this.calcGain(val, arr, this.id);
  2608. this.lvl = lvl;
  2609. // this.timestamp = Date.now(); // mostly for debugging
  2610. }
  2611. findWhich(arr) {
  2612. return ((arr == lastMinXP || arr == lastHrXP ? "xp " : "coins " ) + (arr == lastHrXP || arr == lastHrCoins ? "hour" : "minute"));
  2613. }
  2614. calcGain(val, arr, id){
  2615. const prevObj = arr[arr.length - 1];
  2616. if(prevObj && arr == lastHrXP && id == 1) return round(sigma(getProperty(lastMinXP, "gained")), 3);
  2617. if(prevObj && arr == lastHrCoins && id == 1) return round(sigma(getProperty(lastMinCoins, "gained")), 3);
  2618. return prevObj && val - prevObj.amount >= 0 && prevObj.user == this.user && prevObj.amount != 0 ? round(val - prevObj.amount, 3) : 0;
  2619. }
  2620. getID(arr) {
  2621. return arr[arr.length - 1] ? arr[arr.length - 1].id + 1 : 1;
  2622. }
  2623.  
  2624. }
  2625.  
  2626. const xpInfo = () => {
  2627. currentPercent = $('.progress-bar[role=progressbar]')[0].style.width.slice(0, -1) / 100;
  2628. currentLevel = +$('#level.user-level')[0].textContent;
  2629. currentXP = (levelSum(currentLevel) + currentLevel * currentPercent) * 1e3;
  2630. }
  2631. const coinsInfo = () => {
  2632. currentCoins = +($('#coinsDash')[0].textContent.replace(/ /g, ''));
  2633. }
  2634.  
  2635. const updateUI = () => {
  2636. if(changingShownStats) return;
  2637. if(!coinsHTMLactive){
  2638. const xpHr = lastHrXP.length,
  2639. xpMin = lastMinXP.length,
  2640. lvlCompleted = currentPercent ? String(Math.round(currentPercent * currentLevel * 1e3, 1)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "/" + (currentLevel * 1e3).toLocaleString('en-US') : "0/0",
  2641. xpRemaining = currentLevel ? currentLevel * 1e3 - currentPercent * currentLevel * 1e3 : 0,
  2642. projectedHr = xpHr > 0 ? sigma(getProperty(lastHrXP.slice(-5), "gained")) * 12 : 0,
  2643. lastHr = xpHr > 0 ? sigma(getProperty(lastHrXP, "gained")) : 0,
  2644. lastHrCompleted = xpHr > 0 ? xpHr : 0,
  2645. lastMin = xpMin > 0 ? sigma(getProperty(lastMinXP, "gained")) : 0,
  2646. lastMinCompleted = xpMin > 0 ? xpMin : 0,
  2647. lastMinTotal = 6e4 / updateTimeXP,
  2648. last12sec = xpMin > 0 ? lastMinXP[lastMinXP.length - 1].gained : 0,
  2649. xBar = xpHr > 0 ? mean(getProperty(lastHrXP, "gained")) : 0,
  2650. xTilde = xpHr > 0 ? median(getProperty(lastHrXP, "gained")) : 0,
  2651. standardDev = xpHr > 0 ? standardDeviation(getProperty(lastHrXP, "gained")) : 0,
  2652. outliers = xpHr > 0 ? checkOutliers(getProperty(lastHrXP, "gained")) : 0,
  2653. sessionXP = currentXP && accounts[currentUser] ? currentXP - accounts[currentUser].xp : 0,
  2654. sessionLength = msToTime(Date.now() - scriptStartXP),
  2655. lifetimeXP = currentXP ? Math.round(currentXP) : 0,
  2656. updateTime = updateTimeXP;
  2657. document.getElementById('stats-table').innerHTML = `
  2658. <tbody>
  2659. <tr id="stats-lvlcomp">
  2660. <td><label><input type="checkbox">Lvl Completed:</label></td>
  2661. <td>${lvlCompleted.toLocaleString('en-US')}</td>
  2662. </tr>
  2663. <tr id="stats-rem">
  2664. <td><label><input type="checkbox">Remaining:</label></td>
  2665. <td>${xpStatsInPercentages ? round(convertToPerc(xpRemaining, currentLevel) * 100, 2) + '%' : round(xpRemaining).toLocaleString('en-US')}</td>
  2666. </tr>
  2667. <tr id="stats-projhr">
  2668. <td><label><input type="checkbox">Projected (hr):</label></td>
  2669. <td>${xpStatsInPercentages ? round(convertToPerc(projectedHr, currentLevel) * 100, 2) + '%' : round(projectedHr).toLocaleString('en-US')}</td>
  2670. </tr>
  2671. <tr id="stats-lasthr">
  2672. <td><label><input type="checkbox">Last Hour:</label></td>
  2673. <td>${xpStatsInPercentages ? round(convertToPerc(lastHr, currentLevel) * 100, 2) + '%' : round(lastHr).toLocaleString('en-US')}<span class="stats-completed">(${lastHrCompleted}/60)</span></td>
  2674. </tr>
  2675. <tr id="stats-lastmin">
  2676. <td><label><input type="checkbox">Last Minute:</label></td>
  2677. <td>${xpStatsInPercentages ? round(convertToPerc(lastMin, currentLevel) * 100, 2) + '%' : round(lastMin).toLocaleString('en-US')}<span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></td>
  2678. </tr>
  2679. <tr id="stats-lastsec">
  2680. <td><label><input type="checkbox">Last 12s:</label></td>
  2681. <td>${xpStatsInPercentages ? round(convertToPerc(last12sec, currentLevel) * 100, 2) + '%' : round(last12sec).toLocaleString('en-US')}</td>
  2682. </tr>
  2683. <tr id="stats-mean">
  2684. <td><label><input type="checkbox">Minute Mean:</label></td>
  2685. <td>${xpStatsInPercentages ? round(convertToPerc(xBar, currentLevel) * 100, 2) + '%' : round(xBar).toLocaleString('en-US')}</td>
  2686. </tr>
  2687. <tr id="stats-median">
  2688. <td><label><input type="checkbox">Minute Median:</label></td>
  2689. <td>${xpStatsInPercentages ? round(convertToPerc(xTilde, currentLevel) * 100, 2) + '%' : round(xTilde).toLocaleString('en-US')}</td>
  2690. </tr>
  2691. <tr id="stats-sd">
  2692. <td><label><input type="checkbox">Minute Sd:</label></td>
  2693. <td>${xpStatsInPercentages ? round(convertToPerc(standardDev, currentLevel) * 100, 2) + '%' : round(standardDev).toLocaleString('en-US')}</td>
  2694. </tr>
  2695. <tr id="stats-sesh">
  2696. <td><label><input type="checkbox">Session XP:</label></td>
  2697. <td>${xpStatsInPercentages ? round(currentLevel && accounts[currentUser] ? ((round(currentPercent, 3) + currentLevel) - accounts[currentUser].lvl) * 100 : 0, 2) + '%' : round(sessionXP).toLocaleString('en-US')}</td>
  2698. </tr>
  2699. <tr id="stats-seshlength">
  2700. <td><label><input type="checkbox">Session Length:</label></td>
  2701. <td id="stats-sesh-length">${sessionLength}</td>
  2702. </tr>
  2703. <tr id="stats-lifetime">
  2704. <td><label><input type="checkbox">Lifetime XP:</label></td>
  2705. <td>${lifetimeXP.toLocaleString('en-US')}</td>
  2706. </tr>
  2707. </tbody>`;
  2708. for(let i in misc_settings.statsSettings.xp){
  2709. $('#stats-' + i)[misc_settings.statsSettings.xp[i] ? 'show' : 'hide']();
  2710. $('#stats-' + i + ' input[type="checkbox"').prop("checked", misc_settings.statsSettings.xp[i]);
  2711. }
  2712. $('#stats-extra-info').text(`XP Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#00bbff');
  2713. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartXP));
  2714. $('#stats-perc-btn').show();
  2715. } else {
  2716. const coinsHr = lastHrCoins.length,
  2717. coinsMin = lastMinCoins.length,
  2718. coinGoalCompleted = currentCoins ? currentCoins.toLocaleString('en-US') + "/" + Math.ceil(currentCoins / 25e4).toLocaleString('en-US') * 25e4 : 0,
  2719. coinsRemaining = currentCoins ? 25e4 - currentCoins % 25e4 : 0,
  2720. projectedHr = coinsHr > 5 ? Math.round(sigma(getProperty(lastHrCoins.slice(-5), "gained")) * 12) : 0,
  2721. lastHr = coinsHr > 0 ? Math.round(sigma(getProperty(lastHrCoins, "gained"))) : 0,
  2722. lastHrCompleted = coinsHr > 0 ? coinsHr : 0,
  2723. lastMin = coinsMin > 0 ? Math.round(sigma(getProperty(lastMinCoins, "gained"))) : 0,
  2724. lastMinCompleted = coinsMin > 0 ? coinsMin : 0,
  2725. lastMinTotal = 6e4 / updateTimeCoins,
  2726. last12sec = coinsMin > 0 ? getProperty(lastHrCoins.slice(-5), "amount")[0] : 0,
  2727. xBar = coinsHr > 0 ? Math.round(mean(getProperty(lastHrCoins, "gained"))) : 0,
  2728. xTilde = coinsHr > 0 ? Math.round(median(getProperty(lastHrCoins, "gained"))) : 0,
  2729. standardDev = coinsHr > 0 ? Math.round(standardDeviation(getProperty(lastHrCoins, "gained"))) : 0,
  2730. outliers = coinsHr > 0 ? checkOutliers(getProperty(lastHrCoins, "gained")) : 0,
  2731. sessionXP = currentCoins && accounts[currentUser] ? Math.round(currentCoins - accounts[currentUser].coins): 0,
  2732. sessionLength = msToTime(Date.now() - scriptStartCoins),
  2733. updateTime = updateTimeCoins;
  2734. document.getElementById('stats-table').innerHTML = `
  2735. <tbody>
  2736. <tr id="stats-rem">
  2737. <td><label><input type="checkbox">Remaining:</label></td>
  2738. <td>${coinsRemaining.toLocaleString('en-US')}</td>
  2739. </tr>
  2740. <tr id="stats-projhr">
  2741. <td><label><input type="checkbox">Projected (hr):</label></td>
  2742. <td>${projectedHr.toLocaleString('en-US')}</td>
  2743. </tr>
  2744. <tr id="stats-lasthr">
  2745. <td><label><input type="checkbox">Last Hour:</label></td>
  2746. <td>${lastHr.toLocaleString('en-US')}<span class="stats-completed">(${lastHrCompleted}/60)</span></td>
  2747. </tr>
  2748. <tr id="stats-lastmin">
  2749. <td><label><input type="checkbox">Last Minute:</label></td>
  2750. <td>${lastMin.toLocaleString('en-US')}<span class="stats-completed">(${lastMinCompleted + "/" + lastMinTotal})</span></td>
  2751. </tr>
  2752. <tr id="stats-mean">
  2753. <td><label><input type="checkbox">Minute Mean:</label></td>
  2754. <td>${xBar.toLocaleString('en-US')}</td>
  2755. </tr>
  2756. <tr id="stats-median">
  2757. <td><label><input type="checkbox">Minute Median:</label></td>
  2758. <td>${xTilde.toLocaleString('en-US')}</td>
  2759. </tr>
  2760. <tr id="stats-sd">
  2761. <td><label><input type="checkbox">Minute Sd:</label></td>
  2762. <td>${standardDev.toLocaleString('en-US')}</td>
  2763. </tr>
  2764. <tr id="stats-sesh">
  2765. <td><label><input type="checkbox">Session Coins:</label></td>
  2766. <td>${sessionXP.toLocaleString('en-US')}</td>
  2767. </tr>
  2768. <tr id="stats-seshlength">
  2769. <td><label><input type="checkbox">Session Length:</label></td>
  2770. <td id="stats-sesh-length">${sessionLength}</td>
  2771. </tr>
  2772. </tbody>`;
  2773. for(let i in misc_settings.statsSettings.coins){
  2774. $('#stats-' + i)[misc_settings.statsSettings.coins[i] ? 'show' : 'hide']();
  2775. $('#stats-' + i + ' input[type="checkbox"').prop("checked", misc_settings.statsSettings.coins[i]);
  2776. }
  2777. $('#stats-extra-info').text(`Coin Stats - Updating Every ${updateTime / 1e3}s`).css('color', '#ffc800');
  2778. $('#stats-sesh-length').text(msToTime(Date.now() - scriptStartCoins));
  2779. $('#stats-perc-btn').hide();
  2780. }
  2781. }
  2782.  
  2783. $('.progress-bar').eq(1).parent()[0].style.cursor = "pointer";
  2784.  
  2785. if(userPreferences.coinXPstats){
  2786. $('.progress-bar').eq(1).parent().on("click", () => {
  2787. const statsCont = $('#stats-container');
  2788. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  2789. else if(!coinsHTMLactive) statsCont.fadeOut(400);
  2790. coinsHTMLactive = false;
  2791. updateUI();
  2792. }), [$(".dash-coin.dcTopBar").eq(0), $("#coinsTopLeft"), $(".progress-bar-coins").eq(1)].forEach(el => {
  2793. el.on('click', (e) => {
  2794. const statsCont = $('#stats-container');
  2795. if(statsCont[0].style.display == "none") statsCont.fadeIn(400);
  2796. else if(coinsHTMLactive) statsCont.fadeOut(400);
  2797. coinsHTMLactive = true;
  2798. updateUI();
  2799. e.stopImmediatePropagation();
  2800. });
  2801. });
  2802. }
  2803.  
  2804. // copy chat msgs
  2805. if(userPreferences.rightClickCopyChat){
  2806. $('#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>`);
  2807. $('#contextCopyChat').on('click', () => {
  2808. let arr = chatmsgs, str = "";
  2809. if(arr != null){
  2810. for(let i of arr.reverse()) str += `${new Date(i.time).toLocaleTimeString()} ${i.name}: ${i.message}\n`;
  2811. navigator.clipboard.writeText(str).then(function() {
  2812. curserMsg('Chat messages were successfully added to clipboard.', 'green');
  2813. }, function() {
  2814. curserMsg('Something went wrong. Nothing was added to your clipboard.', 'red');
  2815. });
  2816. }
  2817. $('#contextMenu').hide();
  2818. });
  2819. }
  2820.  
  2821.  
  2822.  
  2823. // add linesplit bubbles
  2824. $('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
  2825. // add class to all elements that need to be hidden
  2826. setTimeout(() => $('#stats-container, #inventory, #chat, #minionUi, #infection_remain_zombie, #party, #challengeInfoBox, #gamemodeBox, #infoBox, #brGameContainer, #infGameContainer, #curser, #leaderboard, #minimap, #btnFriends, .innerBoxDashboard2, #fpsBox, #settingsBtn, #megaholder, #keyboard-layout, div[style^="position: fixed; right: 20px; bottom: 230px; z-index: 998;"], #linesplit_overlay, #fushykng, #art-panel').addClass("hideUI"), 4e3);
  2827.  
  2828. const addFriendDecline = () => {
  2829. if(!userPreferences.friendDeclineAll || currentUser == 'Please Login First') return;
  2830. $('#friendAcceptAll').text('Reject All').addClass('fsfb-temp').clone().insertAfter($('#friendAcceptAll')).attr('style', 'right: 93px;').text('Accept All').removeClass('fsfb-temp');
  2831. $('.fsfb-temp').attr('id', 'friendRejectAll').removeAttr('onclick').removeClass('fsfb-temp');
  2832. $('#friendRejectAll').on('click', () => {
  2833. $('#requestList>.friend>.btn-friends.remove').each(function(){ $(this)[0].click() })
  2834. });
  2835. }
  2836.  
  2837. if(userPreferences.friendDeclineAll){ // $('#friendAcceptAll').length
  2838. $('#btnFriends').on('click', async() => {
  2839. await waitUntil(() => $('#friendAcceptAll').length > 0);
  2840. if($('#friendAcceptAll').length == 0) return;
  2841. await sleep(50);
  2842. addFriendDecline();
  2843. })
  2844. }
  2845.  
  2846. let pushFn = Array.prototype.push,
  2847. spliceFn = Array.prototype.splice,
  2848. prop = null,
  2849. specialCells = !0,
  2850. customDc = false,
  2851. cellProto,
  2852. avgFps = 0,
  2853. fpsArr = [],
  2854. svSwitch = false,
  2855. pubNameSwitch = false,
  2856. entArr = null,
  2857. chatmsgs,
  2858. hideMinionMaxSize = 80;
  2859.  
  2860. let r1Portal = {
  2861. portal: null,
  2862. lastMass: 0,
  2863. lastMassChange: 0,
  2864. lastValue: 0,
  2865. room: 1
  2866. }, r2Portal = {
  2867. portal: null,
  2868. lastMass: 0,
  2869. lastMassChange: 0,
  2870. lastValue: 0,
  2871. room: 2
  2872. };
  2873.  
  2874. let svInfo = {
  2875. "default": {
  2876. ejPortalMass: 12,
  2877. r1Id: 1,
  2878. r2Id: 7,
  2879. r3Id: null,
  2880. r1StartMass: 500,
  2881. r2StartMass: 500,
  2882. entities: [],
  2883. serverType: "normal"
  2884. },
  2885. 1: { // POPSPLIT
  2886. entities: [
  2887. // A1
  2888. {type: 1, x: 2500, y: 2500, size: 45},
  2889. // r1
  2890. {type: 0, x: 3400, y: 15300, size: 195},
  2891. {type: 1, x: 2500, y: 15000, size: 45},
  2892. {type: 2, x: 3000, y: 14500, size: 35},
  2893. {type: 3, x: 2700, y: 14600, size: 29},
  2894. // r2
  2895. {type: 0, x: 12000, y: 15500, size: 195},
  2896. {type: 1, x: 11000, y: 15000, size: 29},
  2897. {type: 2, x: 12600, y: 14900, size: 35},
  2898. {type: 2, x: 12000, y: 15200, size: 35},
  2899. {type: 2, x: 11300, y: 14900, size: 35},
  2900. {type: 3, x: 12800, y: 14500, size: 29}
  2901. ],
  2902. bots: 4
  2903. },
  2904. 2: { // SLOWSPLIT
  2905. ejPortalMass: 20,
  2906. r1Id: 1,
  2907. r2Id: 14, // rightmost portal
  2908. r3Id: 6,
  2909. r1StartMass: 500,
  2910. r2StartMass: 500,
  2911. entities: [
  2912. // A1
  2913. {type: 1, x: 2500, y: 2500, size: 45},
  2914. // r1
  2915. {type: 0, x: 7400, y: 21300, size: 195},
  2916. {type: 1, x: 3500, y: 21000, size: 45},
  2917. {type: 2, x: 5000, y: 20500, size: 35},
  2918. {type: 3, x: 3700, y: 20600, size: 29},
  2919. // r2
  2920. {type: 0, x: 14000, y: 22000, size: 195},
  2921. {type: 1, x: 11000, y: 21000, size: 29},
  2922. {type: 2, x: 11300, y: 20900, size: 35},
  2923. {type: 2, x: 12000, y: 21200, size: 35},
  2924. {type: 2, x: 12600, y: 20900, size: 35},
  2925. {type: 3, x: 12800, y: 20500, size: 29},
  2926. // r2 (2nd?)
  2927. {type: 0, x: 22000, y: 21500, size: 195},
  2928. {type: 2, x: 21300, y: 21000, size: 45}
  2929. ]
  2930. },
  2931. 3: { // Dodgeball NA
  2932. entities: [],
  2933. bots: 7
  2934. },
  2935. 4: { // FASTSPLIT
  2936. ejPortalMass: 20,
  2937. r1Id: 1,
  2938. r2Id: 14, // rightmost portal
  2939. r3Id: 6,
  2940. r1StartMass: 500,
  2941. r2StartMass: 500,
  2942. entities: [
  2943. // A1
  2944. {type: 1, x: 2500, y: 2500, size: 45},
  2945. // r1
  2946. {type: 0, x: 7400, y: 21300, size: 195},
  2947. {type: 1, x: 3500, y: 21000, size: 45},
  2948. {type: 2, x: 5000, y: 20500, size: 35},
  2949. {type: 3, x: 3700, y: 20600, size: 29},
  2950. // r2
  2951. {type: 0, x: 14000, y: 22000, size: 195},
  2952. {type: 1, x: 11000, y: 21000, size: 29},
  2953. {type: 2, x: 11300, y: 20900, size: 35},
  2954. {type: 2, x: 12000, y: 21200, size: 35},
  2955. {type: 2, x: 12600, y: 20900, size: 35},
  2956. {type: 3, x: 12800, y: 20500, size: 29},
  2957. // r2 (2nd?)
  2958. {type: 0, x: 22000, y: 21500, size: 195},
  2959. {type: 2, x: 21300, y: 21000, size: 35}
  2960. ],
  2961. bots: 1
  2962. },
  2963. 5: { // SPLITRUN
  2964. entities: [
  2965. // A1
  2966. {type: 1, x: 2500, y: 2500, size: 45},
  2967. // r1
  2968. {type: 0, x: 3400, y: 15300, size: 195},
  2969. {type: 1, x: 2500, y: 15000, size: 45},
  2970. {type: 2, x: 3000, y: 14500, size: 35},
  2971. {type: 3, x: 2700, y: 14600, size: 29},
  2972. // r2
  2973. {type: 0, x: 12000, y: 15500, size: 195},
  2974. {type: 1, x: 11000, y: 15000, size: 29},
  2975. {type: 2, x: 12600, y: 14900, size: 35},
  2976. {type: 2, x: 11300, y: 14900, size: 35},
  2977. {type: 2, x: 12000, y: 15200, size: 35},
  2978. {type: 3, x: 12800, y: 14500, size: 29}
  2979. ]
  2980. },
  2981. 6: { // XINSTA
  2982. ejPortalMass: 12,
  2983. r1Id: 1,
  2984. r2Id: 6,
  2985. r1StartMass: 500,
  2986. r2StartMass: 500,
  2987. entities: [
  2988. // A1
  2989. {type: 1, x: 2500, y: 2500, size: 45},
  2990. // r1
  2991. {type: 0, x: 3400, y: 26300, size: 195},
  2992. {type: 1, x: 2500, y: 26000, size: 45},
  2993. {type: 2, x: 3000, y: 25500, size: 45},
  2994. {type: 3, x: 2700, y: 25600, size: 29},
  2995. // r2
  2996. {type: 0, x: 15000, y: 26500, size: 195},
  2997. {type: 1, x: 14000, y: 26000, size: 29},
  2998. {type: 2, x: 14300, y: 25900, size: 45},
  2999. {type: 2, x: 15000, y: 26200, size: 45},
  3000. {type: 2, x: 15600, y: 25900, size: 45},
  3001. {type: 3, x: 15800, y: 25500, size: 29}
  3002. ], bots: 6
  3003. },
  3004. 7: { // XY
  3005. entities: [
  3006. // A1
  3007. {type: 1, x: 2500, y: 2500, size: 45},
  3008. // r1
  3009. {type: 0, x: 3400, y: 15300, size: 195},
  3010. {type: 1, x: 2500, y: 15000, size: 45},
  3011. {type: 2, x: 3000, y: 14500, size: 35},
  3012. {type: 3, x: 2700, y: 14600, size: 29},
  3013. // r2
  3014. {type: 0, x: 12000, y: 15500, size: 195},
  3015. {type: 1, x: 11000, y: 15000, size: 29},
  3016. {type: 2, x: 11300, y: 14900, size: 35},
  3017. {type: 2, x: 12000, y: 15200, size: 35},
  3018. {type: 2, x: 12600, y: 14900, size: 35},
  3019. {type: 3, x: 12800, y: 14500, size: 29}
  3020. ], bots: 5
  3021. },
  3022. 8: { // INSTANT EU
  3023. entities: [
  3024. // A1
  3025. {type: 1, x: 2500, y: 2500, size: 45},
  3026. // r1
  3027. {type: 0, x: 3400, y: 15300, size: 195},
  3028. {type: 1, x: 2500, y: 15000, size: 45},
  3029. {type: 2, x: 3000, y: 14500, size: 35},
  3030. {type: 3, x: 2700, y: 14600, size: 29},
  3031. // r2
  3032. {type: 0, x: 12000, y: 15500, size: 195},
  3033. {type: 1, x: 11000, y: 15000, size: 29},
  3034. {type: 2, x: 11300, y: 14900, size: 35},
  3035. {type: 2, x: 12000, y: 15200, size: 35},
  3036. {type: 2, x: 12600, y: 14900, size: 35},
  3037. {type: 3, x: 12800, y: 14500, size: 29}
  3038. ]
  3039. },
  3040. 9: { // CR EU
  3041. entities: [
  3042. // A1
  3043. {type: 1, x: 2500, y: 2500, size: 45},
  3044. // r1
  3045. {type: 0, x: 3400, y: 27300, size: 195},
  3046. {type: 1, x: 2500, y: 27000, size: 45},
  3047. {type: 2, x: 3000, y: 26500, size: 35},
  3048. {type: 3, x: 2700, y: 26600, size: 29},
  3049. // r2
  3050. {type: 0, x: 12000, y: 27500, size: 195},
  3051. {type: 1, x: 11000, y: 27000, size: 29},
  3052. {type: 2, x: 11300, y: 26900, size: 35},
  3053. {type: 2, x: 12000, y: 27200, size: 35},
  3054. {type: 2, x: 12600, y: 26900, size: 35},
  3055. {type: 3, x: 12800, y: 26500, size: 29}
  3056. ], bots: 8
  3057. },
  3058. 11: { // GIGANTIC 1
  3059. entities: [
  3060. {type: 1, x: 2500, y: 2500, size: 45},
  3061. {type: 3, x: 5000, y: 33000, size: 45},
  3062. {type: 1, x: 18000, y: 18000, size: 45},
  3063. {type: 3, x: 24000, y: 12000, size: 45}
  3064. ],
  3065. serverType: "gigantic"
  3066. },
  3067. 12: { // GIANT NA
  3068. entities: [
  3069. {type: 1, x: 2500, y: 2500, size: 45},
  3070. {type: 3, x: 5000, y: 33000, size: 45},
  3071. {type: 1, x: 18000, y: 18000, size: 45},
  3072. {type: 3, x: 24000, y: 12000, size: 45}
  3073. ],
  3074. serverType: "gigantic"
  3075. },
  3076. 13: { // SS EU
  3077. ejPortalMass: 13.5,
  3078. r1Id: 12, //Lower room
  3079. r2Id: 11,
  3080. r1StartMass: 500,
  3081. r2StartMass: 500,
  3082. entities: [
  3083. // r1
  3084. {type: 0, x: 1500, y: 27500, size: 195},
  3085. {type: 1, x: 14000, y: 32000, size: 45},
  3086. {type: 3, x: 13200, y: 33500, size: 45},
  3087. {type: 4, x: 12500, y: 32200, size: 142},
  3088. {type: 4, x: 14500, y: 32200, size: 142},
  3089. // r2
  3090. {type: 0, x: 16000, y: 33500, size: 195},
  3091. {type: 1, x: 500, y: 24000, size: 45},
  3092. {type: 3, x: 2500, y: 24000, size: 45},
  3093. {type: 4, x: 900, y: 22000, size: 142},
  3094. {type: 4, x: 500, y: 15000, size: 224},
  3095. // r3 (?)
  3096. {type: 4, x: 1200, y: 5500, size: 224},
  3097. {type: 4, x: 2000, y: 3000, size: 224},
  3098. {type: 4, x: 4000, y: 6000, size: 224},
  3099. {type: 4, x: 4500, y: 3000, size: 224},
  3100. // on map
  3101. {type: 4, x: 8000, y: 3500, size: 224},
  3102. {type: 4, x: 10000, y: 4500, size: 224},
  3103. {type: 4, x: 16000, y: 3000, size: 224},
  3104. {type: 4, x: 15400, y: 2400, size: 224},
  3105. {type: 4, x: 7500, y: 19000, size: 224},
  3106. {type: 4, x: 19200, y: 14000, size: 224},
  3107. {type: 4, x: 24400, y: 24000, size: 224},
  3108. {type: 4, x: 17500, y: 14000, size: 142},
  3109. {type: 4, x: 30000, y: 16000, size: 142}
  3110. ],
  3111. serverType: "supersonic"
  3112. },
  3113. 14: { // SS NA
  3114. ejPortalMass: 13.5,
  3115. r1Id: 12, //Lower room
  3116. r2Id: 11,
  3117. r1StartMass: 500,
  3118. r2StartMass: 500,
  3119. entities: [
  3120. // r1
  3121. {type: 0, x: 1500, y: 27500, size: 195},
  3122. {type: 1, x: 14000, y: 32000, size: 45},
  3123. {type: 3, x: 13200, y: 33500, size: 45},
  3124. {type: 4, x: 12500, y: 32200, size: 142},
  3125. {type: 4, x: 14500, y: 32200, size: 142},
  3126. // r2
  3127. {type: 0, x: 16000, y: 33500, size: 195},
  3128. {type: 1, x: 500, y: 24000, size: 45},
  3129. {type: 3, x: 2500, y: 24000, size: 45},
  3130. {type: 4, x: 900, y: 22000, size: 142},
  3131. {type: 4, x: 500, y: 15000, size: 224},
  3132. // r3 (?)
  3133. {type: 4, x: 1200, y: 5500, size: 224},
  3134. {type: 4, x: 2000, y: 3000, size: 224},
  3135. {type: 4, x: 4000, y: 6000, size: 224},
  3136. {type: 4, x: 4500, y: 3000, size: 224},
  3137. // on map
  3138. {type: 4, x: 8000, y: 3500, size: 224},
  3139. {type: 4, x: 10000, y: 4500, size: 224},
  3140. {type: 4, x: 16000, y: 3000, size: 224},
  3141. {type: 4, x: 15400, y: 2400, size: 224},
  3142. {type: 4, x: 7500, y: 19000, size: 224},
  3143. {type: 4, x: 19200, y: 14000, size: 224},
  3144. {type: 4, x: 24400, y: 24000, size: 224},
  3145. {type: 4, x: 17500, y: 14000, size: 142},
  3146. {type: 4, x: 30000, y: 16000, size: 142}
  3147. ],
  3148. serverType: "supersonic"
  3149. },
  3150. 16: { // BR NA
  3151. entities: [],
  3152. bots: 7
  3153. },
  3154. 17: { // CR AS
  3155. entities: [
  3156. // A1
  3157. {type: 1, x: 2500, y: 2500, size: 45},
  3158. // r1
  3159. {type: 0, x: 3400, y: 27300, size: 195},
  3160. {type: 1, x: 2500, y: 27000, size: 45},
  3161. {type: 2, x: 3000, y: 26500, size: 35},
  3162. {type: 3, x: 2700, y: 26600, size: 29},
  3163. // r2
  3164. {type: 0, x: 12000, y: 27500, size: 195},
  3165. {type: 1, x: 11000, y: 27000, size: 29},
  3166. {type: 2, x: 11300, y: 26900, size: 35},
  3167. {type: 2, x: 12000, y: 27200, size: 35},
  3168. {type: 2, x: 12600, y: 26900, size: 35},
  3169. {type: 3, x: 12800, y: 26500, size: 29}
  3170. ]
  3171. },
  3172. 18: { // GIGA 1
  3173. entities: [
  3174. {type: 1, x: 2500, y: 2500, size: 45},
  3175. {type: 3, x: 5000, y: 33000, size: 45},
  3176. {type: 1, x: 18000, y: 18000, size: 45},
  3177. {type: 3, x: 24000, y: 12000, size: 45}
  3178. ],
  3179. serverType: "gigantic"
  3180. },
  3181. 19: { // GIGANTIC 2
  3182. entities: [
  3183. {type: 1, x: 2500, y: 2500, size: 45},
  3184. {type: 3, x: 5000, y: 33000, size: 45},
  3185. {type: 1, x: 18000, y: 18000, size: 45},
  3186. {type: 3, x: 24000, y: 12000, size: 45}
  3187. ],
  3188. serverType: "gigantic"
  3189. },
  3190. 20: { // CR NA
  3191. entities: [
  3192. // A1
  3193. {type: 1, x: 2500, y: 2500, size: 45},
  3194. // r1
  3195. {type: 0, x: 3400, y: 27300, size: 195},
  3196. {type: 1, x: 2500, y: 27000, size: 45},
  3197. {type: 2, x: 3000, y: 26500, size: 35},
  3198. {type: 3, x: 2700, y: 26600, size: 29},
  3199. // r2
  3200. {type: 0, x: 12000, y: 27500, size: 195},
  3201. {type: 1, x: 11000, y: 27000, size: 29},
  3202. {type: 2, x: 11300, y: 26900, size: 35},
  3203. {type: 2, x: 12000, y: 27200, size: 35},
  3204. {type: 2, x: 12600, y: 26900, size: 35},
  3205. {type: 3, x: 12800, y: 26500, size: 29}
  3206. ]
  3207. },
  3208. 21: { // EU SF BR
  3209. entities: [],
  3210. bots: 7
  3211. },
  3212. 23: { // GIGANTIC 3
  3213. entities: [
  3214. {type: 1, x: 2500, y: 2500, size: 45},
  3215. {type: 3, x: 5000, y: 33000, size: 45},
  3216. {type: 1, x: 18000, y: 18000, size: 45},
  3217. {type: 3, x: 24000, y: 12000, size: 45}
  3218. ],
  3219. serverType: "gigantic"
  3220. },
  3221. 24: { // GIGANTIC 4
  3222. entities: [
  3223. {type: 1, x: 2500, y: 2500, size: 45},
  3224. {type: 3, x: 5000, y: 33000, size: 45},
  3225. {type: 1, x: 18000, y: 18000, size: 45},
  3226. {type: 3, x: 24000, y: 12000, size: 45}
  3227. ],
  3228. serverType: "gigantic"
  3229. },
  3230. 25: { // GIANT 2 NA
  3231. entities: [
  3232. {type: 1, x: 2500, y: 2500, size: 45},
  3233. {type: 3, x: 5000, y: 33000, size: 45},
  3234. {type: 1, x: 18000, y: 18000, size: 45},
  3235. {type: 3, x: 24000, y: 12000, size: 45}
  3236. ],
  3237. serverType: "gigantic"
  3238. },
  3239. 26: { // GIGA 2
  3240. entities: [
  3241. {type: 1, x: 2500, y: 2500, size: 45},
  3242. {type: 3, x: 5000, y: 33000, size: 45},
  3243. {type: 1, x: 18000, y: 18000, size: 45},
  3244. {type: 3, x: 24000, y: 12000, size: 45}
  3245. ],
  3246. serverType: "gigantic"
  3247. },
  3248. 37: { // MEGASPLIT EU
  3249. entities: [],
  3250. bots: 25
  3251. },
  3252. 38: { // Solo Agf
  3253. ejPortalMass: 12,
  3254. r1Id: 1,
  3255. r2Id: 6,
  3256. r1StartMass: 500,
  3257. r2StartMass: 400,
  3258. entities: [
  3259. // A1
  3260. {type: 1, x: 2500, y: 2500, size: 45},
  3261. // room 1
  3262. {type: 0, x: 3500, y: 11500, size: 195},
  3263. {type: 1, x: 2500, y: 11500, size: 45},
  3264. {type: 2, x: 3000, y: 11000, size: 35},
  3265. {type: 3, x: 2700, y: 11100, size: 29},
  3266. // room 2
  3267. {type: 0, x: 9000, y: 11800, size: 180},
  3268. {type: 1, x: 8200, y: 10500, size: 29},
  3269. {type: 2, x: 8300, y: 10900, size: 35},
  3270. {type: 2, x: 9000, y: 11200, size: 35},
  3271. {type: 2, x: 9600, y: 10900, size: 35},
  3272. {type: 3, x: 9800, y: 10500, size: 29}
  3273. ], bots: 9
  3274. },
  3275. 39: { // MEGASPLIT AS
  3276. entities: [
  3277. ],
  3278. bots: 12
  3279. },
  3280. 40: { // INFECTION EU
  3281. entities: [],
  3282. bots: 15
  3283. },
  3284. 41: { // INFECTION NA
  3285. entities: [],
  3286. bots: 20
  3287. },
  3288. 42: { // GIANT 3 NA
  3289. entities: [
  3290. {type: 1, x: 2500, y: 2500, size: 45},
  3291. {type: 3, x: 5000, y: 33000, size: 45},
  3292. {type: 1, x: 18000, y: 18000, size: 45},
  3293. {type: 3, x: 24000, y: 12000, size: 45}
  3294. ],
  3295. serverType: "gigantic"
  3296. },
  3297. 43: { // Instant AS
  3298. entities: [
  3299. // A1
  3300. {type: 1, x: 2500, y: 2500, size: 45},
  3301. // r1
  3302. {type: 0, x: 3400, y: 15300, size: 195},
  3303. {type: 1, x: 2500, y: 15000, size: 45},
  3304. {type: 2, x: 3000, y: 14500, size: 35},
  3305. {type: 3, x: 2700, y: 14600, size: 29},
  3306. // r2
  3307. {type: 0, x: 12000, y: 15500, size: 195},
  3308. {type: 1, x: 11000, y: 15000, size: 29},
  3309. {type: 2, x: 11300, y: 14900, size: 35},
  3310. {type: 2, x: 12000, y: 15200, size: 35},
  3311. {type: 2, x: 12600, y: 14900, size: 35},
  3312. {type: 3, x: 12800, y: 14500, size: 29}
  3313. ], bots: 3
  3314. }
  3315. };
  3316.  
  3317. 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];
  3318. let currentServerId = 0;
  3319.  
  3320. function getServerValue(value) {
  3321. return (svInfo[currentServerId] && svInfo[currentServerId][value]) ? svInfo[currentServerId][value] : svInfo.default[value]
  3322. }
  3323.  
  3324. try{
  3325. for(let { isCurrent, id } of JSON.parse(localStorage.gameservers)){
  3326. if(isCurrent) currentServerId = id;
  3327. }
  3328. } catch {console.warn("FSFB: Failed to grab current server id.")};
  3329.  
  3330. // setTimeout(() => {
  3331. // svSwitch = true;
  3332. // }, 250);
  3333.  
  3334. function setHideMinionSize() {
  3335. switch(getServerValue("serverType")){
  3336. case "gigantic":
  3337. hideMinionMaxSize = 120;
  3338. break;
  3339. case "supersonic":
  3340. hideMinionMaxSize = 150;
  3341. break;
  3342. case "normal":
  3343. hideMinionMaxSize = 80;
  3344. break;
  3345. default:
  3346. hideMinionMaxSize = 80;
  3347. break;
  3348. }
  3349. }
  3350. setHideMinionSize();
  3351.  
  3352. let ss = unsafeWindow.setserver;
  3353. unsafeWindow.setserver = (sv, sn) => {
  3354. playerAlive = false;
  3355. setHideMinionSize();
  3356. r1Portal.portal = null;
  3357. r2Portal.portal = null;
  3358. svSwitch = true;
  3359. ss(sv, sn);
  3360. if(sn) currentServerId = sn.includes('AS | Instant') ? 43 : +sv.match(/(?<=s)\d+(?=\.agma\.io)/gm)?.[0];
  3361. }
  3362.  
  3363. function createCell(posX, posY, type, nSize){
  3364. if(!cellProto) return null;
  3365.  
  3366. let color,
  3367. colorDimmed = "#FFFFFF",
  3368. size = 0,
  3369. imageId = 0,
  3370. spikes = null;
  3371.  
  3372. switch(type){
  3373. case 0:
  3374. color = "#622373";
  3375. colorDimmed = "#4e1c5c";
  3376. size = nSize ? nSize : 200;
  3377. imageId = 1;
  3378. break;
  3379. case 1:
  3380. color = "#ff0000";
  3381. colorDimmed = "#cc0001";
  3382. size = nSize ? nSize : 32;
  3383. spikes = {x: posX, y: posY, s: size, p: size};
  3384. imageId = 2;
  3385. break;
  3386. case 2:
  3387. color = "#76ff54";
  3388. colorDimmed = "#66b319";
  3389. size = nSize ? nSize : 35;
  3390. imageId = 3;
  3391. break;
  3392. case 3:
  3393. color = "#ffd000";
  3394. colorDimmed = "#ccb300";
  3395. size = nSize ? nSize : 32;
  3396. spikes = {x: posX, y: posY, s: size, p: size};
  3397. imageId = 4;
  3398. break;
  3399. case 4:
  3400. color = "#00a2e8";
  3401. colorDimmed = "#0081b9";
  3402. size = nSize ? nSize : 150;
  3403. imageId = 5;
  3404. break;
  3405. default:
  3406. color = "#FFFFFF";
  3407. size = 500;
  3408. };
  3409.  
  3410. let cell = new cellProto.constructor();
  3411.  
  3412. cell[prop[41]] = imageId;
  3413. cell[prop[19]] = null;
  3414. cell[prop[50]] = 0;
  3415. cell[prop[40]] = spikes ? 1 : 0;
  3416. cell[prop[26]] = null;
  3417. cell[prop[52]] = false;
  3418. cell[prop[53]] = false;
  3419. cell[prop[39]] = [];
  3420. cell[prop[57]] = 0;
  3421. cell[prop[45]] = false;
  3422. cell[prop[37]] = true;
  3423. cell[prop[24]] = null; // name cache
  3424. cell[prop[44]] = false;
  3425. cell[prop[56]] = false;
  3426. cell[prop[47]] = false;
  3427. cell[prop[25]] = null;
  3428. cell[prop[35]] = Date.now();
  3429. cell[prop[51]] = 0;
  3430. cell[prop[42]] = null;
  3431. cell.clanCache = null;
  3432. cell.clanPart = null;
  3433. cell.color = color;
  3434. cell[prop[46]] = 69;
  3435. cell[prop[38]] = spikes;
  3436. cell[prop[33]] = 1;
  3437. cell[prop[36]] = 0;
  3438. cell[prop[31]] = posX;
  3439. cell[prop[32]] = posY;
  3440. cell[prop[3]] = 0;
  3441. cell.id = 1e9;
  3442. cell[prop[21]] = null;
  3443. cell[prop[20]] = null;
  3444. cell.massCache = null;
  3445. cell[prop[11]] = size;
  3446. cell.nSize = size;
  3447. cell.name = null;
  3448. cell.namePart = null;
  3449. cell.nameSize = 0;
  3450. cell.oid = 0;
  3451. cell.ox = posX;
  3452. cell.oy = posY;
  3453. cell[prop[58]] = 0;
  3454. cell.rotation = 0;
  3455. cell.shape = 0;
  3456. cell.size = size;
  3457. cell.skinId = 0;
  3458. cell.strokeSize = size + 4;
  3459. cell.textDrawn = null;
  3460. cell.transform = null;
  3461. cell[prop[18]] = true;
  3462. cell[prop[2]] = colorDimmed ? colorDimmed : dimmColor(color);
  3463. cell[prop[17]] = null;
  3464. cell.x = posX;
  3465. cell[prop[23]] = null;
  3466. cell.y = posY;
  3467. cell[prop[22]] = null;
  3468. cell[prop[54]] = false;
  3469. cell[prop[34]] = Date.now();
  3470. cell[prop[55]] = true;
  3471. return cell;
  3472. }
  3473.  
  3474.  
  3475. const nameColors = {}, nameStrokes = {};
  3476.  
  3477. let nameToIdMap = {};
  3478. let defaultColorsAmnt = 1;
  3479. let colorIntComplete = false;
  3480. let addedStrokeColors = false;
  3481.  
  3482. function contrastColor(hex){
  3483. let r = parseInt(hex.substring(1, 3), 16) / 255;
  3484. let g = parseInt(hex.substring(3, 5), 16) / 255;
  3485. let b = parseInt(hex.substring(5, 7), 16) / 255;
  3486.  
  3487. let max = Math.max(r, g, b), min = Math.min(r, g, b);
  3488. let h, s, l = (max + min) / 2;
  3489.  
  3490. if(max == min){
  3491. h = s = 0; // achromatic
  3492. } else {
  3493. let d = max - min;
  3494. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  3495. switch(max){
  3496. case r: h = (g - b) / d + (g < b ? 6 : 0); break;
  3497. case g: h = (b - r) / d + 2; break;
  3498. case b: h = (r - g) / d + 4; break;
  3499. }
  3500. h /= 6;
  3501. }
  3502.  
  3503. let darkInput = ((51 * (299 * r + g * 587 + b * 114)) / 200) <= 127;
  3504. l = darkInput ? Math.min(l + 0.3, 1) : Math.max(l - 0,4, 0);
  3505.  
  3506. return hslToHex(h * 360, s * 100, l * 100);
  3507. }
  3508.  
  3509.  
  3510. function customize(c){
  3511. Object.defineProperty(Array.prototype, "fsfb_was_here", {
  3512. get: function () {
  3513. if(this[1] === "#FFD700"){
  3514. defaultColorsAmnt = this.length;
  3515. nameColors.get = () => this;
  3516. nameColors.add = color => this.push(color);
  3517. nameColors.set = (index, color) => void(this[index] = color);
  3518. addedStrokeColors = true;
  3519. nameColors.add(settings.name_color[1].color);
  3520. return "#FFFFFF";
  3521. }
  3522. if(this[1] === "#5C4D00"){
  3523. nameStrokes.get = () => this;
  3524. nameStrokes.add = stroke => this.push(stroke);
  3525. nameStrokes.set = (index, color) => void(this[index] = color);
  3526. addedStrokeColors = true;
  3527. nameStrokes.add(settings.name_color[2].active ? settings.name_color[2].color : contrastColor(settings.name_color[1].color));
  3528. return "#000000";
  3529. }
  3530. return "#FFFFFF"; // ¯\_(ツ)_/¯
  3531. }
  3532. });
  3533. // customize cell stuff
  3534. cellProto = Object.getPrototypeOf(c);
  3535. uisdoa && (unsafeWindow.__cellProto = cellProto);
  3536. // this should stay independent unless sora changes the structure of cell class
  3537. const methods = [];
  3538. let a = c;
  3539. while (a = Reflect.getPrototypeOf(a)) {
  3540. const keys = Reflect.ownKeys(a);
  3541. keys.forEach((k) => methods.push(k));
  3542. }
  3543.  
  3544. let dc_fn_name = methods[7];
  3545. let dc = cellProto[dc_fn_name];
  3546. Object.defineProperty(cellProto, '_drCl', { value: dc });
  3547. Object.defineProperty(cellProto, dc_fn_name, { value: function(){
  3548. if(!customCells && !customCellsChanged && !antilagCells) return dc.apply(this, arguments);
  3549.  
  3550. let cell = this,
  3551. cT = cell.c$,
  3552. cellColor = cell.color;
  3553.  
  3554.  
  3555. if (antilagCells && (cT === 0 || cT === 3) &&
  3556. (settings.anti_lag[0].active && cell[prop[52]] && cell.nSize <= hideMinionMaxSize) ||
  3557. (cT === 3 && (settings.anti_lag[2].active || (settings.anti_lag[3].active && !cell[prop[37]])) && cell.color !== "#000101")){
  3558. return (cell.hidden = true);
  3559. } else if(cell.hidden){
  3560. cell.hidden = false;
  3561. }
  3562.  
  3563. if(cT === 0 && !('oType' in cell)){ // second makes sure that the type wasnt changed to playerCell (mothercell showmass)
  3564. // * --- name color --- *
  3565. if(!addedStrokeColors){
  3566. cell.oNameColorId = cell[prop[51]];
  3567. cell[prop[51]] = "fsfb_was_here";
  3568. } else if(!colorIntComplete && cell[prop[51]] === "fsfb_was_here"){
  3569. cell[prop[51]] = cell.oNameColorId;
  3570. colorIntComplete = true;
  3571. }
  3572.  
  3573. if(addedStrokeColors && (pubNameSwitch || settings.name_color[0].active) && !cell[prop[52]] && / (?:\W{3}|\W{6}) /gmi.test(cell?.clanPart)){
  3574. let supposedColorId = nameToIdMap?.[cell.clanPart];
  3575. if(pubNameSwitch && decodeCustomNameColor(cell.clanPart, 0) != null){
  3576. // TODO: To get actual color check which box is active (getting by property is more complicated)
  3577. cell[prop[51]] = 0; // ? atm reverts to 0
  3578. } else if(supposedColorId){
  3579. cell[prop[51]] = supposedColorId;
  3580. } else {
  3581. let color_id = decodeCustomNameColor(cell.clanPart, 0);
  3582. let stroke_id = decodeCustomNameColor(cell.clanPart, 1);
  3583. let brevName = cell.clanPart.length === 5;
  3584. if(color_id != null && (brevName || stroke_id != null)){
  3585. nameToIdMap = {...nameToIdMap, ...{[cell.clanPart]: nameColors.get().length}}
  3586.  
  3587. cell[prop[51]] = nameColors.get().length;
  3588.  
  3589. nameColors.add(getColorById(color_id));
  3590. nameStrokes.add(brevName ? contrastColor(getColorById(color_id)) : getColorById(stroke_id));
  3591. };
  3592. }
  3593. }
  3594.  
  3595. if(cell[prop[52]]){
  3596. if(settings.anti_lag[1].active){
  3597. cell[prop[18]] = false;
  3598. }
  3599. }
  3600.  
  3601. if(settings.theme_boxes[1].active){
  3602. if(!('oOwnCell' in cell)) cell.oOwnCell = cell[prop[45]];
  3603. cell[prop[45]] = true;
  3604. }
  3605.  
  3606. if(settings.theme_boxes[6].active){
  3607. if(!('oSpiked' in cell)) cell.oSpiked = cell[prop[56]];
  3608. cell[prop[56]] = settings.theme_boxes[6].active;
  3609. } else if('oSpiked' in cell){
  3610. cell[prop[56]] = cell.oSpiked;
  3611. }
  3612.  
  3613.  
  3614. if(onlyCells || customCellsChanged){
  3615. if(!settings.name_color[0].active && settings.name_color[1].active && addedStrokeColors && (!("oOwnCell" in cell) ? cell[prop[45]] : cell.oOwnCell)){
  3616. cell[prop[51]] = defaultColorsAmnt;
  3617. }
  3618. if(settings.theme_boxes[2].active){
  3619. if(!('oHasImage' in cell)) cell.oHasImage = cell[prop[18]];
  3620. cell[prop[18]] = (!("oOwnCell" in cell) ? cell[prop[45]] : cell.oOwnCell) ? cell[prop[18]] : false;
  3621.  
  3622. } else if(settings.theme_boxes[3].active){
  3623. if(!('oHasImage' in cell)) cell.oHasImage = cell[prop[18]];
  3624. cell[prop[18]] = cell[prop[53]] ? cell[prop[18]] : false;
  3625.  
  3626. } else if('oHasImage' in cell){
  3627. cell[prop[18]] = cell.oHasImage;
  3628. }
  3629.  
  3630. if(settings.theme_boxes[4].active){
  3631. if(!('oName' in cell)) cell.oName = cell.name;
  3632. cell.name = (!("oOwnCell" in cell) ? cell[prop[45]] : cell.oOwnCell) ? cell.name : "";
  3633.  
  3634. } else if(settings.theme_boxes[5].active){
  3635. if(!('oName' in cell)) cell.oName = cell.name;
  3636. cell.name = cell[prop[53]] ? cell.name : "";
  3637.  
  3638. } else if('oName' in cell){
  3639. cell.name = cell.oName;
  3640. }
  3641. }
  3642. } else if(cT === 1){
  3643. if(!('oSize' in cell)) cell.oSize = cell.nSize; // food normally doesnt have an oSize; ensures that mothercell food is correct
  3644. if(foodSizeOn){
  3645. cell.nSize = cell.oSize * settings.uiScaling[1].level;
  3646. cell.size = cell.oSize * settings.uiScaling[1].level;
  3647. } else if(customCellsChanged) {
  3648. cell.size = cell.oSize;
  3649. cell.nSize = cell.oSize;
  3650. }
  3651. if(settings.theme[0].active){
  3652. if(!('oColor' in cell)) cell.oColor = cell.color;
  3653. cell.color = settings.theme[0].color;
  3654. } else if('oColor' in cell){
  3655. cell.color = cell.oColor;
  3656. }
  3657. } else if(cT === 2){
  3658. if(settings.theme[1].active){
  3659. if(!('oColor' in cell)) cell.oColor = cell.color;
  3660. cell.color = settings.theme[1].color;
  3661. } else if('oColor' in cell){
  3662. cell.color = cell.oColor;
  3663. }
  3664. if(settings.theme[1].active || settings.theme[2].active){ // dimmed color / stroke
  3665. if(!('oColorDimmed' in cell)) cell.oColorDimmed = cell[prop[2]];
  3666. cell[prop[2]] = settings.theme[2].active ? settings.theme[2].color : settings.theme_boxes[0].active && agmaSettings.sBubbleCells ? 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
  3667. } else if('oColorDimmed' in cell){
  3668. cell[prop[2]] = cell.oColorDimmed;
  3669. }
  3670. } else if(cT === 9){
  3671. if(settings.theme[3].active){
  3672. if(!('oColor' in cell)) cell.oColor = cell.color;
  3673. cell.color = settings.theme[3].color;
  3674. } else if('oColor' in cell){
  3675. cell.color = cell.oColor;
  3676. }
  3677. if(settings.theme[3].active || settings.theme[4].active){ // dimmed color / stroke
  3678. if(!('oColorDimmed' in cell)) cell.oColorDimmed = cell[prop[2]];
  3679. cell[prop[2]] = settings.theme[4].active ? settings.theme[4].color : settings.theme_boxes[0].active && agmaSettings.sBubbleCells ? settings.theme[3].color : dimmColor(settings.theme[3].color);
  3680. } else if('oColorDimmed' in cell){
  3681. cell[prop[2]] = cell.oColorDimmed;
  3682. }
  3683.  
  3684. if(settings.checkboxes[9].active){
  3685. cell[prop[46]] = 0;
  3686. cell.oType = 9;
  3687. cell[prop[45]] = true;
  3688. cell.oOwnCell = false;
  3689. dc.apply(this, arguments);
  3690. cell[prop[46]] = 9;
  3691. return;
  3692. }
  3693. }
  3694. return dc.apply(this, arguments);
  3695. }});
  3696.  
  3697.  
  3698. Object.defineProperty(cellProto, prop[46], {
  3699. get: function() {
  3700. return this.c$;
  3701. },
  3702. set: function(val) {
  3703. if((val === 0 || val === 3) && this.color === "#000000"){
  3704. this.color = "#000101";
  3705. } else if(val === 0 && this.color === "#622373"){
  3706. this.color = "#622374"; // give purple cells a slightly diff color to make them detectable in .stroke fn
  3707. }
  3708. this.c$ = val;
  3709. }
  3710. });
  3711.  
  3712. customDc = true;
  3713. }
  3714.  
  3715. function dimmColor(color) {
  3716. var r = (Math.floor(parseInt(color.substring(1, 3), 16) * 0.5)).toString(16),
  3717. g = (Math.floor(parseInt(color.substring(3, 5), 16) * 0.5)).toString(16),
  3718. b = (Math.floor(parseInt(color.substring(5, 7), 16) * 0.5)).toString(16);
  3719. if (r.length === 1) r = "0" + r;
  3720. if (g.length === 1) g = "0" + g;
  3721. if (b.length === 1) b = "0" + b;
  3722. return "#" + r + g + b
  3723. }
  3724.  
  3725. const newSortFunc = function(oldFunc){
  3726. if(settings.theme_boxes[8].active){
  3727. return function(a, b){
  3728. const oldFuncApplied = oldFunc.apply(this, arguments),
  3729. aVal = a.c$,
  3730. bVal = b.c$;
  3731. return ((settings.theme_boxes[7].active ? -oldFuncApplied : oldFuncApplied) > 0 || aVal === 4) && bVal !== 4 ? 1 : aVal === 4 && bVal === 4 ? 0 : -1;
  3732. }
  3733. } else if(settings.theme_boxes[7].active){
  3734. return function(a, b){
  3735. return -oldFunc.apply(this, arguments);
  3736. }
  3737. } else {
  3738. return oldFunc;
  3739. }
  3740. }
  3741.  
  3742. const _sort = Array.prototype.sort;
  3743. Array.prototype.sort = function(oldFunc) {
  3744. return oldFunc == null || typeof this[0]?.color !== "string" ? _sort.apply(this, arguments) : _sort.call(this, newSortFunc(oldFunc));
  3745. }
  3746.  
  3747.  
  3748. var UA = navigator.userAgent;
  3749. var googleDomain = "translate.google.com";
  3750. var dictURL = "https://" + googleDomain + "/translate_a/single?client=t";
  3751.  
  3752. function init_google_value_tk() {
  3753. var url = "https://" + googleDomain + "/translate_a/element.js";
  3754. GM_xmlhttpRequest({
  3755. method: "GET",
  3756. url: url,
  3757. onreadystatechange: function(resp) {
  3758. if (resp.readyState == 4) {
  3759. clearTimeout(setTimeout(function() {
  3760. this.abort();
  3761. }, 2000));
  3762. if (resp.status == 200) {
  3763. init_google_value_tk_parse(resp.responseText);
  3764. }
  3765. }
  3766. }
  3767. });
  3768. }
  3769.  
  3770. function init_google_value_tk_parse(responseText) {
  3771. var res = /c\._ctkk='(.+?)'/i.exec(responseText);
  3772. if (res != null) {
  3773. setStorage('google_value_tk', res[1]);
  3774. };
  3775. }
  3776.  
  3777. const Request = async(txt, sl = 'auto', tl = 'auto') => {
  3778. return new Promise((resolve, reject) => {
  3779. function parse(gTradStringArray) {
  3780. var arr = JSON.parse(gTradStringArray);
  3781. var translation = '';
  3782. for (let i = 0; i < arr[0].length; i++) {
  3783. if (typeof arr[0][i][0] != 'undefined' && arr[0][i][0] != null) translation += arr[0][i][0];
  3784. }
  3785. resolve(translation);
  3786. }
  3787. var tk = googleTK(txt);
  3788. var Url = dictURL +
  3789. "&hl=auto" +
  3790. "&sl=" + sl + "&tl=" + tl +
  3791. "&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" +
  3792. "&tk=" + tk +
  3793. "&q=" + encodeURI(txt);
  3794. var method = 'POST';
  3795. var Data = '';
  3796. var Hdr = {
  3797. "User-Agent": UA,
  3798. "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  3799. "Accept-Encoding": "gzip, deflate"
  3800. }
  3801. var Q = Url.split('&q=');
  3802. Url = Q[0];
  3803. Data = '&q=' + Q[1];
  3804. Hdr["Content-Length"] = Data.length + '';
  3805. Hdr["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
  3806. GM_xmlhttpRequest({
  3807. method: method,
  3808. url: Url,
  3809. data: Data,
  3810. headers: Hdr,
  3811. onload: function(resp) {
  3812. try {
  3813. parse(resp.responseText)
  3814. } catch (e) {
  3815. unsafeWindow.fsfbLogTranslateErrors && console.error("FSFB:", e);
  3816. resolve(null);
  3817. }
  3818. }
  3819. });
  3820. });
  3821. }
  3822.  
  3823. let dURIC = unsafeWindow.decodeURIComponent,
  3824. opt = [0x92933AFC, 0x75408D32];
  3825. unsafeWindow.decodeURIComponent = function(x){
  3826. if(x === "") x = opt[Math.round(Math.random())].toString();
  3827. return dURIC(x);
  3828. }
  3829.  
  3830. // return token for the new API
  3831. function googleTK(text) {
  3832. // view-source:https://translate.google.com/translate/releases/twsfe_w_20160620_RC00/r/js/desktop_module_main.js && TKK from HTML
  3833. var uM = getStorage('google_value_tk');
  3834. if (uM == 'undefined' || uM == null) {
  3835. init_google_value_tk();
  3836. uM = "427110.1469889687";
  3837. } else if (Number(uM.split('.')[0]) !== Math.floor(Date.now() / 3600000)) {
  3838. init_google_value_tk();
  3839. };
  3840. var cb = "&";
  3841. var k = "";
  3842. var Gf = "=";
  3843. var Vb = "+-a^+6";
  3844. var t = "a";
  3845. var Yb = "+";
  3846. var Zb = "+-3^+b+-f";
  3847. var jd = ".";
  3848. var sM = function(a) {
  3849. return function() {
  3850. return a
  3851. }
  3852. }
  3853. var tM = function(a, b) {
  3854. for (var c = 0; c < b.length - 2; c += 3) {
  3855. let d = b.charAt(c + 2);
  3856. d = d >= t ? d.charCodeAt(0) - 87 : Number(d);
  3857. d = b.charAt(c + 1) == Yb ? a >>> d : a << d;
  3858. a = b.charAt(c) == Yb ? a + d & 4294967295 : a ^ d
  3859. }
  3860. return a
  3861. };
  3862. var vM = function(a) {
  3863. var b;
  3864. if (null !== uM) {
  3865. b = uM;
  3866. } else {
  3867. b = sM(String.fromCharCode(84));
  3868. var c = sM(String.fromCharCode(75));
  3869. b = [b(), b()];
  3870. b[1] = c();
  3871. b = (uM = unsafeWindow[b.join(c())] || k) || k
  3872. }
  3873. let d = sM(String.fromCharCode(116));
  3874. c = sM(String.fromCharCode(107));
  3875. d = [d(), d()];
  3876. d[1] = c();
  3877. c = cb + d.join(k) + Gf;
  3878. d = b.split(jd);
  3879. b = Number(d[0]) || 0;
  3880.  
  3881. for (var e = [], f = 0, g = 0; g < a.length; g++) {
  3882. var m = a.charCodeAt(g);
  3883. 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)
  3884. }
  3885. a = b || 0;
  3886. for (f = 0; f < e.length; f++) {
  3887. a += e[f];
  3888. a = tM(a, Vb);
  3889. };
  3890. a = tM(a, Zb);
  3891. a ^= Number(d[1]) || 0;
  3892. 0 > a && (a = (a & 2147483647) + 2147483648);
  3893. a %= 1E6;
  3894. return a.toString() + jd + (a ^ b);
  3895. };
  3896. return vM(text);
  3897. }
  3898.  
  3899. let skinsArr, translatedCache = {}, entsAdded = false;
  3900.  
  3901. Array.prototype.push = function(){
  3902. if(this?.length && typeof this?.[0]?.approved === 'boolean' && typeof this?.[0]?.type === 'number' && typeof this?.[0]?.zIndex === 'undefined') skinsArr = this;
  3903. if(this?.length && typeof this?.[0]?.id === "number" && typeof this?.[0]?.color === "string"){
  3904. // if(customCells){
  3905. let cell = this[this.length - 1],
  3906. [pushedCell] = arguments;
  3907. if(!prop){
  3908. prop = Object.keys(cell);
  3909. uisdoa && (unsafeWindow.__prop = Object.keys(cell));
  3910. if(prop.length != 59 || prop[28] != "massCache"){
  3911. console.error("FSFB Scripts error, contact authors: ", prop.length, prop[28]);
  3912. }
  3913. }
  3914. if((pushedCell[prop[36]] && settings.anti_lag[4].active) || (settings.anti_lag[0].active && pushedCell.hidden)) return;
  3915.  
  3916. if(pushedCell.id === getServerValue("r1Id")){
  3917. r1Portal.portal = pushedCell;
  3918. } else if(pushedCell.id === getServerValue("r2Id")){
  3919. r2Portal.portal = pushedCell;
  3920. }
  3921. !customDc && customize(cell);
  3922.  
  3923. if(entsAdded && !settings.checkboxes[8].active){
  3924. for(let i = this.length - 1; i >= 0; --i) {
  3925. if(this[i].id == 1e9){
  3926. this.splice(i, 1);
  3927. entsAdded = false;
  3928. }
  3929. }
  3930. }
  3931. if((svSwitch || !entsAdded) && settings.checkboxes[8].active && this[0][prop[47]] && this.length > 1){
  3932. for(let i = 0; i < getServerValue("entities").length; i++){
  3933. let ent = getServerValue("entities")[i];
  3934. pushFn.apply(this, [createCell(ent.x, ent.y, ent.type, ent.size)]);
  3935. }
  3936. svSwitch = false;
  3937. entsAdded = true;
  3938. }
  3939. }
  3940.  
  3941. let applied = pushFn.apply(this, arguments);
  3942. if(this?.length && typeof this?.[0]?.message === 'string' && typeof this?.[0]?.name === 'string'){
  3943. chatmsgs = this;
  3944. let ns, translating;
  3945. if(arguments[0]?.message && !/[youaie](?!.: )/gmi.test(arguments[0].message)) Object.entries(cmap).forEach(([key, val]) => (arguments[0].message = arguments[0].message.replace(new RegExp(val, 'g'), key)));
  3946. (async() => {
  3947. if(settings.chat_translate[0].active && (settings.chat_translate[1].active || arguments[0][Object.keys(arguments[0])[0]])){
  3948. let originalMsg = arguments[0]?.untranslated ?? arguments[0].message,
  3949. 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);
  3950. 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}};
  3951. 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){
  3952. setTimeout(() => {
  3953. arguments[0].untranslated = originalMsg;
  3954. arguments[0].translatedLang = settings.chat_translate[3].set + settings.chat_translate[4].set;
  3955. arguments[0].showingOrig = settings.chat_translate[2].active;
  3956. arguments[0].message = settings.chat_translate[2].active ? originalMsg + ' [ ' + translatedMsg + ' ]' : translatedMsg;
  3957. arguments[0].filter = false;
  3958. arguments[0].cache = null;
  3959. }, 0);
  3960. }
  3961. } else { // change translate off
  3962. if('untranslated' in arguments[0] && arguments[0]?.untranslated != arguments[0].message){
  3963. setTimeout(() => {
  3964. arguments[0].message = arguments[0]?.untranslated;
  3965. arguments[0].translatedLang = 'none';
  3966. arguments[0].filter = false;
  3967. arguments[0].cache = null;
  3968. }, 0);
  3969. }
  3970. }
  3971. if(userPreferences.removeColorTagsInChat && /^\[(?:\W{3}|\W{6})\]/gmi.test(arguments[0].name) && decodeCustomNameColor(...arguments[0].name.match(/^\[(?:\W{3}|\W{6})\]/gmi), 0) != null) arguments[0].name = arguments[0].name.replace(/^\[(?:\W{3}|\W{6})\]/gmi, '');
  3972. if(arguments[0]?.cache && ([translating] = Object.keys(arguments[0]?.cache)?.filter(el => el.includes('ns')), ns = arguments[0]?.cache?.[translating], !!ns))[0,14].map(i => noPortalSvIdList[i]).forEach(i => ns.includes(i) && void(ns[ns.indexOf(i)] = invisUnicodeCharIds.indexOf(4448))); // poor contrast (causes eye strain) & confusing for new players
  3973. })();
  3974. }
  3975. return applied;
  3976. }
  3977. Array.prototype.splice = function(){
  3978. if(customCells && this.length && typeof this[0].id == "number" && typeof this[0].color == "string"){
  3979. let cell = this[arguments[0]];
  3980. if(cell == r1Portal.portal){
  3981. r1Portal.portal = null;
  3982. } else if(cell == r2Portal.portal){
  3983. r2Portal.portal = null;
  3984. }
  3985. }
  3986. return spliceFn.apply(this, arguments);
  3987. }
  3988.  
  3989.  
  3990. const brSetting = settings.theme[6];
  3991. const _fillStyleSetter = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype, 'fillStyle').set;
  3992.  
  3993. Object.defineProperty(CanvasRenderingContext2D.prototype, 'fillStyle', {
  3994. set: function(newFillStyle) {
  3995. if(brSetting.active
  3996. && newFillStyle === '#CC3030'){
  3997. newFillStyle = userPreferences.rainbowBrHazard ? hslToHex(Math.floor(Date.now() / userPreferences.rainbowBrHazardSpeed) % 360, 100, 50) : brSetting.color;
  3998. } else if(userPreferences.whiteBorder4BlackCells && newFillStyle === "#000101"){
  3999. this.strokeStyle = "#FFFFFF";
  4000. this.lineWidth = 12;
  4001. this.stroke();
  4002. }
  4003. _fillStyleSetter.call(this, newFillStyle);
  4004. }
  4005. });
  4006.  
  4007.  
  4008. const fillFn = CanvasRenderingContext2D.prototype.fill;
  4009. CanvasRenderingContext2D.prototype.fill = function() {
  4010. if(!fillCells) return fillFn.apply(this, arguments);
  4011. const { globalAlpha } = this;
  4012. let doStroke = true;
  4013. if(globalAlpha === .04){
  4014. switch(this.fillStyle){
  4015. case "#ff0000": // rec
  4016. this.strokeStyle = "#cc0001";
  4017. break;
  4018. case "#76ff54": // grw
  4019. this.strokeStyle = "#66b319";
  4020. break;
  4021. case "#ffd000": // spd
  4022. this.strokeStyle = "#ccb300";
  4023. break;
  4024. case "#00a2e8": // min pack
  4025. this.strokeStyle = "#0081b9";
  4026. break;
  4027. case "#622373": // portal
  4028. this.strokeStyle = "#4e1c5c";
  4029. break;
  4030. default:
  4031. doStroke = false;
  4032. };
  4033. if(doStroke){
  4034. this.globalAlpha = uisdoa?.o ?? .2;
  4035. this.lineWidth = 8;
  4036. this.stroke();
  4037. this.globalAlpha = uisdoa?.oo ?? .1;
  4038. this.shadowOffsetY = 1; // for f#&%ing curser lock
  4039. }
  4040. };
  4041. if(!doStroke && globalAlpha === 0.04 && settings.checkboxes[2].active){
  4042. this.strokeStyle = agmaSettings.sDark ? "#FFFFFF" : "#000000";
  4043. this.globalAlpha = 1;
  4044. this.lineWidth = 30;
  4045. this.stroke();
  4046. this.globalAlpha = 0.04;
  4047. } else if (globalAlpha === .4 && settings.theme_boxes[0].active) {
  4048. this.globalAlpha = 0.15
  4049. }
  4050. return fillFn.apply(this, arguments)
  4051. }
  4052. const strokeFn = CanvasRenderingContext2D.prototype.stroke;
  4053. CanvasRenderingContext2D.prototype.stroke = function() {
  4054. if (strokeCells && this.canvas.id === "canvas") {
  4055. const { strokeStyle } = this;
  4056. if (strokeStyle === "#dddddd" || strokeStyle === "#333333" || strokeStyle === "#4e1c5b" /* adjusted portal cell stroke color*/) {
  4057. if(settings.checkboxes[2].active) this.strokeStyle = agmaSettings.sDark ? "#FFFFFF" : "#000000";
  4058. if(this.shadowOffsetY == 1){
  4059. this.shadowOffsetY = 0;
  4060. return;
  4061. };
  4062. };
  4063. if (agmaSettings.sBubbleCells && settings.theme_boxes[0].active && this.lineWidth != 4) {
  4064. this.lineWidth = 15 + Math.min(Math.max(avgFps - 25, 0), 10);
  4065. }
  4066. }
  4067. return strokeFn.apply(this, arguments)
  4068. }
  4069.  
  4070. let drawImgFn = CanvasRenderingContext2D.prototype.drawImage;
  4071. CanvasRenderingContext2D.prototype.drawImage = function () {
  4072. if(this.globalAlpha === 0.01 && /ects\/[1-5](?:_lo)?\.p/.test(arguments[0]?.src)){
  4073. this.globalAlpha = .35;
  4074. }
  4075. drawImgFn.apply(this, arguments);
  4076. if(settings.checkboxes[7].active && this.canvas.id === "canvas"){
  4077. if((r1Portal.portal || r2Portal.portal) && !noPortalSvIdList.includes(currentServerId) && /ects\/1(?:_lo)?\./.test(arguments[0].src)){ // using destroyed doesnt work hence splice
  4078. let c = p => {
  4079. if((p.portal.nSize * p.portal.nSize / 100) != p.lastMass){
  4080. p.lastMassChange = Date.now();
  4081. }
  4082. p.lastMass = (p.portal.nSize * p.portal.nSize / 100);
  4083.  
  4084. let value = Date.now() - p.lastMassChange > 200 ? ~~(((p.portal.nSize * p.portal.nSize / 100) - getServerValue("r" + p.room + "StartMass")) / getServerValue("ejPortalMass")).toString() : p.lastValue;
  4085. p.lastValue = value;
  4086. if(value > 9 || value < 0){
  4087. value = "?";
  4088. }
  4089. this.fillStyle = value == "7" ? "#FFCC12" : "#FFFFFF";
  4090. this.globalAlpha = 1;
  4091. this.font = "72px Ubuntu, serif";
  4092. this.fillText(value, p.portal.x - this.measureText(value).width / 2, p.portal.y + 20);
  4093. }
  4094. r1Portal.portal && c(r1Portal);
  4095. r2Portal.portal && c(r2Portal);
  4096. // }
  4097. }
  4098. }
  4099. }
  4100.  
  4101.  
  4102. function hue2rgb(p, q, t){
  4103. if (t < 0) t += 1;
  4104. if (t > 1) t -= 1;
  4105. if (t < 1 / 6) return p + (q - p) * 6 * t;
  4106. if (t < 1 / 2) return q;
  4107. if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
  4108. return p;
  4109. };
  4110.  
  4111. function hslToHex(h, s, l) {
  4112. h /= 360;
  4113. s /= 100;
  4114. l /= 100;
  4115. let r, g, b;
  4116. if (s === 0) {
  4117. r = g = b = l;
  4118. } else {
  4119. const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  4120. const p = 2 * l - q;
  4121. r = hue2rgb(p, q, h + 1 / 3);
  4122. g = hue2rgb(p, q, h);
  4123. b = hue2rgb(p, q, h - 1 / 3);
  4124. }
  4125. const toHex = x => {
  4126. const hex = Math.round(x * 255).toString(16);
  4127. return hex.length === 1 ? '0' + hex : hex;
  4128. };
  4129. return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
  4130. }
  4131.  
  4132.  
  4133.  
  4134. const _lineTo = CanvasRenderingContext2D.prototype.lineTo;
  4135. CanvasRenderingContext2D.prototype.lineTo = function () {
  4136. if(settings.theme[5].active){
  4137. if(!agmaSettings.sGrid){ // use to avoid changing color of background "grid lines" settings
  4138. this.strokeStyle = userPreferences.rainbowMapBorder ? hslToHex(Math.floor(Date.now() / userPreferences.rainbowBorderSpeed) % 360, 100, 50) : settings.theme[5].color;
  4139. } else {
  4140. if(agmaSettings.sDark){
  4141. if(!/#(..)\1{2}/gm.test(this.strokeStyle)) this.strokeStyle = userPreferences.rainbowMapBorder ? hslToHex(Math.floor(Date.now() / userPreferences.rainbowBorderSpeed) % 360, 100, 50) : settings.theme[5].color;
  4142. } else {
  4143. let [, r, g, b] = this.strokeStyle.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i).map(hex => parseInt(hex, 16));
  4144. if(r > g && r > b){
  4145. this.strokeStyle = userPreferences.rainbowMapBorder ? hslToHex(Math.floor(Date.now() / userPreferences.rainbowBorderSpeed) % 360, 100, 50) : settings.theme[5].color;
  4146. }
  4147. }
  4148. }
  4149. }
  4150. return _lineTo.apply(this, arguments);
  4151. }
  4152.  
  4153.  
  4154. const encodeCustomNameColor = (rgb) => {
  4155. const r = parseInt(rgb.slice(1, 3), 16);
  4156. const g = parseInt(rgb.slice(3, 5), 16);
  4157. const b = parseInt(rgb.slice(5, 7), 16);
  4158.  
  4159. const step = 0xFF / (invisUnicodeCharIds.length - 1);
  4160. let color_id_r = ~~(r / step);
  4161. let color_id_g = ~~(g / step);
  4162. let color_id_b = ~~(b / step);
  4163.  
  4164. const char1 = color_id_r % (invisUnicodeCharIds.length);
  4165. const char2 = color_id_g % (invisUnicodeCharIds.length);
  4166. const char3 = color_id_b % (invisUnicodeCharIds.length);
  4167.  
  4168. // console.log("ec", char1, char2, char3, color_id_r, color_id_g, color_id_b, rgb);
  4169.  
  4170. const tag = String.fromCharCode(invisUnicodeCharIds[char1], invisUnicodeCharIds[char2], invisUnicodeCharIds[char3]);
  4171.  
  4172. return tag;
  4173. }
  4174.  
  4175. const decodeCustomNameColor = (clanPart, pos) => {
  4176. // adjusted decode function designed to be called with cell.clanPart
  4177. // designed for 3 characters / color
  4178. if(!clanPart || ![5, 8].includes(clanPart.length)) return null;
  4179. // clanPart starts with a space you idiot
  4180. // ???? wtf - fishy
  4181. const idx_1 = invisUnicodeCharIds.indexOf(clanPart.charCodeAt(1 + pos * 3));
  4182. const idx_2 = invisUnicodeCharIds.indexOf(clanPart.charCodeAt(2 + pos * 3));
  4183. const idx_3 = invisUnicodeCharIds.indexOf(clanPart.charCodeAt(3 + pos * 3));
  4184.  
  4185. if(idx_1 == -1 || idx_2 == -1 || idx_3 == -1) return null;
  4186.  
  4187.  
  4188. return {r: idx_1, g: idx_2, b: idx_3};
  4189. }
  4190.  
  4191. const getColorById = (color_id) => {
  4192. const step = 0xFF / (invisUnicodeCharIds.length);
  4193. const r = color_id.r * step;
  4194. const g = color_id.g * step;
  4195. const b = color_id.b * step;
  4196. const rgb = "#" + (~~r).toString(16).padStart(2, '0') + (~~g).toString(16).padStart(2, '0') + (~~b).toString(16).padStart(2, '0');
  4197. return rgb;
  4198. }
  4199.  
  4200. let currentMass = 0, leaderboardPos;
  4201. const _fillText = CanvasRenderingContext2D.prototype.fillText;
  4202. CanvasRenderingContext2D.prototype.fillText = function() {
  4203. if ((this.fillStyle == "#ffffff" || this.fillStyle == "#626262") && isNaN(arguments?.[0]) && /^Mass: \d+$/gm.test(arguments[0])){
  4204. currentMass = +arguments[0].match(/(?<=^Mass: )\d+$/gm)[0];
  4205. if(hiddenUI) arguments[0] = " ";
  4206. } else if(this.canvas.id == "leaderboard" && this.fillStyle == "#ffaaaa" && /^\d+(?=\.\s)/gm.test(arguments[0])) [leaderboardPos] = arguments[0].match(/^\d+(?=\.\s)/gm);
  4207.  
  4208. _fillText.apply(this, arguments);
  4209. }
  4210.  
  4211. const debounce = (func, timeout = 300) => {
  4212. let timer;
  4213. return (...args) => {
  4214. clearTimeout(timer);
  4215. timer = setTimeout(() => { func.apply(this, args); }, timeout);
  4216. };
  4217. }
  4218.  
  4219. const isLogged = () => currentUser != 'Please Login First';
  4220. let intervalCount = 0, currentUser, lastLoggedOut = Date.now();
  4221.  
  4222. // const mainInterval = setInterval(() => {
  4223. const mainInterval = () => {
  4224. intervalCount++;
  4225. if(userPreferences.hoverShowSkinID && $('#publicSkinsPage').children().length > 0 && $('#publicSkinsPage').find('[id^="skinContainer"]>img')[0]?.title == ''){ // check if skins have loaded
  4226. $('[id^="skinContainer"]').each(function(){
  4227. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', '')); // make hover show skin ID
  4228. })
  4229. $('.publicskins-nav-btn').on('click', () => {
  4230. $('[id^="skinContainer"]').each(function(){
  4231. $(this).find('img').attr('title', $(this).attr('id').replace('skinContainer', ''));
  4232. })
  4233. })
  4234. }
  4235. if(userPreferences.sortWearablesByOwned && $('#phpWearables>li').length && !$('#fsfb-wearsloaded').length){
  4236. $($('[id^="wearableUseBtn"]').get().reverse()).each(function(){
  4237. $($(this).parents().get(2)).insertBefore($("#phpWearables li:eq(0)"));
  4238. })
  4239. $('#phpWearables').append('<div id="fsfb-wearsloaded"></div>')
  4240.  
  4241. }
  4242. if(userPreferences.publicSkinSearch && $('#publicSkinsPage').children().length > 0 && !document.getElementById("fsfb-skinsearch")){
  4243. $('.publicskins-nav-bar').eq(0).after(`<input id="fsfb-skinsearch" placeholder="Enter skin name/id here" type="search">`);
  4244. // const handlePress = debounce(() => {
  4245. const handlePress = () => {
  4246. if(!$('#fsfb-skinsearch').val()) return void($('.btn.publicskins-nav-btn.btn-default').not('.btn-primary')[0].click());
  4247. const searchQuery = $('#fsfb-skinsearch').val();
  4248. const skinsSearchedArr = skinsArr.filter(skin => skin.type == 4 && (skin.name.toLowerCase().includes(searchQuery.toLowerCase()) || skin.id == +searchQuery));
  4249. let totalRows = Math.ceil(skinsSearchedArr.length / 4);
  4250. if(totalRows == 0){
  4251. $('#publicSkinsPage tbody').html('').append('<h1>No Skins Found</h1>');
  4252. } else {
  4253. $('#publicSkinsPage tbody').html('');
  4254. for(let i = 0; i < totalRows; i++) $('#publicSkinsPage tbody').append('<tr></tr>');
  4255. let currRow = 0, currColumn = 0;
  4256. for(let i of skinsSearchedArr){
  4257. if(++currColumn > 4) currRow++, currColumn = 1;
  4258. $('#publicSkinsPage tr').eq(currRow).append(`<td id="skinContainer${i.id}" class="skin-container"><img src="skins/${i.id}_lo.png" alt="" ${userPreferences.hoverShowSkinID ? 'title="' + i.id + '"': ''}><h4>${softSanitize(i.name)}</h4><button id="skinUseBtn${i.id}" class="btn btn-primary skinuse-btn" onclick="toggleSkin(${i.id});">Use</button></td>`)
  4259. }
  4260. }
  4261. }
  4262. // }, 300);
  4263. let pressTimer;
  4264. $('#fsfb-skinsearch').on('input', () => {
  4265. clearTimeout(pressTimer);
  4266. pressTimer = setTimeout(() => handlePress(), Math.round(300 / ($('#fsfb-skinsearch').val().length || 300)));
  4267. });
  4268. }
  4269. currentUser = $('#userCoins2')[0].innerText;
  4270. let user_abil = currentUser == 'Please Login First' ? null : misc_settings.abil?.[currentUser];
  4271. if(user_abil != undefined && userPreferences.showRemainingAbilityTime){
  4272. for(let i in user_abil){
  4273. let text = $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0).find('div h5'),
  4274. active = $('#' + $(`.purchase-btn.confirmation[item="${i}"]`).parents().eq(0)[0].id + ' img').eq(1).css('display') != "none";
  4275. // has been 24h+ and the player hasn't logged out since it's expired
  4276. if(Date.now() - user_abil[i] > 8.64e7 && active){
  4277. text.eq(1).text('EXPIRED IF UNLOG');
  4278. text.eq(0).find('div h5').hide();
  4279. }
  4280. // has been >24h
  4281. else if(Date.now() - user_abil[i] < 8.64e7 && active){
  4282. text.eq(0).hide();
  4283. text.eq(1).text(msToTime(8.64e7 - (Date.now() - user_abil[i]))).show();
  4284. }
  4285. else { // has been 24h+ & player has logged out
  4286. text.eq(0).find('div h5').show();
  4287. text.eq(1).find('div h5').hide();
  4288. }
  4289. }
  4290. } else {
  4291. $('.white_shopdesc').show();
  4292. $('.white_shopdesc.fsfb-fake').hide();
  4293. }
  4294. if(accounts[currentUser] == null && currentUser !== 'Please Login First'){
  4295. xpInfo();
  4296. coinsInfo();
  4297. accounts = {...accounts, ...{[currentUser] : {coins: currentCoins, xp: currentXP, lvl: round(currentPercent, 3) + currentLevel}}};
  4298. }
  4299. if(accounts[currentUser] != null && accounts[currentUser].coins == 0) accounts[currentUser].coins = currentCoins;
  4300. if(accounts[currentUser] != null && accounts[currentUser].xp == 0) accounts[currentUser].xp = currentXP;
  4301. if(accounts[currentUser] != null && accounts[currentUser].lvl == 0) accounts[currentUser].lvl = round(currentPercent, 3) + currentLevel;
  4302.  
  4303. if(userPreferences.coinXPstats && intervalCount % 12 == 0){
  4304. xpInfo();
  4305. lastMinXP.push(new StatLog(round(currentXP, 3), round(currentPercent, 3) + currentLevel, currentUser, lastMinXP));
  4306. const prevObjXP = lastMinXP[lastMinXP.length - 1];
  4307. if(prevObjXP && prevObjXP.id % (6e4 / updateTimeXP) == 0) lastHrXP.push(new StatLog(round(currentXP, 3), round(currentPercent, 3) + currentLevel, currentUser, lastHrXP));
  4308. if(lastMinXP.length > 6e4 / updateTimeXP) lastMinXP.shift();
  4309. if(lastHrXP.length > 60) lastHrXP.shift();
  4310. if(!coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  4311. // unsafeWindow.logStatsScriptXP && console.log(lastMinXP, lastHrXP);
  4312. }
  4313. if(userPreferences.coinXPstats && intervalCount % 6 == 0){
  4314. coinsInfo();
  4315. lastMinCoins.push(new StatLog(currentCoins, 0, currentUser, lastMinCoins));
  4316. const lastObjCoins = lastMinCoins[lastMinCoins.length - 1];
  4317. if(lastObjCoins && lastObjCoins.id % (6e4 / updateTimeCoins) == 0) lastHrCoins.push(new StatLog(currentCoins, 0, currentUser, lastHrCoins));
  4318. if(lastMinCoins.length > 6e4 / updateTimeCoins) lastMinCoins.shift();
  4319. if(lastHrCoins.length > 60) lastHrCoins.shift();
  4320. if(coinsHTMLactive && $('#stats-container').css('display') == 'block') updateUI();
  4321. // unsafeWindow.logStatsScriptCoins && console.log(lastMinCoins, lastHrCoins);
  4322. }
  4323. if(userPreferences.coinXPstats && $('#stats-container').css('display') == 'block')$('#stats-sesh-length').text(msToTime(Date.now() - (coinsHTMLactive ? scriptStartCoins : scriptStartXP)))
  4324. if(intervalCount % 3 == 0 && misc_settings?.statsPos != null){
  4325. statsboxPos = {top: $("#stats-container")[0].style.top, left: $("#stats-container")[0].style.left};
  4326. misc_settings.statsPos = statsboxPos;
  4327. setStorage("fsfb-misc", misc_settings);
  4328. }
  4329. if(intervalCount % 2 == 0){ // "You have an activated bot pack available: 100 XXL Bots 1 Hours! Restart your bots before they expire!"
  4330. if(chatmsgs != null && chatmsgs?.length > 2){ // "You have an activated bot pack available: 100 Bots 24 Hours! Restart your bots before they expire!"
  4331. for(let i of chatmsgs){
  4332. if(i.name == '' && i.cache != null && i.cache.color2 == '#ff8100'){
  4333. if(i.message.match(/(?<=(Welcome back to Agma, )).+/g)?.[0] == currentUser){
  4334. const msgBots = $('.memberType').text() == 'GOLD MEMBER' ? chatmsgs?.[chatmsgs.indexOf(i) - 2] : chatmsgs?.[chatmsgs.indexOf(i) - 1],
  4335. msgGM = $('.memberType').text() == 'GOLD MEMBER' ? chatmsgs?.[chatmsgs.indexOf(i) - 1] : null;
  4336. if(msgBots?.message.includes('Restart your bots before they expire!')){
  4337. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = msgBots.message.match(/\d+.+\d Hours/g)[0];
  4338. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: msgBots.message.match(/\d+.+\d Hours/g)[0], started: true}};
  4339. setStorage("fsfb-misc", misc_settings);
  4340. } else if(msgBots?.message.match(/(?<=(You have a new bot pack available: )).+(?=(! Start your bots in the minion panel.))/g)?.length){
  4341. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = msgBots.message.match(/\d+.+\d Hours/g)[0];
  4342. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: msgBots.message.match(/\d+.+\d Hours/g)[0], started: false}};
  4343. setStorage("fsfb-misc", misc_settings);
  4344. }
  4345. if(msgGM != null && msgGM.message.match(/(?<=You have )\d+(?= Days left of Gold Member!)/gm)?.length){
  4346. accGoldMem[currentUser] = {...accGoldMem[currentUser], ... {days: msgGM.message.match(/(?<=You have )\d+(?= Days left of Gold Member!)/gm)[0], has: true}};
  4347. } else {
  4348. accGoldMem[currentUser] = {...accGoldMem[currentUser], ... {has: false}};
  4349. }
  4350. } else if(i.message.match(/(?<=(You have a new bot pack available: )).+(?=(! Start your bots in the minion panel.))/g)?.length){
  4351. if(misc_settings.bots[currentUser] != null) misc_settings.bots[currentUser].chatAmt = i.message.match(/\d+.+\d Hours/g)[0];
  4352. minsChatAmt[currentUser] = {...minsChatAmt[currentUser], ... {amt: i.message.match(/\d+.+\d Hours/g)[0], started: false}};
  4353. setStorage("fsfb-misc", misc_settings);
  4354. }
  4355. }
  4356. }
  4357. }
  4358. }
  4359. if(currentServerId === 0){
  4360. try {
  4361. for(let { isCurrent, id } of JSON.parse(localStorage.gameservers)){
  4362. if(isCurrent) currentServerId = id;
  4363. }
  4364. if(currentServerId !== 0) svSwitch = true;
  4365. } catch {};
  4366. }
  4367. uisdoa && (unsafeWindow.__currentServerId = currentServerId);
  4368. if(currentUser == 'Please Login First' || $('#level').text() == 0) lastLoggedOut = Date.now();
  4369. changeTitle(settings.checkboxes[4].active ? currentUser == 'Please Login First' ? "Agma.io" : "Agma.io | " + currentUser : "Agma.io - A free multiplayer MMO game");
  4370.  
  4371. if($('#friendAcceptAll').length > 0 && userPreferences.friendDeclineAll && $('#friendRejectAll').length < 1 && currentUser != 'Please Login First') addFriendDecline();
  4372.  
  4373. if($('#friendDialogMessage').text() != 'Login to see your friendlist' && $('#friendDialogMessage').text() == 'Loading...' && $('#friendsRequestsAmt').text() == '' && userPreferences.friendDeclineAll && currentUser != 'Please Login First'){
  4374. $('#btnFriends').click().click();
  4375. }
  4376.  
  4377. fpsArr.push(+document.getElementById("fps").innerText);
  4378. if(fpsArr.length == 6) fpsArr.shift();
  4379. avgFps = mean(fpsArr);
  4380. setTimeout(mainInterval, 1e3);
  4381. }
  4382. setTimeout(mainInterval, 1e3);
  4383. // }, 1e3);
  4384.  
  4385.  
  4386. const antiAFK = () => {
  4387. setTimeout(antiAFK, 3e4);
  4388. if(!$('#fsfb-antiAFK').is(':checked')) return; // move mouse every 30sec
  4389. let [moveX, moveY] = linesplitting ? [pointMove.x, pointMove.y] : [mosX, mosY];
  4390. [++moveX, --moveX].forEach(x => $('#canvas').trigger($.Event('mousemove', {clientX: x, clientY: moveY})));
  4391. }
  4392.  
  4393. setTimeout(antiAFK, 3e4);
  4394.  
  4395. uisdoa ?? $('#fsfb-recospeed').parent().hide();
  4396.  
  4397. const updateScriptSettingsUI = () => {
  4398. for(let i of settings.checkboxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  4399. for(let i of settings.hotkeys) $('#' + i.id).text(getName(i.key));
  4400. for(let i of settings.quickSettings){
  4401. $('#' + i.id1).val(i.set);
  4402. $('#' + i.id).text(getName(i.key));
  4403. }
  4404. // slowfeed
  4405. $('#' + settings.slowFeed[0].id).text(getName(settings.slowFeed[0].key));
  4406. $('#' + settings.slowFeed[1].id).val(settings.slowFeed[1].val);
  4407.  
  4408. $('#' + settings.frozenvirus[0].id).text(getName(settings.frozenvirus[0].key));
  4409. $('#' + settings.frozenvirus[1].id).val(settings.frozenvirus[1].val);
  4410.  
  4411. for(let i of settings.fastsplit_hotkeys){
  4412. i.val == null ? $('#' + i.id).text(getName(i.key)) : $('#' + i.id).val(i.val);
  4413. }
  4414. for(let i of settings.uiScaling) $('#' + i.id).val(i.level).trigger("input");
  4415. for(let i of settings.export_import) $('#' + i.id).prop("checked", i.active).trigger("change");
  4416. for(let i of settings.theme){
  4417. $('#' + i.id).prop("checked", i.active).trigger("change");
  4418. $('#' + i.id1).val(i.color).trigger("input");
  4419. }
  4420. for(let i of settings.theme_boxes) $('#' + i.id).prop("checked", i.active).trigger("change");
  4421. for(let i of settings.name_color){
  4422. if('color' in i){
  4423. $('#' + i.id).prop("checked", i.active).trigger("change");
  4424. $('#' + i.id1).val(i.color).trigger("input");
  4425. } else $('#' + i.id).prop("checked", i.active).trigger("change");
  4426. }
  4427. for(let i of settings.anti_lag) $('#' + i.id).prop("checked", i.active).trigger("change");
  4428. for(let i of settings.chat_translate){
  4429. 'set' in i ? $('#' + i.id).val(i.set) : $('#' + i.id).prop('checked', i.active).trigger('change');
  4430. }
  4431. }
  4432. setTimeout(() => updateScriptSettingsUI(), 1e3);
  4433.  
  4434. $('body').append('<div id="fsfb-css-styles"><style id="hideUI-css" type="text/css"></style><style id="css-invsingleline" type="text/css"></style><style id="stats-input-css" type="text/css">#stats-table input{ display: none; }</style></div>');
  4435.  
  4436. const _replaceCSS = (a,b) => {
  4437. document.getElementById(a).innerHTML = b;
  4438. }
  4439. !function(){
  4440. $('body').append(`
  4441. <div class="fade fsfb-bug-modal modal" aria-hidden=true role="dialog" tabindex="-1">
  4442. <div class="modal-dialog modal-lg">
  4443. <div class="modal-content">
  4444. <div class="modal-interior">
  4445. <h2 class="fsfb-modal-title">Script Documentation</h2><button class="close fsfb-btn" data-dismiss="modal" type=button>×</button>
  4446. <section class=fsfb-modal-body>
  4447. <div><span>Chat Copy/Cut/Paste</span> - allows you to use the commands in chat (e.g. Ctrl + V becomes avaiable inside chat)</div>
  4448. <div><span>Anti-AFK</span> - prevents you from automatically disconnecting after 10 minutes</div>
  4449. <div><span>Anti-Invis</span> - shows you players even when they have the invisibility ability active</div>
  4450. <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>
  4451. <div><span>Change Page Title</span> - changes the tab's title to just "Agma.io" with the current username</div>
  4452. <div><span>Hide Shouts</span> - prevent megaphone shouts from showing up at all</div>
  4453. <div><span>Hold To Spam</span> - while the powerup's hotkey is held, it will continuously use the powerup</div>
  4454. <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>
  4455. <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>
  4456. <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>
  4457. <div><span>Food/Virus/Mothercell Color</span> - changes the color that's filling these to a custom one</div>
  4458. <div><span>Virus/Mothercell Stroke</span> - changes the color of the stroke (border/outline) to a custom one</div>
  4459. <div><span>Spiked Cells</span> - render all cells with the spikes from the infecton gamemode</div>
  4460. <div><span>Show Mass</span> - show the mass of all players' cells</div>
  4461. <div><span>Only My Skin</span> - hide all skins besides the one you're using</div>
  4462. <div><span>Only Party Skin</span> - hide all skins besides the ones people in your party are using</div>
  4463. <div><span>Only My Nick</span> - hide all nicks besides the one you're using</div>
  4464. <div><span>Only Party Nick</span> - hide all nicks besides the ones people in your party are using</div>
  4465. <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>
  4466. <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>
  4467. <div><span>Macrosplit Bots</span> - hold this key to macrosplit your bots without switching controls off of yourself</div>
  4468. <div><span>Hide UI</span> - press this key to toggle showing the game UI (intended for recording/screenshots)</div>
  4469. <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>
  4470. <div><span>Slow Feed Speed</span> - the speed at which eject mass is pressed when slow-feeding</div>
  4471. <div><span>Quick Settings</span> - when the hotkey assigned is pressed, it will toggle the setting that is selected</div>
  4472. <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>
  4473. <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>
  4474. <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>
  4475. <div><span>Chat Size</span> - make the size of chat bigger/smaller</div>
  4476. <div><span>Inventory Size</span> - make the size of powerups inventory bigger/smaller</div>
  4477. <div><span>Statsbox Size</span> - make the size of XP/coins stats bigger/smaller</div>
  4478. <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>
  4479. <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>
  4480. <table>
  4481. <tr>
  4482. <th>Chat Command</th>
  4483. <th>Description</th>
  4484. </tr>
  4485. <tr>
  4486. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}help</td>
  4487. <td>list all available chat commands</td>
  4488. </tr>
  4489. <tr>
  4490. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}bots</td>
  4491. <td>show which bot pack you have active and how much time is remaining</td>
  4492. </tr>
  4493. <tr>
  4494. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}pws</td>
  4495. <td>show the amount of powerups in your inventory (recommended to use ${userPreferences.chatPrefix}pws1, ${userPreferences.chatPrefix}pws2, and ${userPreferences.chatPrefix}pws3)</td>
  4496. </tr>
  4497. <tr>
  4498. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}totalpws</td>
  4499. <td>show the total amount of powerups you have in your inventory</td>
  4500. </tr>
  4501. <tr>
  4502. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xp</td>
  4503. <td>show then amount of xp you've completed for this level</td>
  4504. </tr>
  4505. <tr>
  4506. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}lvl</td>
  4507. <td>show your level and how much of the level you've completed</td>
  4508. </tr>
  4509. <tr>
  4510. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}coins</td>
  4511. <td>show the amount of coins you have</td>
  4512. </tr>
  4513. <tr>
  4514. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}hours</td>
  4515. <td>show the hours you have on your account</td>
  4516. </tr>
  4517. <tr>
  4518. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}rank</td>
  4519. <td>show your ranking</td>
  4520. </tr>
  4521. <tr>
  4522. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}ping</td>
  4523. <td>show your current ping</td>
  4524. </tr>
  4525. <tr>
  4526. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}fps</td>
  4527. <td>show your current FPS</td>
  4528. </tr>
  4529. <tr>
  4530. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}topmass</td>
  4531. <td>show your highest mass</td>
  4532. </tr>
  4533. <tr>
  4534. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}cells</td>
  4535. <td>show your cell count</td>
  4536. </tr>
  4537. <tr>
  4538. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}pws1</td>
  4539. <td>show the first part of your powerup inventory</td>
  4540. </tr>
  4541. <tr>
  4542. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}pws2</td>
  4543. <td>show the second part of your powerup inventory</td>
  4544. </tr>
  4545. <tr>
  4546. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}pws3</td>
  4547. <td>show the third part of your powerup inventory</td>
  4548. </tr>
  4549. <tr>
  4550. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}friends</td>
  4551. <td>show how many friends you have and how many are online</td>
  4552. </tr>
  4553. <tr>
  4554. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}requests</td>
  4555. <td>show how many friend requests you have</td>
  4556. </tr>
  4557. <tr>
  4558. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}gold</td>
  4559. <td>show how many days of gold member you have left remaining</td>
  4560. </tr>
  4561. <tr>
  4562. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}alive</td>
  4563. <td>show the amount of time you've been alive</td>
  4564. </tr>
  4565. <tr>
  4566. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}mass</td>
  4567. <td>show your current mass</td>
  4568. </tr>
  4569. <tr>
  4570. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}user</td>
  4571. <td>show your current username</td>
  4572. </tr>
  4573. <tr>
  4574. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}customs</td>
  4575. <td>show the amount of custom skins you own</td>
  4576. </tr>
  4577. <tr>
  4578. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}wearables</td>
  4579. <td>show how many wearables you own</td>
  4580. </tr>
  4581. <tr>
  4582. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}cloak</td>
  4583. <td>show the remaining time of your cloak ability</td>
  4584. </tr>
  4585. <tr>
  4586. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}add [user]</td>
  4587. <td>type this command to quickly add a friend using chat</td>
  4588. </tr>
  4589. <tr>
  4590. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}partymembers</td>
  4591. <td>show how many people are in your party</td>
  4592. </tr>
  4593. <tr>
  4594. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}players</td>
  4595. <td>show how many players are online in your server and are online in all agma servers</td>
  4596. </tr>
  4597. <tr>
  4598. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}server</td>
  4599. <td>show which server you're currently in</td>
  4600. </tr>
  4601. <tr>
  4602. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}abils</td>
  4603. <td>show your currently active abilities</td>
  4604. </tr>
  4605. <tr>
  4606. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xpproj</td>
  4607. <td>show the predicted amount of XP you will gain in an hour</td>
  4608. </tr>
  4609. <tr>
  4610. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}coinsproj</td>
  4611. <td>show the predicted amount of coins you will gain in an hour</td>
  4612. </tr>
  4613. <tr>
  4614. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xprem</td>
  4615. <td>show the amount of XP remaining for your level</td></td>
  4616. </tr>
  4617. <tr>
  4618. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xphour</td>
  4619. <td>show the amount of xp you've gained in the last hour</td>
  4620. </tr>
  4621. <tr>
  4622. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}coinshour</td>
  4623. <td>show the amount of coins you've gained in the last hour</td>
  4624. </tr>
  4625. <tr>
  4626. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xpmin</td>
  4627. <td>show the amount of XP you've gained in the last minute</td>
  4628. </tr>
  4629. <tr>
  4630. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}coinsmin</td>
  4631. <td>show the amount of coins you've gained in the last minute</td>
  4632. </tr>
  4633. <tr>
  4634. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xp12s</td>
  4635. <td>show the amount of coins you've gained in the last 12 seconds</td>
  4636. </tr>
  4637. <tr>
  4638. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}xpsesh</td>
  4639. <td>show the amount of XP you've gained in this session</td>
  4640. </tr>
  4641. <tr>
  4642. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}lifetimexp</td>
  4643. <td>show the total amount of XP you've earned in your account's lifetime</td>
  4644. </tr>
  4645. <tr>
  4646. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}seshcoins</td>
  4647. <td>show the amount of coins you've gained in this session</td>
  4648. </tr>
  4649. <tr>
  4650. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}seshcoins</td>
  4651. <td>show the amount of coins you've gained in this session</td>
  4652. </tr>
  4653. <tr>
  4654. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}waifu [user]</td>
  4655. <td>rate the waifu of the selected username (leave user blank to rate yourself)</td>
  4656. </tr>
  4657. <tr>
  4658. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}pro [user]</td>
  4659. <td>show how pro someone is (leave user blank to rate yourself)</td>
  4660. </tr>
  4661. <tr>
  4662. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}dog [user]</td>
  4663. <td>show how dog someone is (leave user blank to rate yourself)</td>
  4664. </tr>
  4665. <tr>
  4666. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}king [user]</td>
  4667. <td>show how king someone is (leave user blank to rate yourself)</td>
  4668. </tr>
  4669. <tr>
  4670. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}dice [sides]</td>
  4671. <td>roll a die with the desired number of sides</td>
  4672. </tr>
  4673. <tr>
  4674. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}rng [min] [max]</td>
  4675. <td>generate a random number in a range</td>
  4676. </tr>
  4677. <tr>
  4678. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}coinflip</td>
  4679. <td>flip a coin and see if it lands on heads or tails</td>
  4680. </tr>
  4681. <tr>
  4682. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}script</td>
  4683. <td>show the current script you're using & which version</td>
  4684. </tr>
  4685. <tr>
  4686. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}time</td>
  4687. <td>show your current locale date & time</td>
  4688. </tr>
  4689. <tr>
  4690. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}skins</td>
  4691. <td>show your bought skins and their worth (limited as well)</td>
  4692. </tr>
  4693. <tr>
  4694. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}ratefriends [user1] [user2]</td>
  4695. <td>show how what percent friends two usernames are</td>
  4696. </tr>
  4697. <tr>
  4698. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}rateenemies [user1] [user2]</td>
  4699. <td>show how what percent enemies two usernames are</td>
  4700. </tr>
  4701. <tr>
  4702. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}leaderboard</td>
  4703. <td>show your leaderboard position</td>
  4704. </tr>
  4705. <tr>
  4706. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}altcaps [text]</td>
  4707. <td>anything written after this command will have alternating lowercase/capital letters</td>
  4708. </tr>
  4709. <tr>
  4710. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}sparkles [text]</td>
  4711. <td>anything written after this command will be surrounded with star emojis</td>
  4712. </tr>
  4713. <tr>
  4714. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}cfix</td>
  4715. <td>resets canvas, can sometimes fix bugs with rendering</td>
  4716. </tr>
  4717. <tr>
  4718. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}fact</td>
  4719. <td>sends a random fact in chat</td>
  4720. </tr>
  4721. <tr>
  4722. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}fastsplit</td>
  4723. <td>show your fastsplit delays</td>
  4724. </tr>
  4725. <tr>
  4726. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}progress</td>
  4727. <td>show your progress for the daily challenge</td>
  4728. </tr>
  4729. <tr>
  4730. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}sorapoints</td>
  4731. <td>show how many SoraPoints you have</td>
  4732. </tr>
  4733. <tr>
  4734. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}keys</td>
  4735. <td>show how many myster box keys you have</td>
  4736. </tr>
  4737. <tr>
  4738. <td class="fsfb-cmd-title">${userPreferences.chatPrefix}stars</td>
  4739. <td>show how many challenge stars you have</td>
  4740. </tr>
  4741. <table>
  4742. <div><span>Hide Ads</span> - both video and image ads will be removed from the screen</div>
  4743. <div><span>Skin Search</span> - search through skins by their names/ids</div>
  4744. <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>
  4745. <div><span>Sort Wearables</span> - wearables are automatically sorted by owned (the ones you own will be before all others)</div>
  4746. <div><span>Extra Bot Packs</span> - added hidden bot packs that can be purchased with coins (originally discovered by firebone)</div>
  4747. <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>
  4748. <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>
  4749. <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>
  4750. <div><span>Unlock Free Skins</span> - gives you access to the facebook & youtube free skins</div>
  4751. <div><span>Hover For Skin ID</span> - hovering skins in the skin menu will shop their ID</div>
  4752. <div><span>In Depth XP/Coins Stats</span> - click on coins/xp progress bar in top left to view respective statistics</div>
  4753. <div><span>XP Bar Decimals</span> - show the percentage up to 2 decimal places</div>
  4754. <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>
  4755. <div><span>Inventory Single Row</span> - put powerups inventory on a single row instead of on 2 seperate rows (inspired by Principito)</div>
  4756. <div><span>Custom Backgrounds</span> - a few <a href=https://imgur.com/a/sTANNBE target=_blank>backgrounds</a></div>
  4757. </section>
  4758. </div>
  4759. </div>
  4760. </div>
  4761. </div>`);
  4762. }();
  4763.  
  4764. !function(){
  4765. const styles = document.createElement('style');
  4766. styles.innerHTML = `
  4767. p.fsfb-lag::after{
  4768. content: '*';
  4769. position: absolute;
  4770. margin-left: 1px;
  4771. }
  4772. input.fsfb-lag+p::after{
  4773. content: '*';
  4774. position: absolute;
  4775. margin-left: 1px;
  4776. }
  4777. #fsfb-settings-left .hotkey-paragraph{
  4778. margin: 0;
  4779. }
  4780. ${userPreferences.stylizeActiveSettings ? `
  4781. #fsfb-settings-main input:checked+p {
  4782. color: #df901c;
  4783. }
  4784. .fsfb-active-setting{
  4785. color: #df901c;
  4786. }` : ''}
  4787. #fsfb-freeze_yourself {
  4788. background-image: url(../img/store/freeze_yourself.png);
  4789. }
  4790. #fsfb-minion_nuker {
  4791. background-image: url(../img/store/minion_nuker.png);
  4792. }
  4793. #fsfb-megaphone_shout {
  4794. background-image: url(../img/store/megaphone_shout.png);
  4795. }
  4796. .fsfb-update-swal .cancel{
  4797. background-color: #29b962 !important;
  4798. }
  4799. .fsfb-update-swal button:hover{
  4800. opacity: 75%;
  4801. }
  4802. a.fsfb-curser-anchor{
  4803. color: #8CEFFF;
  4804. }
  4805. a.fsfb-curser-anchor:hover{
  4806. opacity: 70%;
  4807. }
  4808. select.fsfb-changelang{
  4809. background: #a8a8a833;
  4810. border-radius: 3px;
  4811. border: none;
  4812. height: 20px;
  4813. color: #ffffffad;
  4814. margin: 2px 0 0 0;
  4815. }
  4816. select.fsfb-changelang:focus-visible{
  4817. outline: none;
  4818. }
  4819. select.fsfb-changelang option{
  4820. background: #222;
  4821. }
  4822. #fsfb-wearsloaded{
  4823. display: none;
  4824. width: 0;
  4825. height: 0;
  4826. }
  4827. #fsfb-skinsearch{
  4828. border: 1px solid #2e6da4;
  4829. background-color: #222328;
  4830. font-size: 17px;
  4831. border-radius: 4px;
  4832. width: 100%;
  4833. padding: 4px 4px 4px 8px;
  4834. margin: 4px 0;
  4835. color: white;
  4836. }
  4837. #stats-table td{
  4838. font-size: 17px;
  4839. }
  4840. #stats-table label{
  4841. padding-right: 10px;
  4842. margin: 0 6px 0 2px;
  4843. }
  4844. #stats-table input{
  4845. transform: scale(1.8);
  4846. margin: 5px 8px 5px 5px;
  4847. }
  4848. #friendRejectAll{
  4849. color: #ff4000 !important;
  4850. }
  4851. div.fsfb-slider{
  4852. display: flex;
  4853. align-items: center;
  4854. }
  4855. input[type="range"].fsfb-slider{
  4856. width: 58px;
  4857. display: inline;
  4858. position: absolute;
  4859. right: 5px;
  4860. }
  4861. #fsfb-minion_nuker img{
  4862. margin-top: 2px;
  4863. }
  4864. .fsfb-shown{
  4865. display: block !important;
  4866. }
  4867. .fsfb-hidden{
  4868. display: none !important;
  4869. }
  4870. #fsfb-quickbuy{
  4871. background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" fill="white" viewBox="0 0 601 601"><path d="M1 301c0-31 23-54 49-54l198 1V50c0-26 23-49 53-49s53 23 53 49v198l197-1c26 0 49 23 49 54 0 30-23 53-49 53l-197-1v198c0 26-23 50-53 50s-53-24-53-50V354H50c-26 0-50-23-50-53"></path></svg>');
  4872. background-size: 80% 80%;
  4873. }
  4874. .fsfb-bug-modal>div>div{
  4875. -webkit-box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
  4876. background: linear-gradient(to bottom,#3b414e 0,#302f33 100%);
  4877. border: 3px solid #232630;
  4878. }
  4879. .close.fsfb-btn{
  4880. position: absolute;
  4881. right: 10px;
  4882. top: 3px;
  4883. font-size: 60px;
  4884. }
  4885. .fsfb-modal-body>div{
  4886. color: ffffffb0;
  4887. margin: 10px 20px;
  4888. }
  4889. .fsfb-modal-body>table{
  4890. width: 90%;
  4891. margin: 10px 20px;
  4892. }
  4893. .fsfb-cmd-title{
  4894. color: white;
  4895. white-space: nowrap;
  4896. padding-right: 12px !important;
  4897. }
  4898. .fsfb-modal-body>table th{
  4899. color: white;
  4900. }
  4901. .fsfb-modal-body>table td{
  4902. padding: 4px 0;
  4903. }
  4904. .fsfb-modal-body>div>span{
  4905. color: white;
  4906. }
  4907. .fsfb-modal-body{
  4908. margin: 10px 10px;
  4909. font-size: 20px;
  4910. max-height: 600px;
  4911. overflow-y: auto;
  4912. }
  4913. .fsfb-modal-title{
  4914. text-align: center;
  4915. color: white;
  4916. }
  4917. .fsfb-hotkey{
  4918. background-color: #df901c;
  4919. color: #fff;
  4920. cursor: pointer;
  4921. text-align: center;
  4922. min-width: 40px;
  4923. max-width: 60px;
  4924. height: 18px;
  4925. line-height: 18px;
  4926. vertical-align: middle;
  4927. border-radius: 9px;
  4928. right: 5px;
  4929. position: absolute;
  4930. display: inline-block;
  4931. padding: 0 5px;
  4932. overflow: hidden;
  4933. opacity: 1;
  4934. }
  4935. .fsfb-modal-body::-webkit-scrollbar-thumb {
  4936. background-color: #57595b;
  4937. border: 1px solid black;
  4938. border-radius: 12px;
  4939. }
  4940. .fsfb-modal-body::-webkit-scrollbar {
  4941. border: 1px solid black;
  4942. background-color: #2523239e;
  4943. width: 15px;
  4944. border-radius: 12px;
  4945. }
  4946. .fsfb-modal-body::-webkit-scrollbar-track {
  4947. -webkit-box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75);
  4948. box-shadow: inset 0px 0px 2px 2px rgba(0, 0, 0, 0.75);
  4949. border-radius: 12px;
  4950. }
  4951. .fsfb-hotkey:hover {
  4952. background-color: #f1a02d;
  4953. }
  4954. .fsfb-hotkey.selected{
  4955. background-color: #ff4;
  4956. color: #444;
  4957. }
  4958. #fsfb-settings-main p{
  4959. margin: 0;
  4960. display: inline-block;
  4961. margin-left: 4px;
  4962. }
  4963. #fsfb-settings-main{
  4964. display: -ms-grid;
  4965. display: grid;
  4966. -ms-grid-columns: 50% 50%;
  4967. grid-template-columns: 50% 50%;
  4968. }
  4969. #settingPage4::-webkit-scrollbar-thumb {
  4970. background-color: #ff9800c2;
  4971. border-radius: 12px;
  4972. border: 1px #000000c2 solid;
  4973. }
  4974. #settingPage4::-webkit-scrollbar {
  4975. border: 1px solid #00000085;
  4976. background-color: #2523239e;
  4977. width: 9px;
  4978. border-radius: 12px;
  4979. }
  4980. #settingPage4{
  4981. display: none;
  4982. max-height: 660px;
  4983. overflow-x: hidden;
  4984. }
  4985. .padbot10{
  4986. padding-bottom: 10px;
  4987. }
  4988. #fsfb-slowfeedtime, #fsfb-dubsecdelay, #fsfb-dubfirstdelay, #fsfb-secdelay, #fsfb-fvsdelay, #fsfb-firstdelay{
  4989. border: none;
  4990. width: 40px;
  4991. }
  4992. select.fsfb-quickchange{
  4993. background: none;
  4994. border: none;
  4995. height: 20px;
  4996. }
  4997. select.fsfb-quickchange:focus-visible{
  4998. outline: none;
  4999. }
  5000. select.fsfb-quickchange option{
  5001. background: #222;
  5002. }
  5003. .fsfb-sect-ch label{
  5004. display: flex;
  5005. align-items: center;
  5006. }
  5007. .fsfb-sect-ch label input{
  5008. margin: 0 2px 0 0;
  5009. }
  5010. .fsfb-colors div{
  5011. height: 18px;
  5012. aspect-ratio: 1;
  5013. }
  5014. .fsfb-colors input[type="color"]{
  5015. width: 100%;
  5016. height: 100%;
  5017. opacity: 0;
  5018. border: none;
  5019. background-color: white;
  5020. margin: 0;
  5021. cursor: pointer;
  5022. }
  5023. .fsfb-colors p{
  5024. min-width: 120px;
  5025. margin-left: 5px;
  5026. }
  5027. .fsfb-colors div{
  5028. border-radius: 4px;
  5029. border: 1px solid #ffffff29;
  5030. }
  5031. #fsfb-ximport-cont{
  5032. display: flex;
  5033. justify-content: space-around;
  5034. margin-top: 7px;
  5035. }
  5036. .fsfb-eximport{
  5037. background-color: #df901c;
  5038. color: white;
  5039. padding: 5px 17px;
  5040. border-radius: 25px;
  5041. cursor: pointer;
  5042. }
  5043. .hideMegaphone{
  5044. display: none !important;
  5045. }
  5046. .fsfb-fake{
  5047. padding: 0 0 0 43px;
  5048. color: #cbff4e !important;
  5049. }
  5050. #fsfb-extra-info{
  5051. margin: 10% 0 0 90%;
  5052. cursor: pointer;
  5053. }
  5054. #linesplit-markers div {
  5055. background-color: transparent;
  5056. height: 15px;
  5057. aspect-ratio: 1;
  5058. position: fixed;
  5059. z-index: 999;
  5060. border: 2px solid rgb(255 255 255 / 80%);
  5061. border-radius: 50%;
  5062. display: none;
  5063. }
  5064. #linesplit-top {
  5065. top: -7.5px;
  5066. transform: translateX(-50%);
  5067. left: 50%;
  5068. }
  5069. #stats-container{
  5070. background: rgba(0,0,0,.5);
  5071. top: 200px;
  5072. position: absolute;
  5073. border: 1px white solid;
  5074. border-radius: 12px;
  5075. color:white;
  5076. left:30px;
  5077. }
  5078. #stats-main{
  5079. padding: 10px;
  5080. }
  5081. #stats-extra-info{
  5082. color: #00bbff;
  5083. font-size: 15px;
  5084. margin-bottom: 2px;
  5085. display: block;
  5086. }
  5087. #stats-info div{
  5088. display:flex;
  5089. }
  5090. #stats-info div p{
  5091. margin: 0;
  5092. }
  5093. .stats-completed{
  5094. margin: 9px 5px 0;
  5095. font-size: 12px;
  5096. bottom: 0;
  5097. color: rgb(255, 255, 255, .8);
  5098. }
  5099. #stats-title{
  5100. display: flex;
  5101. align-items: center;
  5102. justify-content: space-between;
  5103. }
  5104. #stats-title>div{
  5105. font-size: 15px;
  5106. margin-left: 8px;
  5107. cursor: pointer;
  5108. }
  5109. #stats-title>div>div{
  5110. padding: 0 5px;
  5111. }
  5112. #linesplit-right {
  5113. right: -7.5px;
  5114. transform: translateY(-50%);
  5115. top: 50%;
  5116. }
  5117. #linesplit-bottom {
  5118. bottom: -7.5px;
  5119. transform: translateX(-50%);
  5120. left: 50%;
  5121. }
  5122. #linesplit-left {
  5123. left: -7.5px;
  5124. transform: translateY(-50%);
  5125. top: 50%;
  5126. }
  5127. .fsfb-removeAds{
  5128. transform: translateX(9999%) !important;
  5129. }`;
  5130. document.querySelector('body').append(styles);
  5131. }();
  5132.  
  5133. if(userPreferences.level1kFix){
  5134. $('.innerBoxDashboard2>div>div').css('max-width', '210px');
  5135. $('#levelTopLeft').css({'min-width': '30%', 'max-width': '90px', width: 'unset'});
  5136. $('#fpsBox').css('left', '220px');
  5137. }
  5138.  
  5139. const scripts = document.createElement('script');
  5140. scripts.innerHTML = `const onlyNumberKey = (e, key) => (key = e.which || e.keyCode, 48 <= key && key <= 57);`;
  5141.  
  5142. let script_id = 446564; // main script
  5143. let version_timestamp = 1707000000000;
  5144. // @changelog fsfb 40k install update! Custom name setting, hide mod messages setting in TM menu, bugfixes, and more
  5145. if (+getStorage("lastUpdateCheck", "0") + 864e5 <= Date.now() && typeof GM_xmlhttpRequest == 'function' && userPreferences.notifyNewUpdates) {
  5146. try {
  5147. GM_xmlhttpRequest({
  5148. method: "GET",
  5149. url: `https://greasyfork.org/en/scripts/${script_id}/code?${Date.now()}`,
  5150. headers: {
  5151. 'Cache-Control': 'no-cache'
  5152. },
  5153. onload: function(xhrResponse) {
  5154. // console.log(xhrResponse)
  5155. setStorage("lastUpdateCheck", String(Date.now()));
  5156. const rt = xhrResponse.responseText.replace(/&nbsp;?/gm, " ").replace(/&#x000A;/g, "\n").replace(/<li>/gm, "\n").replace(/<[^>]*>/gm, "");
  5157. if (+(rt?.match(/version_timestamp\s*=\s*([0-9]+)/)?.[1] ?? 0) > version_timestamp) {
  5158. let changelog = rt.match(/(?<=@changelog\s+)(?:\S).+$/gm)?.[0] ?? 'unable to find',
  5159. version = rt.match(/(?<=@version\s+)(?:\S).+$/gm)?.[0] ?? 'unable to find';
  5160. swal({
  5161. title: `<span style="color: #8CEFFF;">fsfb update!</span>`,
  5162. text: `<span style="color: #BBF6FF;">It appears there's a new update available for fsfb script (version: ${version})</br>Changelog: ${changelog}</span>`,
  5163. type: "info",
  5164. confirmButtonColor: "#2cb7f7",
  5165. confirmButtonText: 'Install fsfb Update',
  5166. html: true,
  5167. focusCancel: true,
  5168. // cancelButtonColor: "#29b962",
  5169. // cancelButtonText: 'Install Auto-Updating fsfb',
  5170. // showCancelButton: true,
  5171. customClass: 'fsfb-update-swal'
  5172. }, function(val) {
  5173. if(val){ // install new update
  5174. unsafeWindow.open(`https://greasyfork.org/scripts/${script_id}/`);
  5175. }
  5176. });
  5177. }
  5178. }
  5179. });
  5180. } catch (err) {
  5181. console.error("FSFB: An error occurred while checking for updates:\n" + err);
  5182. }
  5183. }
  5184.  
  5185. document.querySelector('body').append(scripts);
  5186. unsafeWindow.fsfbScriptsLoaded = true;
  5187. // $('#gameSettingsTab a')[0].click(); // att
  5188. // $('#settingTab4')[0].click();
  5189. };
  5190.  
  5191.  
  5192. if(unsafeWindow.fsfbScriptsLoaded || unsafeWindow.fsfbEvListenerAdded) alert('It appears fsfb scripts is already loaded. It\'s recommended to only use one instance of fsfb at a time.');
  5193. (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(afterLoaded, 0) : (document.addEventListener("DOMContentLoaded", afterLoaded), unsafeWindow.fsfbEvListenerAdded = true));