Greasy Fork is available in English.

Pendoria: Market easyBuy

For example u buy rhodium: You want to spend 1t,

  1. // ==UserScript==
  2. // @name Pendoria: Market easyBuy
  3. // @version 1.1.2
  4. // @description For example u buy rhodium: You want to spend 1t,
  5. // @description u typ in 1t, and u get the output on how many you can buy
  6. // @author Pinbo
  7. // @match https://pendoria.net/game
  8. // @include /^https?:\/\/(?:.+\.)?pendoria\.net\/?(?:.+)?$/
  9.  
  10. // @namespace https://xpuls3.github.io/
  11. // ==/UserScript==
  12. function getTabs(){
  13. let tabItems = $('div#market-div > ul > li > a');
  14. return tabItems;
  15.  
  16. }
  17. function getCells(){
  18. var allCollumns = [];
  19. allCollumns = document.getElementsByTagName('td');
  20.  
  21. for(var i = 0; i < allCollumns.length; i++){
  22. if( i % 4 == 0){
  23.  
  24. allCollumns[i+1].addEventListener('click', function(){
  25. var priceClicked = this.innerText.split(',').join("");
  26. var priceBillion = prompt("For how much do you want to buy? (100 = 100b)");
  27. var totalPrice = priceBillion * 1000000000;
  28.  
  29. var buyable = Math.round(totalPrice / priceClicked);
  30.  
  31. alert(`Can be bought: ${buyable} at this price`);
  32.  
  33. });
  34. }
  35. }
  36. }
  37.  
  38.  
  39.  
  40.  
  41. function getDataFromMarketOnClick(){
  42. var promise = new Promise((resolve,reject) => {
  43. resolve(inputOutput());
  44.  
  45. })
  46.  
  47. }
  48.  
  49. async function inputOutput(){
  50.  
  51. setTimeout(function(){
  52. getCells();
  53. var dataCells = getTabs();
  54. for(let i = 0; i< dataCells.length;i++){
  55. dataCells[i].addEventListener('click', function(){
  56. setTimeout(function(){
  57. getCells();
  58. },1000)
  59. })
  60. }
  61. },1000);
  62.  
  63.  
  64.  
  65.  
  66. }
  67.  
  68.  
  69. function init(){
  70. $('#market-button').click(function(){
  71. getDataFromMarketOnClick();
  72. });
  73.  
  74.  
  75.  
  76.  
  77. }
  78.  
  79.  
  80. init();
  81.