acnl-editor icon indicating copy to clipboard operation
acnl-editor copied to clipboard

Script for filling your storage rooms with all the museum objects

Open AntennaeVY opened this issue 1 year ago • 0 comments

Since the ACNL-SE lacks of the functionality to complete all the museum I created a JS script that fills your storage room with all the museum objects (331) so you can take them to the Owl in the museum and get your museum 100% completed.

You need to load your save and then go to the "Players" tab, hit CTRL + SHIFT + I and paste the following script in your browser's console.

PLEASE NOTE THAT THIS WILL OVERWRITE YOUR STORAGE ROOMS

async function run(e) {
    /*
        Bugs: 8846 - 8927
        Fish: 8929 - 9004
        Marine Creatures: 9005 - 9035
        Art: 12498 - 12552
        Fossils: 12592 - 12678
    */
    
    let bugStart = 8846, bugEnd = 8927;
    let fishStart = 8929, fishEnd = 9004;
    let marineStart = 9005, marineEnd = 9035;
    let artStart = 12498, artEnd = 12552;
    let fossStart = 12592, fossEnd = 12678;

    const itemSelector = document.getElementById("items");
    
    for (let id=0; id < 4; id++) {
        const element = document.getElementById("storage" + id).children[0];
        
        for(let i=0; i <= 4; i++) {
            for(let j=0; j <= 17; j++) {
                if (bugStart <= bugEnd) {
                    itemSelector.value = bugStart++;
                } else if (fishStart <= fishEnd) {
                    itemSelector.value = fishStart++;
                } else if (marineStart <= marineEnd) {
                    itemSelector.value = marineStart++;
                } else if (artStart <= artEnd) {
                    itemSelector.value = artStart++;
                } else if (fossStart <= fossEnd) {
                    itemSelector.value = fossStart++;
                } else {
                    break;
                }
                
                let clientX = parseInt(Math.ceil(element.getBoundingClientRect().x)) + 3;
                let clientY = parseInt(Math.ceil(element.getBoundingClientRect().y)) + 3;
                
                const event = new MouseEvent("mousedown", {
                    view: window,
                    bubbles: true,
                    cancelable: true,
                    clientX: clientX + i*16,
                    clientY: clientY + j*16,
                });
                
                element.dispatchEvent(event);
                element.dispatchEvent(new MouseEvent("mouseup"));
                await new Promise(r => setTimeout(r, 50));
            }
        } 
    }
}

run()

AntennaeVY avatar Jul 26 '23 03:07 AntennaeVY