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.5 by root, Wed Jul 19 22:20:07 2006 UTC vs.
Revision 1.6 by root, Wed Jul 19 23:00:50 2006 UTC

52 for my $match (@{ $self->{match} }) { 52 for my $match (@{ $self->{match} }) {
53 for (split /\|/, $match->[0]) { 53 for (split /\|/, $match->[0]) {
54 if ($_ eq "*" || $lcmsg eq lc) { 54 if ($_ eq "*" || $lcmsg eq lc) {
55 my $reply = $match->[1]; 55 my $reply = $match->[1];
56 56
57 # combine lines into paragraphs
58 $reply =~ s/(?<=\S)\n(?=\w)/ /g;
59 $reply =~ s/\n\n/\n/g;
60
61 my @replies;
57 my @match; # @match/@parse command results 62 my @match; # @match/@parse command results
63 local $self->{ob}{record_replies} = \@replies;
58 64
59 # now execute @-commands (which can result in a no-match) 65 # now execute @-commands (which can result in a no-match)
60 while ($reply =~ s/^\@(\w+)\s*([^\n]*)\n?//) { 66 while ($reply =~ s/^\@(\w+)\s*([^\n]*)\n?//) {
61 my ($cmd, $args) = ($1, $2); 67 my ($cmd, $args) = ($1, $2);
62 68
76 } else { 82 } else {
77 warn "unknown dialogue command <$cmd,$args> used (from " . $self->{npc}->get_message . ")"; 83 warn "unknown dialogue command <$cmd,$args> used (from " . $self->{npc}->get_message . ")";
78 } 84 }
79 } 85 }
80 86
81 # combine lines into paragraphs 87 # ignores flags and npc from replies
82 $reply =~ s/(?<=\S)\n(?=\w)/ /g; 88 $reply = join "\n", (map $_->[1], @replies), $reply;
83 $reply =~ s/\n\n/\n/g;
84 89
85 my @kw; 90 my @kw;
86 # now mark up all matching keywords 91 # now mark up all matching keywords
87 for my $match (@{ $self->{match} }) { 92 for my $match (@{ $self->{match} }) {
88 for (sort { (length $b) <=> (length $a) } split /\|/, $match->[0]) { 93 for (sort { (length $b) <=> (length $a) } split /\|/, $match->[0]) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines