|
@@ -182,6 +182,7 @@ int chclif_parse_pincode_check( int fd, struct char_session_data* sd ){
|
|
|
}
|
|
|
|
|
|
if( char_pincode_compare( fd, sd, pin ) ){
|
|
|
+ sd->pincode_correct = true;
|
|
|
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
|
|
}
|
|
|
return 1;
|
|
@@ -322,6 +323,7 @@ int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd ){
|
|
|
if( pincode_allowed(newpin) ){
|
|
|
chlogif_pincode_notifyLoginPinUpdate( sd->account_id, newpin );
|
|
|
strncpy( sd->pincode, newpin, sizeof( newpin ) );
|
|
|
+ sd->pincode_correct = true;
|
|
|
|
|
|
chclif_pincode_sendstate( fd, sd, PINCODE_PASSED );
|
|
|
}else{
|
|
@@ -757,6 +759,7 @@ int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl){
|
|
|
sd->login_id2 = login_id2;
|
|
|
sd->sex = sex;
|
|
|
sd->auth = false; // not authed yet
|
|
|
+ sd->pincode_correct = false; // not entered pincode correctly yet
|
|
|
|
|
|
// send back account_id
|
|
|
WFIFOHEAD(fd,4);
|
|
@@ -1569,6 +1572,44 @@ int chclif_parse(int fd) {
|
|
|
unsigned short cmd;
|
|
|
|
|
|
cmd = RFIFOW(fd,0);
|
|
|
+
|
|
|
+#if PACKETVER_SUPPORTS_PINCODE
|
|
|
+ // If the pincode system is enabled
|
|
|
+ if( charserv_config.pincode_config.pincode_enabled ){
|
|
|
+ switch( cmd ){
|
|
|
+ // Connect of player
|
|
|
+ case 0x65:
|
|
|
+ // Client keep-alive packet (every 12 seconds)
|
|
|
+ case 0x187:
|
|
|
+ // Checks the entered pin
|
|
|
+ case 0x8b8:
|
|
|
+ // Request for PIN window
|
|
|
+ case 0x8c5:
|
|
|
+ // Request character list
|
|
|
+ case 0x9a1:
|
|
|
+ // Connect of map-server
|
|
|
+ case 0x2af8:
|
|
|
+ break;
|
|
|
+
|
|
|
+ // Before processing any other packets, do a few checks
|
|
|
+ default:
|
|
|
+ // If the pincode was entered correctly
|
|
|
+ if( sd->pincode_correct ){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // If no pincode is set (yet)
|
|
|
+ if( strlen( sd->pincode ) <= 0 ){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // The pincode was not entered correctly, yet the player (=bot) tried to send a different packet => Goodbye!
|
|
|
+ set_eof( fd );
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
switch( cmd ) {
|
|
|
case 0x65: next=chclif_parse_reqtoconnect(fd,sd,ipl); break;
|
|
|
// char select
|