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.18 by root, Wed Nov 4 19:20:49 2009 UTC vs.
Revision 1.21 by root, Fri Mar 19 22:16:27 2010 UTC

82 82
83=item $who - The cf::object::player object that initiated the dialogue. 83=item $who - The cf::object::player object that initiated the dialogue.
84 84
85=item $npc - The NPC (or magic_ear etc.) object that is being talked to. 85=item $npc - The NPC (or magic_ear etc.) object that is being talked to.
86 86
87=item $map - The map the NPC (not the player) is on.
88
87=item $msg - The actual message as passed to this method. 89=item $msg - The actual message as passed to this method.
88 90
89=item $match - An arrayref with previous results from C<@parse>. 91=item $match - An arrayref with previous results from C<@parse>.
90 92
91=item $state - A hashref that stores state variables associated 93=item $state - A hashref that stores state variables associated
182See C<@ifstate> for an example. 184See C<@ifstate> for an example.
183 185
184=item @ifstate state value 186=item @ifstate state value
185 187
186Requires that the named C<state> has the given C<value>, otherwise this 188Requires that the named C<state> has the given C<value>, otherwise this
187topic is skipped. For more complex comparisons, see C<@cond> with 189topic is skipped. For more complex comparisons, see C<@cond> with
188C<$state>. Example: 190C<$state>. Example:
189 191
190 @match quest 192 @match quest
191 @setstate question quest 193 @setstate question quest
192 Do you really want to help find the magic amulet of Beeblebrox? 194 Do you really want to help find the magic amulet of Beeblebrox?
288 my @find; 290 my @find;
289 291
290 my %vars = ( 292 my %vars = (
291 who => $self->{ob}, 293 who => $self->{ob},
292 npc => $self->{npc}, 294 npc => $self->{npc},
295 map => $self->{npc}->map,
293 state => $state, 296 state => $state,
294 flag => $flag, 297 flag => $flag,
295 msg => $msg, 298 msg => $msg,
296 match => \@match, 299 match => \@match,
297 find => \@find, 300 find => \@find,
341 } elsif ($cmd eq "msg") { 344 } elsif ($cmd eq "msg") {
342 push @replies, [$self->{npc}, (scalar cf::safe_eval $args, %vars)]; 345 push @replies, [$self->{npc}, (scalar cf::safe_eval $args, %vars)];
343 346
344 } elsif ($cmd eq "setflag") { 347 } elsif ($cmd eq "setflag") {
345 my ($name, $value) = split /\s+/, $args, 2; 348 my ($name, $value) = split /\s+/, $args, 2;
346 $value ? $flag->{$name} = $value 349 defined $value ? $flag->{$name} = $value
347 : delete $flag->{$name}; 350 : delete $flag->{$name};
348 351
349 } elsif ($cmd eq "setstate") { 352 } elsif ($cmd eq "setstate") {
350 my ($name, $value) = split /\s+/, $args, 2; 353 my ($name, $value) = split /\s+/, $args, 2;
351 $value ? $state->{$name} = $value 354 defined $value ? $state->{$name} = $value
352 : delete $state->{$name}; 355 : delete $state->{$name};
353 356
354 } elsif ($cmd eq "ifflag") { 357 } elsif ($cmd eq "ifflag") {
355 my ($name, $value) = split /\s+/, $args, 2; 358 my ($name, $value) = split /\s+/, $args, 2;
356 defined $value ? $flag->{$name} eq $value 359 defined $value ? $flag->{$name} eq $value
357 : $flag->{$name} 360 : $flag->{$name}
358 or next topic; 361 or next topic;
359 362
360 } elsif ($cmd eq "ifstate") { 363 } elsif ($cmd eq "ifstate") {
361 my ($name, $value) = split /\s+/, $args, 2; 364 my ($name, $value) = split /\s+/, $args, 2;
362 $state->{$name} eq $value 365 defined $value ? $state->{$name} eq $value
366 : $state->{$name}
363 or next topic; 367 or next topic;
364 368
365 } elsif ($cmd eq "trigger") { 369 } elsif ($cmd eq "trigger") {
366 my ($con, $state) = split /\s+/, $args, 2; 370 my ($con, $state) = split /\s+/, $args, 2;
367 371

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines