Clutch152 / scripts

Collection of scripts for the lazy ... >.>
162 stars 78 forks source link

Dlc 1 scripts #70

Open atrimn opened 1 year ago

atrimn commented 1 year ago

The scripts work but does anyone check the time it took to complete or if the answers are blank but somehow got passing score ? Or is it safe to use

TyrantRex commented 1 year ago

There was a time check but idk if it actually made any difference.

On another note, I made a script that'll show the best answers for dlc2 after pressing tab. Not sure if it still works but was made after not wanting to chance somebody else's account being banned. https://gist.github.com/TyrantRex/639e70bb76aff31c251d25c617a387ce

aaron-kidwell commented 1 year ago

following to see if time checks are actually enforced, I do see that it is recorded.

RWayne93 commented 1 year ago

Had to make a little adjustment to get best answer to work for me. Not sure if anybody else had issues with it.

// ==UserScript==
// @name         ALMS
// @namespace    http://127.0.0.1/
// @version      1.0
// @description  Helps you speed DLC2 courses, should work with others as well but I haven't tested.
// @author       TyrantRex
// @match        *://www.lms.army.mil/gatekeeper/*
// @match        *://www.lms.army.mil/production/*
// ==/UserScript==

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Directions:
 * 1. Start the course
 * 2. Press TAB to speed up videos and audio
 * 3. You should see text up top with the right answers when you get to it.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
(function() {
    const newDiv = document.createElement('div');
    newDiv.innerHTML = '';
    newDiv.style.top = '50px';
    newDiv.style.left = '50px';
    newDiv.style.zIndex = 100000;
    newDiv.style.position = 'absolute';

    function Skip() {
        if (document.querySelector('audio')) document.querySelector('audio').playbackRate=16
        if (document.querySelector('video')) document.querySelector('video').playbackRate=16
    }

    function Click() {
        if (document.querySelector('[id="page-no"]')) document.querySelector('[id="page-no"]').click()
        if (document.querySelector('[id="next-btn"]')) document.querySelector('[id="next-btn"]').click()
        if (document.querySelector('[title="Continue"]')) document.querySelector('[title="Continue"]').click()
        if (document.querySelector('[title="Close"]')) document.querySelector('[title="Close"]').click()
        // had to add this to theto get it to show best answer for me. thank you to the original author. 
        const linkElements = document.getElementsByClassName('link');
        for(let i = 0; i < linkElements.length; i++) {
            linkElements[i].click();
        }
        const popupElements = document.getElementsByClassName('popup-trigger');
        for(let i = 0; i < popupElements.length; i++) {
            popupElements[i].click();
        }
    }

    function ShowBestAnswer() {
        if (document.getElementsByClassName('cheat')) {
            let lesson = document.getElementsByClassName('cheat')[0].innerText.trim(),
                info = eval('StoryboardData.' + lesson + '.options');

            for(let x = 0; x < info.length; x++) {
                if(info[x].grade.grade == 'Best') {
                    newDiv.innerHTML = '<p style="color: white; font-size: 30px; -webkit-text-stroke-width: 1px; -webkit-text-stroke-color: black;">The best answer is: \"' + info[x].text + '\"</p>';
                }
            }
        } else {
            console.log('This course isn\'t supported. Code was made for DLC 2')
        }
    }

    async function RunExploit() {
        for (let x=0; x<2500; x++) {
            Skip()
            Click()
            ShowBestAnswer()
            await new Promise(resolve => setTimeout(() => resolve(), 250))
        }
    }

    document.addEventListener('keydown', e => {
        if (e.code === 'Tab') RunExploit()
    })

    document.body.appendChild(newDiv);
})();