--- deliantra/server/ext/commands.ext 2007/05/07 03:05:58 1.43 +++ deliantra/server/ext/commands.ext 2007/07/01 03:17:39 1.50 @@ -1,4 +1,4 @@ -#! perl # MANDATORY +#! perl # mandatory depends=irc use POSIX (); @@ -38,8 +38,6 @@ 1 } -sub ext::schmorp_irc::users; # HACK: TODO: replace by signal - sub who_listing(;$$) { my ($privileged, $select) = @_; @@ -66,6 +64,7 @@ my ($pl, $ob, $ns) = ($_, $_->ob, $_->ns); "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) + . ($pl->gender ? " [f]" : " [m]") . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") . ($ns->afk ? " [AFK]" : "") . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") @@ -75,7 +74,7 @@ . ($privileged ? " " . $pl->ns->host : "") } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl ), - eval { "* IRC: " . join ", ", ext::schmorp_irc::users }, + eval { "* IRC: " . join ", ", ext::irc::users }, ) } @@ -117,20 +116,26 @@ # Too hard to try and make a header that lines everything up, so just # give a description. (comment from C++) - $ob->reply (undef, "The first column is the name of the body location."); - $ob->reply (undef, "The second column is how many of those locations your body has."); - $ob->reply (undef, "The third column is how many slots in that location are available."); + my $reply = + "The first column is the name of the body location.\n" + . "The second column is how many of those locations your body has.\n" + . "The third column is how many slots in that location are available.\n"; + $reply .= sprintf "%-20s %3s %5s\n", "Location", "You", "Avail"; for (0 .. cf::NUM_BODY_LOCATIONS - 1) { - $ob->reply (undef, (sprintf "%-30s %5d %5d", cf::object::slot_use_name ($_), $ob->slot_info ($_), $ob->slot_used ($_))) + 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 ($_); } - $ob->reply (undef, "You are not allowed to wear armor") + $reply .= "You are not allowed to wear armor\n" unless $ob->flag (cf::FLAG_USE_ARMOUR); - $ob->reply (undef, "You are not allowed to use weapons") + $reply .= "You are not allowed to use weapons\n" unless $ob->flag (cf::FLAG_USE_WEAPON); + $ob->reply (undef, $reply); + 1 }; @@ -182,7 +187,7 @@ cf::register_command mapinfo => sub { my ($ob) = @_; - my $map = $ob->map + my $map = $ob->contr->observe->map or return; $ob->reply (undef, (sprintf "%s (%s) %s", $map->name, $map->path, $ob->region->longname)); $ob->reply (undef, (sprintf "players: %d difficulty: %d size: %d start: %dx%d timeout: %d", @@ -196,7 +201,7 @@ cf::register_command whereami => sub { my ($ob) = @_; - my $reg = $ob->region; + my $reg = $ob->contr->observe->region; $ob->reply (undef, (sprintf "You are %s.\n%s", $reg->longname, $reg->msg)); 1