Hammer Senpa.io Mod - Performance & Visual Enhancements with GUI

Optimize Senpa.io with FPS optimization, freeze on death, and visual effects, all customizable via GUI

当前为 2025-04-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Hammer Senpa.io Mod - Performance & Visual Enhancements with GUI
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description Optimize Senpa.io with FPS optimization, freeze on death, and visual effects, all customizable via GUI
  6. // @author Hammer
  7. // @match https://senpa.io/*
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. let optimizationEnabled = true;
  15. let fxOn = true;
  16. let isFrozen = false;
  17.  
  18. const smallGui = document.createElement('div');
  19. smallGui.id = 'small-gui';
  20. Object.assign(smallGui.style, {
  21. position: 'fixed',
  22. bottom: '20px',
  23. right: '20px',
  24. width: '50px',
  25. height: '50px',
  26. backgroundColor: 'rgba(0, 0, 0, 0.7)',
  27. color: 'white',
  28. textAlign: 'center',
  29. fontSize: '14px',
  30. borderRadius: '5px',
  31. cursor: 'pointer',
  32. zIndex: '9999',
  33. border: '2px solid red'
  34. });
  35. smallGui.innerText = 'Mods';
  36. document.body.appendChild(smallGui);
  37.  
  38. const guiContainer = document.createElement('div');
  39. guiContainer.id = 'gui-container';
  40. Object.assign(guiContainer.style, {
  41. position: 'fixed',
  42. bottom: '100px',
  43. right: '20px',
  44. width: '250px',
  45. backgroundColor: 'rgba(0, 0, 0, 0.8)',
  46. color: 'white',
  47. padding: '20px',
  48. borderRadius: '10px',
  49. zIndex: '9999',
  50. display: 'none',
  51. fontFamily: 'Arial, sans-serif',
  52. border: '2px solid red'
  53. });
  54.  
  55. const closeButton = document.createElement('button');
  56. closeButton.innerText = 'X';
  57. Object.assign(closeButton.style, {
  58. backgroundColor: '#dc3545',
  59. color: 'white',
  60. border: 'none',
  61. padding: '5px',
  62. borderRadius: '50%',
  63. cursor: 'pointer',
  64. position: 'absolute',
  65. top: '10px',
  66. right: '10px'
  67. });
  68. closeButton.addEventListener('click', () => {
  69. guiContainer.style.display = 'none';
  70. hammerText.style.display = 'none';
  71. });
  72.  
  73. const hammerText = document.createElement('div');
  74. hammerText.innerText = 'made by hammer <3';
  75. Object.assign(hammerText.style, {
  76. color: '#fff',
  77. fontSize: '14px',
  78. textAlign: 'center',
  79. marginTop: '20px',
  80. display: 'none'
  81. });
  82.  
  83. function createToggleButton(textOn, textOff, initialState, callback) {
  84. const btn = document.createElement('button');
  85. btn.innerText = initialState ? textOff : textOn;
  86. btn.style.backgroundColor = initialState ? '#28a745' : '#dc3545';
  87. btn.style.color = 'white';
  88. btn.style.border = 'none';
  89. btn.style.padding = '10px';
  90. btn.style.borderRadius = '5px';
  91. btn.style.cursor = 'pointer';
  92. btn.style.marginBottom = '10px';
  93. btn.addEventListener('click', () => {
  94. const newState = callback();
  95. btn.innerText = newState ? textOff : textOn;
  96. btn.style.backgroundColor = newState ? '#28a745' : '#dc3545';
  97. });
  98. return btn;
  99. }
  100.  
  101. guiContainer.appendChild(closeButton);
  102. guiContainer.appendChild(createToggleButton('Enable FPS Optimization', 'Disable FPS Optimization', optimizationEnabled, () => {
  103. optimizationEnabled = !optimizationEnabled;
  104. optimizationEnabled ? enableOptimization() : disableOptimization();
  105. return optimizationEnabled;
  106. }));
  107. guiContainer.appendChild(createToggleButton('Enable FX', 'Disable FX', fxOn, () => {
  108. fxOn = !fxOn;
  109. applyVisualEffects();
  110. return fxOn;
  111. }));
  112. guiContainer.appendChild(createToggleButton('Freeze on Death', 'Unfreeze on Death', isFrozen, () => {
  113. isFrozen = !isFrozen;
  114. return isFrozen;
  115. }));
  116. guiContainer.appendChild(hammerText);
  117. document.body.appendChild(guiContainer);
  118.  
  119. smallGui.addEventListener('click', () => {
  120. const isHidden = guiContainer.style.display === 'none';
  121. guiContainer.style.display = isHidden ? 'block' : 'none';
  122. hammerText.style.display = isHidden ? 'block' : 'none';
  123. });
  124.  
  125. function applyVisualEffects() {
  126. const canvas = document.querySelector('canvas');
  127. if (canvas) {
  128. canvas.style.filter = fxOn ? 'brightness(1.1) contrast(1.2) saturate(1.1)' : 'none';
  129. }
  130. }
  131.  
  132. function enableOptimization() {
  133. document.body.style.backgroundImage = 'none';
  134. document.querySelectorAll('img').forEach(img => img.src = '');
  135. const style = document.createElement('style');
  136. style.innerHTML = `
  137. * {
  138. animation: none !important;
  139. transition: none !important;
  140. box-shadow: none !important;
  141. }
  142. canvas {
  143. image-rendering: optimizeSpeed;
  144. will-change: transform;
  145. }
  146. body, html {
  147. background: #000 !important;
  148. overflow: hidden;
  149. margin: 0;
  150. padding: 0;
  151. }
  152. `;
  153. document.head.appendChild(style);
  154. document.querySelectorAll('audio').forEach(audio => audio.pause());
  155. document.querySelectorAll('.ad, .sidebar, .popup').forEach(ad => ad.remove());
  156. }
  157.  
  158. function disableOptimization() {
  159. const style = document.createElement('style');
  160. style.innerHTML = `
  161. * {
  162. animation: initial !important;
  163. transition: initial !important;
  164. }
  165. `;
  166. document.head.appendChild(style);
  167. }
  168.  
  169. function freezeOnDeath() {
  170. if (!isFrozen) return;
  171. const player = document.querySelector('.player');
  172. if (!player) return;
  173.  
  174. isFrozen = true;
  175. const preventMovement = e => { e.preventDefault(); e.stopPropagation(); };
  176.  
  177. document.addEventListener('keydown', preventMovement);
  178. document.addEventListener('mousemove', preventMovement);
  179. document.addEventListener('mousedown', preventMovement);
  180.  
  181. setTimeout(() => {
  182. isFrozen = false;
  183. document.removeEventListener('keydown', preventMovement);
  184. document.removeEventListener('mousemove', preventMovement);
  185. document.removeEventListener('mousedown', preventMovement);
  186. }, 3000);
  187. }
  188.  
  189. setInterval(() => {
  190. const deathState = document.querySelector('.dead');
  191. if (deathState && isFrozen) {
  192. freezeOnDeath();
  193. }
  194. }, 1000);
  195.  
  196. if (optimizationEnabled) enableOptimization();
  197. if (fxOn) applyVisualEffects();
  198. })();