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

Comparing deliantra/server/ext/NPC_Dialogue.pm (file contents):
Revision 1.9 by root, Mon Apr 21 06:35:26 2008 UTC vs.
Revision 1.11 by root, Mon Sep 22 01:33:09 2008 UTC

11=cut 11=cut
12 12
13package NPC_Dialogue; 13package NPC_Dialogue;
14 14
15use strict; 15use strict;
16
17sub has_dialogue($) {
18 my ($ob) = @_;
19
20 $ob->msg =~ /^\@match /;
21}
22 16
23sub parse_message($) { 17sub parse_message($) {
24 map [split /\n/, $_, 2], 18 map [split /\n/, $_, 2],
25 grep length, 19 grep length,
26 split /^\@match /m, 20 split /^\@match /m,
337 } 331 }
338 } 332 }
339 333
340 delete $self->{npc}{$self->{ob}->name}{dialog_state} unless %$state; 334 delete $self->{npc}{$self->{ob}->name}{dialog_state} unless %$state;
341 delete $self->{ob}{dialog_flag} unless %$flag; 335 delete $self->{ob}{dialog_flag} unless %$flag;
342
343 # combine lines into paragraphs
344 $reply =~ s/(?<=\S)\n(?=\w)/ /g;
345 $reply =~ s/\n\n/\n/g;
346 336
347 # ignores flags and npc from replies 337 # ignores flags and npc from replies
348 $reply = join "\n", (map $_->[1], @replies), $reply; 338 $reply = join "\n", (map $_->[1], @replies), $reply;
349 339
350 # now mark up all matching keywords 340 # now mark up all matching keywords

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines