Auto Blum

Đã sợ thì đừng dùng, đã dùng thì đừng sợ!

  1. // ==UserScript==
  2. // @name Auto Blum
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-06-17
  5. // @description Đã sợ thì đừng dùng, đã dùng thì đừng sợ!
  6. // @author caobang
  7. // @match https://telegram.blum.codes/*
  8. // @icon https://cdn.prod.website-files.com/65b6a1a4a0e2af577bccce96/65ba99c1616e21b24009b86c_blum-256.png
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. const minBombClickCount = 0; //số bomb sẽ bấm vào
  16. const minFreezeClickCount = 2; //số băng sẽ bấm vào
  17. const cloverSkipPercentage = 10; //tỉ lệ bỏ qua click cỏ ba lá (%)
  18.  
  19. const consoleRed = 'font-weight: bold; color: red;';
  20. const consoleGreen = 'font-weight: bold; color: green;';
  21. const consolePrefix = '%c [AutoBot] ';
  22. const originalConsoleLog = console.log;
  23.  
  24. console.log = function () {
  25. if (arguments[0].includes('[AutoBot]') || arguments[0].includes('github.com')) {
  26. originalConsoleLog.apply(console, arguments);
  27. }
  28. };
  29.  
  30. console.error = console.warn = console.info = console.debug = function () { };
  31.  
  32. console.clear();
  33. console.log(`${consolePrefix}Bt đầu bot...`, consoleGreen);
  34.  
  35. let totalPoints = 0;
  36. let bombClickCount = 0;
  37. let freezeClickCount = 0;
  38. let skippedClovers = 0;
  39. let gameEnded = false;
  40. let checkGameEndInterval;
  41.  
  42. const originalPush = Array.prototype.push;
  43. Array.prototype.push = function(...args) {
  44. args.forEach(arg => {
  45. if (arg && arg.item) {
  46. if (arg.item.type === "CLOVER") {
  47. arg.shouldSkip = Math.random() < (cloverSkipPercentage / 100);
  48. if (arg.shouldSkip) {
  49. skippedClovers++;
  50. console.log(`${consolePrefix}B qua c 3 lá (${skippedClovers})`, consoleRed);
  51. } else {
  52. console.log(`${consolePrefix}Bm vào c 3 lá (${totalPoints})`, consoleGreen);
  53. totalPoints++;
  54. arg.onClick(arg);
  55. arg.isExplosion = true;
  56. arg.addedAt = performance.now();
  57. }
  58. } else if (arg.item.type === "BOMB" && bombClickCount < minBombClickCount) {
  59. console.log(`${consolePrefix}Bm vào bomb`, consoleRed);
  60. totalPoints = 0;
  61. arg.onClick(arg);
  62. arg.isExplosion = true;
  63. arg.addedAt = performance.now();
  64. bombClickCount++;
  65. } else if (arg.item.type === "FREEZE" && freezeClickCount < minFreezeClickCount) {
  66. console.log(`${consolePrefix}Bm vào đóng băng`, consoleGreen);
  67. arg.onClick(arg);
  68. arg.isExplosion = true;
  69. arg.addedAt = performance.now();
  70. freezeClickCount++;
  71. }
  72. }
  73. });
  74. return originalPush.apply(this, args);
  75. };
  76.  
  77. function checkGameEnd() {
  78. const rewardElement = document.querySelector('div.reward .animated-points.visible');
  79. if (rewardElement && !gameEnded) {
  80. gameEnded = true;
  81. const rewardAmount = rewardElement.querySelector('.amount').textContent;
  82. console.log(`${consolePrefix}Trò chơi kết thúc. Tng s đim kiếm được: ${rewardAmount}`, consoleGreen);
  83. totalPoints = 0;
  84. bombClickCount = 0;
  85. freezeClickCount = 0;
  86. skippedClovers = 0;
  87.  
  88. const playButton = document.querySelector('button.kit-button.is-large.is-primary');
  89. if (playButton) {
  90. const playPassesText = playButton.querySelector('.label span').textContent;
  91. const playPasses = parseInt(playPassesText.match(/\d+/)[0], 10);
  92.  
  93. if (playPasses > 0) {
  94. setTimeout(() => {
  95. playButton.click();
  96. console.log(`${consolePrefix}Bt đầu trò chơi mi...`, consoleGreen);
  97. gameEnded = false;
  98. }, Math.random() * (5151.2 - 3137.7) + 3137.7);
  99. } else {
  100. console.log(`${consolePrefix}Đã chơi hết game`, consoleRed);
  101. clearInterval(checkGameEndInterval);
  102. }
  103. } else {
  104. console.log(`${consolePrefix}Không tìm thy nút chơi`, consoleRed);
  105. }
  106. }
  107. }
  108.  
  109. function startGameEndCheck() {
  110. if (checkGameEndInterval) {
  111. clearInterval(checkGameEndInterval);
  112. }
  113.  
  114. checkGameEndInterval = setInterval(checkGameEnd, 1000);
  115.  
  116. const observer = new MutationObserver((mutationsList, observer) => {
  117. for (const mutation of mutationsList) {
  118. if (mutation.type === 'childList') {
  119. checkGameEnd();
  120. }
  121. }
  122. });
  123.  
  124. observer.observe(document.body, { childList: true, subtree: true });
  125. }
  126.  
  127. startGameEndCheck();
  128.  
  129. })();