line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Lacuna::Task::Types; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1302
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
6
|
|
|
|
|
|
|
our $VERSION = $Games::Lacuna::Task::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
596
|
use Games::Lacuna::Client::Types qw(ore_types food_types); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Path::Class::File; |
12
|
|
|
|
|
|
|
use Moose::Util::TypeConstraints; |
13
|
|
|
|
|
|
|
use MooseX::Types::Path::Class; |
14
|
|
|
|
|
|
|
use Games::Lacuna::Task::Constants; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Ore' |
17
|
|
|
|
|
|
|
=> as enum([ ore_types() ]) |
18
|
|
|
|
|
|
|
=> message { "Not a valid ore '$_'" }; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Food' |
21
|
|
|
|
|
|
|
=> as enum([ food_types() ]) |
22
|
|
|
|
|
|
|
=> message { "No valid food '$_'" }; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Coordinate' |
25
|
|
|
|
|
|
|
=> as 'ArrayRef[Int]' |
26
|
|
|
|
|
|
|
=> where { scalar(@$_) == 2 } |
27
|
|
|
|
|
|
|
=> message { "Not a valid coordinate".Data::Dumper::Dumper($_); }; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Coordinates' |
30
|
|
|
|
|
|
|
=> as 'ArrayRef[Lacuna::Task::Type::Coordinate]'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
coerce 'Lacuna::Task::Type::Coordinate' |
33
|
|
|
|
|
|
|
=> from 'Str' |
34
|
|
|
|
|
|
|
=> via { |
35
|
|
|
|
|
|
|
return [ split(/[;,x]/) ]; |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Resource' |
39
|
|
|
|
|
|
|
=> as 'Str' |
40
|
|
|
|
|
|
|
=> where { |
41
|
|
|
|
|
|
|
my $element = $_; |
42
|
|
|
|
|
|
|
my $resources_re = join('|', |
43
|
|
|
|
|
|
|
@Games::Lacuna::Task::Constants::RESOURCES_ALL, |
44
|
|
|
|
|
|
|
ore_types(), |
45
|
|
|
|
|
|
|
food_types() |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
return ($element =~ m/^($resources_re)[:=](\d+)$/ ? 1:0); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
=> message { "Not a valid push resource '$_' (must be 'type:quantiy' eg. 'ore:10000')" }; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
subtype 'Lacuna::Task::Type::Resources' |
52
|
|
|
|
|
|
|
=> as 'ArrayRef[Lacuna::Task::Type::Resource]'; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
MooseX::Getopt::OptionTypeMap->add_option_type_to_map( |
55
|
|
|
|
|
|
|
'Lacuna::Task::Type::Coordinate' => '=s', |
56
|
|
|
|
|
|
|
'Lacuna::Task::Type::Resource' => '=s', |
57
|
|
|
|
|
|
|
'Lacuna::Task::Type::Coordinates'=> '=s@', |
58
|
|
|
|
|
|
|
'Lacuna::Task::Type::Resources' => '=s@', |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |