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.52 by root, Wed Apr 21 03:34:26 2010 UTC vs.
Revision 1.56 by root, Sun Sep 5 05:01:39 2010 UTC

73 my ($ob, $msg) = @_; 73 my ($ob, $msg) = @_;
74 74
75 my $pl = $ob->contr; 75 my $pl = $ob->contr;
76 my $name = $ob->name; 76 my $name = $ob->name;
77 77
78 my $coin = int rand 2 ? "Heads" : "Tails"; 78 my $coin = (cf::rndm 2) ? "Heads" : "Tails";
79 79
80 send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" 80 send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say"
81 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; 81 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list;
82 82
83 $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); 83 $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY);
88 88
89 my $pl = $ob->contr; 89 my $pl = $ob->contr;
90 my $name = $ob->name; 90 my $name = $ob->name;
91 91
92 my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); 92 my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc");
93 my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); 93 my ($i, $j, $k, $l) = map +(cf::rndm $_), 5, 5, 5, 6;
94 my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; 94 my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]";
95 95
96 send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" 96 send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say"
97 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; 97 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list;
98 98
734 for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; 734 for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list;
735 735
736 $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); 736 $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM);
737 } elsif ($tname) { 737 } elsif ($tname) {
738 my $target = cf::player::find $tname 738 my $target = cf::player::find $tname
739 or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; 739 or return send_msg $pl, tell_channel $tname, "The player called $tname is not known to this poor server.",
740 cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat";
741
742 $target->ob->active
743 or return send_msg $pl, tell_channel $tname, "$tname is not around. H<$tname must be logged in.>",
744 cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat";
740 745
741 my %emote = %{ $emotes->{$emotion}->{params} || {} }; 746 my %emote = %{ $emotes->{$emotion}->{params} || {} };
742 747
743 $emote{other} ||= "<self> is eyeing <other> quizzically."; 748 $emote{other} ||= "<self> is eyeing <other> quizzically.";
744 $emote{self} ||= "You are still nuts."; 749 $emote{self} ||= "You are still nuts.";
799 # within a 5x5 square that have something resembling 804 # within a 5x5 square that have something resembling
800 # dialogue or support on_say. 805 # dialogue or support on_say.
801 # we prefer the nearest items NOT in the player, otherwise in player. 806 # we prefer the nearest items NOT in the player, otherwise in player.
802 my ($map, $x, $y) = ($ob->map, $ob->x, $ob->y); 807 my ($map, $x, $y) = ($ob->map, $ob->x, $ob->y);
803 808
804 for my $dir (0 .. cf::SIZEOFFREE2) { 809 for my $dir (
810 0,
811 1, 3, 5, 7,
812 2, 4, 6, 8,
813 9 .. cf::SIZEOFFREE2
814 ) {
805 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue, 815 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue,
806 map +($_, $_->inv), 816 map +($_, $_->inv),
807 grep $_ != $ob, 817 grep $_ != $ob,
808 $map->at ($x, $y, $dir) 818 $map->at ($x, $y, $dir)
809 and last; 819 and last;
814 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue, 824 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue,
815 $ob->inv; 825 $ob->inv;
816 } 826 }
817 827
818 for my $npc (@npc) { 828 for my $npc (@npc) {
819 return if $npc->invoke (cf::EVENT_OBJECT_SAY); 829 return if $npc->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg);
820 830
821 # if some listener teleported us somewhere else, stop right here 831 # if some listener teleported us somewhere else, stop right here
822 last unless $map->path == $ob->map->path; 832 last unless $map->path == $ob->map->path;
823 833
824 if ($npc->has_dialogue) { 834 if ($npc->has_dialogue) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines