fsfb script

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

目前為 2024-02-15 提交的版本,檢視 最新版本

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