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

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.93 by elmex, Fri Oct 31 16:13:41 2008 UTC vs.
Revision 1.96 by pippijn, Tue Dec 23 18:52:57 2008 UTC

13} 13}
14 14
15sub query { 15sub query {
16 my ($ns, $flags, $text) = @_; 16 my ($ns, $flags, $text) = @_;
17 17
18 my $current = $Coro::current; 18 $ns->query ($flags, $text, Coro::rouse_cb);
19 $ns->query ($flags, $text, sub { $current->ready; $current = $_[0] }); 19 Coro::rouse_wait
20 Coro::schedule while ref $current;
21
22 $current
23} 20}
24 21
25sub can_cleanup { 22sub can_cleanup {
26 my ($pl, $mtime) = @_; 23 my ($pl, $mtime) = @_;
27 24
143 warn $pl->ob->name, ": enter map 6\n";#d# 140 warn $pl->ob->name, ": enter map 6\n";#d#
144 141
145} 142}
146 143
147# delete a player directory, be non-blocking AND synchronous... 144# delete a player directory, be non-blocking AND synchronous...
148# (thats hard, so we crap out and fork). 145# (that's hard, so we crap out and fork).
149sub nuke_playerdir { 146sub nuke_playerdir {
150 my ($user) = @_; 147 my ($user) = @_;
151 148
152 my $temp = "$PLAYERDIR/~$Coro::current~deleting~"; 149 my $temp = "$PLAYERDIR/~$Coro::current~deleting~";
153 150
446}); 443});
447 444
448cf::register_command quit => sub { 445cf::register_command quit => sub {
449 my ($ob, $arg) = @_; 446 my ($ob, $arg) = @_;
450 447
451 $ob->reply (undef, 448 $ob->send_msg (undef,
452 "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. " 449 "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. "
453 . "If you are sure you want to do this, then use the quit_character command instead of quit.", 450 . "If you are sure you want to do this, then use the quit_character command instead of quit.",
454 cf::NDI_UNIQUE | cf::NDI_RED); 451 cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY);
455}; 452};
456 453
457cf::register_command quit_character => sub { 454cf::register_command quit_character => sub {
458 my ($ob, $arg) = @_; 455 my ($ob, $arg) = @_;
459 456
460 my $pl = $ob->contr; 457 my $pl = $ob->contr;
461 458
462 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to PERMANENTLY delete your character and all associated data (y/n)?", sub { 459 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to PERMANENTLY delete your character and all associated data (y/n)?", sub {
463 if ($_[0] !~ /^[yY]/) { 460 if ($_[0] !~ /^[yY]/) {
464 $ob->reply (undef, 461 $ob->send_msg (undef, "Ok, not not quitting then.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY);
465 "Ok, not not quitting then.",
466 cf::NDI_UNIQUE | cf::NDI_RED);
467 } else { 462 } else {
468 $ob->reply (undef, 463 $ob->send_msg (undef, "Ok, quitting, hope to see you again.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY);
469 "Ok, quitting, hope to see you again.",
470 cf::NDI_UNIQUE | cf::NDI_RED);
471 $pl->ns->flush; 464 $pl->ns->flush;
472 cf::async { $pl->quit_character }; 465 cf::async { $pl->quit_character };
473 } 466 }
474 }); 467 });
475}; 468};
488 cf::async { $pl->save }; 481 cf::async { $pl->save };
489 482
490 my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; 483 my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy;
491 $ob->check_score; 484 $ob->check_score;
492 485
493 $ob->reply (undef, "In the future, you will wake up here when you die."); 486 $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY);
494 487
495 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { 488 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub {
496 if ($_[0] !~ /^[yY]/) { 489 if ($_[0] !~ /^[yY]/) {
497 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); 490 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1);
498 $pl->deactivate; 491 $pl->deactivate;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines