Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Brudasy
  3. // @version 1.1
  4. // @description opis
  5. // @author adison
  6. // @match *://*/
  7. // @grant none
  8. // ==/UserScript==
  9. ((_pI, hero, ts, message, chatSend, _newOther, map, g, enemyClans) => {
  10. const getTime = () => {
  11. const time = new Date();
  12. const hours = time.getHours() < 10 ? `0${time.getHours()}` : time.getHours();
  13. const minutes = time.getMinutes() < 10 ? `0${time.getMinutes()}` : time.getMinutes();
  14. const seconds = time.getSeconds() < 10 ? `0${time.getSeconds()}` : time.getSeconds();
  15.  
  16. return `${hours}:${minutes}:${seconds}`;
  17. }
  18.  
  19. const tabWithsIds = localStorage.getItem("tabWithsIds") ? JSON.parse(localStorage.getItem("tabWithsIds")) : new Object();
  20.  
  21. const sendInfo = (player) => {
  22. const {
  23. x,
  24. y,
  25. nick,
  26. clan
  27. } = player;
  28. message(`<span style="color: red; font-weight: bold">Wróg: ${nick}</span>`);
  29. if (hero.clan > 0) {
  30. chatSend(`/k Wróg ${nick}${clan ? ` z klanu ${clan}` : ``} na mapie ${map.name} na kordach ${x},${y} - ${getTime()}.`);
  31. }
  32.  
  33. localStorage.setItem("tabWithsIds", JSON.stringify(tabWithsIds));
  34. }
  35.  
  36. const checkPlayer = (player) => {
  37. const {
  38. id
  39. } = player;
  40.  
  41. if (!tabWithsIds[id]) {
  42. tabWithsIds[id] = {
  43. time: ts()
  44. }
  45.  
  46. sendInfo(player);
  47. } else if (tabWithsIds[id].time > ts() + 60 * 1000) {
  48. tabWithsIds[id] = undefined;
  49.  
  50. sendInfo(player);
  51. }
  52. }
  53.  
  54. window.newOther = e => {
  55. Object.values(e).forEach(player => {
  56. const {
  57. nick,
  58. x,
  59. clan,
  60. relation
  61. } = player;
  62. if (nick !== undefined && x !== undefined) {
  63. if (map.pvp == 2 && (["en", "cl-en"].includes(relation) || (clan && enemyClans.includes(clan.toLowerCase())))) {
  64. checkPlayer(player);
  65. }
  66. }
  67. });
  68. _newOther(e);
  69. }
  70.  
  71. window.parseInput = (a, b, c) => {
  72. if (a.hasOwnProperty("f") && a.f.init == 1 && hero.clan > 0) {
  73. if (!Object.keys(a.f.w).some(id => id < 0)) {
  74. const team1 = new Array();
  75. const team2 = new Array();
  76. for (let x of Object.values(a.f.w))
  77. x.team == 1 && team1.push(`${x.name} ${x.lvl}${x.prof}`) || team2.push(`${x.name} ${x.lvl}${x.prof} `);
  78. if (a.f.myteam == 2 && hero.clan > 0) window.chatSend(`/k Zostałem zaatakowany na mapie ${map.name} o godzinie ${getTime()}. ${team1.join(", ")} vs. ${team2.join(", ")}`);
  79. }
  80. }
  81.  
  82. _pI(a, b, c);
  83. }
  84.  
  85. })(window.parseInput, window.hero, window.ts, window.message, window.chatSend, window.newOther, window.map, window.g, [
  86. "arystokracja", "freedom", "Archanioły Ciemności", "himaya", "death eaters", "slaughterer", "magnateria", "tórbinoxy i szczeliny", "phasianae", "zwykły klan", "vide cui fide", "hebi", "archanioły ciemności", "fighters of honor", "aeternus"
  87. ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement