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; |
|
|
215 | |
|
|
216 | } elsif ($k eq "xwidget") { |
|
|
217 | # eXperimental server-side widgets |
|
|
218 | $ns->{can_widget} = 1; |
212 | |
219 | |
213 | } elsif ($k eq "excmd") { |
220 | } elsif ($k eq "excmd") { |
214 | # we support it |
221 | # we support it |
215 | |
222 | |
216 | } else { |
223 | } else { |
… | |
… | |
474 | $pl->chargen_race_next; |
481 | $pl->chargen_race_next; |
475 | } |
482 | } |
476 | |
483 | |
477 | $pl->chargen_race_done; |
484 | $pl->chargen_race_done; |
478 | |
485 | |
|
|
486 | while () { |
|
|
487 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
|
|
488 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
|
|
489 | |
|
|
490 | if ($res =~ /^[fF]/) { |
|
|
491 | $pl->gender (1); |
|
|
492 | last; |
|
|
493 | } elsif ($res =~ /^[mM]/) { |
|
|
494 | $pl->gender (0); |
|
|
495 | last; |
|
|
496 | } |
|
|
497 | } |
|
|
498 | |
|
|
499 | $ob->reply (undef, "Welcome to Crossfire!"); |
|
|
500 | |
479 | delete $pl->{deny_save}; |
501 | delete $pl->{deny_save}; |
480 | |
502 | |
481 | last; |
503 | last; |
482 | } |
504 | } |
483 | }); |
505 | }); |
… | |
… | |
606 | |
628 | |
607 | # remove from sight and get fresh "copies" |
629 | # remove from sight and get fresh "copies" |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
630 | $pl = delete $cf::PLAYER{$ob->name}; |
609 | $ob = $pl->ob; |
631 | $ob = $pl->ob; |
610 | |
632 | |
611 | $ob->destroy; |
|
|
612 | $pl->destroy; |
633 | $pl->destroy; # destroys $ob |
613 | } else { |
634 | } else { |
614 | my $a_ = $pl->refcnt;#d# |
635 | my $a_ = $pl->refcnt;#d# |
615 | my $b_ = $ob->refcnt;#d# |
636 | my $b_ = $ob->refcnt;#d# |
616 | |
637 | |
617 | warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# |
638 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
618 | } |
639 | } |
619 | } |
640 | } |
620 | } |
641 | } |
621 | }; |
642 | }; |
622 | warn $@ if $@; |
643 | warn $@ if $@; |