--- deliantra/server/ext/commands.ext 2007/05/03 04:50:27 1.42 +++ deliantra/server/ext/commands.ext 2007/07/06 02:51:21 1.53 @@ -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 }, ) } @@ -115,26 +114,28 @@ cf::register_command body => sub { my ($ob) = @_; - my @body_locations = ("in your range slot", "on your arm", "on your body", "on your head", - "around your neck", "in your skill slot", "on your finger", "around your shoulders", - "on your feet", "on your hands", "around your wrists", "around your waist"); - # 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."); - - for (0 .. scalar @body_locations - 1) { - $ob->reply (undef, (sprintf "%-30s %5d %5d", $body_locations[$_], $ob->body_info($_), $ob->body_used($_))) - if $ob->body_info($_) or $ob->body_used($_); + my $reply = + "The first column is the name of the body location.\n\n" + . "The second column is how many of those locations your body has.\n\n" + . "The third column is how many slots in that location are available.\n\n"; + + $reply .= sprintf " %-20s %3s %5s\n", "Location", "You", "Avail"; + 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 ($_); } - $ob->reply (undef, "You are not allowed to wear armor") + $reply .= "You are not allowed to wear armor\n\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\n" unless $ob->flag (cf::FLAG_USE_WEAPON); + $ob->reply (undef, $reply); + 1 }; @@ -186,11 +187,11 @@ 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", - $map->players, $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout)) + (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout)) if $ob->flag (cf::FLAG_WIZ); $ob->reply (undef, $map->msg); @@ -200,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 @@ -244,6 +245,14 @@ 1 }; + +cf::register_command hintmode => sub { + my ($ob, $arg) = @_; + + _set_mode "hintmode", $ob, $arg, hintmode => qw(show mark hide); + + 1 +}; cf::register_command afk => sub { my ($ob, $arg) = @_;