Class: TravianBot::Application

Inherits:
Object
  • Object
show all
Extended by:
Buildings, Connection, Display, Queue
Defined in:
lib/travian_bot/application.rb,
lib/travian_bot/application/queue.rb,
lib/travian_bot/application/display.rb,
lib/travian_bot/application/buildings.rb,
lib/travian_bot/application/connection.rb,
lib/travian_bot/application/navigation.rb

Defined Under Namespace

Modules: Buildings, Connection, Display, Navigation, Queue

Class Method Summary collapse

Methods included from Buildings

avaible_buildings

Methods included from Navigation

#to_map_page, #to_reports_page, #to_resources_page, #to_stats_page, #to_village_page

Methods included from Display

h1, h2, new_line, text

Methods included from Queue

building_queue, troop_movement

Methods included from Connection

get_credentials, login

Class Method Details

.current_avaible_buildingsObject



27
28
29
30
31
32
33
34
35
# File 'lib/travian_bot/application.rb', line 27

def current_avaible_buildings
  h2 'Avaible buildings'
  buildings = avaible_buildings(@game)
  
  buildings.each do |building|
    puts building.to_s
  end  
  new_line
end

.current_building_queueObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/travian_bot/application.rb', line 37

def current_building_queue
  h2('Current building queue')
  buildings = building_queue(@game)
  
  if buildings.empty?
    text 'nothing building'
  else
    buildings.each do |building|
      puts building.to_s
    end
    new_line
  end
end

.current_troop_movementsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/travian_bot/application.rb', line 51

def current_troop_movements
  h2('Current troop movement')
  troops = troop_movement(@game)
  
  if troops.empty?
    text 'No troops movement'
  else
    troops.each do |troop|
      puts troop.to_s
    end
    new_line
  end
end

.run!(*arguments) ⇒ Object

Is executed by the travinbot shell script.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/travian_bot/application.rb', line 14

def run!(*arguments)
  h1('Welcome to your TravianBot')
  @game = 
  
  current_building_queue
  current_troop_movements
  current_avaible_buildings
  
  @game.quit

  return 1
end