Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- // Prevent creating multiple instances
- if (document.getElementById('wiper-beta-ui')) {
- document.getElementById('wiper-beta-ui').remove();
- }
- if (document.getElementById('wiper-warning-modal')) {
- document.getElementById('wiper-warning-modal').remove();
- }
- let isFastMode = false;
- // --- 1. CREATE THE UI ---
- const ui = document.createElement('div');
- ui.id = 'wiper-beta-ui';
- ui.style.position = 'fixed';
- ui.style.top = '20px';
- ui.style.left = '20px';
- // Dark red to dark orange gradient
- ui.style.background = 'linear-gradient(135deg, #8b0000, #ff8c00)';
- ui.style.color = '#fff';
- ui.style.border = '2px solid #4a0000';
- ui.style.padding = '15px';
- ui.style.zIndex = '999998';
- ui.style.fontFamily = 'monospace';
- ui.style.boxShadow = '0px 6px 15px rgba(0,0,0,0.6)';
- ui.style.width = '240px';
- ui.style.borderRadius = '8px';
- // Title
- const title = document.createElement('h3');
- title.innerText = 'Wiper Beta v1.2.1';
- title.style.margin = '0 0 15px 0';
- title.style.fontSize = '18px';
- title.style.textAlign = 'center';
- title.style.borderBottom = '1px solid rgba(255, 255, 255, 0.3)';
- title.style.paddingBottom = '5px';
- title.style.textShadow = '1px 1px 2px #000';
- ui.appendChild(title);
- // Minimize Button
- const minimizeBtn = document.createElement('div');
- minimizeBtn.innerText = '−';
- minimizeBtn.style.position = 'absolute';
- minimizeBtn.style.top = '5px';
- minimizeBtn.style.right = '30px';
- minimizeBtn.style.cursor = 'pointer';
- minimizeBtn.style.color = '#fff';
- minimizeBtn.style.fontWeight = 'bold';
- minimizeBtn.style.fontSize = '16px';
- minimizeBtn.style.textShadow = '1px 1px 2px #000';
- ui.appendChild(minimizeBtn);
- // Close button
- const closeBtn = document.createElement('div');
- closeBtn.innerText = 'X';
- closeBtn.style.position = 'absolute';
- closeBtn.style.top = '6px';
- closeBtn.style.right = '10px';
- closeBtn.style.cursor = 'pointer';
- closeBtn.style.color = '#fff';
- closeBtn.style.fontWeight = 'bold';
- closeBtn.style.fontSize = '14px';
- closeBtn.style.textShadow = '1px 1px 2px #000';
- closeBtn.onclick = () => ui.remove();
- ui.appendChild(closeBtn);
- // Content Wrapper (hides when minimized)
- const contentDiv = document.createElement('div');
- ui.appendChild(contentDiv);
- minimizeBtn.onclick = () => {
- if (contentDiv.style.display === 'none') {
- contentDiv.style.display = 'block';
- minimizeBtn.innerText = '−';
- title.style.borderBottom = '1px solid rgba(255, 255, 255, 0.3)';
- title.style.margin = '0 0 15px 0';
- } else {
- contentDiv.style.display = 'none';
- minimizeBtn.innerText = '+';
- title.style.borderBottom = 'none';
- title.style.margin = '0';
- }
- };
- // Helper function to create standard textboxes
- function createTextInput(labelText) {
- const wrapper = document.createElement('div');
- wrapper.style.marginBottom = '8px';
- wrapper.style.display = 'flex';
- wrapper.style.justifyContent = 'space-between';
- wrapper.style.alignItems = 'center';
- const label = document.createElement('label');
- label.innerText = labelText + ': ';
- label.style.fontWeight = 'bold';
- label.style.textShadow = '1px 1px 2px #000';
- const input = document.createElement('input');
- input.type = 'text'; // Strictly 'text'
- input.style.width = '120px';
- input.style.backgroundColor = 'rgba(0, 0, 0, 0.6)';
- input.style.color = '#fff';
- input.style.border = '1px solid #ffaa00';
- input.style.padding = '4px';
- input.style.borderRadius = '3px';
- input.style.outline = 'none';
- wrapper.appendChild(label);
- wrapper.appendChild(input);
- contentDiv.appendChild(wrapper);
- return input;
- }
- // Create the 4 inputs
- const inputX1 = createTextInput('X1');
- const inputY1 = createTextInput('Y1');
- const inputX2 = createTextInput('X2');
- const inputY2 = createTextInput('Y2');
- // --- CLEAR IN TILES TOGGLE ---
- const tileWrapper = document.createElement('div');
- tileWrapper.style.margin = '10px 0';
- tileWrapper.style.display = 'flex';
- tileWrapper.style.justifyContent = 'space-between';
- tileWrapper.style.alignItems = 'center';
- const tileLabel = document.createElement('label');
- tileLabel.innerText = 'Clear in Tiles:';
- tileLabel.style.fontWeight = 'bold';
- tileLabel.style.textShadow = '1px 1px 2px #000';
- tileLabel.style.cursor = 'pointer';
- const tileCheckbox = document.createElement('input');
- tileCheckbox.type = 'checkbox';
- tileCheckbox.style.cursor = 'pointer';
- tileCheckbox.style.width = '16px';
- tileCheckbox.style.height = '16px';
- tileWrapper.appendChild(tileLabel);
- tileWrapper.appendChild(tileCheckbox);
- contentDiv.appendChild(tileWrapper);
- // --- EASY MODE SECTION ---
- const easyModeContainer = document.createElement('div');
- easyModeContainer.style.margin = '10px 0';
- easyModeContainer.style.padding = '8px';
- easyModeContainer.style.border = '1px solid #00ffff';
- easyModeContainer.style.borderRadius = '4px';
- easyModeContainer.style.backgroundColor = 'rgba(0, 255, 255, 0.1)';
- easyModeContainer.style.textAlign = 'center';
- const emLabel = document.createElement('div');
- emLabel.style.marginBottom = '5px';
- emLabel.style.fontWeight = 'bold';
- emLabel.style.color = '#00ffff';
- emLabel.style.textShadow = '1px 1px 2px #000';
- emLabel.style.fontSize = '12px';
- emLabel.style.display = 'none'; // Hidden initially
- const emBtn = document.createElement('button');
- emBtn.innerText = 'Easy Mode';
- emBtn.style.width = '100%';
- emBtn.style.padding = '6px';
- emBtn.style.backgroundColor = '#00cccc';
- emBtn.style.color = 'black';
- emBtn.style.fontWeight = 'bold';
- emBtn.style.border = '1px solid #00ffff';
- emBtn.style.cursor = 'pointer';
- emBtn.style.borderRadius = '3px';
- emBtn.style.boxShadow = '0px 2px 4px rgba(0,0,0,0.5)';
- emBtn.onmouseover = () => emBtn.style.backgroundColor = '#00ffff';
- emBtn.onmouseout = () => emBtn.style.backgroundColor = '#00cccc';
- easyModeContainer.appendChild(emLabel);
- easyModeContainer.appendChild(emBtn);
- contentDiv.appendChild(easyModeContainer);
- let easyModeStep = 0;
- // Helper to get EXACT OWOT character/tile position
- function getPlayerCoords() {
- let coords = null;
- if (typeof cursorCoords !== "undefined" && cursorCoords !== null) {
- coords = [cursorCoords[0], cursorCoords[1]];
- } else if (typeof currentCol !== "undefined" && typeof currentRow !== "undefined") {
- coords = [currentCol, currentRow];
- }
- if (!coords) {
- alert("Wiper Beta: Please click anywhere on the map first to place your typing cursor!");
- return null;
- }
- if (tileCheckbox.checked) {
- return [Math.floor(coords[0] / 16), Math.floor(coords[1] / 16)];
- }
- return coords;
- }
- emBtn.addEventListener('click', () => {
- if (easyModeStep === 0) {
- emLabel.style.display = 'block';
- emLabel.innerText = 'Input 1 (Place cursor, hit Select)';
- emBtn.innerText = 'Select';
- easyModeStep = 1;
- } else if (easyModeStep === 1) {
- let pos = getPlayerCoords();
- if (!pos) return;
- inputX1.value = pos[0];
- inputY1.value = pos[1];
- emLabel.innerText = 'Input 2 (Place cursor, hit Select)';
- easyModeStep = 2;
- } else if (easyModeStep === 2) {
- let pos = getPlayerCoords();
- if (!pos) return;
- inputX2.value = pos[0];
- inputY2.value = pos[1];
- emLabel.innerText = 'Easy Select done! have fun!';
- emBtn.style.display = 'none';
- easyModeStep = 3;
- setTimeout(() => {
- emLabel.style.display = 'none';
- emBtn.style.display = 'block';
- emBtn.innerText = 'Easy Mode';
- easyModeStep = 0;
- }, 3000);
- }
- });
- // --- FAST MODE SECTION ---
- const fmWrapper = document.createElement('div');
- fmWrapper.style.margin = '12px 0';
- fmWrapper.style.display = 'flex';
- fmWrapper.style.justifyContent = 'space-between';
- fmWrapper.style.alignItems = 'center';
- fmWrapper.style.borderTop = '1px solid rgba(255,255,255,0.2)';
- fmWrapper.style.paddingTop = '10px';
- const fmLabel = document.createElement('label');
- fmLabel.innerText = 'Fast Mode (x5):';
- fmLabel.style.fontWeight = 'bold';
- fmLabel.style.textShadow = '1px 1px 2px #000';
- fmLabel.style.cursor = 'pointer';
- const fmCheckbox = document.createElement('input');
- fmCheckbox.type = 'checkbox';
- fmCheckbox.style.cursor = 'pointer';
- fmCheckbox.style.width = '18px';
- fmCheckbox.style.height = '18px';
- fmWrapper.appendChild(fmLabel);
- fmWrapper.appendChild(fmCheckbox);
- contentDiv.appendChild(fmWrapper);
- fmCheckbox.addEventListener('click', (e) => {
- if (fmCheckbox.checked) {
- e.preventDefault();
- showWarningPopup();
- } else {
- isFastMode = false;
- }
- });
- // --- SUBMIT SECTION ---
- const submitBtn = document.createElement('button');
- submitBtn.innerText = 'Submit';
- submitBtn.style.width = '100%';
- submitBtn.style.marginTop = '10px';
- submitBtn.style.padding = '10px';
- submitBtn.style.backgroundColor = '#222';
- submitBtn.style.color = 'white';
- submitBtn.style.border = '1px solid #ff8c00';
- submitBtn.style.cursor = 'pointer';
- submitBtn.style.fontWeight = 'bold';
- submitBtn.style.borderRadius = '4px';
- submitBtn.style.boxShadow = '0px 2px 5px rgba(0,0,0,0.4)';
- submitBtn.onmouseover = () => { if(!submitBtn.disabled) submitBtn.style.backgroundColor = '#444'; };
- submitBtn.onmouseout = () => { if(!submitBtn.disabled) submitBtn.style.backgroundColor = '#222'; };
- contentDiv.appendChild(submitBtn);
- document.body.appendChild(ui);
- // --- 2. CUSTOM WARNING POPUP ---
- function showWarningPopup() {
- const modalBg = document.createElement('div');
- modalBg.id = 'wiper-warning-modal';
- modalBg.style.position = 'fixed';
- modalBg.style.top = '0';
- modalBg.style.left = '0';
- modalBg.style.width = '100vw';
- modalBg.style.height = '100vh';
- modalBg.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
- modalBg.style.zIndex = '999999';
- modalBg.style.display = 'flex';
- modalBg.style.justifyContent = 'center';
- modalBg.style.alignItems = 'center';
- const modalBox = document.createElement('div');
- modalBox.style.backgroundColor = '#1a1a1a';
- modalBox.style.border = '2px solid #ff3333';
- modalBox.style.padding = '20px';
- modalBox.style.borderRadius = '8px';
- modalBox.style.width = '300px';
- modalBox.style.textAlign = 'center';
- modalBox.style.color = '#fff';
- modalBox.style.fontFamily = 'monospace';
- modalBox.style.boxShadow = '0px 10px 30px rgba(0,0,0,0.8)';
- const modalTitle = document.createElement('h2');
- modalTitle.innerText = 'Warning!';
- modalTitle.style.color = '#ff4444';
- modalTitle.style.margin = '0 0 10px 0';
- const modalText = document.createElement('p');
- modalText.innerText = 'Please note that it might kick you out or lag you out.';
- modalText.style.margin = '0 0 20px 0';
- modalText.style.fontSize = '14px';
- modalText.style.color = '#ccc';
- const btnContainer = document.createElement('div');
- btnContainer.style.display = 'flex';
- btnContainer.style.justifyContent = 'space-between';
- const cancelBtn = document.createElement('button');
- cancelBtn.innerText = 'Cancel';
- cancelBtn.style.padding = '8px 15px';
- cancelBtn.style.backgroundColor = '#444';
- cancelBtn.style.color = '#fff';
- cancelBtn.style.border = 'none';
- cancelBtn.style.borderRadius = '4px';
- cancelBtn.style.cursor = 'pointer';
- const proceedBtn = document.createElement('button');
- proceedBtn.innerText = 'Proceed';
- proceedBtn.style.padding = '8px 15px';
- proceedBtn.style.backgroundColor = '#cc0000';
- proceedBtn.style.color = '#fff';
- proceedBtn.style.border = 'none';
- proceedBtn.style.borderRadius = '4px';
- proceedBtn.style.cursor = 'pointer';
- proceedBtn.style.fontWeight = 'bold';
- cancelBtn.onclick = () => {
- modalBg.remove();
- fmCheckbox.checked = false;
- };
- proceedBtn.onclick = () => {
- modalBg.remove();
- fmCheckbox.checked = true;
- isFastMode = true;
- };
- btnContainer.appendChild(cancelBtn);
- btnContainer.appendChild(proceedBtn);
- modalBox.appendChild(modalTitle);
- modalBox.appendChild(modalText);
- modalBox.appendChild(btnContainer);
- modalBg.appendChild(modalBox);
- document.body.appendChild(modalBg);
- }
- // --- 3. LOGIC & EXECUTION ---
- submitBtn.addEventListener('click', function() {
- const x1 = parseInt(inputX1.value.trim(), 10);
- const y1 = parseInt(inputY1.value.trim(), 10);
- const x2 = parseInt(inputX2.value.trim(), 10);
- const y2 = parseInt(inputY2.value.trim(), 10);
- if (isNaN(x1) || isNaN(y1) || isNaN(x2) || isNaN(y2)) {
- alert("Wiper Beta: Invalid input! Make sure all 4 fields contain valid numbers.");
- return;
- }
- let minX = Math.min(x1, x2);
- let maxX = Math.max(x1, x2);
- let minY = Math.min(y1, y2);
- let maxY = Math.max(y1, y2);
- // Convert Tile Chunks bounds to literal character bounds for wiping
- if (tileCheckbox.checked) {
- minX = minX * 16;
- maxX = (maxX * 16) + 15;
- minY = minY * 16;
- maxY = (maxY * 16) + 15;
- }
- const totalArea = (maxX - minX + 1) * (maxY - minY + 1);
- if (totalArea > 15000 && !isFastMode) {
- if (!confirm(`Warning: You are about to wipe ${totalArea} cells. Proceed?`)) return;
- }
- submitBtn.disabled = true;
- submitBtn.style.backgroundColor = '#666';
- // Optimized state-machine tracking (Prevents lag/browser-crashing on huge areas)
- let currentX = minX;
- let currentY = minY;
- let progress = 0;
- let workingSignatureIndex = -1;
- function processChunk() {
- let batchSize = isFastMode ? 750 : 150;
- let networkUpdates = [];
- for (let i = 0; i < batchSize && progress < totalArea; i++) {
- let x = currentX;
- let y = currentY;
- let tileX = Math.floor(x / 16);
- let tileY = Math.floor(y / 16);
- let charX = x % 16;
- let charY = y % 16;
- if (charX < 0) charX += 16;
- if (charY < 0) charY += 16;
- if (typeof writeCharTo !== "undefined") {
- let attempts = [
- () => writeCharTo(" ", 0, tileY, tileX, charY, charX),
- () => writeCharTo(" ", 0, tileX, tileY, charX, charY),
- () => writeCharTo(" ", 0, x, y),
- () => writeCharTo(x, y, " ", 0)
- ];
- if (workingSignatureIndex !== -1) {
- try {
- attempts[workingSignatureIndex]();
- } catch (e) {}
- } else {
- for (let a = 0; a < attempts.length; a++) {
- try {
- attempts[a]();
- workingSignatureIndex = a;
- break;
- } catch (e) {}
- }
- }
- } else {
- // Pre-bundle network updates to prevent websocket lag
- networkUpdates.push([tileY, tileX, charY, charX, Date.now(), " ", 0]);
- }
- // Move to next cell mathematically instead of massive arrays
- currentX++;
- if (currentX > maxX) {
- currentX = minX;
- currentY++;
- }
- progress++;
- }
- // Send bundled updates in a single blast if using network fallback
- if (networkUpdates.length > 0 && window.network && window.network.sendUpdates) {
- window.network.sendUpdates(networkUpdates);
- }
- if (progress < totalArea) {
- submitBtn.innerText = `Wiping... ${Math.round((progress / totalArea) * 100)}%`;
- // Faster tick speed (5ms vs 15ms) greatly reduces wipe time!
- setTimeout(processChunk, isFastMode ? 5 : 15);
- } else {
- submitBtn.innerText = 'Submit';
- submitBtn.disabled = false;
- submitBtn.style.backgroundColor = '#222';
- console.log(`%cWiper Beta v1.2.1: Successfully wiped ${totalArea} cells.`, 'color: #00ffff;');
- }
- }
- processChunk();
- });
- console.log("%cWiper Beta v1.2.1 loaded successfully.", "color: #00ffff; font-weight: bold; font-size: 14px;");
- console.log("%cP.S. this is powerful, use with caution!", "color: yellow; font-weight: bold; font-size: 14px;");
- })();
Advertisement