您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
auto battle StarRepublik!
当前为
// ==UserScript== // @name AutoBattleStarRepublik // @namespace http://tampermonkey.net/ // @version 0.1 // @description auto battle StarRepublik! // @author Max Shabalihin aka Demios // @match https://www.starrepublik.com/* // @grant none // @run-at document-end // ==/UserScript== function StarRepublik() { return { recovery_limit: 40, recovery_timer: null, battle_timer: null, init: function() { var self = this; setInterval(function(){ location.reload(); }, 1000*60*14); this.recovery_timer = setInterval(function(){ self.init_recovery_energy(self.recovery_limit); }, 5000); this.init_battle(); console.log('init StarRepublik'); }, init_recovery_energy: function(power_limit) { console.log('check energy...'); var self = this; var max_power = parseInt($('.max-power').text()); var power = parseInt($($('.restore-power').find('.power-to-restore')[0]).text()); var power_txt = $($('.power-text')[0]).text(); if (power >= max_power) { return; } if (power >= power_limit && (power_txt == 'Восстановить' || power_txt == 'Restore')) { $('.restore-power').click(); } }, is_battle: function() { return document.location.href.indexOf('battle')!==-1; }, init_battle: function() { if(!this.is_battle()) { return; } var pre = $('#player-search-form'); var form = $('<div class="row no-margin">'); var div = $('<div class="col-lg-12 col-md-12 col-sm-12 col-xs-6">'); var r1 = $('<div class="form-group"><label for="smg-kill">Auto battle click</label><input type="text" class="form-control" id="smg-kill" placeholder="Count kill..."></div>'); var r2 = $('<button type="button" id="smg-battle" class="btn btn-default">Start</button>'); div.append(r1, r2); form.append(div); pre.prepend(form); $('#smg-battle').data('obj', this); $('#smg-battle').click(this.change_battle); }, change_battle: function() { var obj = $(this).data('obj'); if ($(this).html()=='Start') { obj.battle_timer = setInterval(function(){obj.tick_battle(obj);}, 200); obj.tick_battle(obj); $(this).html('Stop!'); } else { clearInterval(obj.battle_timer); $(this).html('Start'); } }, tick_stop: function() { clearInterval(this.battle_timer); $(document).find('#smg-battle').html('Start'); }, tick_battle: function(obj) { var cnt = parseInt($(document).find('#smg-kill').val()); if (!cnt) { obj.tick_stop(); return; } $('.battle-form').find('.red-btn').click(); cnt = cnt - 1; $('#smg-kill').val(cnt); } }; } obj = StarRepublik(); setTimeout(function(){ obj.init(); }, 2000);