--- deliantra/server/ext/commands.ext 2009/10/03 22:36:08 1.73 +++ deliantra/server/ext/commands.ext 2010/04/13 10:45:48 1.77 @@ -34,7 +34,7 @@ . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") . ($ns->afk ? " [AFK]" : "") . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") - . " [" . $pl->ns->version . "]" + . " [" . $pl->ns->{who_version} . "]" . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" . (sprintf " [rtt %.3fs]", $pl->ns->tcpi_rtt * 1e-6) . ($privileged ? " " . $pl->ns->host : "") @@ -119,44 +119,25 @@ $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY | cf::NDI_CLEAR); }; -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."); - } -}; - -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) = @_; @@ -166,9 +147,28 @@ my $map = $observe->map or return; - my $msg = sprintf "%s (%s)\r%s", $map->name, $map->path, $observe->region->longname; - $msg .= sprintf "\rplayers: %d difficulty: %d size: %d start: %dx%d timeout: %d", - (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout + my $msg = ''; + + if ($map->name ne '') { + $msg .= sprintf "%s [%s] ", $map->name, $map->visible_name + } else { + $msg .= sprintf "%s ", $map->visible_name + } + + if ($map->visible_name ne $map->path) { + $msg .= sprintf "(%s) ", $map->path; + } + + $msg .= sprintf "\r%s", $observe->region->longname; + + $msg .= sprintf "\rplayers: %d difficulty: %d" + . "\rsize: %dx%d start: %dx%d position: (%d|%d) timeout: %d", + (scalar $map->players), + $map->difficulty, + $map->width, $map->height, + $map->enter_x, $map->enter_y, + $ob->x, $ob->y, + $map->timeout if $ob->flag (cf::FLAG_WIZ); $ob->send_msg ("c/mapinfo" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); @@ -269,10 +269,8 @@ return $ob->reply (undef, sprintf "Output rate is presently %dbps.", $ob->contr->ns->max_rate / $cf::TICK) unless $arg > 0; - # minimum is 5k/s - # maximum is 100k/s, this should be configurable - $ob->contr->ns->max_rate ((List::Util::max 5000, List::Util::min 100000, $arg) * $cf::TICK); - $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $cf::TICK); + $ob->contr->ns->max_rate ((cf::clamp $arg, $OUTPUT_RATE_MIN, $OUTPUT_RATE_MAX) * $TICK); + $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $TICK); }; cf::register_command 'output-count' => sub {