--- deliantra/server/ext/login.ext 2012/11/18 09:53:46 1.129 +++ deliantra/server/ext/login.ext 2012/11/18 10:00:55 1.130 @@ -11,14 +11,6 @@ our $VALID_LOGIN = qr<^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,19}\z>; our %LOGIN_LOCK; -# HACK: remove when done -sub cf::client::send_drawinfo { - my ($self, $text, $flags) = @_; - - utf8::encode $text; - $self->send_packet (sprintf "msg %d log %s", $flags || cf::NDI_BLACK, $text); -} - sub query { my ($ns, $flags, $text) = @_; @@ -97,7 +89,7 @@ . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " . "H", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); # kill them. # reminds me of the famous badness 10000 syndrome... @@ -111,7 +103,7 @@ . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " . "Better use a savebed next time, much worse things could have happened... " . "H", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); } } else { @@ -120,7 +112,7 @@ . "as lots of things could happen when you leave by other means, such as cave-ins, " . "or monsters suddenly snapping your body. Better use a savebed next time. " . "H", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); } } @@ -289,11 +281,11 @@ for (;;) { delete $ns->{login_guard}; - $ns->send_drawinfo ( + $ns->send_msg (log => "Please enter your username now. If you are a new user, " . "make one up that describes your character best. " . "Only letters and digits are allowed, though.", - cf::NDI_BLUE + cf::NDI_BLUE | cf::NDI_REPLY ); # read username @@ -303,11 +295,11 @@ if ($user =~ $VALID_LOGIN) { last; } else { - $ns->send_drawinfo ( + $ns->send_msg (log => "Your username contains illegal characters " . "(only a-z, A-Z and 0-9 are allowed), " . "or is not between 3 and 20 characters in length.", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); } Coro::Timer::sleep 0.4; @@ -315,31 +307,31 @@ $Coro::current->{desc} = "addme($user)"; - $ns->send_drawinfo ( + $ns->send_msg (log => "Welcome $user, please enter your password now. " . "New users should now choose a password. " . "Anything your client lets you enter is fine.", - cf::NDI_BLUE + cf::NDI_BLUE | cf::NDI_REPLY ); # read password while () { $pass = query $ns, cf::CS_QUERY_HIDEINPUT, "What is your password?\n:"; last if $pass =~ /.../; - $ns->send_drawinfo ( + $ns->send_msg (log => "Try to use at least three characters as your password please, " . "that cannot be too much to ask for :)", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); Coro::Timer::sleep 0.4; } $ns->{login_guard} = login_guard $user or do { - $ns->send_drawinfo ( + $ns->send_msg (log => "That user is already logged in (or is logging in)." . "Chose another, or wait till the other session has ended.", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); next; }; @@ -362,11 +354,11 @@ } elsif (can_cleanup $pl, $mtime) { Coro::Timer::sleep 1; - $ns->send_drawinfo ( + $ns->send_msg (log => "Player exists, but password does not match. If this is your account, " . "please try again. If not, you can now decide to take over this account " . "because it has not been in-use for some time.", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); (query $ns, cf::CS_QUERY_SINGLECHAR, "Delete existing account and create a new one (Y/N)?") =~ /^[yY]/ @@ -382,10 +374,10 @@ } else { Coro::Timer::sleep 1; - $ns->send_drawinfo ( + $ns->send_msg (log => "Wrong username or password. Please try again " . "(check for Numlock and other semi-obvious error sources).", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); next; } @@ -394,11 +386,11 @@ # check whether the player dir exists, which means the file is corrupted or # something very similar. if (!aio_stat cf::player::playerdir $user) { - $ns->send_drawinfo ( + $ns->send_msg ( log => "Unable to retrieve this player. It might be a locked or broken account. " . "If this is your account, ask a dungeon master for assistance. " . "Otherwise choose a different login name.", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); next; } @@ -407,9 +399,9 @@ my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again."; if ($pass2 ne $pass) { - $ns->send_drawinfo ( + $ns->send_msg (log => "The passwords do not match, please try again.", - cf::NDI_RED + cf::NDI_RED | cf::NDI_REPLY ); Coro::Timer::sleep 0.5; next;