fsfb script

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

当前为 2023-05-31 提交的版本,查看 最新版本

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