fsfb script

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

当前为 2024-02-17 提交的版本,查看 最新版本

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