| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::ARDB::CLI::Cmd::Enemies; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: List ARC enemies command |
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2661
|
use Moo; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
13
|
|
|
7
|
2
|
|
|
2
|
|
931
|
use MooX::Cmd; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
12
|
|
|
8
|
2
|
|
|
2
|
|
5930
|
use MooX::Options; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
option search => ( |
|
14
|
|
|
|
|
|
|
is => 'ro', |
|
15
|
|
|
|
|
|
|
short => 's', |
|
16
|
|
|
|
|
|
|
format => 's', |
|
17
|
|
|
|
|
|
|
doc => 'Search enemies by name', |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub execute { |
|
22
|
0
|
|
|
0
|
0
|
|
my ($self, $args, $chain) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $app = $chain->[0]; |
|
25
|
0
|
|
|
|
|
|
my $enemies = $app->api->arc_enemies; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Apply filters |
|
28
|
0
|
0
|
|
|
|
|
if ($self->search) { |
|
29
|
0
|
|
|
|
|
|
my $search = lc($self->search); |
|
30
|
0
|
|
|
|
|
|
$enemies = [ grep { index(lc($_->name), $search) >= 0 } @$enemies ]; |
|
|
0
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($app->json) { |
|
34
|
0
|
|
|
|
|
|
$app->output_json([ map { $_->_raw } @$enemies ]); |
|
|
0
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if (@$enemies == 0) { |
|
39
|
0
|
|
|
|
|
|
print "No enemies found.\n"; |
|
40
|
0
|
|
|
|
|
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
printf "%-25s %-30s\n", 'Name', 'ID'; |
|
44
|
0
|
|
|
|
|
|
print "-" x 55 . "\n"; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
for my $enemy (@$enemies) { |
|
47
|
0
|
|
|
|
|
|
printf "%-25s %-30s\n", |
|
48
|
|
|
|
|
|
|
$enemy->name, |
|
49
|
|
|
|
|
|
|
$enemy->id; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
print "\n" . scalar(@$enemies) . " enemies found.\n"; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |