astars club Mega Clicker

fuck him all )

Verzia zo dňa 19.02.2025. Pozri najnovšiu verziu.

// ==UserScript==
// @name         astars club Mega Clicker
// @namespace    animestars.org
// @description  fuck him all )
// @author       astars lover
// @version      0.14
// @match        https://astars.club/clubs/*/boost/
// @match        https://asstars1.astars.club/clubs/*/boost/
// @match        https://animestars.org/clubs/*/boost/
// @match        https://as1.astars.club/clubs/*/boost/
// @match        https://asstars.tv/clubs/*/boost/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=astars.club
// @grant        none
// @license MIT
// ==/UserScript==

// Сохраняем оригинальные методы
const originalPush = { ...DLEPush };

let lastText = '';

let newAlert = function(text) {
    if (lastText != text) {
        //originalPush.success(text);
        console.log(text);
        lastText = text;
    }
}

// Отключаем уведомления
DLEPush.info = function() {};
DLEPush.success = newAlert;
DLEPush.warning = function() {};
DLEPush.error = function() {};

const userHash = dle_login_hash;
const REQUEST_DELAY = 20;
let requestCount = 0;
let totalBoosted = 0;
const AUTO_START_TIME = "21:01"; // Время автозапуска в формате HH:MM (по Москве)
let countdownInterval;
let refreshInterval;
let startBtnId = 'startBtnId';

function createButton() {
    const button = document.createElement("button");
    button.id = startBtnId;
    button.innerText = "Ожидание...";
    button.style.position = "fixed";
    button.style.right = "10px";
    button.style.top = "50%";
    button.style.transform = "translateY(-50%)";
    button.style.padding = "10px 20px";
    button.style.fontSize = "16px";
    button.style.backgroundColor = "red";
    button.style.color = "white";
    button.style.border = "none";
    button.style.cursor = "pointer";
    button.style.zIndex = "1000";
    document.body.appendChild(button);

    updateButtonCountdown(button);
    countdownInterval = setInterval(() => updateButtonCountdown(button), 1000);

    button.addEventListener("click", processBoosting);
    createInfoBlock();
}

function updateButtonCountdown(button) {
    const now = new Date();
    const moscowTime = new Date(now.toLocaleString("en-US", { timeZone: "Europe/Moscow" }));
    const [targetHour, targetMinute] = AUTO_START_TIME.split(":").map(Number);
    const targetTime = new Date(moscowTime);
    targetTime.setHours(targetHour, targetMinute, 0, 0);
    if (targetTime < moscowTime) targetTime.setDate(targetTime.getDate() + 1);

    const diff = targetTime - moscowTime;
    if (diff <= 0) {
        button.innerText = "Запуск...";
        clearInterval(countdownInterval);
        processBoosting();
    } else {
        const hours = String(Math.floor(diff / (1000 * 60 * 60))).padStart(2, '0');
        const minutes = String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0');
        const seconds = String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0');
        button.innerText = `${hours}:${minutes}:${seconds}`;
    }
}

function createInfoBlock() {
    const infoBlock = document.createElement("div");
    infoBlock.id = "boost-info";
    infoBlock.style.position = "fixed";
    infoBlock.style.right = "10px";
    infoBlock.style.top = "60%";
    infoBlock.style.transform = "translateY(-50%)";
    infoBlock.style.padding = "10px";
    infoBlock.style.fontSize = "14px";
    infoBlock.style.backgroundColor = "black";
    infoBlock.style.color = "white";
    infoBlock.style.border = "1px solid white";
    infoBlock.style.zIndex = "1000";
    infoBlock.innerHTML = `Количество запросов: 0<br>Сдано карточек: 0`;
    document.body.appendChild(infoBlock);
}

function updateInfoBlock() {
    const infoBlock = document.getElementById("boost-info");
    if (infoBlock) {
        infoBlock.innerHTML = `Количество запросов: ${requestCount}<br>Сдано карточек: ${totalBoosted}`;
    }
}

async function sendBoostRequest(cardId, clubId) {
    await new Promise(resolve => setTimeout(resolve, REQUEST_DELAY));
    requestCount++;
    updateInfoBlock();
    const url = "/clubs/" + clubId + "/boost/";
    const data = { action: "boost", card_id: cardId, user_hash: userHash };

    try {
        const response = await fetch(url, {
            method: "POST",
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            body: new URLSearchParams(data)
        });
        return await response.json();
    } catch (error) {
        // DLEPush?.info(error);
        return null;
    }
}

async function sendRefreshRequest(cardId) {
    await new Promise(resolve => setTimeout(resolve, REQUEST_DELAY));
    requestCount++;
    updateInfoBlock();
    const url = "/engine/ajax/controller.php?mod=clubs_ajax";
    const data = { action: "boost_refresh", card_id: cardId, user_hash: userHash };

    try {
        const response = await fetch(url, {
            method: "POST",
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            body: new URLSearchParams(data)
        });
        return await response.json();
    } catch (error) {
        // DLEPush?.info(error);
        return null;
    }
}

function parseBoostHtml(html) {
    const parser = new DOMParser();
    const doc = parser.parseFromString(html, "text/html");
    const boostBtn = doc.querySelector(".club__boost-btn");
    const refreshBtn = doc.querySelector(".club__boost__refresh-btn");
    return { boostBtn, refreshBtn };
}

function autoClickRefreshButton() {
    refreshInterval = setInterval(() => {
        const refreshButton = document.querySelector(".club__boost__refresh-btn");
        if (refreshButton) {
            refreshButton.click();
            console.log("Кнопка обновления буста нажата");
        }
    }, 5000);
}

async function processBoosting() {
    DLEPush?.success('Вперед, отаки! Начинаем эпичный марафон!');
    autoClickRefreshButton();
    document.getElementById(startBtnId)?.remove();
    let btn = document.querySelector(".club__boost-btn") || document.querySelector(".club__boost__refresh-btn");
    let cardId = 0;
    let clubId = 0;
    let response = {};
    while (true) {
        let response = {};
        if (btn) {
            cardId = btn.getAttribute("data-card-id");
            clubId = 10;//btn.getAttribute("data-club-id");
            response = await sendBoostRequest(cardId, clubId);

            if (response?.error) {
                console.log(response.error);
                if (response.error.includes("Достигнут дневной лимит. все.")) {
                    finishBoost("Достигнут дневной лимит. все.")
                    break;
                }
            }

            if (response?.boost_count) {
                totalBoosted = response.boost_count;
                updateInfoBlock();
            }

            if (response?.boost_html_changed) {
                let { boostBtn: newBoostBtn, refreshBtn: newRefreshBtn } = parseBoostHtml(response.boost_html_changed);
                btn = newBoostBtn || newRefreshBtn;
            }
        } else {
            finishBoost('Кнопки не найдены. все.');
            break;
        }

        if (response?.error) {
            cardId = btn.getAttribute("data-card-id");
            response = await sendRefreshRequest(cardId);

            if (response?.boost_count === "300") {
                finishBoost("Достигнут лимит бустов. все.");
                break;
            }

            if (response?.boost_count) {
                totalBoosted = response.boost_count;
                updateInfoBlock();
            }

            if (response?.boost_html) {
                let { boostBtn: newBoostBtn, refreshBtn: newRefreshBtn } = parseBoostHtml(response.boost_html);
                btn = newBoostBtn || newRefreshBtn;
            }

            if (response?.error) {
                // DLEPush?.info(response.error);
                console.log(response.error);
            }
        }
    }
}

function finishBoost(text) {
    clearInterval(refreshInterval);
    Object.assign(DLEPush, originalPush);
    DLEPush?.success(text);
}


(function() {
    'use strict';
    if (/^\/clubs\/\d+\/boost\/$/.test(window.location.pathname)) {
        createButton();
    }
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元