… | |
… | |
53 | } |
53 | } |
54 | |
54 | |
55 | sub enter_map { |
55 | sub enter_map { |
56 | my ($pl) = @_; |
56 | my ($pl) = @_; |
57 | |
57 | |
|
|
58 | my $ob = $pl->ob; |
|
|
59 | |
58 | my ($map, $x, $y) |
60 | my ($map, $x, $y) |
59 | = $pl->ob->{_link_pos} |
61 | = $ob->{_link_pos} |
60 | ? @{delete $pl->ob->{_link_pos}} |
62 | ? @{delete $ob->{_link_pos}} |
61 | : ($pl->maplevel, $pl->ob->x, $pl->ob->y); |
63 | : ($pl->maplevel, $ob->x, $ob->y); |
62 | |
64 | |
63 | $pl->ob->enter_link; |
65 | $ob->enter_link; |
64 | |
66 | |
65 | if (my $time = delete $pl->{unclean_save}) { |
67 | if (my $time = delete $pl->{unclean_save}) { |
66 | if (my $m = cf::map::find $map) { |
68 | if (my $m = cf::map::find $map) { |
67 | if ($time < $m->{instantiate_time}) { |
69 | if ($time < $m->{instantiate_time}) { |
68 | # the map was reset in the meantime |
70 | # the map was reset in the meantime |
69 | my $age = $cf::RUNTIME - $time; |
71 | my $age = $cf::RUNTIME - $time; |
70 | warn $pl->ob->name, " map reset after logout, logout age $age\n";#d# |
72 | warn $ob->name, " map reset after logout, logout age $age\n";#d# |
71 | |
73 | |
72 | # for now, just go back to savebed |
74 | # for now, just go back to savebed |
73 | ($map, $x, $y) = $pl->savebed; |
75 | ($map, $x, $y) = $pl->savebed; |
74 | |
76 | |
75 | $pl->ns->send_drawinfo ( |
77 | $pl->ns->send_drawinfo ( |
… | |
… | |
87 | ); |
89 | ); |
88 | } |
90 | } |
89 | } |
91 | } |
90 | } |
92 | } |
91 | |
93 | |
92 | $pl->ob->goto ($map, $x, $y); |
94 | $ob->goto ($map, $x, $y); |
93 | } |
95 | } |
94 | |
96 | |
95 | # delete a player directory, be non-blocking AND synchronous... |
97 | # delete a player directory, be non-blocking AND synchronous... |
96 | # (thats hard, so we crap out and fork). |
98 | # (thats hard, so we crap out and fork). |
97 | sub nuke_playerdir { |
99 | sub nuke_playerdir { |
… | |
… | |
184 | . "(only a-z, A-Z and 0-9 are allowed), " |
186 | . "(only a-z, A-Z and 0-9 are allowed), " |
185 | . "or is not between 3 and 18 characters in length.", |
187 | . "or is not between 3 and 18 characters in length.", |
186 | cf::NDI_RED |
188 | cf::NDI_RED |
187 | ); |
189 | ); |
188 | } |
190 | } |
|
|
191 | Coro::Timer::sleep 0.4; |
189 | } |
192 | } |
190 | |
193 | |
191 | check_playing $ns, $user and next; |
194 | check_playing $ns, $user and next; |
192 | |
195 | |
193 | $ns->send_drawinfo ( |
196 | $ns->send_drawinfo ( |
… | |
… | |
204 | $ns->send_drawinfo ( |
207 | $ns->send_drawinfo ( |
205 | "Try to use at least three characters as your password please, " |
208 | "Try to use at least three characters as your password please, " |
206 | . "that cannot be too much to ask for :)", |
209 | . "that cannot be too much to ask for :)", |
207 | cf::NDI_RED |
210 | cf::NDI_RED |
208 | ); |
211 | ); |
|
|
212 | Coro::Timer::sleep 0.4; |
209 | } |
213 | } |
210 | |
214 | |
211 | # lock this username for the remainder of this login session |
215 | # lock this username for the remainder of this login session |
212 | if ($cf::LOGIN_LOCK{$user}) { |
216 | if ($cf::LOGIN_LOCK{$user}) { |
213 | $ns->send_drawinfo ( |
217 | $ns->send_drawinfo ( |
… | |
… | |
294 | nuke_str $pass2; |
298 | nuke_str $pass2; |
295 | $ns->send_drawinfo ( |
299 | $ns->send_drawinfo ( |
296 | "The passwords do not match, please try again.", |
300 | "The passwords do not match, please try again.", |
297 | cf::NDI_RED |
301 | cf::NDI_RED |
298 | ); |
302 | ); |
|
|
303 | Coro::Timer::sleep 0.5; |
299 | next; |
304 | next; |
300 | } |
305 | } |
301 | |
306 | |
302 | nuke_str $pass2; |
307 | nuke_str $pass2; |
303 | |
308 | |
… | |
… | |
325 | $ob->swap_stats ($res - 1, $swap - 1); |
330 | $ob->swap_stats ($res - 1, $swap - 1); |
326 | } |
331 | } |
327 | } else { |
332 | } else { |
328 | $ob->roll_stats; |
333 | $ob->roll_stats; |
329 | } |
334 | } |
|
|
335 | |
|
|
336 | Coro::Timer::sleep 0.2; |
330 | } |
337 | } |
331 | |
338 | |
332 | $ob->set_animation (2); |
339 | $ob->set_animation (2); |
333 | $ob->add_statbonus; |
340 | $ob->add_statbonus; |
334 | |
341 | |
… | |
… | |
342 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
349 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
343 | |
350 | |
344 | last if $res =~ /[dD]/; |
351 | last if $res =~ /[dD]/; |
345 | |
352 | |
346 | $pl->chargen_race_next; |
353 | $pl->chargen_race_next; |
|
|
354 | Coro::Timer::sleep 0.2; |
347 | } |
355 | } |
348 | |
356 | |
349 | $pl->chargen_race_done; |
357 | $pl->chargen_race_done; |
350 | |
358 | |
351 | while () { |
359 | while () { |
… | |
… | |
357 | last; |
365 | last; |
358 | } elsif ($res =~ /^[mM]/) { |
366 | } elsif ($res =~ /^[mM]/) { |
359 | $pl->gender (0); |
367 | $pl->gender (0); |
360 | last; |
368 | last; |
361 | } |
369 | } |
|
|
370 | Coro::Timer::sleep 0.2; |
362 | } |
371 | } |
363 | |
372 | |
364 | $ob->reply (undef, "Welcome to Crossfire!"); |
373 | $ob->reply (undef, "Welcome to Crossfire!"); |
365 | |
374 | |
366 | delete $pl->{deny_save}; |
375 | delete $pl->{deny_save}; |