* Updated packet documentation for
* Auction packets (IZ) * Homunculus packets (IZ) * Mail packets (IZ) * Pet packets (IZ) * Quest packets (IZ) * misc * Inter-server updates * Possible send wrong packet length for pincode and wispher to GM (@request) * ShowInfo if player change pincode * Showinfo "Asking to start pincode ..." only when 'pincode_enabled: yes' Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
This commit is contained in:
parent
7bedf4353b
commit
8bdea5ddef
File diff suppressed because it is too large
Load Diff
@ -168,26 +168,27 @@ int chclif_parse_pincode_change( int fd, struct char_session_data* sd ){
|
||||
return 0;
|
||||
if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id )
|
||||
return 1;
|
||||
else {
|
||||
char oldpin[PINCODE_LENGTH+1];
|
||||
char newpin[PINCODE_LENGTH+1];
|
||||
|
||||
memset(oldpin,0,PINCODE_LENGTH+1);
|
||||
memset(newpin,0,PINCODE_LENGTH+1);
|
||||
strncpy(oldpin, (char*)RFIFOP(fd,6), PINCODE_LENGTH);
|
||||
strncpy(newpin, (char*)RFIFOP(fd,10), PINCODE_LENGTH);
|
||||
RFIFOSKIP(fd,14);
|
||||
|
||||
char_pincode_decrypt(sd->pincode_seed,oldpin);
|
||||
if( !char_pincode_compare( fd, sd, oldpin ) )
|
||||
return 1;
|
||||
char_pincode_decrypt(sd->pincode_seed,newpin);
|
||||
|
||||
chlogif_pincode_notifyLoginPinUpdate( sd->account_id, newpin );
|
||||
strncpy(sd->pincode, newpin, sizeof(newpin));
|
||||
|
||||
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
||||
}
|
||||
else {
|
||||
char oldpin[PINCODE_LENGTH+1];
|
||||
char newpin[PINCODE_LENGTH+1];
|
||||
|
||||
memset(oldpin,0,PINCODE_LENGTH+1);
|
||||
memset(newpin,0,PINCODE_LENGTH+1);
|
||||
strncpy(oldpin, (char*)RFIFOP(fd,6), PINCODE_LENGTH);
|
||||
strncpy(newpin, (char*)RFIFOP(fd,10), PINCODE_LENGTH);
|
||||
RFIFOSKIP(fd,14);
|
||||
|
||||
char_pincode_decrypt(sd->pincode_seed,oldpin);
|
||||
if( !char_pincode_compare( fd, sd, oldpin ) )
|
||||
return 1;
|
||||
char_pincode_decrypt(sd->pincode_seed,newpin);
|
||||
|
||||
chlogif_pincode_notifyLoginPinUpdate( sd->account_id, newpin );
|
||||
strncpy(sd->pincode, newpin, sizeof(newpin));
|
||||
ShowInfo("Pincode changed for AID: %d\n", sd->account_id);
|
||||
|
||||
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -200,19 +201,19 @@ int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd ){
|
||||
|
||||
if( charserv_config.pincode_config.pincode_enabled==0 || RFIFOL(fd,2) != sd->account_id )
|
||||
return 1;
|
||||
else {
|
||||
char newpin[PINCODE_LENGTH+1];
|
||||
memset(newpin,0,PINCODE_LENGTH+1);
|
||||
strncpy( newpin, (char*)RFIFOP(fd,6), PINCODE_LENGTH );
|
||||
RFIFOSKIP(fd,10);
|
||||
else {
|
||||
char newpin[PINCODE_LENGTH+1];
|
||||
memset(newpin,0,PINCODE_LENGTH+1);
|
||||
strncpy( newpin, (char*)RFIFOP(fd,6), PINCODE_LENGTH );
|
||||
RFIFOSKIP(fd,10);
|
||||
|
||||
char_pincode_decrypt( sd->pincode_seed, newpin );
|
||||
char_pincode_decrypt( sd->pincode_seed, newpin );
|
||||
|
||||
chlogif_pincode_notifyLoginPinUpdate( sd->account_id, newpin );
|
||||
strncpy( sd->pincode, newpin, strlen( newpin ) );
|
||||
chlogif_pincode_notifyLoginPinUpdate( sd->account_id, newpin );
|
||||
strncpy( sd->pincode, newpin, strlen( newpin ) );
|
||||
|
||||
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
||||
}
|
||||
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -368,9 +369,9 @@ void chclif_char_delete2_cancel_ack(int fd, int char_id, uint32 result) {
|
||||
|
||||
// CH: <0827>.W <char id>.L
|
||||
int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
|
||||
FIFOSD_CHECK(6)
|
||||
{
|
||||
int char_id, i;
|
||||
FIFOSD_CHECK(6)
|
||||
{
|
||||
int char_id, i;
|
||||
char* data;
|
||||
time_t delete_date;
|
||||
|
||||
@ -425,15 +426,15 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
|
||||
}
|
||||
|
||||
chclif_char_delete2_ack(fd, char_id, 1, delete_date);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B
|
||||
int chclif_parse_char_delete2_accept(int fd, struct char_session_data* sd) {
|
||||
FIFOSD_CHECK(12)
|
||||
{
|
||||
char birthdate[8+1];
|
||||
FIFOSD_CHECK(12)
|
||||
{
|
||||
char birthdate[8+1];
|
||||
int char_id, i, k;
|
||||
unsigned int base_level;
|
||||
char* data;
|
||||
@ -503,8 +504,8 @@ int chclif_parse_char_delete2_accept(int fd, struct char_session_data* sd) {
|
||||
sd->found_char[MAX_CHARS-1] = -1;
|
||||
|
||||
chclif_char_delete2_accept_ack(fd, char_id, 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// CH: <082b>.W <char id>.L
|
||||
|
@ -35,11 +35,13 @@ int chlogif_pincode_notifyLoginPinError( int account_id ){
|
||||
|
||||
int chlogif_pincode_notifyLoginPinUpdate( int account_id, char* pin ){
|
||||
if (login_fd > 0 && session[login_fd] && !session[login_fd]->flag.eof){
|
||||
WFIFOHEAD(login_fd,11);
|
||||
int size = 8 + PINCODE_LENGTH+1;
|
||||
WFIFOHEAD(login_fd,size);
|
||||
WFIFOW(login_fd,0) = 0x2738;
|
||||
WFIFOL(login_fd,2) = account_id;
|
||||
strncpy( (char*)WFIFOP(login_fd,6), pin, PINCODE_LENGTH+1 );
|
||||
WFIFOSET(login_fd,11);
|
||||
WFIFOW(login_fd,2) = size;
|
||||
WFIFOL(login_fd,4) = account_id;
|
||||
strncpy( (char*)WFIFOP(login_fd,8), pin, PINCODE_LENGTH+1 );
|
||||
WFIFOSET(login_fd,size);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -47,6 +49,7 @@ int chlogif_pincode_notifyLoginPinUpdate( int account_id, char* pin ){
|
||||
|
||||
void chlogif_pincode_start(int fd, struct char_session_data* sd){
|
||||
if( charserv_config.pincode_config.pincode_enabled ){
|
||||
ShowInfo("Asking to start pincode to AID: %d\n", sd->account_id);
|
||||
// PIN code system enabled
|
||||
if( sd->pincode[0] == '\0' ){
|
||||
// No PIN code has been set yet
|
||||
@ -75,6 +78,7 @@ void chlogif_pincode_start(int fd, struct char_session_data* sd){
|
||||
}
|
||||
}else{
|
||||
// PIN code system disabled
|
||||
//ShowInfo("Pincode is disabled.\n");
|
||||
chclif_pincode_sendstate( fd, sd, PINCODE_OK );
|
||||
}
|
||||
}
|
||||
@ -329,10 +333,8 @@ int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){
|
||||
} else {
|
||||
// send characters to player
|
||||
chclif_mmo_char_send(u_fd, sd);
|
||||
if(sd->version >= date2version(20110309)){
|
||||
ShowInfo("Asking to start pincode\n");
|
||||
if(sd->version >= date2version(20110309))
|
||||
chlogif_pincode_start(u_fd,sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
RFIFOSKIP(fd,79);
|
||||
|
@ -1002,7 +1002,7 @@ int mapif_parse_WisReply(int fd)
|
||||
// Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers)
|
||||
int mapif_parse_WisToGM(int fd)
|
||||
{
|
||||
unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
|
||||
unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.L <message>.?B
|
||||
|
||||
memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2));
|
||||
WBUFW(buf, 0) = 0x3803;
|
||||
|
@ -682,18 +682,18 @@ int logchrif_parse_setalloffline(int fd, int id){
|
||||
* @return 0 fail (packet does not have enough data), 1 success
|
||||
*/
|
||||
int logchrif_parse_updpincode(int fd){
|
||||
if( RFIFOREST(fd) < 11 )
|
||||
if( RFIFOREST(fd) < 8 + PINCODE_LENGTH+1 )
|
||||
return 0;
|
||||
else{
|
||||
struct mmo_account acc;
|
||||
AccountDB* accounts = login_get_accounts_db();
|
||||
|
||||
if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ){
|
||||
strncpy( acc.pincode, (char*)RFIFOP(fd,6), 5 );
|
||||
if( accounts->load_num(accounts, &acc, RFIFOL(fd,4) ) ){
|
||||
strncpy( acc.pincode, (char*)RFIFOP(fd,8), PINCODE_LENGTH+1 );
|
||||
acc.pincode_change = time( NULL );
|
||||
accounts->save(accounts, &acc);
|
||||
}
|
||||
RFIFOSKIP(fd,11);
|
||||
RFIFOSKIP(fd,8 + PINCODE_LENGTH+1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes)
|
||||
if (CheckForCharServer())
|
||||
return 0;
|
||||
mes_len = strlen(mes) + 1; // + null
|
||||
WFIFOHEAD(inter_fd, mes_len + 32);
|
||||
WFIFOHEAD(inter_fd, mes_len + 8 + NAME_LENGTH);
|
||||
WFIFOW(inter_fd,0) = 0x3003;
|
||||
WFIFOW(inter_fd,2) = mes_len + 32;
|
||||
memcpy(WFIFOP(inter_fd,4), wisp_name, NAME_LENGTH);
|
||||
@ -1200,7 +1200,7 @@ int intif_parse_WisMessage(int fd)
|
||||
}
|
||||
//Success to send whisper.
|
||||
clif_wis_message(sd->fd, wisp_source, (char*)RFIFOP(fd,56),RFIFOW(fd,2)-56);
|
||||
intif_wis_replay(id,0); // succes
|
||||
intif_wis_replay(id,0); // success
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1258,12 +1258,12 @@ int mapif_parse_WisToGM(int fd)
|
||||
char Wisp_name[NAME_LENGTH];
|
||||
char *message;
|
||||
|
||||
mes_len = RFIFOW(fd,2) - 32;
|
||||
mes_len = RFIFOW(fd,2) - 8+NAME_LENGTH;
|
||||
message = (char *) aMalloc(mes_len);
|
||||
|
||||
permission = RFIFOL(fd,28);
|
||||
permission = RFIFOL(fd,4+NAME_LENGTH);
|
||||
safestrncpy(Wisp_name, (char*)RFIFOP(fd,4), NAME_LENGTH);
|
||||
safestrncpy(message, (char*)RFIFOP(fd,32), mes_len);
|
||||
safestrncpy(message, (char*)RFIFOP(fd,8+NAME_LENGTH), mes_len);
|
||||
// information is sent to all online GM
|
||||
map_foreachpc(mapif_parse_WisToGM_sub, permission, Wisp_name, message, mes_len);
|
||||
aFree(message);
|
||||
@ -2891,7 +2891,7 @@ void intif_itembound_req(int char_id,int aid,int guild_id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Acknoledge the good deletion of the bound item
|
||||
* Acknowledge the good deletion of the bound item
|
||||
* (unlock the guild storage)
|
||||
* @struct : 0x3856 <aid>.L <gid>.W
|
||||
* @param fd : Char-serv link
|
||||
@ -2973,18 +2973,15 @@ int intif_parse(int fd)
|
||||
case 0x3840: intif_parse_GuildCastleDataLoad(fd); break;
|
||||
case 0x3843: intif_parse_GuildMasterChanged(fd); break;
|
||||
|
||||
//Quest system
|
||||
case 0x3860: intif_parse_questlog(fd); break;
|
||||
case 0x3861: intif_parse_questsave(fd); break;
|
||||
|
||||
// Mail System
|
||||
// Mail System
|
||||
case 0x3848: intif_parse_Mail_inboxreceived(fd); break;
|
||||
case 0x3849: intif_parse_Mail_new(fd); break;
|
||||
case 0x384a: intif_parse_Mail_getattach(fd); break;
|
||||
case 0x384b: intif_parse_Mail_delete(fd); break;
|
||||
case 0x384c: intif_parse_Mail_return(fd); break;
|
||||
case 0x384d: intif_parse_Mail_send(fd); break;
|
||||
// Auction System
|
||||
|
||||
// Auction System
|
||||
case 0x3850: intif_parse_Auction_results(fd); break;
|
||||
case 0x3851: intif_parse_Auction_register(fd); break;
|
||||
case 0x3852: intif_parse_Auction_cancel(fd); break;
|
||||
@ -2992,28 +2989,37 @@ int intif_parse(int fd)
|
||||
case 0x3854: intif_parse_Auction_message(fd); break;
|
||||
case 0x3855: intif_parse_Auction_bid(fd); break;
|
||||
|
||||
//Bound items
|
||||
//Bound items
|
||||
#ifdef BOUND_ITEMS
|
||||
case 0x3856: intif_parse_itembound_ack(fd); break;
|
||||
#endif
|
||||
|
||||
//Quest system
|
||||
case 0x3860: intif_parse_questlog(fd); break;
|
||||
case 0x3861: intif_parse_questsave(fd); break;
|
||||
|
||||
// Mercenary System
|
||||
case 0x3870: intif_parse_mercenary_received(fd); break;
|
||||
case 0x3871: intif_parse_mercenary_deleted(fd); break;
|
||||
case 0x3872: intif_parse_mercenary_saved(fd); break;
|
||||
|
||||
// Elemental System
|
||||
case 0x387c: intif_parse_elemental_received(fd); break;
|
||||
case 0x387d: intif_parse_elemental_deleted(fd); break;
|
||||
case 0x387e: intif_parse_elemental_saved(fd); break;
|
||||
|
||||
// Pet System
|
||||
case 0x3880: intif_parse_CreatePet(fd); break;
|
||||
case 0x3881: intif_parse_RecvPetData(fd); break;
|
||||
case 0x3882: intif_parse_SavePetOk(fd); break;
|
||||
case 0x3883: intif_parse_DeletePetOk(fd); break;
|
||||
|
||||
// Homunculus
|
||||
case 0x3890: intif_parse_CreateHomunculus(fd); break;
|
||||
case 0x3891: intif_parse_RecvHomunculusData(fd); break;
|
||||
case 0x3892: intif_parse_SaveHomunculusOk(fd); break;
|
||||
case 0x3893: intif_parse_DeleteHomunculusOk(fd); break;
|
||||
|
||||
default:
|
||||
ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0));
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user