Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config] [XKore] add option to auto reply pincode request #3365

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions control/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ XKore_listenIp 127.0.0.1
XKore_listenPort 6901
XKore_publicIp 127.0.0.1
XKore_ID

# XKore misc configuration
XKore_autoReplyPinCode 1

# It is not advised to set secureAdminPassword if you're using Xkore 2
secureAdminPassword 1
Expand Down
2 changes: 1 addition & 1 deletion src/Network/Receive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3912,7 +3912,7 @@ sub login_pin_code_request {
# This is ten second-level password login for 2013/3/29 upgrading of twRO
my ($self, $args) = @_;

if($args->{flag} ne 0 && ($config{XKore} eq "1" || $config{XKore} eq "3")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you decide to remove this check?
$args->{flag} ne 0

if($args->{flag} ne 0 && ($config{XKore} eq "1" || $config{XKore} eq "3") && !$config{XKore_autoReplyPinCode}) {
$timeout{master}{time} = time;
return;
}
Expand Down
63 changes: 0 additions & 63 deletions src/Network/Receive/RMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ package Network::Receive::RMS;

use strict;
use base qw(Network::Receive::kRO::RagexeRE_2014_10_22b);
use Globals qw($firstLoginMap $startingzeny @chars %config $sentWelcomeMessage $accountID $messageSender %timeout);
use Log qw(debug message warning error);
use Translation qw(T);
use Utils qw(getHex);
use Misc qw(charSelectScreen);

sub new {
my ($class) = @_;
Expand All @@ -29,62 +24,4 @@ sub new {
return $self;
}

sub login_pin_code_request {
my ($self, $args) = @_;
# flags:
# 0 - correct - RMS
# 1 - requested (already defined) - RMS
# 3 - expired - RMS(?)
# 4 - requested (not defined) - RMS
# 7 - correct - RMS
# 8 - incorrect - RMS
if ($args->{flag} == 7) { # removed check for seed 0, eA/rA/brA sends a normal seed.
message T("PIN code is correct.\n"), "success";
# call charSelectScreen
if (charSelectScreen(1) == 1) {
$firstLoginMap = 1;
$startingzeny = $chars[$config{'char'}]{'zeny'} unless defined $startingzeny;
$sentWelcomeMessage = 1;
}
} elsif ($args->{flag} == 1) {
# PIN code query request.
$accountID = $args->{accountID};
debug sprintf("Account ID: %s (%s)\n", unpack('V',$accountID), getHex($accountID));

message T("Server requested PIN password in order to select your character.\n"), "connection";
return if ($config{loginPinCode} eq '' && !($self->queryAndSaveLoginPinCode()));
$messageSender->sendLoginPinCode($args->{seed}, 0);
} elsif ($args->{flag} == 4) {
# PIN code has never been set before, so set it.
warning T("PIN password is not set for this account.\n"), "connection";
return if ($config{loginPinCode} eq '' && !($self->queryAndSaveLoginPinCode()));

while ((($config{loginPinCode} =~ /[^0-9]/) || (length($config{loginPinCode}) != 4)) &&
!($self->queryAndSaveLoginPinCode("Your PIN should never contain anything but exactly 4 numbers.\n"))) {
error T("Your PIN should never contain anything but exactly 4 numbers.\n");
}
$messageSender->sendLoginPinCode($args->{seed}, 1);
} elsif ($args->{flag} == 3) {
# should we use the same one again? is it possible?
warning T("PIN password expired.\n"), "connection";
return if ($config{loginPinCode} eq '' && !($self->queryAndSaveLoginPinCode()));

while ((($config{loginPinCode} =~ /[^0-9]/) || (length($config{loginPinCode}) != 4)) &&
!($self->queryAndSaveLoginPinCode("Your PIN should never contain anything but exactly 4 numbers.\n"))) {
error T("Your PIN should never contain anything but exactly 4 numbers.\n");
}
$messageSender->sendLoginPinCode($args->{seed}, 1);
} elsif ($args->{flag} == 8) {
# PIN code incorrect.
error T("PIN code is incorrect.\n");
#configModify('loginPinCode', '', 1);
return if (!($self->queryAndSaveLoginPinCode(T("The login PIN code that you entered is incorrect. Please re-enter your login PIN code."))));
$messageSender->sendLoginPinCode($args->{seed}, 0);
} else {
debug("login_pin_code_request: unknown flag $args->{flag}\n");
}

$timeout{master}{time} = time;
}

1;