--- deliantra/server/ext/commands.ext 2009/01/11 06:08:40 1.72 +++ deliantra/server/ext/commands.ext 2010/04/05 03:22:25 1.74 @@ -80,6 +80,8 @@ cf::register_command body => sub { my ($ob) = @_; + my $observe = $ob->contr->observe; + # Too hard to try and make a header that lines everything up, so just # give a description. (comment from C++) my $reply = @@ -91,7 +93,7 @@ # first process all applied items and hash them into their slots my @slot; - for my $item (grep $_->flag (cf::FLAG_APPLIED), $ob->inv) { + for my $item (grep $_->flag (cf::FLAG_APPLIED), $observe->inv) { $item->slot_info ($_) and push @{ $slot[$_] }, $item for 0 .. cf::NUM_BODY_LOCATIONS-1; @@ -103,58 +105,39 @@ $msg =~ s/^.*? a //; $reply .= sprintf " %-20s %3d %5d %s\n", $msg, - $ob->slot_info ($_), - $ob->slot_used ($_), + $observe->slot_info ($_), + $observe->slot_used ($_), join ", ", map $_->query_short_name, @{ $slot[$_] } - if $ob->slot_info ($_) || $ob->slot_used ($_); + if $observe->slot_info ($_) || $observe->slot_used ($_); } $reply .= "You are not allowed to wear armor\r" - unless $ob->flag (cf::FLAG_USE_ARMOUR); + unless $observe->flag (cf::FLAG_USE_ARMOUR); $reply .= "You are not allowed to use weapons\r" - unless $ob->flag (cf::FLAG_USE_WEAPON); - - $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY); -}; - -cf::register_command mark => sub { - my ($pl, $arg) = @_; + unless $observe->flag (cf::FLAG_USE_WEAPON); - if (length $arg) { - my $ob = $pl->find_best_object_match ($arg); - - return $pl->reply (undef, "Could not find an object that matches $arg") - unless $ob; - - $pl->contr->mark ($ob); - $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); - } else { - my $ob = $pl->find_marked_object; - - $pl->reply (undef, $ob - ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) - : "You have no marked object."); - } + $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY | cf::NDI_CLEAR); }; -for my $cmd ("run", "fire") { - my $oncmd = "${cmd}_on"; - cf::register_command $cmd => sub { - my ($ob, $arg) = @_; - - $ob->reply (undef, "Can't $cmd into a non adjacent square.") - if $arg < 0 or $arg >= 9; - - $ob->contr->$oncmd (1); - $ob->move_player ($arg); - }; - - cf::register_command "${cmd}_stop" => sub { - my ($ob) = @_; - - $ob->contr->$oncmd (0); - }; -} +#cf::register_command mark => sub { +# my ($pl, $arg) = @_; +# +# if (length $arg) { +# my $ob = $pl->find_best_object_match ($arg); +# +# return $pl->reply (undef, "Could not find an object that matches $arg") +# unless $ob; +# +# $pl->contr->mark ($ob); +# $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); +# } else { +# my $ob = $pl->find_marked_object; +# +# $pl->reply (undef, $ob +# ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) +# : "You have no marked object."); +# } +#}; cf::register_command mapinfo => sub { my ($ob) = @_;