| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::MetaForge::ArcRaiders::CLI::Cmd::Arcs; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: List ARCs from the ARC Raiders API |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
|
5
|
1
|
|
|
1
|
|
11219
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
39
|
|
|
6
|
1
|
|
|
1
|
|
527
|
use MooX::Cmd; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
7
|
1
|
|
|
1
|
|
3613
|
use MooX::Options; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
11
|
|
|
8
|
1
|
|
|
1
|
|
2620
|
use JSON::MaybeXS; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
644
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
option loot => ( |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
short => 'l', |
|
13
|
|
|
|
|
|
|
doc => 'Include loot drop information', |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
option page => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
format => 'i', |
|
19
|
|
|
|
|
|
|
short => 'p', |
|
20
|
|
|
|
|
|
|
doc => 'Page number for pagination', |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
option all => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
short => 'a', |
|
26
|
|
|
|
|
|
|
doc => 'Fetch all pages', |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub execute { |
|
30
|
1
|
|
|
1
|
0
|
4134
|
my ($self, $args, $chain) = @_; |
|
31
|
1
|
|
|
|
|
4
|
my $app = $chain->[0]; |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
2
|
my %params; |
|
34
|
1
|
50
|
|
|
|
6
|
$params{includeLoot} = 1 if $self->loot; |
|
35
|
1
|
50
|
|
|
|
6
|
$params{page} = $self->page if $self->page; |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
2
|
my ($arcs, $pagination); |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
4
|
if ($self->all) { |
|
40
|
0
|
|
|
|
|
0
|
$arcs = $app->api->arcs_all(%params); |
|
41
|
|
|
|
|
|
|
} else { |
|
42
|
1
|
|
|
|
|
38
|
my $result = $app->api->arcs_paginated(%params); |
|
43
|
1
|
|
|
|
|
277
|
$arcs = $result->{data}; |
|
44
|
1
|
|
|
|
|
4
|
$pagination = $result->{pagination}; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
9
|
if ($app->json) { |
|
48
|
|
|
|
|
|
|
print JSON::MaybeXS->new(utf8 => 1, pretty => 1)->encode( |
|
49
|
0
|
|
|
|
|
0
|
[ map { $_->_raw } @$arcs ] |
|
|
0
|
|
|
|
|
0
|
|
|
50
|
|
|
|
|
|
|
); |
|
51
|
0
|
|
|
|
|
0
|
return; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
4
|
if (!@$arcs) { |
|
55
|
0
|
|
|
|
|
0
|
print "No ARCs found.\n"; |
|
56
|
0
|
|
|
|
|
0
|
return; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
4
|
for my $arc (@$arcs) { |
|
60
|
2
|
|
50
|
|
|
12
|
my $name = $arc->name // 'Unknown'; |
|
61
|
2
|
|
50
|
|
|
7
|
my $id = $arc->id // '-'; |
|
62
|
2
|
|
|
|
|
92
|
printf "%-40s [%s]\n", $name, $id; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
4
|
my $shown = scalar(@$arcs); |
|
66
|
1
|
50
|
33
|
|
|
13
|
if ($pagination && $pagination->{totalPages} > 1 && !$self->all) { |
|
|
|
|
33
|
|
|
|
|
|
67
|
0
|
|
0
|
|
|
0
|
my $total = $pagination->{total} // '?'; |
|
68
|
0
|
|
0
|
|
|
0
|
my $page_num = $pagination->{page} // 1; |
|
69
|
0
|
|
0
|
|
|
0
|
my $total_pages = $pagination->{totalPages} // '?'; |
|
70
|
0
|
|
|
|
|
0
|
printf "\n%d ARC(s) shown (page %d/%s, %s total). Use --all to fetch all pages.\n", |
|
71
|
|
|
|
|
|
|
$shown, $page_num, $total_pages, $total; |
|
72
|
|
|
|
|
|
|
} else { |
|
73
|
1
|
|
|
|
|
49
|
printf "\n%d ARC(s) found.\n", $shown; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding UTF-8 |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
WWW::MetaForge::ArcRaiders::CLI::Cmd::Arcs - List ARCs from the ARC Raiders API |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
version 0.002 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# List ARCs (first page) |
|
96
|
|
|
|
|
|
|
arcraiders arcs |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# Include loot drop information |
|
99
|
|
|
|
|
|
|
arcraiders arcs --loot |
|
100
|
|
|
|
|
|
|
arcraiders arcs -l |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Navigate to specific page |
|
103
|
|
|
|
|
|
|
arcraiders arcs --page 2 |
|
104
|
|
|
|
|
|
|
arcraiders arcs -p 3 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# Fetch all pages |
|
107
|
|
|
|
|
|
|
arcraiders arcs --all |
|
108
|
|
|
|
|
|
|
arcraiders arcs -a |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Combine options |
|
111
|
|
|
|
|
|
|
arcraiders arcs --loot --all |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# JSON output |
|
114
|
|
|
|
|
|
|
arcraiders --json arcs |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This command retrieves and displays a list of ARCs (enemies) from the ARC Raiders |
|
119
|
|
|
|
|
|
|
game API. By default, it shows the first page of results with basic information |
|
120
|
|
|
|
|
|
|
about each ARC including name and ID. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Results are paginated by the API. Use C<--page> to navigate pages or C<--all> to |
|
123
|
|
|
|
|
|
|
fetch all available ARCs across all pages. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 OPTIONS |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 --loot, -l |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Include loot drop information for each ARC. When enabled, the API returns additional |
|
130
|
|
|
|
|
|
|
details about what items each ARC can drop. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 --page PAGE, -p PAGE |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Retrieve a specific page number. Pages are 1-indexed. Without this option, the first |
|
135
|
|
|
|
|
|
|
page is returned. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Cannot be combined with C<--all>. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 --all, -a |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Fetch all pages automatically. When enabled, the command retrieves every page of |
|
142
|
|
|
|
|
|
|
results and displays all ARCs in a single list. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This may take longer depending on the total number of ARCs. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 OUTPUT |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
In normal mode, outputs a formatted list with each ARC on its own line: |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
ARC Name [ID] |
|
151
|
|
|
|
|
|
|
Another ARC [42] |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
At the end, displays a summary: |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
2 ARC(s) found. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
For paginated results (without C<--all>), the summary includes pagination details: |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
10 ARC(s) shown (page 1/5, 50 total). Use --all to fetch all pages. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
With C<--json> global option, outputs raw API response as JSON array. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 SUPPORT |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 Issues |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Please report bugs and feature requests on GitHub at |
|
168
|
|
|
|
|
|
|
L<https://github.com/Getty/p5-www-metaforge/issues>. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 IRC |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
You can reach Getty on C<irc.perl.org> for questions and support. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Contributions are welcome! Please fork the repository and submit a pull request. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 AUTHOR |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This software is copyright (c) 2026 by Torsten Raudssus. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
187
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |