Greasy Fork 还支持 简体中文。

Fake bot Change Villa

Change villa every iteration

目前為 2025-01-21 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Fake bot Change Villa
  3. // @version 1.4
  4. // @description Change villa every iteration
  5. // @include https://*/game.php*screen=place*
  6. // @namespace https://greasyfork.org/users/1388863
  7. // ==/UserScript==
  8.  
  9. (function() {
  10. 'use strict';
  11.  
  12. const container = document.createElement('div');
  13. container.style.position = 'fixed';
  14. container.style.bottom = '20px';
  15. container.style.right = '20px';
  16. container.style.backgroundColor = '#333';
  17. container.style.color = '#fff';
  18. container.style.padding = '8px';
  19. container.style.borderRadius = '5px';
  20. container.style.zIndex = '10000';
  21. container.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
  22. container.style.display = 'flex';
  23. container.style.flexDirection = 'column';
  24. container.style.gap = '10px';
  25. document.body.appendChild(container);
  26.  
  27. // Remaining loops display
  28. const loopCounterDisplay = document.createElement('div');
  29. loopCounterDisplay.style.fontSize = '14px'; // Smaller text size
  30. loopCounterDisplay.style.textAlign = 'center';
  31. loopCounterDisplay.textContent = 'Remaining Loops: 0';
  32. container.appendChild(loopCounterDisplay);
  33.  
  34. // Create a flex container for buttons to be side by side
  35. const buttonContainer = document.createElement('div');
  36. buttonContainer.style.display = 'flex';
  37. buttonContainer.style.gap = '10px'; // Add space between buttons
  38. buttonContainer.style.width = '100%'; // Ensure the container spans the full width
  39. container.appendChild(buttonContainer);
  40.  
  41. // Start/Stop button
  42. const startStopButton = document.createElement('button');
  43. startStopButton.textContent = 'Start';
  44. startStopButton.style.padding = '5px 8px'; // Smaller padding
  45. startStopButton.style.fontSize = '14px'; // Smaller font size
  46. startStopButton.style.backgroundColor = '#4CAF50';
  47. startStopButton.style.color = '#fff';
  48. startStopButton.style.border = 'none';
  49. startStopButton.style.borderRadius = '3px';
  50. startStopButton.style.cursor = 'pointer';
  51. startStopButton.style.flex = '1'; // Allow button to take equal space
  52. buttonContainer.appendChild(startStopButton);
  53.  
  54. // Set Loops button
  55. const loopButton = document.createElement('button');
  56. loopButton.textContent = 'Set';
  57. loopButton.style.padding = '5px 8px'; // Smaller padding
  58. loopButton.style.fontSize = '14px'; // Smaller font size
  59. loopButton.style.backgroundColor = '#FF9800';
  60. loopButton.style.color = '#fff';
  61. loopButton.style.border = 'none';
  62. loopButton.style.borderRadius = '3px';
  63. loopButton.style.cursor = 'pointer';
  64. loopButton.style.flex = '1'; // Allow button to take equal space
  65. buttonContainer.appendChild(loopButton);
  66.  
  67.  
  68. // Retrieve the last state from localStorage
  69. let isRunning = localStorage.getItem('botState') === 'running';
  70. let remainingLoops = parseFloat(localStorage.getItem('remainingLoops')) || 0;
  71.  
  72. // Set initial button and loop counter state
  73. startStopButton.textContent = isRunning ? 'Stop' : 'Start';
  74. loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
  75.  
  76. // Start the bot if it was running
  77. if (isRunning) {
  78. startBot();
  79. }
  80.  
  81. // Start/Stop button event
  82. startStopButton.addEventListener('click', () => {
  83. if (isRunning) {
  84. stopBot();
  85. } else {
  86. startBot();
  87. }
  88. });
  89.  
  90. // Loop button event
  91. loopButton.addEventListener('click', () => {
  92. const loopsInput = parseInt(prompt("Enter the number of loops to run:", remainingLoops), 10);
  93. if (!isNaN(loopsInput) && loopsInput > 0) {
  94. remainingLoops = loopsInput;
  95. localStorage.setItem('remainingLoops', remainingLoops);
  96. loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
  97. console.log(`Set loops to: ${remainingLoops}`);
  98. }
  99. });
  100.  
  101. function startBot() {
  102. isRunning = true;
  103. localStorage.setItem('botState', 'running');
  104. startStopButton.textContent = 'Stop';
  105. startStopButton.style.backgroundColor = '#FF0000';
  106. console.log("Bot started");
  107. loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
  108. runBotLoop();
  109. }
  110.  
  111. function stopBot() {
  112. isRunning = false;
  113. localStorage.setItem('botState', 'stopped');
  114. startStopButton.textContent = 'Start';
  115. startStopButton.style.backgroundColor = '#4CAF50';
  116. console.log("Bot stopped");
  117. }
  118.  
  119. function runBotLoop() {
  120. if (remainingLoops > 0) {
  121. console.log("Executing loop...");
  122. remainingLoops--;
  123. localStorage.setItem('remainingLoops', remainingLoops);
  124. loopCounterDisplay.textContent = `Remaining Loops: ${remainingLoops}`;
  125. if (remainingLoops > 0) {
  126. setTimeout(runBotLoop, 2000); // Example delay
  127. } else {
  128. stopBot();
  129. }
  130. }
  131. }
  132. })();
  133.  
  134.  
  135.