diff --git a/Auto-Farm.js b/Auto-Farm.js index 1841baa..1e1d499 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -1,5 +1,4 @@ (async () => { - // Configurações globais const CONFIG = { START_X: 742, START_Y: 1148, @@ -17,7 +16,6 @@ } }; - // Estado do aplicativo const state = { running: false, paintedCount: 0, @@ -25,10 +23,10 @@ userInfo: null, lastPixel: null, minimized: false, - menuOpen: false + menuOpen: false, + language: 'en' }; - // Funções utilitárias const sleep = ms => new Promise(r => setTimeout(r, ms)); const fetchAPI = async (url, options = {}) => { @@ -39,12 +37,10 @@ }); return await res.json(); } catch (e) { - console.error('Erro na requisição:', e); return null; } }; - // Funções da API const getRandomPosition = () => ({ x: Math.floor(Math.random() * CONFIG.PIXELS_PER_LINE), y: Math.floor(Math.random() * CONFIG.PIXELS_PER_LINE) @@ -74,13 +70,28 @@ return state.charges; }; - // Lógica principal + const detectUserLocation = async () => { + try { + const response = await fetch('https://ipapi.co/json/'); + const data = await response.json(); + if (data.country === 'BR') { + state.language = 'pt'; + } else if (data.country === 'US') { + state.language = 'en'; + } else { + state.language = 'en'; + } + } catch { + state.language = 'en'; + } + }; + const paintLoop = async () => { while (state.running) { const { count, cooldownMs } = state.charges; if (count < 1) { - updateUI(`⌛ Sem cargas. Esperando ${Math.ceil(cooldownMs/1000)}s...`, 'status'); + updateUI(state.language === 'pt' ? `⌛ Sem cargas. Esperando ${Math.ceil(cooldownMs/1000)}s...` : `⌛ No charges. Waiting ${Math.ceil(cooldownMs/1000)}s...`, 'status'); await sleep(cooldownMs); await getCharge(); continue; @@ -98,15 +109,14 @@ }; state.charges.count--; - // Efeito visual document.getElementById('paintEffect').style.animation = 'pulse 0.5s'; setTimeout(() => { document.getElementById('paintEffect').style.animation = ''; }, 500); - updateUI(`✅ Pixel pintado!`, 'success'); + updateUI(state.language === 'pt' ? '✅ Pixel pintado!' : '✅ Pixel painted!', 'success'); } else { - updateUI(`❌ Falha ao pintar`, 'error'); + updateUI(state.language === 'pt' ? '❌ Falha ao pintar' : '❌ Failed to paint', 'error'); } await sleep(CONFIG.DELAY); @@ -114,18 +124,15 @@ } }; - // Interface do usuário const createUI = () => { if (state.menuOpen) return; state.menuOpen = true; - // Adiciona Font Awesome const fontAwesome = document.createElement('link'); fontAwesome.rel = 'stylesheet'; fontAwesome.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css'; document.head.appendChild(fontAwesome); - // Adiciona estilos const style = document.createElement('style'); style.textContent = ` @keyframes pulse { @@ -265,7 +272,31 @@ `; document.head.appendChild(style); - // Cria o painel + const translations = { + pt: { + title: "WPlace Auto-Farm", + start: "Iniciar", + stop: "Parar", + ready: "Pronto para começar", + user: "Usuário", + pixels: "Pixels", + charges: "Cargas", + level: "Level" + }, + en: { + title: "WPlace Auto-Farm", + start: "Start", + stop: "Stop", + ready: "Ready to start", + user: "User", + pixels: "Pixels", + charges: "Charges", + level: "Level" + } + }; + + const t = translations[state.language] || translations.en; + const panel = document.createElement('div'); panel.className = 'wplace-bot-panel'; panel.innerHTML = ` @@ -273,10 +304,10 @@