Adding to the Info packet known_words.
This commit is contained in:
parent
f43070ffee
commit
206a934d2d
@ -28,6 +28,7 @@ has is_battling => ( is => 'rw' );
|
||||
has remaining_frames => ( is => 'rw' );
|
||||
has available_actions => ( is => 'rw' );
|
||||
has npcs => ( is => 'rw' );
|
||||
has known_words => ( is => 'rw' );
|
||||
|
||||
sub identifier {
|
||||
return 'info';
|
||||
@ -44,11 +45,16 @@ sub data ($self) {
|
||||
my $is_battling = $self->is_battling;
|
||||
my $available_actions = $self->available_actions;
|
||||
my $npcs = $self->npcs;
|
||||
my $known_words = $self->known_words;
|
||||
|
||||
if ( defined $is_battling ) {
|
||||
$is_battling = $is_battling ? $JSON::true : $JSON::false;
|
||||
}
|
||||
return {
|
||||
(
|
||||
( defined $known_words ) ? ( known_words => $known_words )
|
||||
: ()
|
||||
),
|
||||
(
|
||||
( defined $clear ) ? ( clear => $clear )
|
||||
: ()
|
||||
@ -85,8 +91,7 @@ sub data ($self) {
|
||||
: ()
|
||||
),
|
||||
(
|
||||
(defined $npcs)
|
||||
? ( npcs => $npcs)
|
||||
( defined $npcs ) ? ( npcs => $npcs )
|
||||
: ()
|
||||
)
|
||||
};
|
||||
|
@ -18,6 +18,8 @@ use JSON qw/to_json/;
|
||||
|
||||
use Moo;
|
||||
|
||||
use LasTres::Words;
|
||||
|
||||
__PACKAGE__->table('player_pjs');
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
@ -157,9 +159,10 @@ sub known_words_hash ($self) {
|
||||
}
|
||||
|
||||
sub known_words_hash_serialized ($self) {
|
||||
my %words = %{$self->known_words_hash};
|
||||
my %words = %{ $self->known_words_hash };
|
||||
my @identifiers = keys %words;
|
||||
%words = map { ($_->identifier => $_->serialize) } @identifiers;
|
||||
%words =
|
||||
map { ( $words{$_}->identifier => $words{$_}->serialize ) } @identifiers;
|
||||
return \%words;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user