… | |
… | |
58 | my $y = $ob->y; |
58 | my $y = $ob->y; |
59 | |
59 | |
60 | # never happens normally, but helps when shell users make mistakes |
60 | # never happens normally, but helps when shell users make mistakes |
61 | $m->linkable |
61 | $m->linkable |
62 | or return 1; |
62 | or return 1; |
63 | |
|
|
64 | # return 0;#d# |
|
|
65 | # warn join ":", $m->at ($x, $y);#d# |
|
|
66 | # warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; |
|
|
67 | # return 0; |
|
|
68 | |
63 | |
69 | scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) |
64 | scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) |
70 | } |
65 | } |
71 | |
66 | |
72 | sub enter_map { |
67 | sub enter_map { |
… | |
… | |
335 | my $token = $pl->password; |
330 | my $token = $pl->password; |
336 | |
331 | |
337 | if ($cf::CFG{ext_login_nocheck} or compare_password $pass, $token) { |
332 | if ($cf::CFG{ext_login_nocheck} or compare_password $pass, $token) { |
338 | # player exists and passwords match - we can proceed |
333 | # player exists and passwords match - we can proceed |
339 | |
334 | |
340 | $pl->password (encode_password $pass); # make sure we store the new encoding #d# |
|
|
341 | # password matches, wonderful |
335 | # password matches, wonderful |
342 | my $pl = cf::player::find $user or next; |
336 | my $pl = cf::player::find $user or next; |
343 | $pl->connect ($ns); |
337 | $pl->connect ($ns); |
344 | enter_map $pl; |
338 | enter_map $pl; |
345 | login_done $pl; |
339 | login_done $pl; |
… | |
… | |
409 | chargen $ns, $user, $pass; |
403 | chargen $ns, $user, $pass; |
410 | login_done $ns->pl; |
404 | login_done $ns->pl; |
411 | }); |
405 | }); |
412 | }); |
406 | }); |
413 | |
407 | |
|
|
408 | cf::client->attach ( |
|
|
409 | on_version => sub { |
|
|
410 | my ($ns, $arg) = @_; |
|
|
411 | |
|
|
412 | $ns->ext_msg (nonces => map { join "", map { chr rand 256 } 0..63 } 1..2); |
|
|
413 | |
|
|
414 | fatal ($ns,"oops");#d# |
|
|
415 | }, |
|
|
416 | ); |
|
|
417 | |
|
|
418 | #cf::register_async_exticmd create_login => sub { |
|
|
419 | # my ($ns, $reply, $user, $pass) = @_; |
|
|
420 | # |
|
|
421 | # $ns->pl and return $ns->destroy; |
|
|
422 | #}; |
|
|
423 | |
|
|
424 | cf::register_async_exticmd login => sub { |
|
|
425 | my ($ns, $reply, $user, $hash) = @_; |
|
|
426 | |
|
|
427 | $ns->pl and return $ns->destroy; |
|
|
428 | }; |
|
|
429 | |
414 | cf::register_command password => sub { |
430 | cf::register_command password => sub { |
415 | my ($pl, $arg) = @_; |
431 | my ($pl, $arg) = @_; |
416 | |
432 | |
417 | unless ($pl->flag (cf::FLAG_WIZ)) { |
433 | unless ($pl->flag (cf::FLAG_WIZ)) { |
418 | $pl->message ( |
434 | $pl->message ( |