Sha256: cbdbe09c06fda0cce8c4291f377f5b3fabb3da80c95044eace611273601aeffb

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

require 'selenium-webdriver'

Dir.glob(File.join(File.dirname(__FILE__), '/application/*.rb')).sort.each { |lib| load lib }

class TravianBot
  class Application
    class << self
      include Connection
      include Queue
      include Display
      include Buildings
      include Hero
      
      # Is executed by the travinbot shell script.      
      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
      
      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
       
      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
      
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travian_bot-0.3.0 lib/travian_bot/application.rb