… | |
… | |
1149 | my ($type, $reply, @payload) = |
1149 | my ($type, $reply, @payload) = |
1150 | "ARRAY" eq ref $msg |
1150 | "ARRAY" eq ref $msg |
1151 | ? @$msg |
1151 | ? @$msg |
1152 | : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove |
1152 | : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove |
1153 | |
1153 | |
|
|
1154 | my @reply; |
|
|
1155 | |
1154 | if (my $cb = $EXTCMD{$type}) { |
1156 | if (my $cb = $EXTCMD{$type}) { |
1155 | my @reply = $cb->($pl, @payload); |
1157 | @reply = $cb->($pl, @payload); |
1156 | |
|
|
1157 | $pl->ext_reply ($reply, @reply) |
|
|
1158 | if $reply; |
|
|
1159 | } |
1158 | } |
|
|
1159 | |
|
|
1160 | $pl->ext_reply ($reply, @reply) |
|
|
1161 | if $reply; |
|
|
1162 | |
1160 | } else { |
1163 | } else { |
1161 | warn "player " . ($pl->ob->name) . " sent unparseable ext message: <$buf>\n"; |
1164 | warn "player " . ($pl->ob->name) . " sent unparseable ext message: <$buf>\n"; |
1162 | } |
1165 | } |
1163 | |
1166 | |
1164 | cf::override; |
1167 | cf::override; |
… | |
… | |
2646 | my ($type, $reply, @payload) = |
2649 | my ($type, $reply, @payload) = |
2647 | "ARRAY" eq ref $msg |
2650 | "ARRAY" eq ref $msg |
2648 | ? @$msg |
2651 | ? @$msg |
2649 | : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove |
2652 | : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove |
2650 | |
2653 | |
|
|
2654 | my @reply; |
|
|
2655 | |
2651 | if (my $cb = $EXTICMD{$type}) { |
2656 | if (my $cb = $EXTICMD{$type}) { |
2652 | my @reply = $cb->($ns, @payload); |
2657 | @reply = $cb->($ns, @payload); |
2653 | |
|
|
2654 | $ns->ext_reply ($reply, @reply) |
|
|
2655 | if $reply; |
|
|
2656 | } |
2658 | } |
|
|
2659 | |
|
|
2660 | $ns->ext_reply ($reply, @reply) |
|
|
2661 | if $reply; |
|
|
2662 | |
2657 | } else { |
2663 | } else { |
2658 | warn "client " . ($ns->pl ? $ns->pl->ob->name : $ns->host) . " sent unparseable exti message: <$buf>\n"; |
2664 | warn "client " . ($ns->pl ? $ns->pl->ob->name : $ns->host) . " sent unparseable exti message: <$buf>\n"; |
2659 | } |
2665 | } |
2660 | |
2666 | |
2661 | cf::override; |
2667 | cf::override; |
… | |
… | |
2839 | or cf::cleanup "$path: version mismatch, cannot proceed."; |
2845 | or cf::cleanup "$path: version mismatch, cannot proceed."; |
2840 | |
2846 | |
2841 | # patch in the exptable |
2847 | # patch in the exptable |
2842 | $facedata->{resource}{"res/exp_table"} = { |
2848 | $facedata->{resource}{"res/exp_table"} = { |
2843 | type => FT_RSRC, |
2849 | type => FT_RSRC, |
2844 | data => $enc->encode ([map cf::level_to_min_exp $_, 0 .. cf::settings->max_level]), |
2850 | data => $enc->encode ([map cf::level_to_min_exp $_, 1 .. cf::settings->max_level]), |
2845 | }; |
2851 | }; |
2846 | cf::cede_to_tick; |
2852 | cf::cede_to_tick; |
2847 | |
2853 | |
2848 | { |
2854 | { |
2849 | my $faces = $facedata->{faceinfo}; |
2855 | my $faces = $facedata->{faceinfo}; |
… | |
… | |
2902 | name => $name, |
2908 | name => $name, |
2903 | %{ $info->{meta} || {} }, |
2909 | %{ $info->{meta} || {} }, |
2904 | }); |
2910 | }); |
2905 | |
2911 | |
2906 | $data = pack "(w/a*)*", $meta, $info->{data}; |
2912 | $data = pack "(w/a*)*", $meta, $info->{data}; |
|
|
2913 | } else { |
|
|
2914 | $data = $info->{data}; |
2907 | } |
2915 | } |
2908 | |
2916 | |
2909 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
2917 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
2910 | cf::face::set_type $idx, $info->{type}; |
2918 | cf::face::set_type $idx, $info->{type}; |
2911 | |
2919 | |