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.77 by elmex, Tue Apr 13 10:45:48 2010 UTC vs.
Revision 1.84 by root, Sun Jan 29 02:47:04 2017 UTC

60 if ($login eq $pl->name) { 60 if ($login eq $pl->name) {
61 $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); 61 $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY);
62 } elsif (cf::player::find_active $login) { 62 } elsif (cf::player::find_active $login) {
63 $pl->message ("$login is right here on this server!", cf::NDI_REPLY); 63 $pl->message ("$login is right here on this server!", cf::NDI_REPLY);
64 } elsif (cf::player::exists $login 64 } elsif (cf::player::exists $login
65 and stat cf::player::path $login) { 65 and !Coro::AIO::aio_stat cf::player::path $login) {
66 my $time = (stat _)[9]; 66 my $time = (stat _)[9];
67 67
68 $pl->message ("$login was last seen here " 68 $pl->message ("$login was last seen here "
69 . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) 69 . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time)
70 . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); 70 . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY);
129# unless $ob; 129# unless $ob;
130# 130#
131# $pl->contr->mark ($ob); 131# $pl->contr->mark ($ob);
132# $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); 132# $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title));
133# } else { 133# } else {
134# my $ob = $pl->find_marked_object; 134# my $ob = $pl->mark;
135# 135#
136# $pl->reply (undef, $ob 136# $pl->reply (undef, $ob
137# ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) 137# ? (sprintf "%s %s * is marked.", $ob->name, $ob->title)
138# : "You have no marked object."); 138# : "You have no marked object.");
139# } 139# }
243}; 243};
244 244
245cf::register_command afk => sub { 245cf::register_command afk => sub {
246 my ($ob, $arg) = @_; 246 my ($ob, $arg) = @_;
247 247
248 $ob->contr->ns->afk ($ob->contr->ns->afk ? 0 : 1); 248 $ob->contr->ns->afk (!(length $arg ? !$arg : $ob->contr->ns->afk));
249 $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK"); 249 $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK." : "You are no longer AFK.");
250};
251
252cf::register_command bumpmsg => sub {
253 my ($ob, $arg) = @_;
254
255 $ob->contr->ns->bumpmsg (!(length $arg ? !$arg : $ob->contr->ns->bumpmsg));
256 $ob->reply (undef, $ob->contr->ns->bumpmsg ? "Bumping into walls sounds more painful now." : "Bumping into walls will now be silent.");
257};
258
259cf::register_command brace => sub {
260 my ($ob, $arg) = @_;
261
262 $ob->contr->braced (!(length $arg ? !$arg : $ob->contr->braced));
263 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced.");
250}; 264};
251 265
252cf::register_command sound => sub { 266cf::register_command sound => sub {
253 my ($ob, $arg) = @_; 267 my ($ob, $arg) = @_;
254 268
255 $ob->contr->ns->sound ($ob->contr->ns->sound ? 0 : 1); 269 $ob->contr->ns->sound (!(length $arg ? !$arg : $ob->contr->ns->sound));
256 $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden..."); 270 $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden...");
257};
258
259cf::register_command brace => sub {
260 my ($ob, $arg) = @_;
261
262 $ob->contr->braced ($ob->contr->braced ? 0 : 1);
263 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced.");
264}; 271};
265 272
266cf::register_command 'output-rate' => sub { 273cf::register_command 'output-rate' => sub {
267 my ($ob, $arg) = @_; 274 my ($ob, $arg) = @_;
268 275
338 345
339 if (length $from) { 346 if (length $from) {
340 $item = $ob->find_best_object_match ($from) 347 $item = $ob->find_best_object_match ($from)
341 or return $ob->message ("rename: could not find a matching item to rename."); 348 or return $ob->message ("rename: could not find a matching item to rename.");
342 } else { 349 } else {
343 $item = $ob->find_marked_object 350 $item = $ob->mark
344 or return $ob->message ("rename: no from name and no marked item found to rename."); 351 or return $ob->message ("rename: no from name and no marked item found to rename.");
345 } 352 }
346 353
347 $item->custom_name (length $to ? $to : undef); 354 $item->custom_name (length $to ? $to : undef);
348 355
389 my $startup = POSIX::strftime "%Y-%m-%d %H:%M:%S %Z", localtime $cf::UPTIME; 396 my $startup = POSIX::strftime "%Y-%m-%d %H:%M:%S %Z", localtime $cf::UPTIME;
390 my $runtime = sprintf "%.1f", (time - $cf::UPTIME) / 86400; 397 my $runtime = sprintf "%.1f", (time - $cf::UPTIME) / 86400;
391 $ob->send_msg ("c/uptime" => "server started $startup, uptime ${runtime}\d", cf::NDI_REPLY | cf::NDI_CLEAR); 398 $ob->send_msg ("c/uptime" => "server started $startup, uptime ${runtime}\d", cf::NDI_REPLY | cf::NDI_CLEAR);
392}; 399};
393 400
394my %IN_MEMORY = ( 401my %MAP_STATE = (
402 cf::MAP_ACTIVE => "A",
395 cf::MAP_ACTIVE => "I", 403 cf::MAP_INACTIVE => "I",
396 cf::MAP_SWAPPED => "S", 404 cf::MAP_SWAPPED => "S",
397 cf::MAP_LOADING => "L",
398); 405);
399 406
400cf::register_command maps => sub { 407cf::register_command maps => sub {
401 my ($ob, $arg) = @_; 408 my ($ob, $arg) = @_;
402 409
403 no re 'eval'; $arg = qr<$arg>; 410 no re 'eval'; $arg = qr<$arg>;
404 411
405 my $format = " %2s %1s %3s %5s %.60s\n"; 412 my $format = " %2s %1s %3s %5s %.60s\n";
406 413
407 my $msg = "\n" . sprintf $format, "Pl", "I", "Svd", "Reset", "Name"; 414 my $msg = "\n" . sprintf $format, "Pl", "S", "Svd", "Reset", "Name";
408 415
409 for (sort keys %cf::MAP) { 416 for (sort keys %cf::MAP) {
410 my $map = $cf::MAP{$_} 417 my $map = $cf::MAP{$_}
411 or next; 418 or next;
412 419
415 422
416 my $svd = int $cf::RUNTIME - $map->{last_save}; 423 my $svd = int $cf::RUNTIME - $map->{last_save};
417 $svd = "++" if $svd > 99; 424 $svd = "++" if $svd > 99;
418 425
419 $msg .= sprintf $format, 426 $msg .= sprintf $format,
420 (scalar $map->players), 427 (scalar $map->players),
421 $IN_MEMORY{$map->in_memory} || "?", 428 $MAP_STATE{$map->state} || "?",
422 $svd, 429 $svd,
423 (int $map->reset_at - $cf::RUNTIME), 430 (int $map->reset_at - $cf::RUNTIME),
424 $map->visible_name; 431 $map->visible_name;
425 } 432 }
426 433

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines