fsfb script

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

目前為 2024-04-03 提交的版本,檢視 最新版本

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

QingJ © 2025

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