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.27 by root, Sun Jul 30 19:56:57 2006 UTC vs.
Revision 1.33 by root, Fri Aug 25 15:07:43 2006 UTC

1#! perl 1#! perl
2#CONVERSION: PARTIAL
2 3
3# implement a replacement for the built-in say/chat/shout/tell/reply commands 4# implement a replacement for the built-in say/chat/shout/tell/reply commands
4# adds ignore/unignore functionality 5# adds ignore/unignore functionality
5 6
6use NPC_Dialogue; 7use NPC_Dialogue;
21 } 22 }
22 } 23 }
23 } 24 }
24} 25}
25 26
26sub on_logout { 27cf::attach_to_players
28 prio => -1000,
29 on_login => sub {
27 my ($pl, $host) = @_; 30 my ($pl) = @_;
28 31
29 clean_timeouts $pl->ob; 32 clean_timeouts $pl->ob;
30} 33 },
34;
31 35
32cf::register_command listen => 0, sub { 36cf::register_command listen => 0, sub {
33 my ($who, $msg) = @_; 37 my ($who, $msg) = @_;
34 my $player = cf::player::find $who->name; 38 my $player = cf::player::find $who->name;
35 39
111 if ($msg) { 115 if ($msg) {
112 my $name = $who->name; 116 my $name = $who->name;
113 my $NOW = time; 117 my $NOW = time;
114 118
115 utf8::encode $msg; # ->message not yet utf8-ified 119 utf8::encode $msg; # ->message not yet utf8-ified
116 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; 120# cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg;
121 cf::ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg);
117 122
118 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) 123 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE)
119 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; 124 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list;
120 125
121 } else { 126 } else {
130 135
131 if ($msg) { 136 if ($msg) {
132 my $NOW = time; 137 my $NOW = time;
133 my $name = $who->name; 138 my $name = $who->name;
134 139
135 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; 140# cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg;
141 cf::ext::schmorp_irc::do_notice (sprintf "{%s} %s\n", $name, $msg);
136 142
137 utf8::encode $msg; # ->message not yet utf8-ified 143 utf8::encode $msg; # ->message not yet utf8-ified
138 $_->ob->message ("$name shouts: $msg", cf::NDI_RED) 144 $_->ob->message ("$name shouts: $msg", cf::NDI_RED)
139 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; 145 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list;
140 146
187 193
188 $other->ob->{ext_ignore_tell}{$name} >= time 194 $other->ob->{ext_ignore_tell}{$name} >= time
189 or delete $other->ob->{ext_ignore_tell}{$name}; 195 or delete $other->ob->{ext_ignore_tell}{$name};
190 196
191 if ($other->ob->{ext_ignore_tell}{$name} < time) { 197 if ($other->ob->{ext_ignore_tell}{$name} < time) {
192 utf8::encode $msg; # ->message not yet utf8-ified 198 utf8::encode $args; # ->message not yet utf8-ified
193 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args; 199 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args;
194 200
195 $who->message ("You tell " . $other->ob->name . ": $args"); 201 $who->message ("You tell " . $other->ob->name . ": $args");
196 $other->ob->message ("$name tells you: $args"); 202 $other->ob->message ("$name tells you: $args");
197 $who->{ext_last_tell} = $other->ob->name; 203 $who->{ext_last_tell} = $other->ob->name;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines