Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Wykrywacz herosów
  3. // @version 1.5
  4. // @description Wykrywacz herosów dla świata Berufs
  5. // @author adi wilk
  6. // @match http://berufs.margonem.pl/
  7. // @match https://berufs.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10. (function(_n, data, ut) {
  11. //pobranie localStorage
  12. let dane = {};
  13. if (localStorage.getItem("adiherosybrutus")) {
  14. dane = JSON.parse(localStorage.getItem("adiherosybrutus"));
  15. }
  16. if (dane) {
  17. for (let i in dane) {
  18. if (ut() > dane[i].time) {
  19. delete dane[i];
  20. }
  21. }
  22. }
  23. //getTime
  24. function getTime() {
  25. let czas = new Date(),
  26. godzina = czas.getHours(),
  27. sekunda = czas.getSeconds(),
  28. minuta = czas.getMinutes();
  29. if (godzina < 10) godzina = `0${godzina}`;
  30. if (minuta < 10) minuta = `0${minuta}`;
  31. if (sekunda < 10) sekunda = `0${sekunda}`;
  32. return `${godzina}:${minuta}:${sekunda}`;
  33. }
  34. //funkcja wysłania na diskordzika
  35. function sendToDiscord(lvl, nick, icon, x, y) {
  36. $.ajax({
  37. url: data[0],
  38. type: 'POST',
  39. data: JSON.stringify({
  40. 'embeds': [{
  41. 'title': `${hero.nick} · ${hero.lvl}${hero.prof} znalazł herosa/tytana!`,
  42. 'color': ((Math.floor(lvl / 300 * 221) + 32) * 256 + (Math.floor(lvl / 300 * (-112)) + 120)) * 256 + Math.floor(lvl / 300 * (-204)) + 217,
  43. 'description': `${nick} (${lvl}lvl)\n${map.name} (${x}, ${y})\n${getTime()}\n${g.worldname[0].toUpperCase() + g.worldname.substring(1)}`,
  44. 'thumbnail': {
  45. 'url': `http://berufs.margonem.pl${icon}`
  46. }
  47. }],
  48. content: `@everyone Znaleźli mnie na mapie ${map.name}`,
  49. username: nick,
  50. avatar_url: `http://berufs.margonem.pl${icon}`
  51. }),
  52. contentType: 'application/json; charset=utf-8',
  53. dataType: 'json',
  54. async: false
  55. });
  56. }
  57. //funkcja sprawdzajaca czy dane id z ts istnieje
  58. function checkHerosData(id) {
  59. if (dane[id]) {
  60. if (ut() > dane[id].time) {
  61. delete dane[id];
  62. return true;
  63. } else {
  64. return false;
  65. }
  66. }
  67. return true;
  68. }
  69. newNpc = function(e) {
  70. _n.apply(this, arguments);
  71. for (let i in e) {
  72. let heros = e[i];
  73. if (heros.nick != "Mamlambo" && heros.wt > 79 && g.worldname != "asd" && checkHerosData(heros.id)) {
  74. dane[heros.id] = {
  75. time: ut() + (10 * 60)
  76. }
  77. localStorage.setItem("adiherosybrutus", JSON.stringify(dane));
  78. if (hero.clan > 0) chatSend(`/k Znalazłem ${heros.nick} ${heros.lvl}lvl na mapie ${map.name}(${heros.x},${heros.y}).`);
  79. sendToDiscord(heros.lvl, heros.nick, heros.icon, heros.x, heros.y);
  80. break;
  81. }
  82. }
  83. }
  84. })(newNpc, ["https://discordapp.com/api/webhooks/600646660405854208/rBL2Z5_LBmfXMG-lsKVuR3ymQ-fZJSGt2DmIvq0zOYqWkAxnVl8EcI11CBwKYTlDHUGq"], unix_time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement