NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name PVU_Marketplace_Visual_Boost
// @namespace http://tampermonkey.net/
// @version 1.0
// @description PlantVsUndead Market visual boost, showing LE per hour and roi
// @author Swellshinider
// @icon https://marketplace.plantvsundead.com/icon.svg?v2
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @copyright 2021 Swellshinider
// @license MIT
// @run-at document-end
// ==/UserScript==
const LE_P_PVU = 605;
(function () {
setInterval(function () {
$(".tw-grid").each(function (index) {
var divLE = ($(this).find(".le").html());
if (!divLE) { return; }
var total_LE = parseInt(divLE.split(" ")[8].replace("\n", "").split("/")[0]);
var hours = parseInt(divLE.split(" ")[8].replace("\n", "").split("/")[1]);
var price = ($(this).find(".text__green").html());
var price_in_LE = (LE_P_PVU * price).toFixed(2);
var LE_p_hora = (total_LE / hours).toFixed(2);
var LE_p_month = (LE_p_hora * 24 * 30).toFixed(2);
var roi = (((LE_p_month - price_in_LE) / price_in_LE) * 100).toFixed(2);
// Le por hora
$(this).find(".le_p_hora").remove();
$(this).find(".le").append("<div class='le_p_hora'></span>");
$(this).find(".le").find(".le_p_hora").html("(" + LE_p_hora + " LE/h)");
// Green if plant is nice to buy
$(this).find(".marker").remove();
$(this).find(".le").append("<div class='marker'></span>");
$(this).find(".le").find(".marker").html("ROI mensal: " + roi + "%");
$(this).find(".le").css("text-align", "left");
$(this).find(".le").css("foreground-color", "white");
if (roi == 0)
$(this).find(".le").css("background-color", "DarkYellow");
else if (roi < 0)
$(this).find(".le").css("background-color", "DarkRed");
else {
$(this).find(".le").css("background-color", "DarkGreen");
}
// mostra o rendimento
$(this).find(".roi_show").remove();
$(this).find(".le").append("<div class='roi_show'></span>");
$(this).find(".le").find(".roi_show").html("(" + LE_p_month + "/" + price_in_LE + ")");
});
}, 1000);
})();