Bonk.io XP Farmer

A Script that helps you to get free xp by using /xpin <second> in Bonk.io |

  1. // ==UserScript==
  2. // @name Bonk.io XP Farmer
  3. // @namespace https://bonk.io/
  4. // @version 1.0
  5. // @author Torch_7
  6. // @description A Script that helps you to get free xp by using /xpin <second> in Bonk.io |
  7. // @match https://bonk.io/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function BonkCommandsScriptInjector(f){
  15. if(window.location == window.parent.location){
  16. if(document.readyState == "complete"){ f(); }
  17. else{ document.addEventListener('readystatechange', function(){ setTimeout(f, 1500); }); }
  18. }
  19. }
  20.  
  21. BonkCommandsScriptInjector(function(){
  22. var scope = window;
  23. scope.Gwindow = document.getElementById("maingameframe").contentWindow;
  24. scope.Gdocument = document.getElementById("maingameframe").contentDocument;
  25.  
  26. if (typeof scope.displayInChat !== 'function') {
  27. scope.displayInChat = function(msg) {
  28. console.log("Chat Message:", msg);
  29. };
  30. }
  31.  
  32. if (!scope.Gwindow.WebSocket) return;
  33.  
  34. let wsInstance = null;
  35. let originalSend = scope.Gwindow.WebSocket.prototype.send;
  36. scope.Gwindow.WebSocket.prototype.send = function(data) {
  37. if (typeof data === "string" && data.includes("42[38]")) {
  38. console.log("Sent: 42[38]");
  39. }
  40. if (!wsInstance) wsInstance = this;
  41. return originalSend.apply(this, arguments);
  42. };
  43.  
  44. let xpInterval = null;
  45. function startAutoXP(seconds) {
  46. if (xpInterval) clearInterval(xpInterval);
  47. if (seconds > 0) {
  48. xpInterval = setInterval(() => {
  49. if (wsInstance && wsInstance.readyState === WebSocket.OPEN) {
  50. wsInstance.send("42[38]");
  51. scope.displayInChat(" +100xp ");
  52. console.log("Auto XP Sent");
  53. }
  54. }, seconds * 1000);
  55. scope.displayInChat(`✅ XP Auto-Click Enabled | You will receive XP every ${seconds} seconds.`);
  56. } else {
  57. scope.displayInChat("❌ XP Auto-Click Disabled.");
  58. }
  59. }
  60.  
  61. // NEW: Chat Command /xpin <seconds>
  62. let chatBox = scope.Gdocument.getElementById("ingamechatinputtext");
  63. if (chatBox) {
  64. chatBox.addEventListener("keydown", function(event) {
  65. if (event.key === "Enter") {
  66. let message = chatBox.value.trim();
  67. let match = message.match(/^\/xpin\s*(\d+)?$/);
  68. if (match) {
  69. let duration = match[1] ? parseInt(match[1], 10) : 0;
  70. startAutoXP(duration);
  71. }
  72. }
  73. });
  74. }
  75. });
  76. })();

QingJ © 2025

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