Advertisement
Guest User

Untitled

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