-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.rb
More file actions
38 lines (28 loc) · 707 Bytes
/
app.rb
File metadata and controls
38 lines (28 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require './boot'
begin
client = NP::Client.new(
game_id: ENV['GAME_ID'],
auth: ENV['AUTH'],
)
response = client.get
fleets = response.fleets.select { |f| f.player_id.to_s != ENV['PLAYER_ID'] }
fleets.each do |fleet|
next if fleet.orders.empty?
order = fleet.orders.first
next if order.destination_star.player_id.to_s != ENV['PLAYER_ID']
attack = NP::Attack.new(
player: fleet.player,
fleet: fleet,
star: order.destination_star
)
attack.alert
end
puts "FINISHED --- #{Time.now.utc}"
rescue => e
Prowl.add(
apikey: ENV['PROWL_KEY'],
priority: -2,
application: 'Neptunes Pride - Error',
description: e.message
)
end