… | |
… | |
1505 | =cut |
1505 | =cut |
1506 | |
1506 | |
1507 | sub ext_reply($$@) { |
1507 | sub ext_reply($$@) { |
1508 | my ($self, $id, @msg) = @_; |
1508 | my ($self, $id, @msg) = @_; |
1509 | |
1509 | |
1510 | if ($self->ns->extcmd == 2) { |
1510 | $self->ns->ext_reply ($id, @msg) |
1511 | $self->send ("ext " . $self->ns->{json_coder}->encode (["reply-$id", @msg])); |
|
|
1512 | } elsif ($self->ns->extcmd == 1) { |
|
|
1513 | #TODO: version 1, remove |
|
|
1514 | unshift @msg, msgtype => "reply", msgid => $id; |
|
|
1515 | $self->send ("ext " . $self->ns->{json_coder}->encode ({@msg})); |
|
|
1516 | } |
|
|
1517 | } |
1511 | } |
1518 | |
1512 | |
1519 | =item $player->ext_msg ($type, @msg) |
1513 | =item $player->ext_msg ($type, @msg) |
1520 | |
1514 | |
1521 | Sends an ext event to the client. |
1515 | Sends an ext event to the client. |
… | |
… | |
2567 | push @msg, msgtype => "event_$type"; |
2561 | push @msg, msgtype => "event_$type"; |
2568 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
2562 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
2569 | } |
2563 | } |
2570 | } |
2564 | } |
2571 | |
2565 | |
|
|
2566 | =item $client->ext_reply ($msgid, @msg) |
|
|
2567 | |
|
|
2568 | Sends an ext reply to the client. |
|
|
2569 | |
|
|
2570 | =cut |
|
|
2571 | |
|
|
2572 | sub cf::client::ext_reply($$@) { |
|
|
2573 | my ($self, $id, @msg) = @_; |
|
|
2574 | |
|
|
2575 | if ($self->extcmd == 2) { |
|
|
2576 | $self->send_packet ("ext " . $self->{json_coder}->encode (["reply-$id", @msg])); |
|
|
2577 | } elsif ($self->ns->extcmd == 1) { |
|
|
2578 | #TODO: version 1, remove |
|
|
2579 | unshift @msg, msgtype => "reply", msgid => $id; |
|
|
2580 | $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); |
|
|
2581 | } |
|
|
2582 | } |
|
|
2583 | |
2572 | =item $success = $client->query ($flags, "text", \&cb) |
2584 | =item $success = $client->query ($flags, "text", \&cb) |
2573 | |
2585 | |
2574 | Queues a query to the client, calling the given callback with |
2586 | Queues a query to the client, calling the given callback with |
2575 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |
2587 | the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, |
2576 | C<cf::CS_QUERY_SINGLECHAR> or C<cf::CS_QUERY_HIDEINPUT> or C<0>. |
2588 | C<cf::CS_QUERY_SINGLECHAR> or C<cf::CS_QUERY_HIDEINPUT> or C<0>. |
… | |
… | |
2827 | or cf::cleanup "$path: version mismatch, cannot proceed."; |
2839 | or cf::cleanup "$path: version mismatch, cannot proceed."; |
2828 | |
2840 | |
2829 | # patch in the exptable |
2841 | # patch in the exptable |
2830 | $facedata->{resource}{"res/exp_table"} = { |
2842 | $facedata->{resource}{"res/exp_table"} = { |
2831 | type => FT_RSRC, |
2843 | type => FT_RSRC, |
2832 | data => $enc->encode ([map cf::level_to_min_exp $_, 0 .. cf::settings->max_level]), |
2844 | data => $enc->encode ([map cf::level_to_min_exp $_, 1 .. cf::settings->max_level]), |
2833 | }; |
2845 | }; |
2834 | cf::cede_to_tick; |
2846 | cf::cede_to_tick; |
2835 | |
2847 | |
2836 | { |
2848 | { |
2837 | my $faces = $facedata->{faceinfo}; |
2849 | my $faces = $facedata->{faceinfo}; |
… | |
… | |
2890 | name => $name, |
2902 | name => $name, |
2891 | %{ $info->{meta} || {} }, |
2903 | %{ $info->{meta} || {} }, |
2892 | }); |
2904 | }); |
2893 | |
2905 | |
2894 | $data = pack "(w/a*)*", $meta, $info->{data}; |
2906 | $data = pack "(w/a*)*", $meta, $info->{data}; |
|
|
2907 | } else { |
|
|
2908 | $data = $info->{data}; |
2895 | } |
2909 | } |
2896 | |
2910 | |
2897 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
2911 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
2898 | cf::face::set_type $idx, $info->{type}; |
2912 | cf::face::set_type $idx, $info->{type}; |
2899 | |
2913 | |