TTRS Auto Answer Simulator (Internal Testing)

Auto answers questions on TTRS for authorized testing only

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         TTRS Auto Answer Simulator (Internal Testing)
// @namespace    https://ttrockstars.com/
// @version      1.1
// @description  Auto answers questions on TTRS for authorized testing only
// @author       TTRS Security Team
// @license      MIT
// @match        *://*.ttrockstars.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function getAnswer(question) {
        // TTRS questions look like "6 x 7" or "12 x 3"
        const parts = question.split('x');
        if (parts.length !== 2) return '';
        const num1 = parseInt(parts[0].trim());
        const num2 = parseInt(parts[1].trim());
        return num1 * num2;
    }

    function simulateAutoAnswer() {
        // Actual question element - this is a div with class "question__content" or similar
        const questionEl = document.querySelector('.question__content, .question-text, .question');
        // The input where you type the answer
        const inputEl = document.querySelector('input.answer-input, input[type="text"], input[aria-label="Answer"]');
        // The submit button
        const submitBtn = document.querySelector('button.submit-btn, button[type="submit"], button[aria-label="Submit"]');

        if (questionEl && inputEl && submitBtn) {
            const questionText = questionEl.innerText || questionEl.textContent;
            const answer = getAnswer(questionText);
            if (!isNaN(answer)) {
                // Only answer if input is empty or different
                if (inputEl.value !== String(answer)) {
                    inputEl.value = answer;
                    // Trigger input event so React/Vue/Angular registers the change
                    inputEl.dispatchEvent(new Event('input', { bubbles: true }));
                    submitBtn.click();
                    console.log(`[AutoAnswer] Question: "${questionText.trim()}" Answered: ${answer}`);
                }
            }
        } else {
            // If one or more elements are missing, log for debugging
            console.log('[AutoAnswer] Waiting for question, input, or submit button elements...');
        }

        setTimeout(simulateAutoAnswer, 200);
    }

    setTimeout(simulateAutoAnswer, 1000);
})();