HaremHeroes - Buy all stats

Add a button in market to buy all stats points at once, so you don't have to click over 9000 times

Verze ze dne 16. 10. 2018. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         HaremHeroes - Buy all stats
// @version      1.01
// @description  Add a button in market to buy all stats points at once, so you don't have to click over 9000 times
// @author       Spychopat
// @match        http*://nutaku.haremheroes.com/*
// @match        http*://*.hentaiheroes.com/*
// @namespace JDscripts
// ==/UserScript==

//$("#equiped plus")[0].click()


var sheet = (function() {
    var style = document.createElement('style');
    document.head.appendChild(style);
    return style.sheet;
})();






function marketCss(){
    sheet.insertRule('plus_buy_all{'
                     +'display:block;'
                     +'position:static;'
                     +'top:0;right:0;'
                     +'color:#fff;'
                     +'text-decoration:none;'
                     +'margin:0;'
                     +'padding-left: 5px;'
                     +'padding-right: 5px;'
                     +'-webkit-border-radius:10%;'
                     +'-moz-border-radius:10%;'
                     +'border-radius:10%;'
                     +'cursor:pointer;'
                     +'text-align:center;'
                     +'background:#057;'
                     +'background:-webkit-linear-gradient(-90deg,#0af 0,#068 50%,#057 51%,#0af 100%);'
                     +'background:-moz-linear-gradient(180deg,#0af 0,#068 50%,#057 51%,#0af 100%)');

   sheet.insertRule('#shops #equiped div.sub_block .hero_stats>div>[cur]{'
                    +'display: none;');
}

function ModifyMarket() {
    var loc2 = $('.hero_stats').children();
    loc2.each(function() {
        var stat = $(this).attr("hero");
        if(stat == "carac1" || stat == "carac2" || stat == "carac3"){
            var disabled = 'disabled="disabled"';
            if(stat == "carac1" && !$("#equiped plus")[0].getAttribute("disabled"))
                disabled = "";
            if(stat == "carac2" && !$("#equiped plus")[1].getAttribute("disabled"))
                disabled = "";
            if(stat == "carac3" && !$("#equiped plus")[2].getAttribute("disabled"))
                disabled = "";
            $(this).append('<plus_buy_all for_carac="'+stat+'" '+disabled+'><span>Buy max</span></plus_all>');
        }
    });
}


function clickFunction(){
    $("#equiped plus_buy_all").click(function() {
        var carac_num;
        var $me = $(this);
        if ($me.attr("disabled")) return;
        var carac = $me.attr("for_carac");
        if(carac == "carac1")
            carac_num = 0;
        if(carac == "carac2")
            carac_num = 1;
        if(carac == "carac3")
            carac_num = 2;

        var button_plus_stat = $("#equiped plus")[carac_num];

        var auto_click = setInterval(function() {
            //console.log("achat stat");
            if(!button_plus_stat || !$("#equiped plus").next()[carac_num].getAttribute("value")/*|| button_plus_stat.getAttribute("disabled")*/) {
                //console.log("time to stop");
                //console.log($("#equiped plus").next()[carac_num].getAttribute("value"));
                $me[0].setAttribute("disabled","disabled");
                clearInterval(auto_click);
                return;
            }
            button_plus_stat.click();
        }, 10);
    });
}

(function() {
    'use strict';
    marketCss();
    ModifyMarket();
    clickFunction();
})();