--- deliantra/server/ext/commands.ext 2007/01/01 16:00:09 1.7 +++ deliantra/server/ext/commands.ext 2007/01/03 18:50:52 1.12 @@ -7,7 +7,7 @@ sub rename_to($$$) { my ($ob, $from, $to) = @_; - $to =~ /^[a-zA-Z0-9.,=#\/%$!^]*$/ + $to =~ /^[a-zA-Z0-9.,=#\/%$!^ ]*$/ or return $ob->message ("rename: name must consist only of letters, digits, spaces and a few other things."); 127 >= length $to @@ -125,14 +125,20 @@ 1 }; +my %IN_MEMORY = ( + cf::MAP_IN_MEMORY => "I", + cf::MAP_SWAPPED => "S", + cf::MAP_LOADING => "L", +); + cf::register_command maps => sub { my ($ob, $arg) = @_; no re 'eval'; $arg = qr<$arg>; - my $format = "%2s %2s %5s %-30.30s\n"; + my $format = "%2s %1s %3s %5s %-60.60s\n"; - my $msg = sprintf $format, "Pl", "Fl", "Reset", "Name"; + $ob->reply (undef, sprintf $format, "Pl", "I", "Svd", "Reset", "Name"); for (sort keys %cf::MAP) { my $map = $cf::MAP{$_} @@ -140,15 +146,17 @@ next unless $map->path =~ $arg; - $msg .= sprintf $format, + my $svd = int $cf::RUNTIME - $map->{last_save}; + $svd = "++" if $svd > 99; + + $ob->reply (undef, sprintf $format, (scalar $map->players), - 0, + $IN_MEMORY{$map->in_memory} || "?", + $svd, (int $map->reset_at - $cf::RUNTIME), - $map->{path}->visible_name; + $map->{path}->visible_name); } - $ob->reply (undef, $msg); - 1 };