--- deliantra/server/ext/commands.ext 2008/09/11 17:56:09 1.69 +++ deliantra/server/ext/commands.ext 2009/01/11 06:08:40 1.72 @@ -55,24 +55,26 @@ cf::register_command seen => sub { my ($pl, $args) = @_; - if (my ($login) = $args =~ /(\S+)/) { - if ($login eq $pl->name) { - $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); - } elsif (cf::player::find_active $login) { - $pl->message ("$login is right here on this server!", cf::NDI_REPLY); - } elsif (cf::player::exists $login - and stat cf::player::path $login) { - my $time = (stat _)[9]; - - $pl->message ("$login was last seen here " - . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) - . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); + cf::async { + if (my ($login) = $args =~ /(\S+)/) { + if ($login eq $pl->name) { + $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); + } elsif (cf::player::find_active $login) { + $pl->message ("$login is right here on this server!", cf::NDI_REPLY); + } elsif (cf::player::exists $login + and stat cf::player::path $login) { + my $time = (stat _)[9]; + + $pl->message ("$login was last seen here " + . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) + . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); + } else { + $pl->message ("No player named $login is known to me.", cf::NDI_REPLY); + } } else { - $pl->message ("No player named $login is known to me.", cf::NDI_REPLY); + $pl->message ("Usage: seen ", cf::NDI_REPLY); } - } else { - $pl->message ("Usage: seen ", cf::NDI_REPLY); - } + }; }; cf::register_command body => sub { @@ -83,14 +85,28 @@ my $reply = "The first column is the name of the body location.\r" . "The second column is how many of those locations your body has.\r" - . "The third column is how many slots in that location are available.\n\n"; + . "The third column is how many slots in that location are available.\r" + . "The last column shows the items currently using the slot\n\n"; + + # first process all applied items and hash them into their slots + my @slot; + + for my $item (grep $_->flag (cf::FLAG_APPLIED), $ob->inv) { + $item->slot_info ($_) + and push @{ $slot[$_] }, $item + for 0 .. cf::NUM_BODY_LOCATIONS-1; + } - $reply .= sprintf " %-20s %3s %5s\n", "Location", "You", "Avail"; + $reply .= sprintf " %-20s %3s %5s %s\n", "Location", "You", "Avail", "What"; for (0 .. cf::NUM_BODY_LOCATIONS - 1) { my $msg = cf::object::slot_nonuse_name $_; $msg =~ s/^.*? a //; - $reply .= sprintf " %-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_) - if $ob->slot_info ($_) or $ob->slot_used ($_); + $reply .= sprintf " %-20s %3d %5d %s\n", + $msg, + $ob->slot_info ($_), + $ob->slot_used ($_), + join ", ", map $_->query_short_name, @{ $slot[$_] } + if $ob->slot_info ($_) || $ob->slot_used ($_); } $reply .= "You are not allowed to wear armor\r" @@ -172,8 +188,8 @@ ++$count{$pl->ob->region->longname}; } - my $msg = "In the world currently there are:\n\n" - . join "", map { sprintf "C<%2d >player(s) %s\r", $count{$_}, $_ } sort keys %count; + my $msg = "T\n\n" + . join "", map { sprintf " C<%3d >player(s) %s\r", $count{$_}, $_ } sort keys %count; $ob->send_msg ("c/who" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); };