Trimps+

Autobuys storage when full

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Trimps+
// @namespace    Danielv123
// @version      1.0
// @description  Autobuys storage when full
// @author       You
// @match        http://trimps.github.io/
// @grant        unsafeWindow
// ==/UserScript==
if(!unsafeWindow.settings){
    unsafeWindow.settings = {
        autoBuild:true
    };
}
var autoStorageMod = (function() {
    var barnThreshold = 0.9;  /*percentage at which minimum*/
    var shedThreshold = 0.9;  /*to buy storage*/
    var forgeThreshold = 0.9; /*from 0 (min) to 1 (max)*/

    this.loop = function() {
        var game = unsafeWindow.game;
        if(game.resources.food.owned / (game.resources.food.max * (1 + game.portal.Packrat.level * (game.portal.Packrat.modifier * 100) / 100)) >= barnThreshold)
            buyBuilding("Barn");
        if(game.resources.wood.owned / (game.resources.wood.max * (1 + game.portal.Packrat.level * (game.portal.Packrat.modifier * 100) / 100)) >= shedThreshold)
            buyBuilding("Shed");
        if(game.resources.metal.owned / (game.resources.metal.max * (1 + game.portal.Packrat.level * (game.portal.Packrat.modifier * 100) / 100)) >= forgeThreshold)
            buyBuilding("Forge");

        setTimeout(this.loop.bind(this), 100);
    };
    this.loop();
})();