| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::MetaForge::ArcRaiders::Result::Trader; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Trader result object |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
|
5
|
6
|
|
|
6
|
|
492091
|
use Moo; |
|
|
6
|
|
|
|
|
9548
|
|
|
|
6
|
|
|
|
|
50
|
|
|
6
|
6
|
|
|
6
|
|
5023
|
use Types::Standard qw(Str Int ArrayRef HashRef Maybe); |
|
|
6
|
|
|
|
|
152124
|
|
|
|
6
|
|
|
|
|
92
|
|
|
7
|
6
|
|
|
6
|
|
18715
|
use namespace::clean; |
|
|
6
|
|
|
|
|
21724
|
|
|
|
6
|
|
|
|
|
55
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has name => ( |
|
10
|
|
|
|
|
|
|
is => 'ro', |
|
11
|
|
|
|
|
|
|
isa => Str, |
|
12
|
|
|
|
|
|
|
required => 1, |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has description => ( |
|
16
|
|
|
|
|
|
|
is => 'ro', |
|
17
|
|
|
|
|
|
|
isa => Maybe[Str], |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has location => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
isa => Maybe[Str], |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has inventory => ( |
|
26
|
|
|
|
|
|
|
is => 'ro', |
|
27
|
|
|
|
|
|
|
isa => ArrayRef[HashRef], |
|
28
|
|
|
|
|
|
|
default => sub { [] }, |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has last_refresh => ( |
|
32
|
|
|
|
|
|
|
is => 'ro', |
|
33
|
|
|
|
|
|
|
isa => Maybe[Str], |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has _raw => ( |
|
37
|
|
|
|
|
|
|
is => 'ro', |
|
38
|
|
|
|
|
|
|
isa => HashRef, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub from_hashref { |
|
42
|
2
|
|
|
2
|
1
|
18736
|
my ($class, $data) = @_; |
|
43
|
|
|
|
|
|
|
return $class->new( |
|
44
|
|
|
|
|
|
|
name => $data->{name}, |
|
45
|
|
|
|
|
|
|
description => $data->{description}, |
|
46
|
|
|
|
|
|
|
location => $data->{location}, |
|
47
|
|
|
|
|
|
|
inventory => $data->{inventory} // [], |
|
48
|
|
|
|
|
|
|
last_refresh => $data->{lastRefresh}, |
|
49
|
2
|
|
100
|
|
|
102
|
_raw => $data, |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub find_item { |
|
54
|
7
|
|
|
7
|
1
|
9210
|
my ($self, $item_name) = @_; |
|
55
|
7
|
|
|
|
|
33
|
for my $item ($self->inventory->@*) { |
|
56
|
8
|
100
|
50
|
|
|
80
|
return $item if lc($item->{item} // '') eq lc($item_name); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
3
|
|
|
|
|
17
|
return undef; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub has_item { |
|
62
|
4
|
|
|
4
|
1
|
8579
|
my ($self, $item_name) = @_; |
|
63
|
4
|
|
|
|
|
14
|
return defined $self->find_item($item_name); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=pod |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding UTF-8 |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
WWW::MetaForge::ArcRaiders::Result::Trader - Trader result object |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 0.002 |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $traders = $api->traders; |
|
85
|
|
|
|
|
|
|
for my $trader (@$traders) { |
|
86
|
|
|
|
|
|
|
say $trader->name; |
|
87
|
|
|
|
|
|
|
if (my $item = $trader->find_item('Ferro I')) { |
|
88
|
|
|
|
|
|
|
say " Sells Ferro I for $item->{price}"; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Represents a trader NPC from the ARC Raiders game. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 name |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Trader name (e.g., "Apollo", "TianWen"). |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 description |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Trader description text. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 location |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Where the trader can be found. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 inventory |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
ArrayRef of items for sale: C<[{ item => "Name", price => 1000, stock => 5 }]>. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 last_refresh |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
ISO timestamp of last inventory refresh. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 from_hashref |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $trader = WWW::MetaForge::ArcRaiders::Result::Trader->from_hashref(\%data); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Construct from API response. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 find_item |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $info = $trader->find_item('Ferro I'); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Search inventory by name (case-insensitive). Returns inventory entry or undef. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 has_item |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
if ($trader->has_item('Metal Parts')) { ... } |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns true if trader sells the named item. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SUPPORT |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 Issues |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Please report bugs and feature requests on GitHub at |
|
139
|
|
|
|
|
|
|
L<https://github.com/Getty/p5-www-metaforge/issues>. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 IRC |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
You can reach Getty on C<irc.perl.org> for questions and support. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Contributions are welcome! Please fork the repository and submit a pull request. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 AUTHOR |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This software is copyright (c) 2026 by Torsten Raudssus. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
158
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |