Module: TravianBot::Application::Queue

Included in:
TravianBot::Application
Defined in:
lib/travian_bot/application/queue.rb

Instance Method Summary collapse

Instance Method Details

#building_queue(selenium) ⇒ Object

Check if building something



7
8
9
10
11
12
13
14
15
16
17
18
19
# 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) ⇒ Object

Show the troop movement.



22
23
24
25
26
27
28
29
30
31
32
33
34
# 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