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.81 by root, Fri Jan 18 03:34:55 2008 UTC vs.
Revision 1.90 by root, Tue Sep 16 16:03:02 2008 UTC

73} 73}
74 74
75sub enter_map { 75sub enter_map {
76 my ($pl) = @_; 76 my ($pl) = @_;
77 77
78 warn $pl->ob->name, ": enter map 1\n";#d#
78 my $ob = $pl->ob; 79 my $ob = $pl->ob;
79 80
80 my ($map, $x, $y) 81 my ($map, $x, $y)
81 = $ob->{_link_pos} 82 = $ob->{_link_pos}
82 ? @{delete $ob->{_link_pos}} 83 ? @{delete $ob->{_link_pos}}
83 : ($pl->maplevel, $ob->x, $ob->y); 84 : ($pl->maplevel, $ob->x, $ob->y);
84 85
86 warn $pl->ob->name, ": enter map 2\n";#d#
85 $ob->enter_link; 87 $ob->enter_link;
88 warn $pl->ob->name, ": enter map 3\n";#d#
86 89
87 my $m = cf::map::find $map; 90 my $m = cf::map::find $map;
88 my $time = delete $pl->{unclean_save}; 91 my $time = delete $pl->{unclean_save};
92 warn $pl->ob->name, ": enter map 4\n";#d#
89 93
90 if ($time && $m) { 94 if ($time && $m) {
91 if ($time < $m->{instantiate_time}) { 95 if ($time < $m->{instantiate_time}) {
92 # the map was reset in the meantime 96 # the map was reset in the meantime
93 my $age = $cf::RUNTIME - $time; 97 my $age = $cf::RUNTIME - $time;
103 cf::NDI_RED 107 cf::NDI_RED
104 ); 108 );
105 # kill them. 109 # kill them.
106 # reminds me of the famous badness 10000 syndrome... 110 # reminds me of the famous badness 10000 syndrome...
107 $ob->stats->hp (-10000); #] if they survive this they deserved to live 111 $ob->stats->hp (-10000); #] if they survive this they deserved to live
108 $pl->killer ("a cave-in"); 112 my $killer = cf::arch::get "killer_login"; $pl->killer ($killer); $killer->destroy;
109 } else { 113 } else {
110 ($map, $x, $y) = $pl->savebed; 114 ($map, $x, $y) = $pl->savebed;
111 115
112 $ob->message ( 116 $ob->message (
113 "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " 117 "You didn't use a bed to reality to leave this realm, leaving your body in great danger. "
126 cf::NDI_RED 130 cf::NDI_RED
127 ); 131 );
128 } 132 }
129 } 133 }
130 134
135 warn $pl->ob->name, ": enter map 5\n";#d#
131 $ob->goto ($map, $x, $y); 136 #$ob->goto ($map, $x, $y);
137 $ob->goto ($map, $x, $y, sub {
138 warn $pl->ob->name, ": enter map check\n";#d#
139 $_[0]
140 }, sub {
141 warn $pl->ob->name, ": enter map done\n";#d#
142 });
143 warn $pl->ob->name, ": enter map 6\n";#d#
144
132} 145}
133 146
134# delete a player directory, be non-blocking AND synchronous... 147# delete a player directory, be non-blocking AND synchronous...
135# (thats hard, so we crap out and fork). 148# (thats hard, so we crap out and fork).
136sub nuke_playerdir { 149sub nuke_playerdir {
209 cf::NDI_BLUE 222 cf::NDI_BLUE
210 ); 223 );
211 224
212 # read username 225 # read username
213 while () { 226 while () {
214 $user = query $ns, 0, "What is your name?\n:"; 227 $user = query $ns, 0, "What is your name? (login names are case-sensitive)\n:";
215 228
216 if ($cf::LOGIN_LOCK{$user}) { 229 if ($cf::LOGIN_LOCK{$user}) {
217 $ns->send_drawinfo ( 230 $ns->send_drawinfo (
218 "That username is currently used in another login session. " 231 "That username is currently used in another login session. "
219 . "Chose another, or wait till the other session has ended.", 232 . "Chose another, or wait till the other session has ended.",
279 if ($cf::CFG{ext_login_nocheck} or $hash eq crypt $pass, $hash) { 292 if ($cf::CFG{ext_login_nocheck} or $hash eq crypt $pass, $hash) {
280 nuke_str $pass; 293 nuke_str $pass;
281 # password matches, wonderful 294 # password matches, wonderful
282 my $pl = cf::player::find $user or next; 295 my $pl = cf::player::find $user or next;
283 $pl->connect ($ns); 296 $pl->connect ($ns);
297 $pl->ob->flag (cf::FLAG_DEBUG, 1);#d# temp
284 enter_map $pl; 298 enter_map $pl;
285 last; 299 last;
286 } elsif (can_cleanup $pl, $mtime) { 300 } elsif (can_cleanup $pl, $mtime) {
287 Coro::Timer::sleep 1; 301 Coro::Timer::sleep 1;
288 302
377 } 391 }
378 } else { 392 } else {
379 $ob->roll_stats; 393 $ob->roll_stats;
380 } 394 }
381 395
382 Coro::Timer::sleep 0.2; 396 Coro::Timer::sleep 0.05;
383 } 397 }
384 398
385 $ob->set_animation (2); 399 $ob->set_animation (2);
386 $ob->add_statbonus; 400 $ob->add_statbonus;
387 401
398 412
399 $pl->chargen_race_next; 413 $pl->chargen_race_next;
400 Coro::Timer::sleep 0.2; 414 Coro::Timer::sleep 0.2;
401 } 415 }
402 416
417 # create the playerdir, if necessary, as chargen_race_done did it before
418 # presumably because of unique maps
419 aio_mkdir playerdir $pl, 0770;
403 $pl->chargen_race_done; 420 $pl->chargen_race_done;
404 421
405 while () { 422 while () {
406 my $res = query $ns, cf::CS_QUERY_SINGLECHAR, 423 my $res = query $ns, cf::CS_QUERY_SINGLECHAR,
407 "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; 424 "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n";
465 482
466 # update respawn position 483 # update respawn position
467 $pl->savebed ($bed->map->path, $bed->x, $bed->y); 484 $pl->savebed ($bed->map->path, $bed->x, $bed->y);
468 cf::async { $pl->save }; 485 cf::async { $pl->save };
469 486
470 $pl->killer ("left"); 487 my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy;
471 $ob->check_score; 488 $ob->check_score;
472 489
473 $ob->reply (undef, "In the future, you will wake up here when you die."); 490 $ob->reply (undef, "In the future, you will wake up here when you die.");
474 491
475 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { 492 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub {
549 $pl->destroy; # destroys $ob 566 $pl->destroy; # destroys $ob
550 } else { 567 } else {
551 my $a_ = $pl->refcnt;#d# 568 my $a_ = $pl->refcnt;#d#
552 my $b_ = $ob->refcnt;#d# 569 my $b_ = $ob->refcnt;#d#
553 570
554 warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# 571 warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref/3 ob $ob_ref/3 (C pl $a_/1 ob $b_/2)\n";#d#
555 } 572 }
556 } 573 }
557 } 574 }
558 }; 575 };
559 warn $@ if $@; 576 warn $@ if $@;
560 Coro::cede; 577 cf::cede_to_tick;
561 }; 578 };
562 } 579 }
563}; 580};
564 581
565$SCHEDULER->prio (1); 582$SCHEDULER->prio (1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines