1 | #! perl # MANDATORY |
1 | #! perl # mandatory |
2 | |
2 | |
3 | # login handling |
3 | # login handling |
4 | |
4 | |
5 | use Fcntl; |
5 | use Fcntl; |
6 | use Coro::AIO; |
6 | use Coro::AIO; |
7 | use List::Util qw(min max); |
7 | use List::Util qw(min max); |
|
|
8 | |
|
|
9 | our %EXT_SETUP; |
8 | |
10 | |
9 | # paranoia function to overwrite a string-in-place |
11 | # paranoia function to overwrite a string-in-place |
10 | sub nuke_str { |
12 | sub nuke_str { |
11 | substr $_[0], 0, (length $_[0]), "x" x length $_[0] |
13 | substr $_[0], 0, (length $_[0]), "x" x length $_[0] |
12 | } |
14 | } |
… | |
… | |
206 | |
208 | |
207 | } elsif ($k eq "fxix") { |
209 | } elsif ($k eq "fxix") { |
208 | $ns->fxix ($v); |
210 | $ns->fxix ($v); |
209 | |
211 | |
210 | } elsif ($k eq "msg") { |
212 | } elsif ($k eq "msg") { |
211 | $ns->can_msg ($v); |
213 | $ns->can_msg ($v >= 2); |
|
|
214 | $setup{$k} = $ns->can_msg; |
212 | |
215 | |
213 | } elsif ($k eq "excmd") { |
216 | } elsif ($k eq "excmd") { |
214 | # we support it |
217 | # we support it |
215 | |
218 | |
216 | } else { |
219 | } else { |
… | |
… | |
474 | $pl->chargen_race_next; |
477 | $pl->chargen_race_next; |
475 | } |
478 | } |
476 | |
479 | |
477 | $pl->chargen_race_done; |
480 | $pl->chargen_race_done; |
478 | |
481 | |
|
|
482 | while () { |
|
|
483 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
|
|
484 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
|
|
485 | |
|
|
486 | if ($res =~ /^[fF]/) { |
|
|
487 | $pl->gender (1); |
|
|
488 | last; |
|
|
489 | } elsif ($res =~ /^[mM]/) { |
|
|
490 | $pl->gender (0); |
|
|
491 | last; |
|
|
492 | } |
|
|
493 | } |
|
|
494 | |
|
|
495 | $ob->reply (undef, "Welcome to Crossfire!"); |
|
|
496 | |
479 | delete $pl->{deny_save}; |
497 | delete $pl->{deny_save}; |
480 | |
498 | |
481 | last; |
499 | last; |
482 | } |
500 | } |
483 | }); |
501 | }); |
… | |
… | |
606 | |
624 | |
607 | # remove from sight and get fresh "copies" |
625 | # remove from sight and get fresh "copies" |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
626 | $pl = delete $cf::PLAYER{$ob->name}; |
609 | $ob = $pl->ob; |
627 | $ob = $pl->ob; |
610 | |
628 | |
611 | $ob->destroy; |
|
|
612 | $pl->destroy; |
629 | $pl->destroy; # destroys $ob |
613 | } else { |
630 | } else { |
614 | my $a_ = $pl->refcnt;#d# |
631 | my $a_ = $pl->refcnt;#d# |
615 | my $b_ = $ob->refcnt;#d# |
632 | my $b_ = $ob->refcnt;#d# |
616 | |
633 | |
617 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
634 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |