Auto Dailies

Start at Gathering. When Gathering finishes, go to Trivia, then Plunder, then Nesting Grounds (to incubate), then your lair to Feed. Feeds your dragon with energy levels are less than 50/50. Automatically collects and clicks Transmute in Baldwin. At Crim, if you can't trade, it clicks 'new offer' until you can or until you run out of offers. When you run out of offers, there will be a timer to refresh when you get new offers.

As of 2020-01-13. See the latest version.

// ==UserScript==
// @name         Auto Dailies
// @version      0.1
// @description  Start at Gathering. When Gathering finishes, go to Trivia, then Plunder, then Nesting Grounds (to incubate), then your lair to Feed. Feeds your dragon with energy levels are less than 50/50. Automatically collects and clicks Transmute in Baldwin. At Crim, if you can't trade, it clicks 'new offer' until you can or until you run out of offers. When you run out of offers, there will be a timer to refresh when you get new offers.
// @author       AyBeCee
// @match        *.flightrising.com/*
// @grant        none
// @namespace https://greasyfork.runtimutd.eu.org/users/145271
// ==/UserScript==

// auto feed
if (window.location.href.indexOf("flightrising.com/lair") > -1) {
    var energyLevels = $('.lair-page-dragon-energy-frame.common-tooltip').attr("title");

    var energyValue = energyLevels.substring(energyLevels.indexOf('Energy: ') + 8, energyLevels.indexOf('/50') );
    console.log(energyValue);
    if ( Number(energyValue) < 50 ) {
        $("#lair-action-feed.lair-action").click();
    }
}

// auto gathering
if (window.location.href.indexOf("?p=gather&action=") > -1) {
    $(".beigebutton.thingbutton[value='Repeat Gathering »'").click();
}
if (window.location.href.indexOf("?p=gather") > -1) {
    // go to trivia when 0 gathering turns left
    var turnsLeft = $("div[style='color:#000; margin-left:auto; margin-right:auto; font-size:20px; padding-top:2px;']").text();
    var numberTurns = parseInt(turnsLeft);
    if ( numberTurns === 0 ) {
        window.open("https://flightrising.com/main.php?p=tradepost&lot=trivia","_self")
    }
}

// auto plunder
if (window.location.href.indexOf("/trading/pinkpile") > -1) {
    $("input[value='Grab an Item'").click();
    //
    setInterval(function(){
        if( $('#newitem').length ) {
            window.open("https://www1.flightrising.com/nest","_self")
        }
    }, 1000);
}

// auto incubate
if (window.location.href.indexOf("&tab=hatchery") == -1) {
    $("img[src*='/images/layout/button_incubate.png']").click();
    // if nothing left to incubate, go to lair
    if( $("img[src*='/images/layout/button_incubate.png']").length ) {
        window.open("https://www1.flightrising.com/lair/","_self")
    }
}

// auto familiar bonding
if (window.location.href.includes("id=") && window.location.href.includes("did=")) {

    // if dragon has a familiar
    if( $('.clueitem img').length ) {
        if( $('a.loginbar[title="You have already visited this familiar today. Come visit tomorrow!"]').length ) {
            // go to next dragon
            $('#buttonnext').click();
        } else {
            $("a.loginbar[title='Click here to bond with your familiar. You may do this once a day.'] img").click();

            setInterval(function(){
                // if the confirmation bonding div is open
                if( $('#bonding').length ) {
                    // go to the next dragon (because clicking on #buttonnext doesn't work for some reason
                    var nextDrag = $('#buttonnext').parent().attr("href");
                    window.open(nextDrag,"_self")

                }
            }, 1000);

        }
    }


}


// auto baldwin
if (window.location.href.includes("trading/baldwin/transmute")) {
    $("input.redbutton.anybutton[value='Collect!']").click();
    $("input.redbutton.anybutton[value='Transmute']").click();
}

// auto naming
if (window.location.href.includes("id=") && window.location.href.includes("did=")) {
    var unnamedSpan = $('span[style*="font-size:22px; text-align:left; color:#731d08; font-weight:bold; position:absolute; top:20px; left:52px;"]').text();

    if (unnamedSpan.includes("Unnamed")) {
        $("img[src*='/images/layout/button_rename.png']").click();

        function clickAccept() {
            //   $(".beigebutton.thingbutton[value='Accept'").click();
        }

        function clickRandomize() {
            $(".beigebutton.thingbutton[value='Randomize'").click();
            setTimeout(clickAccept, 1000);
        }

        setTimeout(clickRandomize, 1000);
    }
}

// auto crim - if can't trade, clicks 'new offer'
if (window.location.href.includes("trading/crim")) {
    var availableOffers = $("#counter").text();
    // convert string to integer
    var numberOffers = parseInt(availableOffers);

    if ( numberOffers > 0 ) {

        if( $('#notrade').length ) {
            $("#newoffer").click();
        } else {
            $("#trade").click();
        }

    } else {
        var timeRemaining = $("#crimswap p span").text();
        // get the number only
        var timeNumber = timeRemaining.substring(0, timeRemaining.indexOf(' minutes') );
        // convert string to integer and then x6000
        var integerTime = parseInt(timeNumber) * 60000;

        setTimeout(function() {location.reload();}, integerTime);
    }


}