… | |
… | |
5 | # miscellaneous commands |
5 | # miscellaneous commands |
6 | |
6 | |
7 | sub rename_to($$$) { |
7 | sub rename_to($$$) { |
8 | my ($ob, $from, $to) = @_; |
8 | my ($ob, $from, $to) = @_; |
9 | |
9 | |
10 | $to =~ /^[a-zA-Z0-9.,=#\/%$!^]*$/ |
10 | $to =~ /^[a-zA-Z0-9.,=#\/%$!^ ]*$/ |
11 | or return $ob->message ("rename: name must consist only of letters, digits, spaces and a few other things."); |
11 | or return $ob->message ("rename: name must consist only of letters, digits, spaces and a few other things."); |
12 | |
12 | |
13 | 127 >= length $to |
13 | 127 >= length $to |
14 | or return $ob->message ("rename: new name must be <= 127 characters."); |
14 | or return $ob->message ("rename: new name must be <= 127 characters."); |
15 | |
15 | |
… | |
… | |
134 | cf::register_command maps => sub { |
134 | cf::register_command maps => sub { |
135 | my ($ob, $arg) = @_; |
135 | my ($ob, $arg) = @_; |
136 | |
136 | |
137 | no re 'eval'; $arg = qr<$arg>; |
137 | no re 'eval'; $arg = qr<$arg>; |
138 | |
138 | |
139 | my $format = "%2s %1s %3s %5s %-60.60s\n"; |
139 | my $format = "%2s %1s %3s %5s %.60s\n"; |
140 | |
140 | |
141 | my $msg = sprintf $format, "Pl", "I", "Svd", "Reset", "Name"; |
141 | $ob->reply (undef, (sprintf $format, "Pl", "I", "Svd", "Reset", "Name"), cf::NDI_BLACK | cf::NDI_UNIQUE); |
142 | |
142 | |
143 | for (sort keys %cf::MAP) { |
143 | for (sort keys %cf::MAP) { |
144 | my $map = $cf::MAP{$_} |
144 | my $map = $cf::MAP{$_} |
145 | or next; |
145 | or next; |
146 | |
146 | |
147 | next unless $map->path =~ $arg; |
147 | next unless $map->path =~ $arg; |
148 | |
148 | |
149 | my $svd = int $cf::RUNTIME - $map->{last_save}; |
149 | my $svd = int $cf::RUNTIME - $map->{last_save}; |
150 | $svd = "++" if $svd > 99; |
150 | $svd = "++" if $svd > 99; |
151 | |
151 | |
152 | $msg .= sprintf $format, |
152 | $ob->reply (undef, |
|
|
153 | (sprintf $format, |
153 | (scalar $map->players), |
154 | (scalar $map->players), |
154 | $IN_MEMORY{$map->in_memory} || "?", |
155 | $IN_MEMORY{$map->in_memory} || "?", |
155 | $svd, |
156 | $svd, |
156 | (int $map->reset_at - $cf::RUNTIME), |
157 | (int $map->reset_at - $cf::RUNTIME), |
157 | $map->{path}->visible_name; |
158 | $map->{path}->visible_name), |
|
|
159 | cf::NDI_BLACK | cf::NDI_UNIQUE); |
158 | } |
160 | } |
159 | |
|
|
160 | $ob->reply (undef, $msg); |
|
|
161 | |
161 | |
162 | 1 |
162 | 1 |
163 | }; |
163 | }; |
164 | |
164 | |