Advertisement
Guest User

Untitled

a guest
Mar 26th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Plemiona: ACS
  3. // @namespace http://plemiona.pl
  4. // @version 1.0
  5. // @description ACS
  6. // @author E*C*O
  7. // @match http*://*.plemiona.pl/game.php*&try=confirm
  8. // @grant none
  9. // ==/UserScript==
  10. $(document).ready(function() {
  11. const acs = {
  12. current_time: {
  13. hour: 0,
  14. min: 0,
  15. sec: 0,
  16. ms: 0
  17. },
  18. wanted_time: {
  19. hour: 0,
  20. min: 0,
  21. sec: 0,
  22. ms: 0
  23. },
  24. init : function () {
  25. this.getWantedTime();
  26. },
  27. getTime : function () {
  28. const x = new Date(Math.round(Timing.getCurrentServerTime()));
  29. this.current_time.hour = parseInt(x.getHours());
  30. this.current_time.min = parseInt(x.getMinutes());
  31. this.current_time.sec = parseInt(x.getSeconds());
  32. this.current_time.ms = parseInt(x.getMilliseconds());
  33. },
  34. confirmWantedTime : function () {
  35. const aH = $('#acsHour').val();
  36. const aM = $('#acsMin').val();
  37. const aS = $('#acsSec').val();
  38. const aMS = $('#acsMS').val();
  39. this.wanted_time.hour = parseInt(aH);
  40. this.wanted_time.min = parseInt(aM);
  41. this.wanted_time.sec = parseInt(aS);
  42. this.wanted_time.ms = parseInt(aMS);
  43. this.getSendTime();
  44. },
  45. getSendTime : function () {
  46. const ongoing = parseInt($('.relative_time').get(0).getAttribute("data-duration"));
  47. const hours = Math.floor(ongoing/ 60/ 60);
  48. const mins = Math.floor(ongoing/ 60)% 60;
  49. const secs = ongoing% 60;
  50. this.wanted_time.hour -= hours;
  51. this.wanted_time.min -= mins;
  52. this.wanted_time.sec -= secs;
  53. this.getTime();
  54. this.sendAttack();
  55. },
  56. sendAttack : function () {
  57. const delay_obj = {
  58. h: this.wanted_time.hour - this.current_time.hour,
  59. m: this.wanted_time.min - this.current_time.min,
  60. s: this.wanted_time.sec - this.current_time.sec,
  61. ms: this.wanted_time.ms - this.current_time.ms +40
  62. }
  63. const delay = delay_obj.h%24 * 60 * 60 * 1000 + delay_obj.m * 60 * 1000 + delay_obj.s * 1000 + delay_obj.ms;
  64. setTimeout(function(){
  65. $('#troop_confirm_go').click();
  66. }, delay);
  67. },
  68. getWantedTime : function () {
  69. Dialog.show("GetTiming","<div id='WantedTime' align='center'><h2>Podaj pożądany czas</h2><input type='text' style='display: block;' id='acsHour' value='Godzina'><input style='display: block;' type='text' id='acsMin' value='Minuta'><input type='text' style='display: block;' id='acsSec' value='Sekunda'><input type='text' style='display: block;' id='acsMS' value='Milisekunda'><input type='button' class='btn btn-confirm-yes' id='acsbtn' value='Zatwierdź'></div>");
  70. $('#acsbtn').bind('click',function(){
  71. acs.confirmWantedTime();
  72. })
  73. }
  74. }
  75. setTimeout(function(){
  76. let x = $('<div>');
  77. x.attr('style',"background: transparent url(https://i.imgur.com/okdzf6T.png); height: 16px; width: 16px; position: relative; margin-top: 60px; margin-left: auto; margin-right: auto; padding: 0;");
  78. let y = $('<a>');
  79. y.bind('click',function(){
  80. acs.init();
  81. });
  82. y.html("<img src='https://i.imgur.com/okdzf6T.png' />")
  83. x.append(y);
  84. $('#ECOscript').append(x);
  85. },2000);
  86. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement