--- deliantra/server/ext/map_lib.ext 2006/12/17 22:02:55 1.1 +++ deliantra/server/ext/map_lib.ext 2007/02/05 11:48:43 1.4 @@ -51,7 +51,7 @@ =cut -cf::register_attachment check_inventory_on_apply => +cf::object::attachment check_inventory_on_apply => on_apply => sub { my ($self, $pl) = @_; my $cfg = $self->{check_inventory_on_apply}; @@ -62,9 +62,49 @@ }); if ($match) { $match->decrease_ob_nr ($cfg->{decrease_by_cnt}) if $cfg->{decrease_by_cnt}; - $pl->message ($cfg->{message_on_match}) if defined $cfg->{message_on_match}; + $pl->message ($cfg->{message_on_match}, cf::NDI_UNIQUE) if defined $cfg->{message_on_match}; } else { - $pl->message ($cfg->{message_on_nomatch}) if defined $cfg->{message_on_nomatch}; + $pl->message ($cfg->{message_on_nomatch}, cf::NDI_RED | cf::NDI_UNIQUE) if defined $cfg->{message_on_nomatch}; + cf::override; + } + }; + + +=item object attachment: 'trigger_on_dialog_flag' + +This attachment checks whether the player has a specific +dialog flag set (the ones you can set with @setflag, see also +L, and triggers a connection depending on that. + +The attachment has following configuration: + +=over 4 + +=item flag + +This field should contain the name of the flag that you want to check +for. + +=item connection + +The connection ID of the connection you want to trigger. + +=item state + +The state of the connection: 0 for release, 1 for push. + +=back + +=cut + +cf::object::attachment trigger_on_dialog_flag => + on_move_trigger => sub { + my ($self, $who, $orig) = @_; + my $cfg = $self->{trigger_on_dialog_flag}; + if (exists $who->{ob}{dialog_flag}{$cfg->{flag}}) { + if ($who->{ob}{dialog_flag}{$cfg->{flag}}) { + $self->map->trigger ($cfg->{connection}, $cfg->{state}); + } cf::override; } };