Advertisement
mateusz1239196

paradise-rpg obliczanie wypłat z org

Apr 7th, 2022
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function run(){
  2.     //================USTAWIENIA==================//
  3.     //
  4.     var oprocentowanie = 0.8;
  5.     //
  6.     //============================================//
  7.     myDocument = document.getElementsByClassName('b-overlay-wrap position-relative')[1].children[2];
  8.     let mojewpisy = [];
  9.     let mojewpisy2 = [];
  10.     for(let i=0;i < myDocument.childElementCount;i++){
  11.         node = myDocument.children[i];
  12.         for(let j=0;j < node.childElementCount;j++){
  13.             node2 = node.children[j];
  14.             if(node2.innerHTML.includes("MoneyMaker")){
  15.                 mojewpisy.push(node2.innerHTML);
  16.             }
  17.             if(node2.innerHTML.includes("Wypłacono")){
  18.                 mojewpisy2.push(node2.innerHTML);
  19.             }
  20.             for(let k=0;k < node2.childElementCount;k++){
  21.                 node3 = node2.children[k].innerHTML;
  22.                 if(node3.includes("MoneyMaker")){
  23.                     mojewpisy.push(node3.innerHTML);
  24.                 }
  25.                 if(node3.includes("Wypłacono")){
  26.                     mojewpisy2.push(node3.innerHTML);
  27.                 }
  28.             }
  29.         }
  30.     }
  31.     var jakes = 0;
  32.     var mateusz12391 = 0;
  33.     var wyplatajakes = 0;
  34.     var wyplatamateusz12391 = 0;
  35.     console.log(mojewpisy.length);
  36.     for(let i=0; i < mojewpisy.length ;i++){
  37.         var wpis = mojewpisy[i];
  38.         var poczatek = 0;
  39.         var koniec = 0;
  40.         var kwota = 0;
  41.         if(wpis && wpis.indexOf('$') !== -1){
  42.             var poczatek = wpis.indexOf('$');
  43.         }
  44.         if(wpis && wpis.indexOf(' ') !== -1){
  45.             var koniec = wpis.indexOf(' ',poczatek);
  46.         }
  47.         if(poczatek !=0 && koniec != 0){
  48.             var kwota = wpis.substring(poczatek+1,koniec);
  49.         }
  50.         if(wpis != null && wpis.includes("Jakes")){
  51.             jakes+=parseInt(kwota,10);
  52.         }
  53.         if(wpis != null && wpis.includes("mateusz123_91")){
  54.             mateusz12391+=parseInt(kwota,10);
  55.         }
  56.     }
  57.     for(let i=0; i < mojewpisy2.length ;i++){
  58.         var wpis = mojewpisy2[i];
  59.         var poczatek = 0;
  60.         var koniec = 0;
  61.         var kwota = 0;
  62.         if(wpis && wpis.indexOf('$') !== -1){
  63.             var poczatek = wpis.indexOf('$');
  64.         }
  65.         if(wpis && wpis.indexOf(' ') !== -1){
  66.             var koniec = wpis.indexOf(' ',poczatek);
  67.         }
  68.         if(poczatek !=0 && koniec != 0){
  69.             var kwota = wpis.substring(poczatek+1,koniec);
  70.         }
  71.         if(wpis != null && wpis.includes("Jakes")){
  72.             wyplatajakes+=parseInt(kwota,10);
  73.         }
  74.         if(wpis != null && wpis.includes("mateusz123_91")){
  75.             wyplatamateusz12391+=parseInt(kwota,10);
  76.         }
  77.     }
  78.     //wyrównanie
  79.     wyplatajakes+=15000;
  80.     wyplatamateusz12391-=15000;
  81.     mateusz12391+=50000;
  82.     console.log("Jakes zarobił: " + jakes + " i wypłacił: " + wyplatajakes);
  83.     console.log("Wypłata Jakes: " + ((jakes * oprocentowanie) - wyplatajakes ));
  84.     console.log("Mateusz zarobił: " + mateusz12391 + " i wypłacił: " + wyplatamateusz12391);
  85.     console.log("Wypłata Mateusz: " + ((mateusz12391 * oprocentowanie) - wyplatamateusz12391));
  86.     alerttext = "Jakes zarobił: " + jakes + " i wypłacił: " + wyplatajakes + "\n";
  87.     alerttext+= "Wypłata Jakes: " + ((jakes * oprocentowanie) - wyplatajakes ) + "\n";
  88.     alerttext+= "Mateusz zarobił: " + mateusz12391 + " i wypłacił: " + wyplatamateusz12391 + "\n";
  89.     alerttext+= "Wypłata Mateusz: " + ((mateusz12391 * oprocentowanie) - wyplatamateusz12391);
  90.     alert(alerttext);
  91.    
  92. }
  93. function dodaj_przycisk(){
  94.     const pasek = document.getElementsByClassName("tabs");
  95.     let przycisk = document.createElement("button");
  96.     przycisk.innerText="Oblicz Pensje";
  97.     przycisk.id = "oblicz";
  98.     przycisk.onclick = zmienKarte;
  99.     przycisk.className = "btn btn-primary shadow_box tabs mb-1";
  100.     pasek[0].appendChild(przycisk);
  101. }
  102. function zmienKarte(){
  103.     przycisklogi = document.getElementById("oblicz").previousSibling;
  104.     przycisklogi.click();
  105.     document.getElementsByClassName("btn btn-primary")[6].click();
  106.     window.setTimeout(run, 2000);
  107. }
  108.  
  109. let stateCheck = setInterval(() => {
  110.   if (document.readyState === 'complete') {
  111.     clearInterval(stateCheck);
  112.     dodaj_przycisk();
  113.   }
  114. }, 1500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement