// ==UserScript==
// @name Implant Boosts Inventory
// @version 0.7
// @description adds percentage of all implants equipped or that have been equipped.
// @author Kyll
// @match https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=25
// @icon https://www.google.com/s2/favicons?sz=64&domain=deadfrontier.com
// @namespace https://greasyfork.org/users/929255
// ==/UserScript==
function CreateDisplay()
{
var button = '<div id="boostcalc" data-inventory-type="storage" class="opElem" style="width: 40%; top: -2%;position: relative;left: 66%;font-family: serif;font-size: 14px;"><p style=" font-size: 15px; ">Implants Boosts</p><ul style="text-align: left;color: #00ff00;list-style: none;"><li><span class="BoostCalcs" style="position: relative;" data-boostcalc="+0% Exp Boost"></span></li><li><span class="BoostCalcs1" style="position: relative;" data-boostcalc="+0% PVP Points Boost"></span></li><li><span class="BoostCalcs2" style="position: relative;" data-boostcalc="+0% Damage Inflicted"></span></li><li><span class="BoostCalcs3" style="position: relative;" data-boostcalc="+0% Movement Speed"></span></li><li><span class="BoostCalcs4" style="position: relative;" data-boostcalc="+0% Ammo Looted"></span></li> <li><span class="BoostCalcs5" style="position: relative;" data-boostcalc="+0% Cash Looted"></span></li> <li><span class="BoostCalcs6" style="position: relative;" data-boostcalc="+0% Chance to Find Armour"></span></li> <li><span class="BoostCalcs7" style="position: relative;" data-boostcalc="+0% Chance to Find Weapon"></span></li> <li><span class="BoostCalcs8" style="position: relative;" data-boostcalc="+0% More Loot Spots"></span></li> <li><span class="BoostCalcs9" style="position: relative;" data-boostcalc="+0% Search Speed"></span></li> </ul></div>'
document.getElementById("inventoryholder").insertAdjacentHTML ('beforeend', button);
}
(function() {
'use strict';
var code = '';
code += ' var expboost = 0;';
code += ' var pvppointsboost = 0;';
code += ' var damageboost = 0;';
code += ' var speedboost = 0;';
code += ' var ammoboost = 0;';
code += ' var cashboost = 0;';
code += ' var findarmourboost = 0;';
code += ' var findweaponboost = 0;';
code += ' var lotspotboost = 0;';
code += ' var searchspeedboost = 0;';
code += 'function implantcalc()';
code += '{';
code += ' expboost = 0;';
code += ' pvppointsboost = 0;';
code += ' damageboost = 0;';
code += ' speedboost = 0;';
code += ' ammoboost = 0;';
code += ' cashboost = 0;';
code += ' findarmourboost = 0;';
code += ' findweaponboost = 0;';
code += ' lotspotboost = 0;';
code += ' searchspeedboost = 0;';
code += ' for(var i = 1; i <= userVars["DFSTATS_df_implantslots"]; i++)';
code += ' {';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_expboostmod"] !== "undefined")';
code += ' {';
code += ' expboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_expboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_pvppointsboostmod"] !== "undefined")';
code += ' {';
code += ' pvppointsboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_pvppointsboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_damageboostmod"] !== "undefined")';
code += ' {';
code += ' damageboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_damageboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_speedboostmod"] !== "undefined")';
code += ' {';
code += ' speedboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_speedboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_ammolootboostmod"] !== "undefined")';
code += ' {';
code += ' ammoboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_ammolootboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_cashlootboostmod"] !== "undefined")';
code += ' {';
code += ' cashboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_cashlootboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_armourlootboostmod"] !== "undefined")';
code += ' {';
code += ' findarmourboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_armourlootboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_weaponlootboostmod"] !== "undefined")';
code += ' {';
code += ' findweaponboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_weaponlootboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_lootspotboostmod"] !== "undefined")';
code += ' {';
code += ' lotspotboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_lootspotboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' if(typeof globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]?.["implant_searchspeedboostmod"] !== "undefined")';
code += ' {';
code += ' searchspeedboost += (globalData[userVars["DFSTATS_df_" + "implant" + i + "_type"]]["implant_searchspeedboostmod"] * 100).toFixed(2) / 1;';
code += ' }';
code += ' }';
code += ' if(expboost > 0)';
code += ' {';
code += ' var expboost = "+" + expboost + " Exp Boost"; ';
code += ' $(".BoostCalcs").each(function()';
code += ' {';
code += ' $(this).text(expboost).attr("data-boostcalc", expboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(expboost < 0)';
code += ' {';
code += ' var expboost = expboost + " Exp Boost"; ';
code += ' $(".BoostCalcs").each(function()';
code += ' {';
code += ' $(this).text(expboost).attr("data-boostcalc", expboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' expboost = "";';
code += ' $(".BoostCalcs").each(function()';
code += ' {';
code += ' $(this).text(expboost).attr("data-boostcalc", expboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(pvppointsboost > 0)';
code += ' {';
code += ' var pvppointsboost = "+" + pvppointsboost + " PVP Points Boost"; ';
code += ' $(".BoostCalcs1").each(function()';
code += ' {';
code += ' $(this).text(pvppointsboost).attr("data-boostcalc", pvppointsboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(pvppointsboost < 0)';
code += ' {';
code += ' var pvppointsboost = pvppointsboost + " PVP Points Boost"; ';
code += ' $(".BoostCalcs1").each(function()';
code += ' {';
code += ' $(this).text(pvppointsboost).attr("data-boostcalc", pvppointsboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' pvppointsboost = "";';
code += ' $(".BoostCalcs1").each(function()';
code += ' {';
code += ' $(this).text(pvppointsboost).attr("data-boostcalc", pvppointsboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(damageboost > 0)';
code += ' {';
code += ' var damageboost = "+" + damageboost + " Damage Inflicted"; ';
code += ' $(".BoostCalcs2").each(function()';
code += ' {';
code += ' $(this).text(damageboost).attr("data-boostcalc", damageboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(damageboost < 0)';
code += ' {';
code += ' var damageboost = damageboost + " Damage Inflicted"; ';
code += ' $(".BoostCalcs2").each(function()';
code += ' {';
code += ' $(this).text(damageboost).attr("data-boostcalc", damageboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' damageboost = "";';
code += ' $(".BoostCalcs2").each(function()';
code += ' {';
code += ' $(this).text(damageboost).attr("data-boostcalc", damageboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(speedboost > 0)';
code += ' {';
code += ' var speedboost = "+" + speedboost + " Movement Boost"; ';
code += ' $(".BoostCalcs3").each(function()';
code += ' {';
code += ' $(this).text(speedboost).attr("data-boostcalc", speedboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(speedboost < 0)';
code += ' {';
code += ' var speedboost = speedboost + " Movement Boost"; ';
code += ' $(".BoostCalcs3").each(function()';
code += ' {';
code += ' $(this).text(speedboost).attr("data-boostcalc", speedboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' speedboost = "";';
code += ' $(".BoostCalcs3").each(function()';
code += ' {';
code += ' $(this).text(speedboost).attr("data-boostcalc", speedboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(ammoboost > 0)';
code += ' {';
code += ' var ammoboost = "+" + ammoboost + " Ammo Looted"; ';
code += ' $(".BoostCalcs4").each(function()';
code += ' {';
code += ' $(this).text(ammoboost).attr("data-boostcalc", ammoboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(ammoboost < 0)';
code += ' {';
code += ' var ammoboost = ammoboost + " Ammo Looted"; ';
code += ' $(".BoostCalcs4").each(function()';
code += ' {';
code += ' $(this).text(ammoboost).attr("data-boostcalc", ammoboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' ammoboost = "";';
code += ' $(".BoostCalcs4").each(function()';
code += ' {';
code += ' $(this).text(ammoboost).attr("data-boostcalc", ammoboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(cashboost > 0)';
code += ' {';
code += ' var cashboost = "+" + cashboost + " Cash Looted"; ';
code += ' $(".BoostCalcs5").each(function()';
code += ' {';
code += ' $(this).text(cashboost).attr("data-boostcalc", cashboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(cashboost < 0)';
code += ' {';
code += ' var cashboost = cashboost + " Cash Looted"; ';
code += ' $(".BoostCalcs5").each(function()';
code += ' {';
code += ' $(this).text(cashboost).attr("data-boostcalc", cashboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' cashboost = "";';
code += ' $(".BoostCalcs5").each(function()';
code += ' {';
code += ' $(this).text(cashboost).attr("data-boostcalc", cashboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(findarmourboost > 0)';
code += ' {';
code += ' var findarmourboost = "+" + findarmourboost + " Chance to Find Armour"; ';
code += ' $(".BoostCalcs6").each(function()';
code += ' {';
code += ' $(this).text(findarmourboost).attr("data-boostcalc", findarmourboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(findarmourboost < 0)';
code += ' {';
code += ' var findarmourboost = findarmourboost + " Chance to Find Armour"; ';
code += ' $(".BoostCalcs6").each(function()';
code += ' {';
code += ' $(this).text(findarmourboost).attr("data-boostcalc", findarmourboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' findarmourboost = "";';
code += ' $(".BoostCalcs6").each(function()';
code += ' {';
code += ' $(this).text(findarmourboost).attr("data-boostcalc", findarmourboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(findweaponboost > 0)';
code += ' {';
code += ' var findweaponboost = "+" + findweaponboost + " Chance to Find Weapon"; ';
code += ' $(".BoostCalcs7").each(function()';
code += ' {';
code += ' $(this).text(findweaponboost).attr("data-boostcalc", findweaponboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(findweaponboost < 0)';
code += ' {';
code += ' var findweaponboost = findweaponboost + " Chance to Find Weapon"; ';
code += ' $(".BoostCalcs7").each(function()';
code += ' {';
code += ' $(this).text(findweaponboost).attr("data-boostcalc", findweaponboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' findweaponboost = "";';
code += ' $(".BoostCalcs7").each(function()';
code += ' {';
code += ' $(this).text(findweaponboost).attr("data-boostcalc", findweaponboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(lotspotboost > 0)';
code += ' {';
code += ' var lotspotboost = "+" + lotspotboost + " More Loot Spots"; ';
code += ' $(".BoostCalcs8").each(function()';
code += ' {';
code += ' $(this).text(lotspotboost).attr("data-boostcalc", lotspotboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(lotspotboost < 0)';
code += ' {';
code += ' var lotspotboost = lotspotboost + " More Loot Spots"; ';
code += ' $(".BoostCalcs8").each(function()';
code += ' {';
code += ' $(this).text(lotspotboost).attr("data-boostcalc", lotspotboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' lotspotboost = "";';
code += ' $(".BoostCalcs8").each(function()';
code += ' {';
code += ' $(this).text(lotspotboost).attr("data-boostcalc", lotspotboost);';
code += ' });';
code += ' }';
code += ' }';
code += ' if(searchspeedboost > 0)';
code += ' {';
code += ' var searchspeedboost = "+" + searchspeedboost + " Search Speed"; ';
code += ' $(".BoostCalcs9").each(function()';
code += ' {';
code += ' $(this).text(searchspeedboost).attr("data-boostcalc", searchspeedboost);';
code += ' $(this).css(`color`, ``);';
code += ' });';
code += ' } else {';
code += ' if(searchspeedboost < 0)';
code += ' {';
code += ' var searchspeedboost = searchspeedboost + " Search Speed"; ';
code += ' $(".BoostCalcs9").each(function()';
code += ' {';
code += ' $(this).text(searchspeedboost).attr("data-boostcalc", searchspeedboost);';
code += ' $(this).css(`color`, `red`);';
code += ' });';
code += ' } else {';
code += ' searchspeedboost = "";';
code += ' $(".BoostCalcs9").each(function()';
code += ' {';
code += ' $(this).text(searchspeedboost).attr("data-boostcalc", searchspeedboost);';
code += ' });';
code += ' }';
code += ' }';
code += '}';
code += 'var target = prompt;';
code += 'var observer = new MutationObserver(function(mutations) {';
code += ' implantcalc();';
code += '});';
code += 'observer.observe(target, {';
code += ' attributes: true,';
code += ' childList: true,';
code += ' characterData: true';
code += '});';
var script = document.createElement('script');
script.innerText = code;
document.body.appendChild(script);
document.addEventListener("load", CreateDisplay());
document.addEventListener("load", implantcalc());
})();