Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Plemiona: ACS
- // @namespace http://plemiona.pl
- // @version 1.0
- // @description ACS
- // @author E*C*O
- // @match http*://*.plemiona.pl/game.php*&try=confirm
- // @grant none
- // ==/UserScript==
- $(document).ready(function() {
- const acs = {
- current_time: {
- hour: 0,
- min: 0,
- sec: 0,
- ms: 0
- },
- wanted_time: {
- hour: 0,
- min: 0,
- sec: 0,
- ms: 0
- },
- init : function () {
- this.getWantedTime();
- },
- getTime : function () {
- const x = new Date(Math.round(Timing.getCurrentServerTime()));
- this.current_time.hour = parseInt(x.getHours());
- this.current_time.min = parseInt(x.getMinutes());
- this.current_time.sec = parseInt(x.getSeconds());
- this.current_time.ms = parseInt(x.getMilliseconds());
- },
- confirmWantedTime : function () {
- const aH = $('#acsHour').val();
- const aM = $('#acsMin').val();
- const aS = $('#acsSec').val();
- const aMS = $('#acsMS').val();
- this.wanted_time.hour = parseInt(aH);
- this.wanted_time.min = parseInt(aM);
- this.wanted_time.sec = parseInt(aS);
- this.wanted_time.ms = parseInt(aMS);
- this.getSendTime();
- },
- getSendTime : function () {
- const ongoing = parseInt($('.relative_time').get(0).getAttribute("data-duration"));
- const hours = Math.floor(ongoing/ 60/ 60);
- const mins = Math.floor(ongoing/ 60)% 60;
- const secs = ongoing% 60;
- this.wanted_time.hour -= hours;
- this.wanted_time.min -= mins;
- this.wanted_time.sec -= secs;
- this.getTime();
- this.sendAttack();
- },
- sendAttack : function () {
- const delay_obj = {
- h: this.wanted_time.hour - this.current_time.hour,
- m: this.wanted_time.min - this.current_time.min,
- s: this.wanted_time.sec - this.current_time.sec,
- ms: this.wanted_time.ms - this.current_time.ms +40
- }
- const delay = delay_obj.h%24 * 60 * 60 * 1000 + delay_obj.m * 60 * 1000 + delay_obj.s * 1000 + delay_obj.ms;
- setTimeout(function(){
- $('#troop_confirm_go').click();
- }, delay);
- },
- getWantedTime : function () {
- 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>");
- $('#acsbtn').bind('click',function(){
- acs.confirmWantedTime();
- })
- }
- }
- setTimeout(function(){
- let x = $('<div>');
- 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;");
- let y = $('<a>');
- y.bind('click',function(){
- acs.init();
- });
- y.html("<img src='https://i.imgur.com/okdzf6T.png' />")
- x.append(y);
- $('#ECOscript').append(x);
- },2000);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement