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.44 by root, Mon Apr 23 19:10:16 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 {
180 206
181 } elsif ($k eq "fxix") { 207 } elsif ($k eq "fxix") {
182 $ns->fxix ($v); 208 $ns->fxix ($v);
183 209
184 } elsif ($k eq "msg") { 210 } elsif ($k eq "msg") {
185 $ns->{setup}{msg} = $v; 211 $ns->can_msg ($v);
186 212
187 } elsif ($k eq "excmd") { 213 } elsif ($k eq "excmd") {
188 # we support it 214 # we support it
189 215
190 } else { 216 } else {
191 # other commands: 217 # other commands:
192 # sexp: no idea, probably for oudated servers 218 # sexp: no idea, probably for oudated servers
193 # tick: more stupidity, server should sned a tick per tick 219 # tick: more stupidity, server should send a tick per tick
194 220
195 $setup{$k} = "FALSE"; 221 $setup{$k} = "FALSE";
196 } 222 }
197 } 223 }
198 224
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
431 } 458 }
432 459
433 $ob->set_animation (2); 460 $ob->set_animation (2);
434 $ob->add_statbonus; 461 $ob->add_statbonus;
435 462
436 $ns->send_drawinfo ($ob->msg, cf::NDI_BLUE); 463 while () {
437 $ns->send_packet (sprintf "query %d %s", cf::CS_QUERY_SINGLECHAR, 464 $ns->send_msg (-1, "chargen-race-title", ucfirst $pl->title);
465 my $msg = $ob->msg;
466 $msg =~ s/(?<=\S)\n(?=\S)/ /g;
467 $ns->send_msg (cf::NDI_BLUE, "chargen-race-description", $msg);
468
469 my $res = query $ns, cf::CS_QUERY_SINGLECHAR,
438 "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"); 470 "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n";
439 471
440 $ns->state (cf::ST_CHANGE_CLASS); 472 last if $res =~ /[dD]/;
473
474 $pl->chargen_race_next;
475 }
476
477 $pl->chargen_race_done;
478
441 delete $pl->{deny_save};#d# too early 479 delete $pl->{deny_save};
442 480
443 last; 481 last;
444 } 482 }
445 }); 483 });
446} 484}
574 $ob = $pl->ob; 612 $ob = $pl->ob;
575 613
576 $ob->destroy; 614 $ob->destroy;
577 $pl->destroy; 615 $pl->destroy;
578 } else { 616 } else {
579 warn "player-scheduler refcnt ", $ob->name, " $pl_ref,$a_ $ob_ref,$b_\n";#d# 617 warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d#
580 } 618 }
581 } 619 }
582 } 620 }
583 }; 621 };
584 warn $@ if $@; 622 warn $@ if $@;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines