Class: TravianBot::Application
- Inherits:
-
Object
- Object
- TravianBot::Application
- Extended by:
- Buildings, Connection, Display, Hero, Queue
- Defined in:
- lib/travian_bot/application.rb,
lib/travian_bot/application/hero.rb,
lib/travian_bot/application/time.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, Hero, Navigation, Queue, Time
Class Method Summary collapse
- .current_avaible_buildings ⇒ Object
- .current_building_queue ⇒ Object
- .current_troop_movements ⇒ Object
-
.run!(*arguments) ⇒ Object
Is executed by the travinbot shell script.
Methods included from Hero
Methods included from Time
Methods included from Navigation
#to_hero_quest_page, #to_map_page, #to_reports_page, #to_resources_page, #to_stats_page, #to_village_page
Methods included from Buildings
Methods included from Display
h1, h2, new_line, text, warning
Methods included from Queue
building_queue, troop_movement
Methods included from Connection
Class Method Details
.current_avaible_buildings ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/travian_bot/application.rb', line 37 def current_avaible_buildings @game ||= login h2 'Avaible buildings' buildings = avaible_buildings(@game) buildings.each do |building| text building.to_s end new_line sleep(3) end |
.current_building_queue ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/travian_bot/application.rb', line 49 def current_building_queue @game ||= login h2('Current building queue') buildings = building_queue(@game) if buildings.empty? warning 'nothing building' else buildings.each do |building| text building.to_s end end new_line sleep(3) end |
.current_troop_movements ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/travian_bot/application.rb', line 65 def current_troop_movements @game ||= login h2('Current troop movement') troops = troop_movement(@game) if troops.empty? warning 'No troops movement' else troops.each do |troop| text troop.to_s end end new_line sleep(3) end |
.run!(*arguments) ⇒ Object
Is executed by the travinbot shell script.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/travian_bot/application.rb', line 15 def run!(*arguments) h1('Welcome to your TravianBot') @game = login #current_building_queue #current_troop_movements #current_avaible_buildings h2('Custom actions actions') text '1 => closest_adventure' new_line command = gets.chomp if '1'.eql?(command) h2 'Start the closest adventure' puts start_closest_adventure(@game) end @game.quit return 1 end |