SerlitePD

PD5.1 Roll Hunter

Sep 12th, 2018
794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. //  PD5.1 Roll Hunter (really, really crude)
  3. //  Created by Serlite
  4. //
  5. //  - Allows autobet to be stopped in the browser if a roll number meets the hunt requirements.
  6. //
  7. //  Usage Requirements:
  8. //  - All autobet parameters should be set up before starting this.
  9. //  - My Bets should be selected in the bets section.
  10. //  - To start, call startHunt(), and to stop, call stopHunt().
  11. //      - If autobet starts and you start seeing "Checking for hits..." printed repeatedly to your console, it's working!
  12. //      - The script will stop automatically when it detects a target number, and will print the number and bet ID to the console.
  13. //  - After it hits a number and stops, 10 manual bets will need to be made to clear My Bets before starting again.
  14. //
  15. //  NOTE: Only compatible with modern browsers, as no backwards compatibility is implemented.
  16. */
  17.  
  18. var huntInterval;
  19. var checkDelay = 1000;
  20.  
  21. // These selectors may change with updates to PD - if they don't match in the future, you may need to change the classes accordingly
  22. var betButton = document.querySelector(".Button__Button-eELvBW.jplDNk");
  23. var betNumberColumnSelector = ".styles__StyledTable-cMeZPi.eNDaaT tr td:nth-child(6)";
  24.  
  25. function startHunt(){
  26.     toggleBetting();
  27.     huntInterval = setInterval(checkIfHitNumber, checkDelay);
  28. }
  29.  
  30. function stopHunt(){
  31.     toggleBetting();
  32.     clearInterval(huntInterval);
  33. }
  34.  
  35. function toggleBetting(){
  36.     betButton.click();
  37. }
  38.  
  39. function hitNumber(givenNumber){
  40.     return givenNumber == "13.31" || givenNumber == "24.42" || givenNumber == "57.75" || givenNumber == "68.86";
  41. }
  42.  
  43. function stopBettingIfHitNumber(givenNumber){
  44.     if (hitNumber(givenNumber)){
  45.         stopHunt();
  46.         return true;
  47.     }
  48.     return false;
  49. }
  50.  
  51. function checkIfHitNumber(){
  52.     var hitFound = false;
  53.     console.log("Checking for hits...");
  54.     document.querySelectorAll(betNumberColumnSelector).forEach(function(e){
  55.         var rolledNumber = e.innerText.trim();
  56.         if (!hitFound && stopBettingIfHitNumber(rolledNumber)){
  57.             console.log("Number hit: " + rolledNumber + ", Bet ID: " + e.parentElement.children[0].innerText.trim());
  58.             hitFound = true;
  59.         }
  60.     });
  61. }
Advertisement
Add Comment
Please, Sign In to add comment