--- deliantra/server/lib/cf.pm 2012/11/15 07:08:08 1.604 +++ deliantra/server/lib/cf.pm 2012/11/20 14:40:01 1.610 @@ -3044,20 +3044,6 @@ =over 4 -=item $client->send_drawinfo ($text, $flags) - -Sends a drawinfo packet to the client. Circumvents output buffering so -should not be used under normal circumstances. - -=cut - -sub cf::client::send_drawinfo { - my ($self, $text, $flags) = @_; - - utf8::encode $text; - $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text); -} - =item $client->send_big_packet ($pkt) Like C, but tries to compress large packets, and fragments @@ -3085,9 +3071,9 @@ =item $client->send_msg ($channel, $msg, $color, [extra...]) -Send a drawinfo or msg packet to the client, formatting the msg for the -client if neccessary. C<$type> should be a string identifying the type of -the message, with C being the default. If C<$color> is negative, suppress +Send a msg packet to the client, formatting the msg for the client if +necessary. C<$type> should be a string identifying the type of the +message, with C being the default. If C<$color> is negative, suppress the message unless the client supports the msg packet. =cut @@ -3292,6 +3278,44 @@ 1 } +=item $client->update_command_faces + +=cut + +our %COMMAND_FACE; + +sub cf::client::update_command_faces { + my ($self) = @_; + + my @faces = grep $_, + $COMMAND_FACE{standard}, + $COMMAND_FACE{emote}, + $COMMAND_FACE{skill}, + $self->pl->ob->flag (cf::FLAG_WIZ) ? $COMMAND_FACE{dm} : (), + ; + + $self->send_face ($_) + for @faces; + $self->flush_fx; + + $self->ext_msg (command_list => @faces); +} + +=item cf::client::set_command_face $type, $commands + +=cut + +sub cf::client::set_command_face { + my ($type, $list) = @_; + + my $idx = &cf::face::set ( #d# ugly forward reference + "command_list/$type" => cf::FT_RSRC, + JSON::XS->new->utf8->encode ([ sort @$list ]) + ); + + $COMMAND_FACE{$type} = $idx; +} + cf::client->attach ( on_connect => sub { my ($ns) = @_; @@ -3540,7 +3564,7 @@ my $idx = cf::face::find $name; if ($idx) { - delete $HASH{cf::face::get_chksum $idx}; + delete $HASH{cf::face::get_csum $idx}; } else { $idx = cf::face::alloc $name; }