summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-04-05 17:23:04 -0400
committergumi <git@gumi.ca>2018-04-05 17:23:09 -0400
commit1acf5016d8dc5cdc93e7cb3ed655dde5ff04ca33 (patch)
treec8959d576f47b5ee0e3a95595fbcf3097107fca8
parent06770d49189dd647ccd836ed738e9a4560e0118e (diff)
downloadtmwa-1acf5016d8dc5cdc93e7cb3ed655dde5ff04ca33.tar.gz
tmwa-1acf5016d8dc5cdc93e7cb3ed655dde5ff04ca33.tar.bz2
tmwa-1acf5016d8dc5cdc93e7cb3ed655dde5ff04ca33.tar.xz
tmwa-1acf5016d8dc5cdc93e7cb3ed655dde5ff04ca33.zip
preemptively send auth details to char server
why wasn't this already the case? o_o
-rw-r--r--src/char/char.cpp20
-rw-r--r--src/login/login.cpp48
-rwxr-xr-xtools/protocol.py16
3 files changed, 69 insertions, 15 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 8e687d6..22e8162 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -1237,6 +1237,26 @@ void parse_tologin(Session *ls)
break;
}
+ case 0x2715:
+ {
+ Packet_Fixed<0x2715> fixed;
+ rv = recv_fpacket<0x2715, 22>(ls, fixed);
+ if (rv != RecvResult::Complete)
+ break;
+
+ if (auth_fifo_iter == auth_fifo.end())
+ auth_fifo_iter = auth_fifo.begin();
+ auth_fifo_iter->account_id = fixed.account_id;
+ auth_fifo_iter->char_id = CharId();
+ auth_fifo_iter->login_id1 = fixed.login_id1;
+ auth_fifo_iter->login_id2 = fixed.login_id2;
+ auth_fifo_iter->delflag = 2;
+ auth_fifo_iter->ip = fixed.ip;
+ auth_fifo_iter->client_version = fixed.client_protocol_version;
+ auth_fifo_iter++;
+ break;
+ }
+
// Receiving of an e-mail/time limit from the login-server (answer of a request because a player comes back from map-server to char-server) by [Yor]
case 0x2717:
{
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 16cfaaa..c108205 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -2514,21 +2514,39 @@ void parse_login(Session *s)
// if at least 1 char-server
if (repeat_69.size())
{
- if (auth_fifo_pos >= AUTH_FIFO_SIZE)
- auth_fifo_pos = 0;
- auth_fifo[auth_fifo_pos].account_id =
- account.account_id;
- auth_fifo[auth_fifo_pos].login_id1 =
- account.login_id1;
- auth_fifo[auth_fifo_pos].login_id2 =
- account.login_id2;
- auth_fifo[auth_fifo_pos].sex = account.sex;
- auth_fifo[auth_fifo_pos].delflag = 0;
- auth_fifo[auth_fifo_pos].ip =
- s->client_ip;
- auth_fifo[auth_fifo_pos].client_version =
- fixed.client_protocol_version;
- auth_fifo_pos++;
+ // pre-send the auth validation to char server
+ {
+ Packet_Fixed<0x2715> fixed_27;
+ fixed_27.account_id = account.account_id;
+ fixed_27.login_id1 = account.login_id1;
+ fixed_27.login_id2 = account.login_id2;
+ fixed_27.ip = s->client_ip;
+ fixed_27.client_protocol_version = fixed.client_protocol_version;
+
+ for (Session *ss : iter_char_sessions())
+ send_fpacket<0x2715, 22>(ss, fixed_27);
+ }
+
+ // since char server already knows our auth ids this
+ // shouldn't be necessary, but we're keeping it just
+ // in case, because why not
+ {
+ if (auth_fifo_pos >= AUTH_FIFO_SIZE)
+ auth_fifo_pos = 0;
+ auth_fifo[auth_fifo_pos].account_id =
+ account.account_id;
+ auth_fifo[auth_fifo_pos].login_id1 =
+ account.login_id1;
+ auth_fifo[auth_fifo_pos].login_id2 =
+ account.login_id2;
+ auth_fifo[auth_fifo_pos].sex = account.sex;
+ auth_fifo[auth_fifo_pos].delflag = 0;
+ auth_fifo[auth_fifo_pos].ip =
+ s->client_ip;
+ auth_fifo[auth_fifo_pos].client_version =
+ fixed.client_protocol_version;
+ auth_fifo_pos++;
+ }
Packet_Head<0x0069> head_69;
head_69.login_id1 = account.login_id1;
diff --git a/tools/protocol.py b/tools/protocol.py
index 1001158..a6a9e39 100755
--- a/tools/protocol.py
+++ b/tools/protocol.py
@@ -4904,6 +4904,22 @@ def build_context():
This occurs every few seconds, so is also used for antifreeze if enabled.
''',
)
+ login_char.r(0x2715, 'send auth',
+ fixed=[
+ at(0, u16, 'packet id'),
+ at(2, account_id, 'account id'),
+ at(6, u32, 'login id1'),
+ at(10, u32, 'login id2'),
+ at(14, ip4, 'ip'),
+ at(18, client_version, 'client protocol version'),
+ ],
+ fixed_size=22,
+ pre=[0x0065],
+ post=[0x006b, 0x006c],
+ desc='''
+ Send the auth data to char server
+ ''',
+ )
login_char.r(0x2716, 'email limit',
fixed=[
at(0, u16, 'packet id'),