--- deliantra/server/ext/commands.ext 2007/06/11 21:38:13 1.46 +++ deliantra/server/ext/commands.ext 2007/07/20 14:13:58 1.55 @@ -1,4 +1,4 @@ -#! perl # mandatory +#! perl # mandatory depends=irc use POSIX (); @@ -38,8 +38,6 @@ 1 } -sub ext::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]" : "") @@ -118,21 +117,21 @@ # Too hard to try and make a header that lines everything up, so just # give a description. (comment from C++) 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"; + "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"; + $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 ($_) + $reply .= sprintf " %-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_) if $ob->slot_info ($_) or $ob->slot_used ($_); } - $reply .= "You are not allowed to wear armor\n" + $reply .= "You are not allowed to wear armor\n\n" unless $ob->flag (cf::FLAG_USE_ARMOUR); - $reply .= "You are not allowed to use weapons\n" + $reply .= "You are not allowed to use weapons\n\n" unless $ob->flag (cf::FLAG_USE_WEAPON); $ob->reply (undef, $reply); @@ -188,11 +187,13 @@ cf::register_command mapinfo => sub { my ($ob) = @_; + $ob = $ob->contr->observe; + my $map = $ob->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); @@ -202,7 +203,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 @@ -247,6 +248,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) = @_; @@ -280,8 +289,8 @@ return $ob->reply (undef, sprintf "Output rate is presently %dbps.", $ob->contr->ns->max_rate / $cf::TICK) unless $arg > 0; - # minimum is 2k/s - $ob->contr->ns->max_rate ((List::Util::max 2048, $arg) * $cf::TICK); + # minimum is 5k/s + $ob->contr->ns->max_rate ((List::Util::max 5000, $arg) * $cf::TICK); $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $cf::TICK); 1