travian_bot 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,4 +6,5 @@ group :development do
6
6
  end
7
7
 
8
8
  gem 'selenium-webdriver'
9
- gem 'chronic_duration'
9
+ gem 'chronic_duration'
10
+ gem 'term-ansicolor'
data/Gemfile.lock CHANGED
@@ -20,6 +20,7 @@ GEM
20
20
  ffi (= 1.0.9)
21
21
  json_pure
22
22
  rubyzip
23
+ term-ansicolor (1.0.7)
23
24
 
24
25
  PLATFORMS
25
26
  ruby
@@ -29,3 +30,4 @@ DEPENDENCIES
29
30
  chronic_duration
30
31
  jeweler (~> 1.6.4)
31
32
  selenium-webdriver
33
+ term-ansicolor
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -1,23 +1,32 @@
1
+ require 'term/ansicolor'
2
+
3
+ class String
4
+ include Term::ANSIColor
5
+ end
6
+
1
7
  class TravianBot
2
8
  class Application
3
9
  module Display
4
10
  def h1(text)
5
11
  puts ' '
6
- puts "#{text}"
7
- puts "=" * text.length
12
+ puts "#{text}".red
13
+ puts "=".red * text.length
8
14
  puts ' '
9
15
  puts ' '
10
16
  end
11
17
 
12
18
  def h2(text)
13
- puts "#{text}"
14
- puts "-" * text.length
19
+ puts "#{text}".yellow
20
+ puts "-".yellow * text.length
15
21
  puts ' '
16
22
  end
17
23
 
18
24
  def text(text)
19
- puts text
20
- puts ' '
25
+ puts text.to_s.green
26
+ end
27
+
28
+ def warning(text)
29
+ puts text.to_s.red
21
30
  end
22
31
 
23
32
  def new_line
@@ -16,13 +16,14 @@ class TravianBot
16
16
  h1('Welcome to your TravianBot')
17
17
  @game = login
18
18
 
19
- h2('Your avaible actions')
20
- #command = gets
21
- #self.send(command)
22
19
  current_building_queue
23
20
  current_troop_movements
24
21
  current_avaible_buildings
25
- start_closest_adventure @game
22
+
23
+ h2('Custom actions actions')
24
+ text 'closest_adventure'
25
+ command = gets
26
+ start_closest_adventure @game if command == 'closest_adventure'
26
27
  @game.quit
27
28
 
28
29
  return 1
@@ -34,7 +35,7 @@ class TravianBot
34
35
  buildings = avaible_buildings(@game)
35
36
 
36
37
  buildings.each do |building|
37
- puts building.to_s
38
+ text building.to_s
38
39
  end
39
40
  new_line
40
41
  end
@@ -45,13 +46,13 @@ class TravianBot
45
46
  buildings = building_queue(@game)
46
47
 
47
48
  if buildings.empty?
48
- text 'nothing building'
49
+ warning 'nothing building'
49
50
  else
50
51
  buildings.each do |building|
51
- puts building.to_s
52
+ text building.to_s
52
53
  end
53
- new_line
54
- end
54
+ end
55
+ new_line
55
56
  end
56
57
 
57
58
  def current_troop_movements
@@ -60,13 +61,13 @@ class TravianBot
60
61
  troops = troop_movement(@game)
61
62
 
62
63
  if troops.empty?
63
- text 'No troops movement'
64
+ warning 'No troops movement'
64
65
  else
65
66
  troops.each do |troop|
66
- puts troop.to_s
67
+ text troop.to_s
67
68
  end
68
- new_line
69
69
  end
70
+ new_line
70
71
  end
71
72
  end
72
73
  end
data/travian_bot.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "travian_bot"
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roman Simecek"]
@@ -51,17 +51,20 @@ Gem::Specification.new do |s|
51
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
52
  s.add_runtime_dependency(%q<selenium-webdriver>, [">= 0"])
53
53
  s.add_runtime_dependency(%q<chronic_duration>, [">= 0"])
54
+ s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
54
55
  s.add_development_dependency(%q<bundler>, [">= 0"])
55
56
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
56
57
  else
57
58
  s.add_dependency(%q<selenium-webdriver>, [">= 0"])
58
59
  s.add_dependency(%q<chronic_duration>, [">= 0"])
60
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
59
61
  s.add_dependency(%q<bundler>, [">= 0"])
60
62
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
61
63
  end
62
64
  else
63
65
  s.add_dependency(%q<selenium-webdriver>, [">= 0"])
64
66
  s.add_dependency(%q<chronic_duration>, [">= 0"])
67
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
65
68
  s.add_dependency(%q<bundler>, [">= 0"])
66
69
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
67
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travian_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
16
- requirement: &2165300380 !ruby/object:Gem::Requirement
16
+ requirement: &2156662640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2165300380
24
+ version_requirements: *2156662640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: chronic_duration
27
- requirement: &2165299440 !ruby/object:Gem::Requirement
27
+ requirement: &2156661960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2165299440
35
+ version_requirements: *2156661960
36
+ - !ruby/object:Gem::Dependency
37
+ name: term-ansicolor
38
+ requirement: &2156659580 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2156659580
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: bundler
38
- requirement: &2165298460 !ruby/object:Gem::Requirement
49
+ requirement: &2156658900 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *2165298460
57
+ version_requirements: *2156658900
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: jeweler
49
- requirement: &2165297340 !ruby/object:Gem::Requirement
60
+ requirement: &2156658280 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,7 +65,7 @@ dependencies:
54
65
  version: 1.6.4
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *2165297340
68
+ version_requirements: *2156658280
58
69
  description: A little bot for travian.
59
70
  email: roman.simecek@cyt.ch
60
71
  executables:
@@ -99,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
110
  version: '0'
100
111
  segments:
101
112
  - 0
102
- hash: -1008102311582387206
113
+ hash: 4286807613602955578
103
114
  required_rubygems_version: !ruby/object:Gem::Requirement
104
115
  none: false
105
116
  requirements: