ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/commands.ext
(Generate patch)

Comparing deliantra/server/ext/commands.ext (file contents):
Revision 1.68 by root, Mon Sep 8 18:34:35 2008 UTC vs.
Revision 1.69 by root, Thu Sep 11 17:56:09 2008 UTC

81 # Too hard to try and make a header that lines everything up, so just 81 # Too hard to try and make a header that lines everything up, so just
82 # give a description. (comment from C++) 82 # give a description. (comment from C++)
83 my $reply = 83 my $reply =
84 "The first column is the name of the body location.\r" 84 "The first column is the name of the body location.\r"
85 . "The second column is how many of those locations your body has.\r" 85 . "The second column is how many of those locations your body has.\r"
86 . "The third column is how many slots in that location are available.\r"; 86 . "The third column is how many slots in that location are available.\n\n";
87 87
88 $reply .= sprintf " %-20s %3s %5s\n", "Location", "You", "Avail"; 88 $reply .= sprintf " %-20s %3s %5s\n", "Location", "You", "Avail";
89 for (0 .. cf::NUM_BODY_LOCATIONS - 1) { 89 for (0 .. cf::NUM_BODY_LOCATIONS - 1) {
90 my $msg = cf::object::slot_nonuse_name $_; 90 my $msg = cf::object::slot_nonuse_name $_;
91 $msg =~ s/^.*? a //; 91 $msg =~ s/^.*? a //;
146 my $observe = $ob->contr->observe; 146 my $observe = $ob->contr->observe;
147 147
148 my $map = $observe->map 148 my $map = $observe->map
149 or return; 149 or return;
150 150
151 my $msg = sprintf "%s (%s) %s\r", $map->name, $map->path, $observe->region->longname; 151 my $msg = sprintf "%s (%s)\r%s", $map->name, $map->path, $observe->region->longname;
152 $msg .= sprintf "players: %d difficulty: %d size: %d start: %dx%d timeout: %d", 152 $msg .= sprintf "\rplayers: %d difficulty: %d size: %d start: %dx%d timeout: %d",
153 (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout 153 (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout
154 if $ob->flag (cf::FLAG_WIZ); 154 if $ob->flag (cf::FLAG_WIZ);
155 155
156 $ob->send_msg ("c/mapinfo" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); 156 $ob->send_msg ("c/mapinfo" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR);
157}; 157};
158 158
159cf::register_command whereami => sub { 159cf::register_command whereami => sub {
160 my ($ob) = @_; 160 my ($ob) = @_;
161 161
162 my $reg = $ob->contr->observe->region; 162 my $reg = $ob->contr->observe->region;
163 $ob->send_msg ("c/who" => (sprintf "You are %s.\n%s", $reg->longname, $reg->msg), cf::NDI_REPLY | cf::NDI_CLEAR); 163 $ob->send_msg ("c/who" => (sprintf "You are %s.\n\n%s", $reg->longname, $reg->msg), cf::NDI_REPLY | cf::NDI_CLEAR);
164}; 164};
165 165
166cf::register_command whereabouts => sub { 166cf::register_command whereabouts => sub {
167 my ($ob, $arg) = @_; 167 my ($ob, $arg) = @_;
168 168
171 for my $pl (cf::player::list) { 171 for my $pl (cf::player::list) {
172 ++$count{$pl->ob->region->longname}; 172 ++$count{$pl->ob->region->longname};
173 } 173 }
174 174
175 my $msg = "In the world currently there are:\n\n" 175 my $msg = "In the world currently there are:\n\n"
176 . join "", map "$count{$_} player(s) $_\n\n", sort keys %count; 176 . join "", map { sprintf "C<%2d >player(s) %s\r", $count{$_}, $_ } sort keys %count;
177 177
178 $ob->send_msg ("c/who" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); 178 $ob->send_msg ("c/who" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR);
179}; 179};
180 180
181cf::register_command hiscore => sub { 181cf::register_command hiscore => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines