Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Kupowanie strzał u tunii.
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author Patix0331
  7. // @match http://*.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. const config = {
  12. // Dokładna nazwa itemku, który ma kupować.
  13. itemName: "Strzały Tunii",
  14. // Do ilu stacków ma kupować danego itemku? (Pamietaj, ze strzały potrzebuja 3 stacki zeby zajac 1 slot w eq)
  15. itemStacks: 18,
  16. // profesje na którcyh ma kupowac
  17. prof: ["h", "t"],
  18. }
  19.  
  20. const old = _g;
  21. let isBought = 0;
  22. _g = x => {
  23.  
  24. if (!x.includes("talk&id=16366&c="
  25. && !hero.prof.includes(config.prof)
  26. || isBought) {
  27. return old(x);
  28. }
  29.  
  30. old(x);
  31.  
  32. setTimeout(() => {
  33. const toBuy = Object.values(g.item).find(item => {
  34. return item.name == config.itemName
  35. && item.own == 16366
  36. });
  37. if (!toBuy) {
  38. return;
  39. }
  40. const inBagItemsCount = Object.values(g.item).filter(item => {
  41. return item.name == config.itemName
  42. && item.loc == "g";
  43. }).length;
  44.  
  45. isBought ^= 1;
  46.  
  47. if (inBagItemsCount == config.itemStacks) {
  48. return;
  49. }
  50.  
  51. old(`shop&buy=${toBuy.id},${config.itemStacks - inBagItemsCount}&sell=`);
  52. }, 150);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement