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