summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2013-03-16 12:36:24 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2013-03-16 12:36:24 +0800
commit5b1fee9ef54dbfc27fef5f6125a678fa88eba1be (patch)
tree6c98dfacc605296b32afcbef94190b7d72c3d0a8
parentf214021bb14aa3ab976730b32dd79d843ff8e93e (diff)
downloadhercules-5b1fee9ef54dbfc27fef5f6125a678fa88eba1be.tar.gz
hercules-5b1fee9ef54dbfc27fef5f6125a678fa88eba1be.tar.bz2
hercules-5b1fee9ef54dbfc27fef5f6125a678fa88eba1be.tar.xz
hercules-5b1fee9ef54dbfc27fef5f6125a678fa88eba1be.zip
Enhance Pincode Feature.
-added a hack check for pincode feature. Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
-rw-r--r--src/char/char.c24
-rw-r--r--src/char/pincode.c21
2 files changed, 39 insertions, 6 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 9e63a682c..260f7a5cf 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3741,6 +3741,18 @@ int parse_char(int fd)
int slot = RFIFOB(fd,2);
RFIFOSKIP(fd,3);
+ if( *pincode->enabled ){ // hack check
+ struct online_char_data* character;
+ character = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
+ if( character && character->pincode_enable == -1){
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x6c;
+ WFIFOB(fd,2) = 0;
+ WFIFOSET(fd,3);
+ break;
+ }
+ }
+
if ( SQL_SUCCESS != Sql_Query(sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot)
|| SQL_SUCCESS != Sql_NextRow(sql_handle)
|| SQL_SUCCESS != Sql_GetData(sql_handle, 0, &data, NULL) )
@@ -3936,6 +3948,18 @@ int parse_char(int fd)
{
int cid = RFIFOL(fd,2);
+ if( *pincode->enabled ){ // hack check
+ struct online_char_data* character;
+ character = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
+ if( character && character->pincode_enable == -1 ){
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x6c;
+ WFIFOB(fd,2) = 0;
+ WFIFOSET(fd,3);
+ break;
+ }
+ }
+
ShowInfo(CL_RED"Request Char Deletion: "CL_GREEN"%d (%d)"CL_RESET"\n", sd->account_id, cid);
memcpy(email, RFIFOP(fd,6), 40);
RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56);
diff --git a/src/char/pincode.c b/src/char/pincode.c
index 3acc0aa6f..b68c4e38a 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -19,9 +19,7 @@ int charselect = 0;
unsigned int multiplier = 0x3498, baseSeed = 0x881234;
void pincode_handle ( int fd, struct char_session_data* sd ) {
- struct online_char_data* character;
-
- character = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
+ struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
if( character && character->pincode_enable > *pincode->charselect ){
character->pincode_enable = *pincode->charselect * 2;
@@ -38,6 +36,9 @@ void pincode_handle ( int fd, struct char_session_data* sd ) {
}
} else // No PIN code has been set yet
pincode->sendstate( fd, sd, PINCODE_NOTSET );
+
+ if( character )
+ character->pincode_enable = -1;
}
void pincode_check(int fd, struct char_session_data* sd) {
@@ -46,6 +47,9 @@ void pincode_check(int fd, struct char_session_data* sd) {
strncpy(pin, (char*)RFIFOP(fd, 6), 4+1);
pincode->decrypt(sd->pincode_seed, pin);
if( pincode->compare( fd, sd, pin ) ){
+ struct online_char_data* character;
+ if( (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) )
+ character->pincode_enable = *pincode->charselect * 2;
pincode->sendstate( fd, sd, PINCODE_OK );
}
}
@@ -65,7 +69,8 @@ int pincode_compare(int fd, struct char_session_data* sd, char* pin) {
void pincode_change(int fd, struct char_session_data* sd) {
char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0";
-
+ struct online_char_data* character;
+
strncpy(oldpin, (char*)RFIFOP(fd,6), 4+1);
pincode->decrypt(sd->pincode_seed,oldpin);
if( !pincode->compare( fd, sd, oldpin ) )
@@ -74,19 +79,23 @@ void pincode_change(int fd, struct char_session_data* sd) {
strncpy(newpin, (char*)RFIFOP(fd,10), 3+1);
pincode->decrypt(sd->pincode_seed,newpin);
pincode->update( sd->account_id, newpin );
-
+ if( (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) )
+ character->pincode_enable = *pincode->charselect * 2;
pincode->sendstate( fd, sd, PINCODE_OK );
}
void pincode_setnew(int fd, struct char_session_data* sd) {
char newpin[5] = "\0\0\0\0";
-
+ struct online_char_data* character;
+
strncpy(newpin, (char*)RFIFOP(fd,6), 4+1);
pincode->decrypt(sd->pincode_seed,newpin);
pincode->update( sd->account_id, newpin );
pincode->sendstate( fd, sd, PINCODE_OK );
+ if( (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) )
+ character->pincode_enable = *pincode->charselect * 2;
}
// 0 = pin is correct