module TravianBot::Application::Queue

Public Instance Methods

building_queue(selenium) click to toggle source

Check if building something

# File lib/travian_bot/application/queue.rb, line 7
def building_queue(selenium)        
  begin
    building_pipe = selenium.find_elements(:xpath, "//table[@id='building_contract']/tbody/tr")
    
    building_pipe.inject([]) do |out, entry|
      out << entry.text
      
      out
    end
  rescue Selenium::WebDriver::Error::NoSuchElementError
    []
  end
end
troop_movement(selenium) click to toggle source

Show the troop movement.

# File lib/travian_bot/application/queue.rb, line 22
def troop_movement(selenium)
  begin
    troop_movement = selenium.find_elements(:xpath, "//table[@id='movements']/tbody/tr")
    
    troop_movement.inject([]) do |out, movement|
      out << movement.text
      
      out
    end
  rescue   Selenium::WebDriver::Error::NoSuchElementError
    []
  end
end