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.67 by root, Tue Apr 15 14:21:04 2008 UTC vs.
Revision 1.68 by root, Mon Sep 8 18:34:35 2008 UTC

47cf::register_command who => sub { 47cf::register_command who => sub {
48 my ($ob, $arg) = @_; 48 my ($ob, $arg) = @_;
49 49
50 $ob->speed_left ($ob->speed_left - 4); 50 $ob->speed_left ($ob->speed_left - 4);
51 51
52 $ob->send_msg ("c/who" => (join "\n\n", who_listing $ob->may ("extended_who"), $arg), cf::NDI_DK_ORANGE | cf::NDI_REPLY | cf::NDI_CLEAR | cf::NDI_DEF); 52 $ob->send_msg ("c/who" => (join "\r", who_listing $ob->may ("extended_who"), $arg), cf::NDI_DK_ORANGE | cf::NDI_REPLY | cf::NDI_CLEAR | cf::NDI_DEF);
53}; 53};
54 54
55cf::register_command seen => sub { 55cf::register_command seen => sub {
56 my ($pl, $args) = @_; 56 my ($pl, $args) = @_;
57 57
79 my ($ob) = @_; 79 my ($ob) = @_;
80 80
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.\n\n" 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.\n\n" 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.\n\n"; 86 . "The third column is how many slots in that location are available.\r";
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 //;
92 $reply .= sprintf " %-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_) 92 $reply .= sprintf " %-20s %3d %5d\n", $msg, $ob->slot_info ($_), $ob->slot_used ($_)
93 if $ob->slot_info ($_) or $ob->slot_used ($_); 93 if $ob->slot_info ($_) or $ob->slot_used ($_);
94 } 94 }
95 95
96 $reply .= "You are not allowed to wear armor\n\n" 96 $reply .= "You are not allowed to wear armor\r"
97 unless $ob->flag (cf::FLAG_USE_ARMOUR); 97 unless $ob->flag (cf::FLAG_USE_ARMOUR);
98 $reply .= "You are not allowed to use weapons\n\n" 98 $reply .= "You are not allowed to use weapons\r"
99 unless $ob->flag (cf::FLAG_USE_WEAPON); 99 unless $ob->flag (cf::FLAG_USE_WEAPON);
100 100
101 $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY); 101 $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY);
102}; 102};
103 103
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", $map->name, $map->path, $observe->region->longname; 151 my $msg = sprintf "%s (%s) %s\r", $map->name, $map->path, $observe->region->longname;
152 $msg .= sprintf "\n\nplayers: %d difficulty: %d size: %d start: %dx%d timeout: %d", 152 $msg .= sprintf "players: %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};
384cf::register_command maps => sub { 384cf::register_command maps => sub {
385 my ($ob, $arg) = @_; 385 my ($ob, $arg) = @_;
386 386
387 no re 'eval'; $arg = qr<$arg>; 387 no re 'eval'; $arg = qr<$arg>;
388 388
389 my $format = "%2s %1s %3s %5s %.60s\n"; 389 my $format = " %2s %1s %3s %5s %.60s\n";
390 390
391 $ob->send_msg ("c/mapinfo" => (sprintf $format, "Pl", "I", "Svd", "Reset", "Name"), cf::NDI_REPLY | cf::NDI_CLEAR); 391 my $msg = "\n" . sprintf $format, "Pl", "I", "Svd", "Reset", "Name";
392 392
393 for (sort keys %cf::MAP) { 393 for (sort keys %cf::MAP) {
394 my $map = $cf::MAP{$_} 394 my $map = $cf::MAP{$_}
395 or next; 395 or next;
396 396
398 next if $map->{deny_list}; 398 next if $map->{deny_list};
399 399
400 my $svd = int $cf::RUNTIME - $map->{last_save}; 400 my $svd = int $cf::RUNTIME - $map->{last_save};
401 $svd = "++" if $svd > 99; 401 $svd = "++" if $svd > 99;
402 402
403 $ob->send_msg ("c/mapinfo" => 403 $msg .= sprintf $format,
404 (sprintf $format,
405 (scalar $map->players), 404 (scalar $map->players),
406 $IN_MEMORY{$map->in_memory} || "?", 405 $IN_MEMORY{$map->in_memory} || "?",
407 $svd, 406 $svd,
408 (int $map->reset_at - $cf::RUNTIME), 407 (int $map->reset_at - $cf::RUNTIME),
409 $map->visible_name) 408 $map->visible_name;
410 );
411 } 409 }
412};
413 410
411 $ob->send_msg ("c/mapinfo" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR);
412};
413

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines