fsfb script

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

当前为 2023-06-25 提交的版本,查看 最新版本

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