fsfb script

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

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

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址