Greasy Fork镜像 支持简体中文。

fsfb script

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

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

QingJ © 2025

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