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

Comparing deliantra/maps/perl/chat.ext (file contents):
Revision 1.34 by root, Fri Aug 25 15:24:54 2006 UTC vs.
Revision 1.35 by root, Tue Aug 29 07:58:35 2006 UTC

53cf::register_command say => 0, sub { 53cf::register_command say => 0, sub {
54 my ($who, $msg) = @_; 54 my ($who, $msg) = @_;
55 55
56 utf8::decode $msg; 56 utf8::decode $msg;
57 57
58 return if $who->contr->invoke (cf::EVENT_PLAYER_SAY, $msg);
59
58 if ($msg) { 60 if ($msg) {
59 my $name = $who->name; 61 my $name = $who->name;
60 62
61 utf8::encode $msg; # ->message not yet utf8-ified 63 utf8::encode $msg; # ->message not yet utf8-ified
62 $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE) 64 $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE)
63 for grep $who->on_same_map_as ($_->ob), cf::player::list; 65 for grep $who->on_same_map_as ($_->ob), cf::player::list;
64 utf8::decode $msg; 66 utf8::decode $msg;
65 67
66 # npcs, magic_ears etc. 68 # npcs, magic_ears etc.
67 # first find all objects and their inventories within a 5x5 square 69 # first find all objects and theirt-level inventories
68 # that have something resembling dialogue 70 # within a 5x5 square # that have something resembling
71 # dialogue or support on_say.
69 my ($map, $x, $y) = ($who->map, $who->x - 2, $who->y - 2); 72 my ($map, $x, $y) = ($who->map, $who->x - 2, $who->y - 2);
70 73
71 for my $npc ( 74 for my $npc (
72 grep NPC_Dialogue::has_dialogue $_, 75 grep +($_->invoke (cf::EVENT_OBJECT_SAY, $who, $msg) && return) || NPC_Dialogue::has_dialogue $_,
73 map +($_, $_->inv), 76 map +($_, $_->inv),
74 grep $_, 77 grep $_,
75 map $map->at ($x + $_ % 5, $y + (int $_ / 5)), 78 map $map->at ($x + $_ % 5, $y + (int $_ / 5)),
76 0..24 79 0..24
77 ) { 80 ) {
110cf::register_command chat => 0, sub { 113cf::register_command chat => 0, sub {
111 my ($who, $msg) = @_; 114 my ($who, $msg) = @_;
112 115
113 utf8::decode $msg; 116 utf8::decode $msg;
114 117
118 return if $who->contr->invoke (cf::EVENT_PLAYER_CHAT, $msg);
119
115 if ($msg) { 120 if ($msg) {
116 my $name = $who->name; 121 my $name = $who->name;
117 my $NOW = time; 122 my $NOW = time;
118 123
119 utf8::encode $msg; # ->message not yet utf8-ified 124 utf8::encode $msg; # ->message not yet utf8-ified
131cf::register_command shout => 0, sub { 136cf::register_command shout => 0, sub {
132 my ($who, $msg) = @_; 137 my ($who, $msg) = @_;
133 138
134 utf8::decode $msg; 139 utf8::decode $msg;
135 140
141 return if $who->contr->invoke (cf::EVENT_PLAYER_SHOUT, $msg);
142
136 if ($msg) { 143 if ($msg) {
137 my $NOW = time; 144 my $NOW = time;
138 my $name = $who->name; 145 my $name = $who->name;
139 146
140# cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; 147# cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg;
153cf::register_command tell => 0, sub { 160cf::register_command tell => 0, sub {
154 my ($who, $args) = @_; 161 my ($who, $args) = @_;
155 my ($target, $msg) = split /\s+/, $args, 2; 162 my ($target, $msg) = split /\s+/, $args, 2;
156 163
157 utf8::decode $msg; 164 utf8::decode $msg;
165
166 return if $who->contr->invoke (cf::EVENT_PLAYER_TELL, $target, $msg);
158 167
159 my $name = $who->name; 168 my $name = $who->name;
160 169
161 if (my $other = cf::player::find $target) { 170 if (my $other = cf::player::find $target) {
162 171
186 my ($who, $args) = @_; 195 my ($who, $args) = @_;
187 my $name = $who->name; 196 my $name = $who->name;
188 197
189 utf8::decode $args; 198 utf8::decode $args;
190 199
200 return if $who->contr->invoke (cf::EVENT_PLAYER_TELL, $who->{ext_last_tell}, $args);
201
191 if (my $other = cf::player::find $who->{ext_last_tell}) { 202 if (my $other = cf::player::find $who->{ext_last_tell}) {
203
192 if ($args) { 204 if ($args) {
193
194 $other->ob->{ext_ignore_tell}{$name} >= time 205 $other->ob->{ext_ignore_tell}{$name} >= time
195 or delete $other->ob->{ext_ignore_tell}{$name}; 206 or delete $other->ob->{ext_ignore_tell}{$name};
196 207
197 if ($other->ob->{ext_ignore_tell}{$name} < time) { 208 if ($other->ob->{ext_ignore_tell}{$name} < time) {
198 utf8::encode $args; # ->message not yet utf8-ified 209 utf8::encode $args; # ->message not yet utf8-ified

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines