--- deliantra/server/ext/NPC_Dialogue.pm 2009/11/04 19:20:49 1.18 +++ deliantra/server/ext/NPC_Dialogue.pm 2010/03/19 22:16:27 1.21 @@ -84,6 +84,8 @@ =item $npc - The NPC (or magic_ear etc.) object that is being talked to. +=item $map - The map the NPC (not the player) is on. + =item $msg - The actual message as passed to this method. =item $match - An arrayref with previous results from C<@parse>. @@ -184,7 +186,7 @@ =item @ifstate state value Requires that the named C has the given C, otherwise this -topic is skipped. For more complex comparisons, see C<@cond> with +topic is skipped. For more complex comparisons, see C<@cond> with C<$state>. Example: @match quest @@ -290,6 +292,7 @@ my %vars = ( who => $self->{ob}, npc => $self->{npc}, + map => $self->{npc}->map, state => $state, flag => $flag, msg => $msg, @@ -343,13 +346,13 @@ } elsif ($cmd eq "setflag") { my ($name, $value) = split /\s+/, $args, 2; - $value ? $flag->{$name} = $value - : delete $flag->{$name}; + defined $value ? $flag->{$name} = $value + : delete $flag->{$name}; } elsif ($cmd eq "setstate") { my ($name, $value) = split /\s+/, $args, 2; - $value ? $state->{$name} = $value - : delete $state->{$name}; + defined $value ? $state->{$name} = $value + : delete $state->{$name}; } elsif ($cmd eq "ifflag") { my ($name, $value) = split /\s+/, $args, 2; @@ -359,7 +362,8 @@ } elsif ($cmd eq "ifstate") { my ($name, $value) = split /\s+/, $args, 2; - $state->{$name} eq $value + defined $value ? $state->{$name} eq $value + : $state->{$name} or next topic; } elsif ($cmd eq "trigger") {