fsfb script

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

目前為 2023-04-29 提交的版本,檢視 最新版本

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

QingJ © 2025

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