File Coverage

blib/lib/Games/AssaultCube/Log/Line/ClientStatus.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             # Declare our package
2             package Games::AssaultCube::Log::Line::ClientStatus;
3              
4             # import the Moose stuff
5 1     1   2506 use Moose;
  0            
  0            
6              
7             # Initialize our version
8             use vars qw( $VERSION );
9             $VERSION = '0.04';
10              
11             extends 'Games::AssaultCube::Log::Line::Base';
12              
13             with 'Games::AssaultCube::Log::Line::Base::TeamInfo',
14             'Games::AssaultCube::Log::Line::Base::RoleInfo',
15             'Games::AssaultCube::Log::Line::Base::NickIP';
16              
17             # TODO improve validation for everything here, ha!
18              
19             has 'cn' => (
20             isa => 'Int',
21             is => 'ro',
22             required => 1,
23             );
24              
25             has 'frags' => (
26             isa => 'Int',
27             is => 'ro',
28             required => 1,
29             );
30              
31             has 'deaths' => (
32             isa => 'Int',
33             is => 'ro',
34             required => 1,
35             );
36              
37             has 'flags' => (
38             isa => 'Int',
39             is => 'ro',
40             );
41              
42             has 'tostr' => (
43             isa => 'Str',
44             is => 'ro',
45             lazy => 1,
46             default => sub {
47             my $self = shift;
48              
49             # we want nicely-formatted output
50             return sprintf( "Client status of %25s (%4s): %3d frags, %3d deaths%s", $self->nick, $self->team_name, $self->frags, $self->deaths, ( defined $self->flags ? sprintf( ", %d flags", $self->flags ) : "" ) );
51             },
52             );
53              
54             # TODO Moose can't export multiple roles into this class unless it defines BUILD...
55             # Error: 'Games::AssaultCube::Log::Line::Base::Mastermode|Games::AssaultCube::Log::Line::Base::Gamemode' requires the method 'BUILD' to be implemented by 'Games::AssaultCube::Log::Line::GameStatus' at /usr/local/share/perl/5.10.0/Moose/Meta/Role/Application.pm line 59
56             sub BUILD {
57             return;
58             }
59              
60             no Moose;
61             __PACKAGE__->meta->make_immutable;
62              
63             1;
64             __END__
65              
66             =for stopwords CLA RVSF ADMIN cn frags gamemode ip
67              
68             =head1 NAME
69              
70             Games::AssaultCube::Log::Line::ClientStatus - Describes the ClientStatus event in a log line
71              
72             =head1 ABSTRACT
73              
74             Describes the ClientStatus event in a log line
75              
76             =head1 DESCRIPTION
77              
78             This module holds the "ClientStatus" event data from a log line. Normally, you would not use this class directly
79             but via the L<Games::AssaultCube::Log::Line> class.
80              
81             This line is emitted once in a while as the AC server goes through the game.
82              
83             =head2 Attributes
84              
85             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
86             class, you can also use it's attributes too.
87              
88             =head3 cn
89              
90             The client connection id
91              
92             =head3 nick
93              
94             The nick of the client
95              
96             =head3 team
97              
98             The id of the client's team
99              
100             0 = CLA
101             1 = RVSF
102             2 = NONE
103              
104             =head3 team_name
105              
106             The team name of the client ( CLA, RVSF, NONE )
107              
108             =head3 frags
109              
110             The number of frags this client has done
111              
112             =head3 deaths
113              
114             The number of deaths this client has done
115              
116             =head3 flags
117              
118             The number of flags taken ( not always defined - depends on gamemode )
119              
120             =head3 role
121              
122             The id of the client's role
123              
124             0 = DEAFULT
125             1 = ADMIN
126              
127             =head3 role_name
128              
129             The role name of the client ( DEFAULT, ADMIN )
130              
131             =head3 ip
132              
133             The ip of the client
134              
135             =head1 AUTHOR
136              
137             Apocalypse E<lt>apocal@cpan.orgE<gt>
138              
139             Props goes to the BS clan for the support!
140              
141             This project is sponsored by L<http://cubestats.net>
142              
143             =head1 COPYRIGHT AND LICENSE
144              
145             Copyright 2009 by Apocalypse
146              
147             This library is free software; you can redistribute it and/or modify
148             it under the same terms as Perl itself.
149              
150             =cut