Strudels

Neggfest Tarot Odds Calculator

Aug 22nd, 2024
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Neggfest Tarot Odds Calculator
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.2
  5. // @description  bored
  6. // @author       Rippy
  7. // @match        http*://*.neopets.com/neggfest/?playtarot=1
  8. // @icon         https://www.google.com/s2/favicons?sz=64&domain=neopets.com
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     'use strict';
  14.  
  15.     let cards;
  16.     const cardNum = 22;
  17.     const _resetGameBoard = resetGameBoard;
  18.     const _startTarotGame = startTarotGame;
  19.     $("#TarotGameButtons").append("<div id='tarotOdds'></div>");
  20.     function calculateOdds() {
  21.         const current = parseInt($("#TarotCard1Num").text());
  22.         cards.splice(cards.indexOf(current), 1);
  23.         const higher = cards.filter(e => e > current);
  24.         console.log(cards);
  25.         console.log(higher);
  26.         $("#tarotOdds").text(`Higher: ${(higher.length/cards.length * 100).toFixed(3)}% | Lower: ${((cards.length - higher.length)/cards.length * 100).toFixed(3)}%`);
  27.     }
  28.     startTarotGame = () => {
  29.         cards = [...Array(cardNum).keys()];
  30.         _startTarotGame();
  31.     };
  32.     resetGameBoard = () => {
  33.         cards = [...Array(cardNum).keys()];
  34.         _resetGameBoard();
  35.     };
  36.     const observer = new MutationObserver(calculateOdds);
  37.     observer.observe(document.querySelector("#TarotCard1Num"), {childList: true});
  38. })();
Advertisement
Add Comment
Please, Sign In to add comment