90 lines
2.1 KiB
Perl
90 lines
2.1 KiB
Perl
package LasTres::Controller::Websocket::OutputPacket::Info;
|
|
|
|
use v5.36.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use feature 'signatures';
|
|
|
|
use Data::Dumper;
|
|
|
|
use Moo;
|
|
use JSON;
|
|
|
|
with 'LasTres::Controller::Websocket::OutputPacket';
|
|
|
|
has clear => ( is => 'rw', );
|
|
|
|
has team_pjs => ( is => 'rw', );
|
|
has enemy_team_pjs => ( is => 'rw' );
|
|
|
|
has location_data => ( is => 'rw', );
|
|
|
|
has set_log => ( is => 'rw', );
|
|
has append_log => ( is => 'rw' );
|
|
has is_battling => ( is => 'rw' );
|
|
|
|
has remaining_frames => ( is => 'rw' );
|
|
has available_actions => ( is => 'rw' );
|
|
|
|
sub identifier {
|
|
return 'info';
|
|
}
|
|
|
|
sub data ($self) {
|
|
my $clear = $self->clear;
|
|
my $team_pjs = $self->team_pjs;
|
|
my $enemy_team_pjs = $self->enemy_team_pjs;
|
|
my $location_data = $self->location_data;
|
|
my $set_log = $self->set_log;
|
|
my $append_log = $self->append_log;
|
|
my $remaining_frames = $self->remaining_frames;
|
|
my $is_battling = $self->is_battling;
|
|
my $available_actions = $self->available_actions;
|
|
|
|
if ( defined $is_battling ) {
|
|
$is_battling = $is_battling ? $JSON::true : $JSON::false;
|
|
}
|
|
return {
|
|
(
|
|
( defined $clear ) ? ( clear => $clear )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $team_pjs ) ? ( team_pjs => $team_pjs )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $enemy_team_pjs ) ? ( enemy_team_pjs => $enemy_team_pjs )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $location_data ) ? ( location_data => $location_data )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $set_log ) ? ( set_log => [ map { $_->hash } @$set_log ] )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $append_log ) ? ( append_log => $append_log )
|
|
: ()
|
|
),
|
|
( ( defined $is_battling ) ? ( is_battling => $is_battling ) : () ),
|
|
(
|
|
( defined $remaining_frames )
|
|
? ( remaining_frames => $remaining_frames )
|
|
: ()
|
|
),
|
|
(
|
|
( defined $available_actions )
|
|
? ( available_actions => $available_actions )
|
|
: ()
|
|
),
|
|
|
|
};
|
|
}
|
|
|
|
1;
|