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.15 by root, Fri Apr 27 00:49:58 2007 UTC vs.
Revision 1.17 by root, Sat May 19 11:04:16 2007 UTC

764 return if $pl->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); 764 return if $pl->contr->invoke (cf::EVENT_PLAYER_SAY, $msg);
765 765
766 if ($msg) { 766 if ($msg) {
767 my $name = $pl->name; 767 my $name = $pl->name;
768 768
769 utf8::encode $msg; # ->message not yet utf8-ified
770 $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE) 769 $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE)
771 for grep $pl->on_same_map_as ($_->ob), cf::player::list; 770 for grep $pl->on_same_map_as ($_->ob), cf::player::list;
772 utf8::decode $msg;
773 771
774 # npcs, magic_ears etc. 772 # npcs, magic_ears etc.
775 # first find all objects and theirt-level inventories 773 # first find all objects and their first-level inventories
776 # within a 5x5 square # that have something resembling 774 # within a 5x5 square that have something resembling
777 # dialogue or support on_say. 775 # dialogue or support on_say.
778 my ($map, $x, $y) = ($pl->map, $pl->x - 2, $pl->y - 2); 776 my ($map, $x, $y) = ($pl->map, $pl->x - 2, $pl->y - 2);
779 777
780 for my $npc ( 778 for my $npc (
781 grep +($_->invoke (cf::EVENT_OBJECT_SAY, $pl->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, 779 grep +($_->invoke (cf::EVENT_OBJECT_SAY, $pl->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_,
826 if ($msg) { 824 if ($msg) {
827 my $name = $pl->name; 825 my $name = $pl->name;
828 my $NOW = time; 826 my $NOW = time;
829 827
830 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; 828 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg;
831 ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg); 829 ext::irc::do_notice (sprintf "[%s] %s", $name, $msg);
832 830
833 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) 831 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE)
834 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; 832 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list;
835 833
836 } else { 834 } else {
848 if ($msg) { 846 if ($msg) {
849 my $NOW = time; 847 my $NOW = time;
850 my $name = $pl->name; 848 my $name = $pl->name;
851 849
852 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; 850 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg;
853 ext::schmorp_irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); 851 ext::irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg);
854 852
855 utf8::encode $msg; # ->message not yet utf8-ified
856 $_->ob->message ("$name shouts: $msg", cf::NDI_RED) 853 $_->ob->message ("$name shouts: $msg", cf::NDI_RED)
857 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; 854 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list;
858 855
859 } else { 856 } else {
860 $pl->message ("Shout what?", cf::NDI_UNIQUE); 857 $pl->message ("Shout what?", cf::NDI_UNIQUE);
872 my $name = $pl->name; 869 my $name = $pl->name;
873 870
874 if ($target =~ /irc\//) { 871 if ($target =~ /irc\//) {
875 my (undef, $nick) = split /\//, $target, 2; 872 my (undef, $nick) = split /\//, $target, 2;
876 $pl->message ("You tell $target: $args"); 873 $pl->message ("You tell $target: $args");
877 ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); 874 ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg);
878 } elsif (my $other = cf::player::find_active $target) { 875 } elsif (my $other = cf::player::find_active $target) {
879 876
880 if ($msg) { 877 if ($msg) {
881 if ($target eq $name) { 878 if ($target eq $name) {
882 $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); 879 $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE);
883 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { 880 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) {
884 $pl->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE); 881 $pl->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE);
885 } else { 882 } else {
886 return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl->contr, $msg); 883 return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl->contr, $msg);
887 utf8::encode $msg; # ->message not yet utf8-ified
888 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; 884 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg;
889 885
890 $pl->message ("You tell $target: $msg"); 886 $pl->message ("You tell $target: $msg");
891 $other->ob->message ("$name tells you: $msg"); 887 $other->ob->message ("$name tells you: $msg");
892 $other->ob->{ext_last_tell} = $name; 888 $other->ob->{ext_last_tell} = $name;
909 return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); 905 return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args);
910 906
911 if ($pl->{ext_last_tell} =~ /irc\//) { 907 if ($pl->{ext_last_tell} =~ /irc\//) {
912 my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; 908 my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2;
913 $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); 909 $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args");
914 ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); 910 ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args);
915 } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { 911 } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) {
916 912
917 if ($args) { 913 if ($args) {
918 $other->ob->{ext_ignore_tell}{$name} >= time 914 $other->ob->{ext_ignore_tell}{$name} >= time
919 or delete $other->ob->{ext_ignore_tell}{$name}; 915 or delete $other->ob->{ext_ignore_tell}{$name};
920 916
921 if ($other->ob->{ext_ignore_tell}{$name} < time) { 917 if ($other->ob->{ext_ignore_tell}{$name} < time) {
922 utf8::encode $args; # ->message not yet utf8-ified
923 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args; 918 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args;
924 919
925 $pl->message ("You tell " . $other->ob->name . ": $args"); 920 $pl->message ("You tell " . $other->ob->name . ": $args");
926 $other->ob->message ("$name tells you: $args"); 921 $other->ob->message ("$name tells you: $args");
927 $pl->{ext_last_tell} = $other->ob->name; 922 $pl->{ext_last_tell} = $other->ob->name;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines