Greasy Fork 还支持 简体中文。

fsfb script

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

目前為 2023-08-26 提交的版本,檢視 最新版本

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