Starblast.io ECPCheck

Check the ECPs in starblast.io

  1. // ==UserScript==
  2. // @name Starblast.io ECPCheck
  3. // @description Check the ECPs in starblast.io
  4. // @version 0.1
  5. // @author Pixelmelt
  6. // @license MIT
  7. // @namespace https://greasyfork.org/en/users/226344
  8. // @match https://starblast.io/
  9. // @icon https://cdn.upload.systems/uploads/DDPfEofl.png
  10. // @run-at document-start
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. const modName = "ECPCheck";
  15.  
  16. const log = (msg) => console.log(`%c[${modName}] ${msg}`, "color: #85FF6C");
  17.  
  18. function injector(sbCode) {
  19. log(`Mod injected`);
  20. return sbCode;
  21. }
  22. function runner(){
  23.  
  24. if(localStorage.getItem("ecpcheck") == null){
  25. localStorage.setItem("ecpcheck", "false")
  26. }
  27.  
  28. if(localStorage.getItem("ecpcheck") == "true"){
  29. window.module.exports.settings.parameters.ecpcheck = {
  30. name:`ECP Check shortcut (Shift+E)`,
  31. value:true
  32. }
  33. }else{
  34. window.module.exports.settings.parameters.ecpcheck = {
  35. name:`ECP Check shortcut (Shift+E)`,
  36. value:false
  37. }
  38. }
  39.  
  40. if(localStorage.getItem("ecpcheck") != "true"){return}
  41.  
  42. function check() {
  43. function getColor(e){
  44. return e < 25 ? "Red" : e < 50 ? "Orange" : e < 75 ? "Yellow" : e < 150 ? "Green" : e < 256 ? "Blue" : e < 287 ? "Purple" : e < 331 ? "Pink" : void 0;
  45. }
  46. let teams = {}, k = Object.keys(window.module.exports.settings).filter(e => e.match(/[iI10OlL]{3,6}/))[0], b = [];
  47. window.module.exports.settings[k].names.data.filter(e => void 0 !== e).forEach(e => {
  48. b.push(`${e.hue}_${getColor(e.hue)} - ${e.player_name} - ${e.custom?e.custom.badge.charAt(0).toUpperCase() + e.custom.badge.slice(1):"No ecp"}`); b.sort();
  49. var a = getColor(e.hue);
  50. teams[a] || (teams[a] = {ecps: 0,hiddenECP: 0,randoms: 0,total: 0,hue: 0,names: "\n",map: new Map()}),
  51. e.custom && !teams[a].map.has(e.player_name) ? (teams[a].ecps += 1, "Blank" === e.custom.badge && (teams[a].hiddenECP += 1), teams[a].hue = e.hue,
  52. teams[a].names += e.player_name + " - " + e.custom.badge.charAt(0).toUpperCase() + e.custom.badge.slice(1) + "\n") : teams[a].randoms += 1, teams[a].total += 1;
  53. });
  54. for (var c in b) console.log(`%c${b[c].toString().split("_")[1]}`,`color: hsl(${b[c].toString().split("_")[0]},100%,80%)`);
  55. Object.keys(teams).forEach(e => console.log(`%c${teams[e].names}`, `color: hsl(${teams[e].hue},100%,80%)`, teams[e]));
  56. }
  57. document.addEventListener("keydown", function(e){
  58. if(e.shiftKey && e.keyCode == 69){
  59. check();
  60. }
  61. })
  62. log(`Mod ran`);
  63. }
  64. if (!window.sbCodeInjectors) window.sbCodeInjectors = [];
  65. window.sbCodeInjectors.push((sbCode) => {
  66. try {
  67. return injector(sbCode);
  68. } catch (error) {
  69. alert(`${modName} failed to load`);
  70. throw error;
  71. }
  72. });
  73. if(!window.sbCodeRunners) window.sbCodeRunners = [];
  74. window.sbCodeRunners.push(() => {
  75. try {
  76. return runner();
  77. } catch (error) {
  78. alert(`${modName} failed to load`);
  79. throw error;
  80. }
  81. });
  82. log(`Mod loaded`);