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

Comparing deliantra/maps/perl/NPC_Dialogue.pm (file contents):
Revision 1.2 by root, Sat Jun 24 00:08:58 2006 UTC vs.
Revision 1.4 by root, Wed Jul 19 08:52:57 2006 UTC

8 8
9=cut 9=cut
10 10
11package NPC_Dialogue; 11package NPC_Dialogue;
12 12
13sub has_dialogue { 13sub has_dialogue($) {
14 my ($ob) = @_; 14 my ($ob) = @_;
15 15
16 $ob->get_message =~ /^\@match /; 16 $ob->get_message =~ /^\@match /;
17} 17}
18 18
42} 42}
43 43
44sub tell { 44sub tell {
45 my ($self, $msg) = @_; 45 my ($self, $msg) = @_;
46 46
47 $msg = lc $msg;
48
47 for my $match (@{ $self->{match} }) { 49 for my $match (@{ $self->{match} }) {
48 for (split /\|/, $match->[0]) { 50 for (split /\|/, $match->[0]) {
49 if ($_ eq "*" || $_ eq $msg) { 51 if ($_ eq "*" || $msg eq lc) {
50 my $reply = $match->[1]; 52 my $reply = $match->[1];
51 53
52 # combine lines into paragraphs 54 # combine lines into paragraphs
53 $reply =~ s/(?<=\S)\n(?=\w)/ /g; 55 $reply =~ s/(?<=\S)\n(?=\w)/ /g;
54 $reply =~ s/\n\n/\n/g; 56 $reply =~ s/\n\n/\n/g;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines