Skip to content

Commit

Permalink
Fixed #122 @accountinfo issue
Browse files Browse the repository at this point in the history
* Now inter-server always asking to login-server for account info instead using direct query to `login` table. Merged from HerculesWS/Hercules@da233d5
* Inter-server packet usage: HA 0x2720 & AH 0x2721
* Additional changes from inter-server to map-server to parse the account info result with type 1 by using packet 0x3808 for clif_account_name(). Just some changes from @lighta at his old diff
* Moved some messages to char_msg.conf
* Updated inter-server packet documentation

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
  • Loading branch information
cydh committed Nov 22, 2014
1 parent 5386d2e commit a212839
Show file tree
Hide file tree
Showing 12 changed files with 326 additions and 124 deletions.
17 changes: 17 additions & 0 deletions conf/msg_conf/char_msg.conf
Expand Up @@ -128,3 +128,20 @@
209: You have placed a higher bid.
210: You have won the auction.
211: Payment for your auction!.

// @accountinfo
212: No matches were found for your criteria, '%s'
213: An error occured, bother your admin about it.
214: Your query returned the following %d results, please be more specific...
215: [AID: %d] %s | %s | Level: %d/%d | %s
216: No account with ID '%d' was found.
217: -- Account %d --
218: User: %s | GM Group: %d | State: %d
219: Password: %s (PIN:%s)
220: ****
221: Account e-mail: %s | Birthdate: %s
222: Last IP: %s (%s)
223: This user has logged in %d times, the last time was at %s
224: -- Character Details --
225: [Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s
226: This account doesn't have characters.
61 changes: 56 additions & 5 deletions doc/packet_interserv.txt
Expand Up @@ -140,8 +140,45 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
- Ping request from char-server

0x2720:
Type: HA
Structure: <cmd>.W <map_fd>.L <u_fd>.L <u_aid>.L <u_group>.L <account_id>.L
index: 0,2,6,10,14,18
len: 22
parameter:
- cmd : packet identification (0x2720)
- map_fd :
- u_fd :
- u_aid :
- u_group :
- account_id :
desc:
-

0x2721:
free
Type: AH
Structure: <cmd>.W <map_fd>.L <u_fd>.L <u_aid>.L <account_id>.L <status>.B <password>.33B <email>.40B <last_ip>.16B <last_login>.24B <group_id>.L <logincount>.L <state>.L <password>.33B <birthdate>.11B <pincode>.?B <userid>.?B
index: 0,2,6,10,18,19,52,92,108,132,136,140,144,155,155+PINCODE_LENGTH
len: 155 + PINCODE_LENGTH + NAME_LENGTH
parameter:
- cmd : packet identification (0x2721)
- map_fd
- u_fd
- u_aid
- account_id
- status: 0 - Failed
- password
- email
- last_ip
- last_login
- group_id
- logincount
- state
- password
- birthdate
- pincode
- userid
desc:
-

0x2722:
Type: HA
Expand Down Expand Up @@ -567,15 +604,16 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x3007
Type: ZI
Structure: <cmd>.W <u_fd>.L <aid>.L <group_lv>.L
index: 0,2,6,10,14
len: 14+NAME_LENGTH
Structure: <cmd>.W <u_fd>.L <aid>.L <group_lv>.L <type>.B <query>.?B
index: 0,2,6,10,14,15
len: 15+NAME_LENGTH
parameter:
- cmd : packet identification (0x3007)
- u_fd
- aid
- group_lv
- query
- type : 0 - Full account info. 1 - Return as clif_account_name
- query : name or aid of player we want info
desc:
- Request acc info

Expand Down Expand Up @@ -1449,6 +1487,19 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
desc:
- sends a mesasge to map server (fd) to a user (u_fd) although we use fd we keep aid for safe-check

0x3808
Type: IZ
Structure: <cmd>.W <u_fd>.L <aid>.L <acc_name>.?B
index: 0,2,6,10
len: variable: 10+NAME+LENGTH
parameter:
- cmd : packet identification (0x3807)
- u_fd
- aid
- acc_name
desc:
- Transmit the result of a account_information request from map-serv, with type 1

0x3818
Type: IZ
Structure: <cmd>.W <len>.W <aid>.L <guild_id>.L <flag>.B <guild_storage>.?B
Expand Down
68 changes: 56 additions & 12 deletions src/char/char_logif.c
Expand Up @@ -609,10 +609,52 @@ int chlogif_reqvipdata(uint32 aid, uint8 type, int32 timediff, int mapfd) {
return 0;
}

/**
* HA 0x2720
* Request account info to login-server
*/
int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int u_group, int account_id, int8 type) {
loginif_check(-1);
//ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type);
WFIFOHEAD(login_fd,23);
WFIFOW(login_fd,0) = 0x2720;
WFIFOL(login_fd,2) = fd;
WFIFOL(login_fd,6) = u_fd;
WFIFOL(login_fd,10) = u_aid;
WFIFOL(login_fd,14) = u_group;
WFIFOL(login_fd,18) = account_id;
WFIFOB(login_fd,22) = type;
WFIFOSET(login_fd,23);
return 1;
}

/**
* AH 0x2721
* Retrieve account info from login-server, ask inter-server to tell player
*/
int chlogif_parse_AccInfoAck(int fd) {
if (RFIFOREST(fd) < 19)
return 0;
else {
int8 type = RFIFOB(fd, 18);
if (type == 0 || RFIFOREST(fd) < 155+PINCODE_LENGTH+NAME_LENGTH) {
mapif_accinfo_ack(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), 0, -1, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
RFIFOSKIP(fd,19);
return 1;
}
type>>=1;
mapif_accinfo_ack(true, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), type, RFIFOL(fd,19), RFIFOL(fd,23), RFIFOL(fd,27),
(char*)RFIFOP(fd,31), (char*)RFIFOP(fd,71), (char*)RFIFOP(fd,87), (char*)RFIFOP(fd,111),
(char*)RFIFOP(fd,122), (char*)RFIFOP(fd,155), (char*)RFIFOP(fd,155+PINCODE_LENGTH));
RFIFOSKIP(fd,155+PINCODE_LENGTH+NAME_LENGTH);
}
return 1;
}


int chlogif_parse(int fd) {
struct char_session_data* sd = NULL;

// only process data from the login-server
if( fd != login_fd ) {
ShowDebug("parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n", fd);
Expand Down Expand Up @@ -645,26 +687,28 @@ int chlogif_parse(int fd) {
uint16 command = RFIFOW(fd,0);
switch( command )
{
case 0x2741: next=chlogif_parse_BankingAck(fd); break;
case 0x2743: next=chlogif_parse_vipack(fd); break;
case 0x2741: next = chlogif_parse_BankingAck(fd); break;
case 0x2743: next = chlogif_parse_vipack(fd); break;
// acknowledgement of connect-to-loginserver request
case 0x2711: next=chlogif_parse_ackconnect(fd,sd); break;
case 0x2711: next = chlogif_parse_ackconnect(fd,sd); break;
// acknowledgement of account authentication request
case 0x2713: next=chlogif_parse_ackaccreq(fd, sd); break;
case 0x2713: next = chlogif_parse_ackaccreq(fd, sd); break;
// account data
case 0x2717: next=chlogif_parse_reqaccdata(fd, sd); break;
case 0x2717: next = chlogif_parse_reqaccdata(fd, sd); break;
// login-server alive packet
case 0x2718: next=chlogif_parse_keepalive(fd, sd); break;
case 0x2718: next = chlogif_parse_keepalive(fd, sd); break;
// changesex reply
case 0x2723: next=chlogif_parse_ackchangesex(fd, sd); break;
case 0x2723: next = chlogif_parse_ackchangesex(fd, sd); break;
// reply to an account_reg2 registry request
case 0x2729: next=chlogif_parse_ackacc2req(fd, sd); break;
case 0x2729: next = chlogif_parse_ackacc2req(fd, sd); break;
// State change of account/ban notification (from login-server)
case 0x2731: next=chlogif_parse_accbannotification(fd, sd); break;
case 0x2731: next = chlogif_parse_accbannotification(fd, sd); break;
// Login server request to kick a character out. [Skotlex]
case 0x2734: next=chlogif_parse_askkick(fd,sd); break;
case 0x2734: next = chlogif_parse_askkick(fd,sd); break;
// ip address update signal from login server
case 0x2735: next=chlogif_parse_updip(fd,sd); break;
case 0x2735: next = chlogif_parse_updip(fd,sd); break;
// @accinfo result
case 0x2721: next = chlogif_parse_AccInfoAck(fd); break;
default:
ShowError("Unknown packet 0x%04x received from login-server, disconnecting.\n", command);
set_eof(fd);
Expand Down
1 change: 1 addition & 0 deletions src/char/char_logif.h
Expand Up @@ -40,6 +40,7 @@ int chlogif_BankingReq(int32 account_id, int8 type, int32 data);
int chlogif_parse_BankingAck(int fd);
int chlogif_parse_vipack(int fd);
int chlogif_reqvipdata(uint32 aid, uint8 type, int32 timediff, int mapfd);
int chlogif_req_accinfo(int fd, int u_fd, int u_aid, int u_group, int account_id, int8 type);

int chlogif_parse(int fd);

Expand Down

2 comments on commit a212839

@tmav94
Copy link

@tmav94 tmav94 commented on a212839 Nov 24, 2014

Choose a reason for hiding this comment

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

NOTE TO ME: I STOPPED HERE!

@lighta
Copy link
Member

@lighta lighta commented on a212839 Nov 25, 2014

Choose a reason for hiding this comment

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

=)
@accinfo will be fine, now I remember what I wasn't sure at the time was the clif call, since as I remenber there was some doubt about that this action should return a name or was to fullstrip or something like that...
Anyway it's better like this anyway and the clif part could be remaped by db so win win =)

Please sign in to comment.