MathsOnline CHEAT {CHEAT} {HACK} {EXPLOIT} {SPOOF}

Finally, a MathsOnline Cheat after all these years!

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         MathsOnline CHEAT {CHEAT} {HACK} {EXPLOIT} {SPOOF}
// @namespace    https://tampermonkey.net
// @version      1.8
// @description  Finally, a MathsOnline Cheat after all these years!
// @author       Phil 🥹👍 and DynaHacks
// @license      MIT
// @match        *://www.mathsonline.com.au/*
// @match        *://www.mathsonline.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    console.log('%c[MathsOnline Cheat] MathsOnline Auto-Cheat loaded', 'color: #0066ff; font-weight: bold;');

    // Get tutorial (lesson ID)
    window.getTutorial = function() {
        let tutorial = null;

        // From URL (most reliable)
        const urlParams = new URLSearchParams(window.location.search);
        const pathParts = window.location.pathname.split('/');

        tutorial = urlParams.get('tutorial') || urlParams.get('tutorialId');

        // Extract from URL path like /lessons/102/3656
        if (!tutorial) {
            for (let i = 0; i < pathParts.length; i++) {
                if (pathParts[i] === 'lessons' && pathParts[i+1]) {
                    tutorial = pathParts[i+2] || pathParts[i+1]; // fallback
                    break;
                }
            }
        }

        // Fallback to global variables
        if (!tutorial && typeof window.tutorial !== 'undefined') tutorial = window.tutorial;
        if (!tutorial && window.currentQuestionSet) tutorial = window.currentQuestionSet.tutorial;

        console.log('%c[MathsOnline Cheat] Current tutorial:', tutorial);
        return tutorial;
    };

    // Get tutorialMaster (kept from before)
    window.getTutorialMaster = function() {
        let tutorialMaster = null;

        const urlParams = new URLSearchParams(window.location.search);
        tutorialMaster = urlParams.get('tutorialMaster') || urlParams.get('tutorialmaster');

        if (!tutorialMaster) {
            if (typeof window.tutorialMaster !== 'undefined') tutorialMaster = window.tutorialMaster;
            if (!tutorialMaster && window.currentQuestionSet) tutorialMaster = window.currentQuestionSet.tutorialMaster;
        }

        if (!tutorialMaster) {
            for (let key in window) {
                if (key.toLowerCase().includes('tutorialmaster') || key.toLowerCase().includes('tutorial_master')) {
                    const val = window[key];
                    if (typeof val === 'string' && /^\d+$/.test(val)) {
                        tutorialMaster = val;
                        break;
                    }
                }
            }
        }

        console.log('%c[MathsOnline Cheat] Current tutorialMaster:', tutorialMaster);
        return tutorialMaster;
    };

    function addCheatButton() {
        if (document.getElementById('cheat-btn')) return;

        const btn = document.createElement('button');
        btn.id = 'cheat-btn';
        btn.innerHTML = 'Send';
        btn.style.cssText = `
            position: fixed;
            top: 10px;
            right: 10px;
            z-index: 999999;
            padding: 6px 14px;
            background: #0066cc;
            color: white;
            border: none;
            border-radius: 4px;
            font-weight: bold;
            font-size: 13px;
            cursor: pointer;
            box-shadow: none;
            margin-left: 8px;
        `;

        btn.onmouseover = () => btn.style.background = '#0055aa';
        btn.onmouseout = () => btn.style.background = '#0066cc';

        btn.onclick = async () => {
            const tutorial = window.getTutorial();
            const tutorialMaster = window.getTutorialMaster();

            if (!tutorial || !tutorialMaster) {
                alert('Could not detect tutorial or tutorialMaster.\nMake sure you are inside an active lesson.');
                return;
            }

            console.log('%c[MathsOnline Cheat] Starting cheat → Tutorial:', tutorial, 'Master:', tutorialMaster);

            try {
                const startResponse = await fetch(
                    `https://www.mathsonline.com.au/ajax/svg_interactives/startQuestionSet?rid=${Math.random()}`,
                    {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded',
                            'X-Requested-With': 'XMLHttpRequest',
                        },
                        body: new URLSearchParams({
                            userQuestionSetTypeId: '7',
                            tutorial: tutorial,
                            tutorialMaster: tutorialMaster,
                            menuId: '102',
                            worksheetId: '0',
                            taskId: '0',
                            diagnosticTypeId: '0',
                        })
                    }
                );

                const startData = await startResponse.json();
                const { userQuestionSetId, svgInteractiveId } = startData;

                const submitResponse = await fetch(
                    `https://www.mathsonline.com.au/ajax/svg_interactives/submitResult?r=${Math.random()}`,
                    {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded',
                            'X-Requested-With': 'XMLHttpRequest',
                        },
                        body: new URLSearchParams({
                            userQuestionSetId,
                            svgInteractiveId,
                            tutorial: tutorial,
                            tutorialMaster: tutorialMaster,
                            menuId: '102',
                            worksheetId: '0',
                            diagnosticTypeId: '0',
                            userQuestionSetTypeId: '7',
                            difficulty: '1',
                            correct: 1,
                            incorrect: 0,
                            duration: Math.floor(8000 + Math.random() * 15000),
                            data: JSON.stringify([{
                                questionId: 1,
                                inputs: [{"id": "input1", "value": "42", "correct": "true"}],
                                checkboxes: [],
                                radiobuttons: [],
                                selectables: [],
                                draggables: [],
                                marks: [{"id": "mark1", "correct": "true"}],
                                solutions: []
                            }]),
                        })
                    }
                );

                const result = await submitResponse.json();
                console.log('%c[MathsOnline Cheat] Cheat successful!', result);

                // Auto reload to sync progress
                setTimeout(() => {
                    window.location.reload();
                }, 800);

            } catch (e) {
                console.error(e);
                alert('Cheat failed - check console for details.');
            }
        };

        document.body.appendChild(btn);
    }

    window.addEventListener('load', () => {
        setTimeout(addCheatButton, 1200);
    });

    console.log('%c[MathsOnline Cheat] Dynamic tutorial + tutorialMaster cheat ready.', 'color: #0066ff');
})();