fsfb script

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

目前為 2023-06-23 提交的版本,檢視 最新版本

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