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.29 by elmex, Wed Aug 2 16:59:47 2006 UTC vs.
Revision 1.34 by root, Fri Aug 25 15:24:54 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;
117 cf::ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg); 121 ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg);
118 122
119 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) 123 $_->ob->message ("$name chats: $msg", cf::NDI_BLUE)
120 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;
121 125
122 } else { 126 } else {
131 135
132 if ($msg) { 136 if ($msg) {
133 my $NOW = time; 137 my $NOW = time;
134 my $name = $who->name; 138 my $name = $who->name;
135 139
136 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; 140# cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg;
137 cf::ext::schmorp_irc::do_notice (sprintf "{%s} %s\n", $name, $msg); 141 ext::schmorp_irc::do_notice (sprintf "{%s} %s\n", $name, $msg);
138 142
139 utf8::encode $msg; # ->message not yet utf8-ified 143 utf8::encode $msg; # ->message not yet utf8-ified
140 $_->ob->message ("$name shouts: $msg", cf::NDI_RED) 144 $_->ob->message ("$name shouts: $msg", cf::NDI_RED)
141 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;
142 146

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines