1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
(function () { ('use strict'); (function () { const button = document.createElement('button'); button.innerText = '启动自动点击'; button.style.position = 'fixed'; button.style.top = '33px'; button.style.right = '17px'; button.style.zIndex = '10001';
button.addEventListener('click', () => { if (isClicking) { stopAutoClick(); button.innerText = '启动自动点击'; button.style.background = ''; button.style.color = ''; } else { startAutoClick(); button.innerText = '停止自动点击'; button.style.background = 'black'; button.style.color = 'rgb(0,255,0)'; } });
const button_A = document.createElement('button'); button_A.innerText = 'A'; button_A.style.position = 'fixed'; button_A.style.top = '57px'; button_A.style.right = '97px'; button_A.style.width = '12px'; button_A.style.padding = '1px'; button_A.style.zIndex = '10001';
button_A.addEventListener('click', () => { if (isClickingA) { isClickingA = false; button_A.style.background = ''; button_A.style.color = ''; } else { isClickingA = true; button_A.style.background = 'black'; button_A.style.color = 'rgb(0,255,0)'; } });
const input = document.createElement('input'); input.type = 'number'; input.id = 'inputNumber'; input.style.position = 'fixed'; input.style.top = '55px'; input.style.right = '17px'; input.style.zIndex = '10000'; input.style.width = '35px'; input.style.background = '#ffffff'; input.placeholder = 'index..'; input.value = localStorage.getItem('inputNum'); input.min = '0'; input.max = '19';
const input_side = document.createElement('input'); input_side.type = 'number'; input_side.id = 'inputSideNumber'; input_side.style.position = 'fixed'; input_side.style.top = '55px'; input_side.style.right = '58px'; input_side.style.zIndex = '10000'; input_side.style.width = '30px'; input_side.style.background = '#ffffff'; input_side.placeholder = 'n..'; input_side.value = localStorage.getItem('inputNumSide'); input_side.min = '0'; input_side.max = '19';
document.body.appendChild(button); document.body.appendChild(button_A); document.body.appendChild(input); document.body.appendChild(input_side); })();
let intervalId; let isClicking = false; let isClickingA = false; let input = document.getElementById('inputNumber'); let input_side = document.getElementById('inputSideNumber');
function parseLargeNumberString(str) { const unitMap = { thousand: 1e3, million: 1e6, billion: 1e9, trillion: 1e12, quadrillion: 1e15, quintillion: 1e18, sextillion: 1e21, septillion: 1e24, octillion: 1e27, nonillion: 1e30, decillion: 1e33, };
str = str.toLowerCase().trim();
const match = str.match(/^(-?\d+(\.\d+)?|\.\d+)\s*(\w+)?$/);
if (!match) { throw new Error('Invalid input format'); }
const [_, numberStr, , unit] = match;
const cleanNumberStr = numberStr.replace(/,/g, '');
const number = parseFloat(cleanNumberStr);
if (!unit || unit === '') { return number; }
if (!/^[a-z]+$/.test(unit)) { throw new Error(`Invalid unit: ${unit}`); }
if (!(unit in unitMap)) { throw new Error(`Unknown unit: ${unit}`); }
const result = number * unitMap[unit];
return result; }
function startAutoClick() { if (isClicking) return; isClicking = true; intervalId = setInterval(() => { let productPriceArray = []; const inputNum = input.valueAsNumber; const inputNumSide = input_side.valueAsNumber; localStorage.setItem('inputNum', `${inputNum}`); localStorage.setItem('inputNumSide', `${inputNumSide}`);
if (inputNumSide > inputNum) input.value = inputNumSide;
for (let i = inputNum; i >= inputNumSide; i--) { productPriceArray.unshift( BigInt( parseLargeNumberString( document.getElementById(`productPrice${i}`).textContent ) ) ); } for (let i = 0; i < productPriceArray.length; i++) { console.log( productPriceArray[i] / BigInt(2 ** i) / (productPriceArray[productPriceArray.length - 1] / BigInt(2 ** (productPriceArray.length - 1))) ); productPriceArray[i] = productPriceArray[i] / BigInt(2 ** i) < productPriceArray[productPriceArray.length - 1] / BigInt(2 ** (productPriceArray.length - 1)); } console.log(productPriceArray); for (let i = inputNum; i >= inputNumSide; i--) { if (productPriceArray[i + inputNumSide]) { document.getElementById(`product${i}`).click(); console.log(`点击了product${i}`); break; } } document.getElementById('bigCookie').click(); if (isClickingA) document.getElementById('upgrade0').click(); const shimmer = document.querySelector('.shimmer'); if (shimmer !== null) { shimmer.click(); console.log('shimmer found!'); } }, 100); }
function stopAutoClick() { if (!isClicking) return;
clearInterval(intervalId); isClicking = false; console.log('停止了自动点击'); } })();
|