ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/chat.ext
(Generate patch)

Comparing deliantra/server/ext/chat.ext (file contents):
Revision 1.45 by root, Tue Sep 23 00:24:52 2008 UTC vs.
Revision 1.47 by root, Sun Jan 25 23:56:13 2009 UTC

760 } 760 }
761 }; 761 };
762 }; 762 };
763} 763}
764 764
765cf::register_command me => sub {
766 my ($pl, $msg) = @_;
767
768 my $name = $pl->name;
769
770 send_msg $_, $cf::SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say"
771 for grep $pl->on_same_map_as ($_->ob), cf::player::list;
772};
773
774cf::register_command say => sub { 765cf::register_command say => sub {
775 my ($ob, $msg) = @_; 766 my ($ob, $msg) = @_;
776 767
777 utf8::decode $msg; 768 utf8::decode $msg;
778 769
805 my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc; 796 my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc;
806 my ($reply, @kw) = $dialog->tell ($msg); 797 my ($reply, @kw) = $dialog->tell ($msg);
807 798
808 if (defined $reply) { 799 if (defined $reply) {
809 if ($npc->type == cf::MAGIC_EAR) { 800 if ($npc->type == cf::MAGIC_EAR) {
810 if (length $reply) {
811 send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" 801 send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say"
812 for @plonmap; 802 for @plonmap;
813 }
814 $npc->use_trigger;
815 } else { 803 } else {
816 if (length $reply) {
817 send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" 804 send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say"
818 for @plonmap; 805 for @plonmap;
819 }
820 } 806 }
821 } 807 }
822 808
823 if (@kw) { 809 if (@kw) {
824 $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) 810 $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN)
829 } else { 815 } else {
830 $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); 816 $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY);
831 } 817 }
832}; 818};
833 819
834cf::register_command chat => sub { 820
821sub _chat {
835 my ($ob, $msg) = @_; 822 my ($ob, $msg) = @_;
836
837 utf8::decode $msg;
838 823
839 my $pl = $ob->contr; 824 my $pl = $ob->contr;
840 825
841 return if $pl->invoke (cf::EVENT_PLAYER_CHAT, $msg); 826 return if $pl->invoke (cf::EVENT_PLAYER_CHAT, $msg);
842 827
843 if ($msg) { 828 if ($msg) {
844 my $name = $ob->name; 829 my $name = $ob->name;
845 my $NOW = time; 830 my $NOW = time;
846 831
847 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; 832 cf::LOG cf::llevDebug, sprintf "QBERT %s\n", $name, $msg;
848 send_irc ("[%s] %s", $name, $msg); 833 send_irc ($msg);
849 834
850 send_msg $_, $cf::CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" 835 send_msg $_, $cf::CHAT_CHANNEL => $msg, cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat"
851 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; 836 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list;
852 837
853 } else { 838 } else {
854 $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); 839 $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY);
855 } 840 }
841}
842
843cf::register_command chat => sub {
844 my ($ob, $msg) = @_;
845
846 utf8::decode $msg;
847 _chat $ob, $ob->name . " chats: $msg";
848};
849
850cf::register_command me => sub {
851 my ($ob, $msg) = @_;
852
853 utf8::decode $msg;
854 _chat $ob, "* " . $ob->name . " $msg";
856}; 855};
857 856
858cf::register_command shout => sub { 857cf::register_command shout => sub {
859 my ($ob, $msg) = @_; 858 my ($ob, $msg) = @_;
860 859

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines