line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Lacuna::Task::Report::Mining; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1480
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
4
|
|
|
|
|
|
|
our $VERSION = $Games::Lacuna::Task::VERSION; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
445
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Games::Lacuna::Client::Types qw(ore_types); |
9
|
|
|
|
|
|
|
use List::Util qw(min max); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub report_mining { |
12
|
|
|
|
|
|
|
my ($self) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $table = Games::Lacuna::Task::Table->new( |
15
|
|
|
|
|
|
|
headline=> 'Mining Report', |
16
|
|
|
|
|
|
|
columns => ['Planet','Level','Platforms','Capacity','Min','Max'], |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
foreach my $planet_id ($self->my_planets) { |
20
|
|
|
|
|
|
|
$self->_report_mining_body($planet_id,$table); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $table; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _report_mining_body { |
27
|
|
|
|
|
|
|
my ($self,$planet_id,$table) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $planet_stats = $self->my_body_status($planet_id); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Get mining ministry |
32
|
|
|
|
|
|
|
my $mining = $self->find_building($planet_stats->{id},'MiningMinistry'); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return |
35
|
|
|
|
|
|
|
unless $mining; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $mining_object = $self->build_object($mining); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $mining_data = $self->request( |
40
|
|
|
|
|
|
|
object => $mining_object, |
41
|
|
|
|
|
|
|
method => 'view_platforms', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my @platforms; |
45
|
|
|
|
|
|
|
my $capcity = 0; |
46
|
|
|
|
|
|
|
foreach my $platform (@{$mining_data->{platforms}}) { |
47
|
|
|
|
|
|
|
my $total = 0; |
48
|
|
|
|
|
|
|
foreach my $ore (ore_types) { |
49
|
|
|
|
|
|
|
$total += $platform->{$ore.'_hour'}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
push(@platforms,$total); |
52
|
|
|
|
|
|
|
$capcity ||= $platform->{shipping_capacity}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$table->add_row({ |
57
|
|
|
|
|
|
|
planet => $planet_stats->{name}, |
58
|
|
|
|
|
|
|
level => $mining->{level}, |
59
|
|
|
|
|
|
|
platforms => scalar(@{$mining_data->{platforms}}), |
60
|
|
|
|
|
|
|
capacity => $capcity.'%', |
61
|
|
|
|
|
|
|
min => min(@platforms), |
62
|
|
|
|
|
|
|
max => max(@platforms), |
63
|
|
|
|
|
|
|
}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
no Moose::Role; |
67
|
|
|
|
|
|
|
1; |