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.47 by root, Fri Apr 27 17:16:13 2007 UTC vs.
Revision 1.48 by root, Sat May 26 15:44:03 2007 UTC

51 ); 51 );
52 52
53 1 53 1
54} 54}
55 55
56sub check_clean_save { 56sub enter_map {
57 my ($pl) = @_; 57 my ($pl) = @_;
58 58
59 my ($map, $x, $y)
60 = $pl->ob->{_link_pos}
61 ? @{delete $pl->ob->{_link_pos}}
62 : ($pl->maplevel, $pl->ob->x, $pl->ob->y);
63
64 $pl->ob->enter_link;
65
59 if (my $time = delete $pl->{unclean_save}) { 66 if (my $time = delete $pl->{unclean_save}) {
67 if (my $m = cf::map::find $map) {
68 if ($time < $m->{instantiate_time}) {
69 # the map was reset in the meantime
70 my $age = $cf::RUNTIME - $time;
71 warn $pl->ob->name, " map reset after logout, logout age $age\n";#d#
72
73 # for now, just go back to savebed
74 ($map, $x, $y) = $pl->savebed;
75
60 $pl->ns->send_drawinfo ( 76 $pl->ns->send_drawinfo (
77 "You didn't use a bed to reality to leave this realm, leaving your body in great danger. "
78 . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. "
79 . "Better use a savebed next time, much worse things could have happened...",
80 cf::NDI_RED
81 );
82 } else {
83 $pl->ns->send_drawinfo (
61 "You didn't use a savebed to leave this realm. This is very dangerous, " 84 "You didn't use a bed to reality to leave this realm. This is very dangerous, "
62 . "as lots of things could happen when you leave by other means, such as cave-ins, " 85 . "as lots of things could happen when you leave by other means, such as cave-ins, "
63 . "or monsters suddenly snapping your body. Better use a savebed next time.", 86 . "or monsters suddenly snapping your body. Better use a savebed next time.",
64 cf::NDI_RED 87 cf::NDI_RED
88 );
89 }
65 ); 90 }
66 #d#TODO
67 } 91 }
92
93 $pl->ob->goto ($map, $x, $y);
68} 94}
69 95
70# delete a player directory, be non-blocking AND synchronous... 96# delete a player directory, be non-blocking AND synchronous...
71# (thats hard, so we crap out and fork). 97# (thats hard, so we crap out and fork).
72sub nuke_playerdir { 98sub nuke_playerdir {
332 if ($cf::CFG{ext_login_nocheck} or $hash eq crypt $pass, $hash) { 358 if ($cf::CFG{ext_login_nocheck} or $hash eq crypt $pass, $hash) {
333 nuke_str $pass; 359 nuke_str $pass;
334 # password matches, wonderful 360 # password matches, wonderful
335 my $pl = cf::player::find $user or next; 361 my $pl = cf::player::find $user or next;
336 $pl->connect ($ns); 362 $pl->connect ($ns);
337 check_clean_save $pl; 363 enter_map $pl;
338 last; 364 last;
339 } elsif (can_cleanup $pl, $mtime) { 365 } elsif (can_cleanup $pl, $mtime) {
340 Coro::Timer::sleep 1; 366 Coro::Timer::sleep 1;
341 367
342 $ns->send_drawinfo ( 368 $ns->send_drawinfo (
405 431
406 my $pl = cf::player::new $user; 432 my $pl = cf::player::new $user;
407 $pl->password (crypt $pass, join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]); 433 $pl->password (crypt $pass, join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]);
408 nuke_str $pass; 434 nuke_str $pass;
409 $pl->connect ($ns); 435 $pl->connect ($ns);
410
411 my $ob = $pl->ob; 436 my $ob = $pl->ob;
437
438 $ob->goto ($pl->maplevel, $ob->x, $ob->y);
412 439
413 while () { 440 while () {
414 $ob->update_stats; 441 $ob->update_stats;
415 $pl->save_stats; 442 $pl->save_stats;
416 443

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines