Created
January 29, 2010 12:28
-
-
Save pirj/289694 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'kit/base' | |
# require 'kit/travian' | |
class Dozorni | |
extend Bot::Base | |
# extend Bot::Travian | |
def self.bot name, &b | |
::AllBots.bots[name] = b | |
end | |
def self.account | |
{ | |
:server => 'http://s5.travian.ru', | |
:login => 'Anton_Pocek', | |
:password => 't1234567', | |
:x => -50, | |
:y => -35 | |
} | |
end | |
bot :dozorni do | |
puts "logging in" | |
page = get '/' | |
login_form = page["//form[@name='snd']"] | |
login_form["//input[@type='text']"] = account[:login] | |
login_form["//input[@type='password']"] = account[:password] | |
page = login_form.click "//input[@type='image']" | |
puts "logged in" | |
attack = page["//table[@id='movements']//tr//span[@class='a1']/../../div[@class='dur_r']/span"] | |
if !attack.nil? and !attack.text.nil? and attack < '0:07:00' then | |
puts 'attack under 7 mins, saving defs!' | |
a2b = get '/a2b.php' | |
snd_form = a2b["//form[@name='snd']"] | |
snd_form["//input[@name='x']"] = account[:x] | |
snd_form["//input[@name='y']"] = account[:y] | |
snd_form["//input[@name='c']"] = 2 | |
(1..11).each do |t| snd_form["//input[@name='t#{t}']"] = '999999' end | |
page = snd_form.submit | |
page["//form"].submit | |
puts 'saving defs saved' | |
else | |
puts 'no attack under 7 mins' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment