Bonk.io Ultimate Script

Add rainbow styles, auto-join games, UI tweaks, hotkeys, and more to Bonk.io. Activated via commands.

当前为 2024-12-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bonk.io Ultimate Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 17.8.9
  5. // @description Add rainbow styles, auto-join games, UI tweaks, hotkeys, and more to Bonk.io. Activated via commands.
  6. // @author YourName
  7. // @match https://bonk.io/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. let isRainbowActive = false;
  15. let isAutoJoinActive = false;
  16. let isChatBoostActive = false;
  17. let isAutoPlayActive = false;
  18. let customSkin = null;
  19. let hotkeys = {};
  20.  
  21. let hue = 0;
  22.  
  23. function setupCommandListener() {
  24. document.addEventListener('keydown', (e) => {
  25. if (e.key === 'Enter') {
  26. setTimeout(() => {
  27. const chatInput = document.querySelector('#chatinput');
  28. if (!chatInput) return;
  29.  
  30. const command = chatInput.value.trim().toLowerCase();
  31. chatInput.value = ''; // Clear input
  32.  
  33. // Handle commands
  34. switch (command) {
  35. case '/rainbowstyle':
  36. isRainbowActive = !isRainbowActive;
  37. console.log(`Rainbow Style: ${isRainbowActive ? 'Enabled' : 'Disabled'}`);
  38. break;
  39. case '/autojoin':
  40. isAutoJoinActive = !isAutoJoinActive;
  41. console.log(`Auto-Join: ${isAutoJoinActive ? 'Enabled' : 'Disabled'}`);
  42. break;
  43. case '/customizeui':
  44. customizeUI();
  45. break;
  46. case '/sethotkeys':
  47. setHotkeys();
  48. break;
  49. case '/chatboost':
  50. isChatBoostActive = !isChatBoostActive;
  51. console.log(`Chat Boost: ${isChatBoostActive ? 'Enabled' : 'Disabled'}`);
  52. break;
  53. case '/setskin':
  54. setCustomSkin();
  55. break;
  56. case '/autoplay':
  57. isAutoPlayActive = !isAutoPlayActive;
  58. console.log(`Auto-Play: ${isAutoPlayActive ? 'Enabled' : 'Disabled'}`);
  59. break;
  60. default:
  61. console.log(`Unknown command: ${command}`);
  62. }
  63. }, 0);
  64. }
  65. });
  66. }
  67.  
  68. function applyRainbowEffect() {
  69. setInterval(() => {
  70. if (!isRainbowActive) return;
  71.  
  72. hue = (hue + 5) % 360;
  73. const rectangleColor = `hsl(${hue}, 100%, 50%)`;
  74. const oppositeColor = `hsl(${(hue + 180) % 360}, 100%, 50%)`;
  75.  
  76. try {
  77. if (window.bonkHost && window.bonkHost.p) {
  78. window.bonkHost.p.color = rectangleColor;
  79. window.bonkHost.p.outline = rectangleColor;
  80. }
  81.  
  82. const playerName = document.querySelector('.playerName');
  83. const levelText = document.querySelector('.levelText');
  84. if (playerName) playerName.style.color = oppositeColor;
  85. if (levelText) levelText.style.color = oppositeColor;
  86.  
  87. } catch (e) {
  88. console.error('Error applying rainbow effect:', e);
  89. }
  90. }, 100);
  91. }
  92.  
  93. function autoJoinGames() {
  94. setInterval(() => {
  95. if (!isAutoJoinActive) return;
  96.  
  97. try {
  98. const joinButton = document.querySelector('.joinGameButton');
  99. if (joinButton) {
  100. joinButton.click();
  101. console.log('Auto-Joined a game!');
  102. }
  103. } catch (e) {
  104. console.error('Error with Auto-Join:', e);
  105. }
  106. }, 1000);
  107. }
  108.  
  109. function customizeUI() {
  110. alert('UI customization activated! (This is a placeholder — add customization logic here.)');
  111. }
  112.  
  113. function setHotkeys() {
  114. alert('Hotkey configuration activated! (This is a placeholder — add hotkey logic here.)');
  115. }
  116.  
  117. function chatBoost() {
  118. if (!isChatBoostActive) return;
  119.  
  120. const chatLog = document.querySelector('.chatLog');
  121. if (chatLog) {
  122. // Example: Automatically highlight certain messages
  123. chatLog.querySelectorAll('.chatMessage').forEach((msg) => {
  124. if (msg.textContent.includes('!')) {
  125. msg.style.color = 'red';
  126. }
  127. });
  128. }
  129. }
  130.  
  131. function setCustomSkin() {
  132. customSkin = prompt('Enter a hex color for your custom skin:');
  133. if (customSkin && window.bonkHost && window.bonkHost.p) {
  134. window.bonkHost.p.color = customSkin;
  135. window.bonkHost.p.outline = customSkin;
  136. console.log(`Custom skin set to: ${customSkin}`);
  137. }
  138. }
  139.  
  140. function autoPlay() {
  141. setInterval(() => {
  142. if (!isAutoPlayActive) return;
  143.  
  144. try {
  145. if (window.bonkHost && window.bonkHost.p) {
  146. // Example: Automatically jump every second
  147. window.bonkHost.p.jump();
  148. console.log('Auto-Jumping!');
  149. }
  150. } catch (e) {
  151. console.error('Error with Auto-Play:', e);
  152. }
  153. }, 1000);
  154. }
  155.  
  156. const waitForGame = setInterval(() => {
  157. if (typeof window.bonkHost !== 'undefined' && window.bonkHost.p !== undefined) {
  158. clearInterval(waitForGame);
  159. setupCommandListener();
  160. applyRainbowEffect();
  161. autoJoinGames();
  162. setInterval(chatBoost, 500); // Enhance chat functionality
  163. autoPlay();
  164. }
  165. }, 100);
  166. })();