1 | #! perl # mandatory |
1 | #! perl # mandatory depends=highscore |
2 | |
2 | |
3 | # login handling |
3 | # login handling |
4 | |
4 | |
5 | use Fcntl; |
5 | use Fcntl; |
6 | use Coro::AIO; |
6 | use Coro::AIO; |
… | |
… | |
347 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
347 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
348 | |
348 | |
349 | last if $res =~ /[dD]/; |
349 | last if $res =~ /[dD]/; |
350 | |
350 | |
351 | $pl->chargen_race_next; |
351 | $pl->chargen_race_next; |
352 | Coro::Timer::sleep 0.2; |
352 | Coro::Timer::sleep 0.05; |
353 | } |
353 | } |
354 | |
354 | |
355 | # create the playerdir, if necessary, as chargen_race_done did it before |
355 | # create the playerdir, if necessary, as chargen_race_done did it before |
356 | # presumably because of unique maps |
356 | # presumably because of unique maps |
357 | aio_mkdir playerdir $pl, 0770; |
357 | aio_mkdir playerdir $pl, 0770; |
… | |
… | |
366 | last; |
366 | last; |
367 | } elsif ($res =~ /^[mM]/) { |
367 | } elsif ($res =~ /^[mM]/) { |
368 | $pl->gender (0); |
368 | $pl->gender (0); |
369 | last; |
369 | last; |
370 | } |
370 | } |
371 | Coro::Timer::sleep 0.2; |
371 | Coro::Timer::sleep 0.05; |
372 | } |
372 | } |
373 | |
373 | |
374 | $ob->reply (undef, "Welcome to Deliantra!"); |
374 | $ob->reply (undef, "Welcome to Deliantra!"); |
375 | |
375 | |
376 | # XXX: Workaround for delayed client ext protocol handshake |
376 | # XXX: Workaround for delayed client ext protocol handshake |
377 | $pl->esrv_new_player; |
377 | $pl->esrv_new_player; |
378 | |
378 | |
379 | delete $pl->{deny_save}; |
379 | delete $pl->{deny_save}; |
380 | |
380 | |
381 | last; |
381 | last; |
|
|
382 | } |
|
|
383 | |
|
|
384 | if (0 < Coro::AIO::aio_load "$cf::CONFDIR/motd", my $motd) { |
|
|
385 | $ns->send_msg ("c/motd" => $motd, cf::NDI_CLEAR); |
382 | } |
386 | } |
383 | }); |
387 | }); |
384 | }); |
388 | }); |
385 | |
389 | |
386 | cf::register_command quit => sub { |
390 | cf::register_command quit => sub { |
… | |
… | |
420 | # update respawn position |
424 | # update respawn position |
421 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
425 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
422 | cf::async { $pl->save }; |
426 | cf::async { $pl->save }; |
423 | |
427 | |
424 | my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; |
428 | my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; |
425 | $ob->check_score; |
429 | ext::highscore::check $ob; |
426 | |
430 | |
427 | $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY); |
431 | $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY); |
428 | |
432 | |
429 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
433 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
430 | if ($_[0] !~ /^[yY]/) { |
434 | if ($_[0] !~ /^[yY]/) { |