Greasy Fork is available in English.

PayDay 3 Stats+

ajoute des stats, filtre Top bientôt fini, update auto(10min),style pour les skills (modifier les variables: interval et top si besoin)

// ==UserScript==
// @name         PayDay 3 Stats+
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  ajoute des stats, filtre Top bientôt fini, update auto(10min),style pour les skills (modifier les variables: interval et top si besoin)
// @author       DEV314R
// @match        https://pd3.gg/challenges/*
// @match        https://pd3.gg/skills
// @icon         https://icons.duckduckgo.com/ip2/pd3.gg.ico
// @run-at       document-end
// @license      MIT
// ==/UserScript==
const interval=10//minute
const top=3//%


if (location.href.search(/challenges\/(weapons|heists|special-units|equipment|miscellaneous)/gi) > -1) {
const filterRow = document.querySelector(".filter > .row");
filterRow.insertAdjacentHTML('beforeend', `<div class="col-auto"><div class="filter-item"><input type="checkbox" autocomplete="off" class="control-check" id="avenir" >&nbsp;Top `+top+`% Proche</input></div></div>`);


const objectivesProgressElements = document.querySelectorAll(".objectives-progress");

let highestProchemax = 0;

for (const El of objectivesProgressElements) {
    const prochmax = El.querySelector(".objectives > .objective:not(.completed) > div.text");

    if(prochmax){
    const prochemaxValue=parseInt(prochmax.textContent);
    highestProchemax=Math.max(highestProchemax,prochemaxValue);
    }
}

const threshold=(top/100) * highestProchemax
let currentElement
for(const El of objectivesProgressElements){
    const maxElement=El.querySelector(".objectives > .objective:last-child  > div.text");
    const prochmax=El.querySelector(".objectives > .objective:not(.completed) > div.text");
    const pointproch=El.querySelector(".objectives-progress > div > div.objectives > .objective:not(.completed) > div.text");


if(El.querySelector(".current-progress:not(.d-none) > div.text")){
 currentElement=El.querySelector(".current-progress > div.text");
 }
if (El.querySelector(".objectives-progress > div > div.current-progress.d-none")){
 const tousLesElements = El.querySelector(".objectives-progress > div > div.current-progress.d-none").previousElementSibling.querySelectorAll(".objective.completed");
 currentElement=tousLesElements[tousLesElements.length - 1]
	//	console.log((tousLesElements[tousLesElements.length - 1]).innerText);
 }


    if (maxElement&&currentElement&&prochmax&&pointproch){
        const max = parseInt(maxElement.textContent);
        const current =parseInt(currentElement.textContent);
        const prochemax = parseInt(prochmax.textContent);
        const pointinf = parseInt(pointproch.title.match(/\d.+/gi));

   if(max>current){
   El.insertAdjacentHTML('afterend', `<a>Proche:${prochemax - current}<br>PI:${pointinf}<br>Total:${max - current}</a>`);
   }
document.getElementById("avenir").addEventListener("change",function () {
const isChecked=this.checked;
El.parentElement.style.display=isChecked&&(prochemax-current)>threshold||(prochemax-current)==0 ? "none" : "";
})

}
}

function appuyerSurBoutonToutesLesXMinutes() {
    // Vérifie si le dernier appui sur le bouton a été enregistré
    let lastButtonClickTime = localStorage.getItem('lastButtonClickTime');
    // Si c'est la première fois, ou si cela fait plus de 10 minutes depuis le dernier appui
    if (!lastButtonClickTime || (Date.now() - lastButtonClickTime > interval * 60 * 1000)) {
        // Appuie sur le bouton
      document.querySelector("#updateUserStatsBtn").click();
        // Enregistre le temps de l'appui sur le bouton actuel
        localStorage.setItem('lastButtonClickTime', Date.now());}
    // Configure l'intervalle pour appeler la fonction toutes les interval minutes
    setInterval(appuyerSurBoutonToutesLesXMinutes, interval * 60 * 1000);
}
appuyerSurBoutonToutesLesXMinutes();

}

if (location.href.search(/skills/gi) > -1) {

	const applyStyles = (selector, styles) => {
  const element = document.querySelector(selector).parentNode.style;
  Object.assign(element, styles);
};

const addEDGE={background:"linear-gradient(#fbbe0d 33.33%,#0000 33.33%"}
const addGRIT={background:"linear-gradient(#0000 33.33%,#dd473a 33.33%,#dd473a 66.66%,#0000 66.66%)"}
const addRUSH={background:"linear-gradient(#0000 66.66%,#3aab58 66.66%)"}
const siEDGE={borderTop:0,borderBottom:0,borderLeft:"0.3em solid",borderRight:"0.3em solid",borderImage:"linear-gradient(#fbbe0d 33.33%,#0000 33.33%,#0000 66.66%,#0000)",borderImageSlice:"1"}
const siGRIT={border:"0.3em solid",borderImage:"linear-gradient(#0000 33.33%,#dd473a 33.33%,#dd473a 66.66%,#0000 66.66%)",borderImageSlice:"1"}
const siRUSH={borderTop:0,borderBottom:0,borderLeft:"0.3em solid",borderRight:"0.3em solid",borderImage:"linear-gradient(#0000 66.66%,#3aab58 66.66%,#3aab58)",borderImageSlice:"1"}
const siEDGEGRITRUSH={borderTop:0,borderBottom:0,borderLeft:"0.3em solid",borderRight:"0.3em solid",borderImage:"linear-gradient(#fbbe0d 33.33%,#dd473a 33.33%,#dd473a 66.66%,#3aab58 66.66%)",borderImageSlice:"1"}
const siEDGEGRIT={borderTop:0,borderBottom:0,borderLeft:"0.3em solid",borderRight:"0.3em solid",borderImage:"linear-gradient(#fbbe0d 33.33%,#dd473a 33.33%,#dd473a 66.66%,#0000 66.66%)",borderImageSlice:"1"}

applyStyles('[style="--r:1;--c:1;"]',addGRIT);
applyStyles('[style="--r:1;--c:4;"]',siGRIT);
applyStyles('[style="--r:1;--c:5;"]',addRUSH);
applyStyles('[style="--r:1;--c:6;"]',siEDGEGRITRUSH);

applyStyles('[style="--r:2;--c:1;"]',addEDGE);
applyStyles('[style="--r:2;--c:2;"]',siEDGE);
applyStyles('[style="--r:2;--c:4;"]',siGRIT);
applyStyles('[style="--r:2;--c:6;"]',siRUSH);

applyStyles('[style="--r:3;--c:1;"]',addEDGE);
applyStyles('[style="--r:3;--c:2;"]',siEDGE);
applyStyles('[style="--r:3;--c:3;"]',siEDGE);
applyStyles('[style="--r:3;--c:4;"]',siEDGE);
applyStyles('[style="--r:3;--c:5;"]',siEDGE);

applyStyles('[style="--r:4;--c:1;"]',addRUSH)
applyStyles('[style="--r:4;--c:2;"]',siRUSH);
applyStyles('[style="--r:4;--c:4;"]',siRUSH);

applyStyles('[style="--r:5;--c:1;"]',addGRIT);
applyStyles('[style="--r:5;--c:5;"]',siGRIT);

applyStyles('[style="--r:6;--c:1;"]',addEDGE);
applyStyles('[style="--r:6;--c:3;"]',siEDGE);
applyStyles('[style="--r:6;--c:4;"]',siEDGE);
applyStyles('[style="--r:6;--c:5;"]',siEDGE);

applyStyles('[style="--r:7;--c:1;"]',{background:"linear-gradient(#fbbe0d 33.33%,#0000 33.33%,#0000 66.66%,#3aab58 66.66%)"});//addEDGEaddRUSH
applyStyles('[style="--r:7;--c:2;"]',siRUSH);
applyStyles('[style="--r:7;--c:3;"]',Object.assign({},siEDGE,addGRIT));
applyStyles('[style="--r:7;--c:4;"]',siGRIT);
applyStyles('[style="--r:7;--c:5;"]',siEDGEGRITRUSH);

applyStyles('[style="--r:8;--c:1;"]',addRUSH);
applyStyles('[style="--r:8;--c:2;"]',addGRIT);
applyStyles('[style="--r:8;--c:4;"]',siRUSH);
applyStyles('[style="--r:8;--c:5;"]',siGRIT);

applyStyles('[style="--r:9;--c:1;"]',{background:"linear-gradient(#fbbe0d 33.33%,#dd473a 33.33%,#dd473a 66.66%,#0000 66.66%)"})//addEDGEaddGRIT
applyStyles('[style="--r:9;--c:2;"]',siEDGEGRIT);
applyStyles('[style="--r:9;--c:3;"]',siEDGEGRIT);
applyStyles('[style="--r:9;--c:4;"]',siEDGEGRIT);
applyStyles('[style="--r:9;--c:5;"]',siEDGEGRIT);

applyStyles('[style="--r:12;--c:1;"]',addEDGE);
applyStyles('[style="--r:12;--c:2;"]',siEDGE);
applyStyles('[style="--r:12;--c:3;"]',siEDGE);
applyStyles('[style="--r:12;--c:4;"]',siEDGE);

applyStyles('[style="--r:13;--c:1;"]',addRUSH);
applyStyles('[style="--r:13;--c:2;"]',siRUSH);
applyStyles('[style="--r:13;--c:3;"]',siRUSH);

applyStyles('[style="--r:15;--c:1;"]',addEDGE);
applyStyles('[style="--r:15;--c:3;"]',siEDGE);

applyStyles('[style="--r:16;--c:2;"]',siEDGE);
applyStyles('[style="--r:16;--c:3;"]',siGRIT);
applyStyles('[style="--r:16;--c:4;"]',siRUSH);

applyStyles('[style="--r:17;--c:1;"]',{background:"linear-gradient(#0000 33.33%,#dd473a 33.33%,#dd473a 66.66%,#3aab58 66.66%)"})//addGRITaddRUSH
applyStyles('[style="--r:17;--c:4;"]',siGRIT);

applyStyles('[style="--r:18;--c:1;"]',{background:"linear-gradient(#0000 33.33%,#dd473a 33.33%,#dd473a 66.66%,#3aab58 66.66%)"})//addGRITaddRUSH
applyStyles('[style="--r:18;--c:2;"]',siRUSH);
applyStyles('[style="--r:18;--c:3;"]',siGRIT);

}