… | |
… | |
443 | }); |
443 | }); |
444 | |
444 | |
445 | cf::register_command quit => sub { |
445 | cf::register_command quit => sub { |
446 | my ($ob, $arg) = @_; |
446 | my ($ob, $arg) = @_; |
447 | |
447 | |
448 | $ob->reply (undef, |
448 | $ob->send_msg (undef, |
449 | "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. " |
450 | . "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.", |
451 | cf::NDI_UNIQUE | cf::NDI_RED); |
451 | cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); |
452 | }; |
452 | }; |
453 | |
453 | |
454 | cf::register_command quit_character => sub { |
454 | cf::register_command quit_character => sub { |
455 | my ($ob, $arg) = @_; |
455 | my ($ob, $arg) = @_; |
456 | |
456 | |
457 | my $pl = $ob->contr; |
457 | my $pl = $ob->contr; |
458 | |
458 | |
459 | $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 { |
460 | if ($_[0] !~ /^[yY]/) { |
460 | if ($_[0] !~ /^[yY]/) { |
461 | $ob->reply (undef, |
461 | $ob->send_msg (undef, "Ok, not not quitting then.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); |
462 | "Ok, not not quitting then.", |
|
|
463 | cf::NDI_UNIQUE | cf::NDI_RED); |
|
|
464 | } else { |
462 | } else { |
465 | $ob->reply (undef, |
463 | $ob->send_msg (undef, "Ok, quitting, hope to see you again.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); |
466 | "Ok, quitting, hope to see you again.", |
|
|
467 | cf::NDI_UNIQUE | cf::NDI_RED); |
|
|
468 | $pl->ns->flush; |
464 | $pl->ns->flush; |
469 | cf::async { $pl->quit_character }; |
465 | cf::async { $pl->quit_character }; |
470 | } |
466 | } |
471 | }); |
467 | }); |
472 | }; |
468 | }; |
… | |
… | |
485 | cf::async { $pl->save }; |
481 | cf::async { $pl->save }; |
486 | |
482 | |
487 | 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; |
488 | $ob->check_score; |
484 | $ob->check_score; |
489 | |
485 | |
490 | $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); |
491 | |
487 | |
492 | $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 { |
493 | if ($_[0] !~ /^[yY]/) { |
489 | if ($_[0] !~ /^[yY]/) { |
494 | $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); |
490 | $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); |
495 | $pl->deactivate; |
491 | $pl->deactivate; |