summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/login/login.c4
-rw-r--r--src/login_sql/login.c888
-rw-r--r--src/map/skill.c18
-rw-r--r--src/map/status.c64
4 files changed, 481 insertions, 493 deletions
diff --git a/src/login/login.c b/src/login/login.c
index c74995850..0cd9b5b9b 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -3127,7 +3127,7 @@ int parse_login(int fd) {
if (!check_ip(session[fd]->client_addr.sin_addr.s_addr)) {
login_log("Connection refused: IP isn't authorised (deny/allow, ip: %s)." RETCODE, ip);
- WFIFOHEAD(fd, 23);
+ WFIFOHEAD(fd, 23);
WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = 3; // 3 = Rejected from Server
WFIFOSET(fd,23);
@@ -3141,7 +3141,7 @@ int parse_login(int fd) {
if (min_level_to_connect > gm_level) {
login_log("Connection refused: the minimum GM level for connection is %d (account: %s, GM level: %d, ip: %s)." RETCODE,
min_level_to_connect, account.userid, gm_level, ip);
- WFIFOHEAD(fd, 3);
+ WFIFOHEAD(fd, 3);
WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = 1; // 01 = Server closed
WFIFOSET(fd,3);
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 64e623fc8..f6365e0f2 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -286,32 +286,32 @@ void send_GM_accounts(int fd) {
//-----------------------------------------------------
/*
int isGM(int account_id) {
-int level;
-
-MYSQL_RES* sql_res;
-MYSQL_ROW sql_row;
-level = 0;
-sprintf(tmpsql,"SELECT `%s` FROM `%s` WHERE `%s`='%d'", login_db_level, login_db, login_db_account_id, account_id);
-if (mysql_query(&mysql_handle, tmpsql)) {
-ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-}
-sql_res = mysql_store_result(&mysql_handle);
-if (sql_res) {
-sql_row = mysql_fetch_row(sql_res);
-level = atoi(sql_row[0]);
-if (level > 99)
-level = 99;
-}
+ int level;
-if (level == 0) {
-return 0;
-//not GM
-}
+ MYSQL_RES* sql_res;
+ MYSQL_ROW sql_row;
+ level = 0;
+ sprintf(tmpsql,"SELECT `%s` FROM `%s` WHERE `%s`='%d'", login_db_level, login_db, login_db_account_id, account_id);
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ sql_res = mysql_store_result(&mysql_handle);
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res);
+ level = atoi(sql_row[0]);
+ if (level > 99)
+ level = 99;
+ }
+
+ if (level == 0) {
+ return 0;
+ //not GM
+ }
-mysql_free_result(sql_res);
+ mysql_free_result(sql_res);
-return level;
+ return level;
}
*/
@@ -355,9 +355,9 @@ int e_mail_check(char *email) {
}
/*======================================================
-* Does a mysql_ping to all connection handles. [Skotlex]
-*------------------------------------------------------
-*/
+ * Does a mysql_ping to all connection handles. [Skotlex]
+ *------------------------------------------------------
+ */
int login_sql_ping(int tid, unsigned int tick, int id, int data)
{
ShowInfo("Pinging SQL server to keep connection alive...\n");
@@ -380,38 +380,38 @@ int mmo_auth_sqldb_init(void) {
// DB connection start
ShowStatus("Connect Login Database Server....\n");
if (!mysql_real_connect(&mysql_handle, login_server_ip, login_server_id, login_server_pw,
- login_server_db, login_server_port, (char *)NULL, 0)) {
- // pointer check
- ShowFatalError("%s\n", mysql_error(&mysql_handle));
- exit(1);
- } else {
- ShowStatus("Connect success!\n");
- }
- if( strlen(default_codepage) > 0 ) {
- sprintf( tmpsql, "SET NAMES %s", default_codepage );
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmpsql);
- }
+ login_server_db, login_server_port, (char *)NULL, 0)) {
+ // pointer check
+ ShowFatalError("%s\n", mysql_error(&mysql_handle));
+ exit(1);
+ } else {
+ ShowStatus("Connect success!\n");
+ }
+ if( strlen(default_codepage) > 0 ) {
+ sprintf( tmpsql, "SET NAMES %s", default_codepage );
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmpsql);
}
+ }
- if (log_login)
- {
- sprintf(tmpsql, "INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '0', 'lserver','100','login server started')", loginlog_db);
+ if (log_login)
+ {
+ sprintf(tmpsql, "INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '0', 'lserver','100','login server started')", loginlog_db);
- //query
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
+ //query
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
+ }
- if (connection_ping_interval) {
- add_timer_func_list(login_sql_ping, "login_sql_ping");
- add_timer_interval(gettick()+connection_ping_interval*60*60*1000,
+ if (connection_ping_interval) {
+ add_timer_func_list(login_sql_ping, "login_sql_ping");
+ add_timer_interval(gettick()+connection_ping_interval*60*60*1000,
login_sql_ping, 0, 0, connection_ping_interval*60*60*1000);
- }
- return 0;
+ }
+ return 0;
}
//-----------------------------------------------------
@@ -439,17 +439,17 @@ void mmo_db_close(void) {
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
}
- /*
+/*
//delete all server status
sprintf(tmpsql,"DELETE FROM `sstatus`");
//query
if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
mysql_close(&mysql_handle);
ShowStatus("close DB connect....\n");
- */
+*/
for (i = 0; i < MAX_SERVERS; i++) {
if ((fd = server_fd[i]) >= 0)
@@ -520,31 +520,31 @@ int mmo_auth_new(struct mmo_account* account, char sex)
if(mysql_field_count(&mysql_handle) == 0 &&
mysql_insert_id(&mysql_handle) < START_ACCOUNT_NUM) {
- //Invalid Account ID! Must update it.
- int id = (int)mysql_insert_id(&mysql_handle);
- sprintf(tmp_sql, "UPDATE `%s` SET `%s`='%d' WHERE `%s`='%d'", login_db, login_db_account_id, START_ACCOUNT_NUM, login_db_account_id, id);
+ //Invalid Account ID! Must update it.
+ int id = (int)mysql_insert_id(&mysql_handle);
+ sprintf(tmp_sql, "UPDATE `%s` SET `%s`='%d' WHERE `%s`='%d'", login_db, login_db_account_id, START_ACCOUNT_NUM, login_db_account_id, id);
+ if(mysql_query(&mysql_handle, tmp_sql)){
+ ShowError("New account %s has an invalid account ID [%d] which could not be updated (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM);
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ //Just delete it and fail.
+ sprintf(tmp_sql, "DELETE FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, id);
if(mysql_query(&mysql_handle, tmp_sql)){
- ShowError("New account %s has an invalid account ID [%d] which could not be updated (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM);
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- //Just delete it and fail.
- sprintf(tmp_sql, "DELETE FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, id);
- if(mysql_query(&mysql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- return 1;
}
- ShowNotice("Updated New account %s's ID %d->%d (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM, START_ACCOUNT_NUM);
- }
- if(tick > new_reg_tick)
- { //Update the registration check.
- num_regs=0;
- new_reg_tick=gettick()+time_allowed*1000;
+ return 1;
}
- num_regs++;
+ ShowNotice("Updated New account %s's ID %d->%d (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM, START_ACCOUNT_NUM);
+ }
+ if(tick > new_reg_tick)
+ { //Update the registration check.
+ num_regs=0;
+ new_reg_tick=gettick()+time_allowed*1000;
+ }
+ num_regs++;
- return 0;
+ return 0;
}
#ifdef LCCWIN32
@@ -645,7 +645,7 @@ int mmo_auth( struct mmo_account* account , int fd){
if (account->passwdenc==PASSWORDENC) {
memcpy(t_pass, account->passwd, NAME_LENGTH);
- t_pass[24] = '\0';
+ t_pass[NAME_LENGTH] = '\0';
} else
jstrescapecpy(t_pass, account->passwd);
@@ -765,36 +765,36 @@ int mmo_auth( struct mmo_account* account , int fd){
//ShowInfo("auth ok %s %s" RETCODE, tmpstr, account->userid);
}
- /*
- // do not remove this section. this is meant for future, and current forums usage
- // as a login manager and CP for login server. [CLOWNISIUS]
+/*
+// do not remove this section. this is meant for future, and current forums usage
+// as a login manager and CP for login server. [CLOWNISIUS]
if (atoi(sql_row[10]) == 1) {
- return 4;
+ return 4;
}
if (atoi(sql_row[10]) >= 5) {
- switch(atoi(sql_row[10])) {
- case 5:
- return 5;
- break;
- case 6:
- return 7;
- break;
- case 7:
- return 9;
- break;
- case 8:
- return 10;
- break;
- case 9:
- return 11;
- break;
- default:
- return 10;
- break;
- }
+ switch(atoi(sql_row[10])) {
+ case 5:
+ return 5;
+ break;
+ case 6:
+ return 7;
+ break;
+ case 7:
+ return 9;
+ break;
+ case 8:
+ return 10;
+ break;
+ case 9:
+ return 11;
+ break;
+ default:
+ return 10;
+ break;
+ }
}
- */
+*/
ban_until_time = atol(sql_row[8]);
//login {0-account_id/1-userid/2-user_pass/3-lastlogin/4-logincount/5-sex/6-connect_untl/7-last_ip/8-ban_until/9-state}
@@ -820,34 +820,34 @@ int mmo_auth( struct mmo_account* account , int fd){
if (atoi(sql_row[9])) {
switch(atoi(sql_row[9])) { // packet 0x006a value + 1
- case 1: // 0 = Unregistered ID
- case 2: // 1 = Incorrect Password
- case 3: // 2 = This ID is expired
- case 4: // 3 = Rejected from Server
- case 5: // 4 = You have been blocked by the GM Team
- case 6: // 5 = Your Game's EXE file is not the latest version
- case 7: // 6 = Your are Prohibited to log in until %s
- case 8: // 7 = Server is jammed due to over populated
- case 9: // 8 = No more accounts may be connected from this company
- case 10: // 9 = MSI_REFUSE_BAN_BY_DBA
- case 11: // 10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
- case 12: // 11 = MSI_REFUSE_BAN_BY_GM
- case 13: // 12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
- case 14: // 13 = MSI_REFUSE_SELF_LOCK
- case 15: // 14 = MSI_REFUSE_NOT_PERMITTED_GROUP
- case 16: // 15 = MSI_REFUSE_NOT_PERMITTED_GROUP
- case 100: // 99 = This ID has been totally erased
- case 101: // 100 = Login information remains at %s.
- case 102: // 101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
- case 103: // 102 = This account has been temporarily prohibited from login due to a bug-related investigation
- case 104: // 103 = This character is being deleted. Login is temporarily unavailable for the time being
- case 105: // 104 = Your spouse character is being deleted. Login is temporarily unavailable for the time being
- ShowNotice("Auth Error #%d\n", atoi(sql_row[9]));
- return atoi(sql_row[9]) - 1;
- break;
- default:
- return 99; // 99 = ID has been totally erased
- break;
+ case 1: // 0 = Unregistered ID
+ case 2: // 1 = Incorrect Password
+ case 3: // 2 = This ID is expired
+ case 4: // 3 = Rejected from Server
+ case 5: // 4 = You have been blocked by the GM Team
+ case 6: // 5 = Your Game's EXE file is not the latest version
+ case 7: // 6 = Your are Prohibited to log in until %s
+ case 8: // 7 = Server is jammed due to over populated
+ case 9: // 8 = No more accounts may be connected from this company
+ case 10: // 9 = MSI_REFUSE_BAN_BY_DBA
+ case 11: // 10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
+ case 12: // 11 = MSI_REFUSE_BAN_BY_GM
+ case 13: // 12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
+ case 14: // 13 = MSI_REFUSE_SELF_LOCK
+ case 15: // 14 = MSI_REFUSE_NOT_PERMITTED_GROUP
+ case 16: // 15 = MSI_REFUSE_NOT_PERMITTED_GROUP
+ case 100: // 99 = This ID has been totally erased
+ case 101: // 100 = Login information remains at %s.
+ case 102: // 101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
+ case 103: // 102 = This account has been temporarily prohibited from login due to a bug-related investigation
+ case 104: // 103 = This character is being deleted. Login is temporarily unavailable for the time being
+ case 105: // 104 = Your spouse character is being deleted. Login is temporarily unavailable for the time being
+ ShowNotice("Auth Error #%d\n", atoi(sql_row[9]));
+ return atoi(sql_row[9]) - 1;
+ break;
+ default:
+ return 99; // 99 = ID has been totally erased
+ break;
}
}
@@ -941,7 +941,7 @@ int parse_fromchar(int fd){
}
while(RFIFOREST(fd) >= 2) {
- // printf("char_parse: %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd, 0));
+// printf("char_parse: %d %d packet case=%x\n", fd, RFIFOREST(fd), RFIFOW(fd, 0));
switch (RFIFOW(fd,0)) {
case 0x2709:
@@ -962,57 +962,58 @@ int parse_fromchar(int fd){
case 0x2712:
if (RFIFOREST(fd) < 19)
return 0;
- {
- int account_id;
- account_id = RFIFOL(fd,2); // speed up
- for(i=0;i<AUTH_FIFO_SIZE;i++){
- if (auth_fifo[i].account_id == account_id &&
- auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
+ {
+ int account_id;
+ account_id = RFIFOL(fd,2); // speed up
+ for(i=0;i<AUTH_FIFO_SIZE;i++){
+ if (auth_fifo[i].account_id == account_id &&
+ auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
#if CMP_AUTHFIFO_LOGIN2 != 0
- auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
#endif
- auth_fifo[i].sex == RFIFOB(fd,14) &&
+ auth_fifo[i].sex == RFIFOB(fd,14) &&
#if CMP_AUTHFIFO_IP != 0
- auth_fifo[i].ip == RFIFOL(fd,15) &&
+ auth_fifo[i].ip == RFIFOL(fd,15) &&
#endif
- !auth_fifo[i].delflag) {
- auth_fifo[i].delflag = 1;
- ShowDebug("auth -> %d\n", i);
- break;
- }
+ !auth_fifo[i].delflag)
+ {
+ auth_fifo[i].delflag = 1;
+ ShowDebug("auth -> %d\n", i);
+ break;
}
+ }
- if (i != AUTH_FIFO_SIZE && account_id > 0) { // send ack
- time_t connect_until_time = 0;
- char email[40] = "";
- account_id=RFIFOL(fd,2);
- sprintf(tmpsql, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id);
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- sql_res = mysql_store_result(&mysql_handle) ;
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res);
- connect_until_time = atol(sql_row[1]);
- strcpy(email, sql_row[0]);
- mysql_free_result(sql_res);
- }
- WFIFOW(fd,0) = 0x2713;
- WFIFOL(fd,2) = account_id;
- WFIFOB(fd,6) = 0;
- memcpy(WFIFOP(fd, 7), email, 40);
- WFIFOL(fd,47) = (unsigned long) connect_until_time;
- WFIFOSET(fd,51);
- } else {
- WFIFOW(fd,0) = 0x2713;
- WFIFOL(fd,2) = account_id;
- WFIFOB(fd,6) = 1;
- WFIFOSET(fd,51);
+ if (i != AUTH_FIFO_SIZE && account_id > 0) { // send ack
+ time_t connect_until_time = 0;
+ char email[40] = "";
+ account_id=RFIFOL(fd,2);
+ sprintf(tmpsql, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id);
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ sql_res = mysql_store_result(&mysql_handle) ;
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res);
+ connect_until_time = atol(sql_row[1]);
+ strcpy(email, sql_row[0]);
+ mysql_free_result(sql_res);
}
+ WFIFOW(fd,0) = 0x2713;
+ WFIFOL(fd,2) = account_id;
+ WFIFOB(fd,6) = 0;
+ memcpy(WFIFOP(fd, 7), email, 40);
+ WFIFOL(fd,47) = (unsigned long) connect_until_time;
+ WFIFOSET(fd,51);
+ } else {
+ WFIFOW(fd,0) = 0x2713;
+ WFIFOL(fd,2) = account_id;
+ WFIFOB(fd,6) = 1;
+ WFIFOSET(fd,51);
}
RFIFOSKIP(fd,19);
break;
+ }
case 0x2714:
if (RFIFOREST(fd) < 6)
@@ -1038,34 +1039,34 @@ int parse_fromchar(int fd){
RFIFOSKIP(fd,6);
break;
- // We receive an e-mail/limited time request, because a player comes back from a map-server to the char-server
+ // We receive an e-mail/limited time request, because a player comes back from a map-server to the char-server
case 0x2716:
if (RFIFOREST(fd) < 6)
return 0;
- {
- int account_id;
- time_t connect_until_time = 0;
- char email[40] = "";
- account_id=RFIFOL(fd,2);
- sprintf(tmpsql,"SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'",login_db, login_db_account_id, account_id);
- if(mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- sql_res = mysql_store_result(&mysql_handle) ;
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res);
- connect_until_time = atol(sql_row[1]);
- strcpy(email, sql_row[0]);
- }
- mysql_free_result(sql_res);
- //printf("parse_fromchar: E-mail/limited time request from '%s' server (concerned account: %d)\n", server[id].name, RFIFOL(fd,2));
- WFIFOW(fd,0) = 0x2717;
- WFIFOL(fd,2) = RFIFOL(fd,2);
- memcpy(WFIFOP(fd, 6), email, 40);
- WFIFOL(fd,46) = (unsigned long) connect_until_time;
- WFIFOSET(fd,50);
+ {
+ int account_id;
+ time_t connect_until_time = 0;
+ char email[40] = "";
+ account_id=RFIFOL(fd,2);
+ sprintf(tmpsql,"SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'",login_db, login_db_account_id, account_id);
+ if(mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ sql_res = mysql_store_result(&mysql_handle) ;
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res);
+ connect_until_time = atol(sql_row[1]);
+ strcpy(email, sql_row[0]);
}
+ mysql_free_result(sql_res);
+ //printf("parse_fromchar: E-mail/limited time request from '%s' server (concerned account: %d)\n", server[id].name, RFIFOL(fd,2));
+ WFIFOW(fd,0) = 0x2717;
+ WFIFOL(fd,2) = RFIFOL(fd,2);
+ memcpy(WFIFOP(fd, 6), email, 40);
+ WFIFOL(fd,46) = (unsigned long) connect_until_time;
+ WFIFOSET(fd,50);
+ }
RFIFOSKIP(fd,6);
break;
@@ -1085,185 +1086,184 @@ int parse_fromchar(int fd){
WFIFOSET(fd, 10);
return 0;
- // Map server send information to change an email of an account via char-server
+ // Map server send information to change an email of an account via char-server
case 0x2722: // 0x2722 <account_id>.L <actual_e-mail>.40B <new_e-mail>.40B
if (RFIFOREST(fd) < 86)
return 0;
- {
- int acc;
- char actual_email[40], new_email[40];
- acc = RFIFOL(fd,2);
- memcpy(actual_email, RFIFOP(fd,6), 40);
- memcpy(new_email, RFIFOP(fd,46), 40);
- if (e_mail_check(actual_email) == 0)
- ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)" RETCODE,
- server[id].name, acc, ip);
- else if (e_mail_check(new_email) == 0)
- ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)" RETCODE,
- server[id].name, acc, ip);
- else if (strcmpi(new_email, "a@a.com") == 0)
- ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)" RETCODE,
- server[id].name, acc, ip);
- else {
- sprintf(tmpsql, "SELECT `%s`,`email` FROM `%s` WHERE `%s` = '%d'", login_db_userid, login_db, login_db_account_id, acc);
- if (mysql_query(&mysql_handle, tmpsql))
- {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- sql_res = mysql_store_result(&mysql_handle);
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res); //row fetching
-
- if (strcmpi(sql_row[1], actual_email) == 0) {
- sprintf(tmpsql, "UPDATE `%s` SET `email` = '%s' WHERE `%s` = '%d'", login_db, new_email, login_db_account_id, acc);
- // query
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- ShowInfo("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s)." RETCODE,
- server[id].name, acc, sql_row[0], actual_email, ip);
+ {
+ int acc;
+ char actual_email[40], new_email[40];
+ acc = RFIFOL(fd,2);
+ memcpy(actual_email, RFIFOP(fd,6), 40);
+ memcpy(new_email, RFIFOP(fd,46), 40);
+ if (e_mail_check(actual_email) == 0)
+ ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)" RETCODE,
+ server[id].name, acc, ip);
+ else if (e_mail_check(new_email) == 0)
+ ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)" RETCODE,
+ server[id].name, acc, ip);
+ else if (strcmpi(new_email, "a@a.com") == 0)
+ ShowWarning("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)" RETCODE,
+ server[id].name, acc, ip);
+ else {
+ sprintf(tmpsql, "SELECT `%s`,`email` FROM `%s` WHERE `%s` = '%d'", login_db_userid, login_db, login_db_account_id, acc);
+ if (mysql_query(&mysql_handle, tmpsql))
+ {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ sql_res = mysql_store_result(&mysql_handle);
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res); //row fetching
+
+ if (strcmpi(sql_row[1], actual_email) == 0) {
+ sprintf(tmpsql, "UPDATE `%s` SET `email` = '%s' WHERE `%s` = '%d'", login_db, new_email, login_db_account_id, acc);
+ // query
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
+ ShowInfo("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s)." RETCODE,
+ server[id].name, acc, sql_row[0], actual_email, ip);
}
-
}
+
}
RFIFOSKIP(fd, 86);
break;
+ }
case 0x2724: // Receiving of map-server via char-server a status change resquest (by Yor)
if (RFIFOREST(fd) < 10)
return 0;
- {
- int acc, statut;
- acc = RFIFOL(fd,2);
- statut = RFIFOL(fd,6);
- sprintf(tmpsql, "SELECT `state` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, acc);
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- sql_res = mysql_store_result(&mysql_handle);
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res); // row fetching
- }
- if (atoi(sql_row[0]) != statut && statut != 0) {
- unsigned char buf[16];
- WBUFW(buf,0) = 0x2731;
- WBUFL(buf,2) = acc;
- WBUFB(buf,6) = 0; // 0: change of statut, 1: ban
- WBUFL(buf,7) = statut; // status or final date of a banishment
- charif_sendallwos(-1, buf, 11);
- }
- sprintf(tmpsql,"UPDATE `%s` SET `state` = '%d' WHERE `%s` = '%d'", login_db, statut,login_db_account_id,acc);
- //query
- if(mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- RFIFOSKIP(fd,10);
+ {
+ int acc, statut;
+ acc = RFIFOL(fd,2);
+ statut = RFIFOL(fd,6);
+ sprintf(tmpsql, "SELECT `state` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, acc);
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
- return 0;
+ sql_res = mysql_store_result(&mysql_handle);
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res); // row fetching
+ }
+ if (atoi(sql_row[0]) != statut && statut != 0) {
+ unsigned char buf[16];
+ WBUFW(buf,0) = 0x2731;
+ WBUFL(buf,2) = acc;
+ WBUFB(buf,6) = 0; // 0: change of statut, 1: ban
+ WBUFL(buf,7) = statut; // status or final date of a banishment
+ charif_sendallwos(-1, buf, 11);
+ }
+ sprintf(tmpsql,"UPDATE `%s` SET `state` = '%d' WHERE `%s` = '%d'", login_db, statut,login_db_account_id,acc);
+ //query
+ if(mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ RFIFOSKIP(fd,10);
+ break;
+ }
case 0x2725: // Receiving of map-server via char-server a ban resquest (by Yor)
if (RFIFOREST(fd) < 18)
return 0;
- {
- int acc;
- struct tm *tmtime;
- time_t timestamp, tmptime;
- acc = RFIFOL(fd,2);
- sprintf(tmpsql, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- sql_res = mysql_store_result(&mysql_handle);
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res); // row fetching
- }
- tmptime = atol(sql_row[0]);
- if (tmptime == 0 || tmptime < time(NULL))
- timestamp = time(NULL);
- else
- timestamp = tmptime;
- tmtime = localtime(&timestamp);
- tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,6);
- tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,8);
- tmtime->tm_mday = tmtime->tm_mday + (short)RFIFOW(fd,10);
- tmtime->tm_hour = tmtime->tm_hour + (short)RFIFOW(fd,12);
- tmtime->tm_min = tmtime->tm_min + (short)RFIFOW(fd,14);
- tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,16);
- timestamp = mktime(tmtime);
- if (timestamp != -1) {
- if (timestamp <= time(NULL))
- timestamp = 0;
- if (tmptime != timestamp) {
- if (timestamp != 0) {
- unsigned char buf[16];
- WBUFW(buf,0) = 0x2731;
- WBUFL(buf,2) = acc;
- WBUFB(buf,6) = 1; // 0: change of statut, 1: ban
- WBUFL(buf,7) = (unsigned int)timestamp; // status or final date of a banishment
- charif_sendallwos(-1, buf, 11);
- }
- ShowNotice("Account: %d Banned until: %ld\n", acc, timestamp);
- sprintf(tmpsql, "UPDATE `%s` SET `ban_until` = '%ld', `state`='7' WHERE `%s` = '%d'", login_db, (unsigned long)timestamp, login_db_account_id, acc);
- // query
- if (mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
+ {
+ int acc;
+ struct tm *tmtime;
+ time_t timestamp, tmptime;
+ acc = RFIFOL(fd,2);
+ sprintf(tmpsql, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
+ sql_res = mysql_store_result(&mysql_handle);
+ if (sql_res) {
+ sql_row = mysql_fetch_row(sql_res); // row fetching
+ }
+ tmptime = atol(sql_row[0]);
+ if (tmptime == 0 || tmptime < time(NULL))
+ timestamp = time(NULL);
+ else
+ timestamp = tmptime;
+ tmtime = localtime(&timestamp);
+ tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,6);
+ tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,8);
+ tmtime->tm_mday = tmtime->tm_mday + (short)RFIFOW(fd,10);
+ tmtime->tm_hour = tmtime->tm_hour + (short)RFIFOW(fd,12);
+ tmtime->tm_min = tmtime->tm_min + (short)RFIFOW(fd,14);
+ tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,16);
+ timestamp = mktime(tmtime);
+ if (timestamp != -1) {
+ if (timestamp <= time(NULL))
+ timestamp = 0;
+ if (tmptime != timestamp) {
+ if (timestamp != 0) {
+ unsigned char buf[16];
+ WBUFW(buf,0) = 0x2731;
+ WBUFL(buf,2) = acc;
+ WBUFB(buf,6) = 1; // 0: change of statut, 1: ban
+ WBUFL(buf,7) = (unsigned int)timestamp; // status or final date of a banishment
+ charif_sendallwos(-1, buf, 11);
+ }
+ ShowNotice("Account: %d Banned until: %ld\n", acc, timestamp);
+ sprintf(tmpsql, "UPDATE `%s` SET `ban_until` = '%ld', `state`='7' WHERE `%s` = '%d'", login_db, (unsigned long)timestamp, login_db_account_id, acc);
+ // query
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
}
- RFIFOSKIP(fd,18);
- break;
}
- return 0;
+ RFIFOSKIP(fd,18);
+ break;
+ }
case 0x2727:
if (RFIFOREST(fd) < 6)
return 0;
- {
- int acc,sex;
- unsigned char buf[16];
- acc=RFIFOL(fd,2);
- sprintf(tmpsql,"SELECT `sex` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
+ {
+ int acc,sex;
+ unsigned char buf[16];
+ acc=RFIFOL(fd,2);
+ sprintf(tmpsql,"SELECT `sex` FROM `%s` WHERE `%s` = '%d'",login_db,login_db_account_id,acc);
- if(mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return 0;
- }
+ if(mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return 0;
+ }
- sql_res = mysql_store_result(&mysql_handle) ;
+ sql_res = mysql_store_result(&mysql_handle) ;
- if (sql_res) {
- if (mysql_num_rows(sql_res) == 0) {
- mysql_free_result(sql_res);
- return 0;
- }
- sql_row = mysql_fetch_row(sql_res); //row fetching
+ if (sql_res) {
+ if (mysql_num_rows(sql_res) == 0) {
+ mysql_free_result(sql_res);
+ return 0;
}
+ sql_row = mysql_fetch_row(sql_res); //row fetching
+ }
- if (strcmpi(sql_row[0], "M") == 0)
- sex = 1;
- else
- sex = 0;
- sprintf(tmpsql,"UPDATE `%s` SET `sex` = '%c' WHERE `%s` = '%d'", login_db, (sex==0?'M':'F'), login_db_account_id, acc);
- //query
- if(mysql_query(&mysql_handle, tmpsql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- WBUFW(buf,0) = 0x2723;
- WBUFL(buf,2) = acc;
- WBUFB(buf,6) = sex;
- charif_sendallwos(-1, buf, 7);
- RFIFOSKIP(fd,6);
+ if (strcmpi(sql_row[0], "M") == 0)
+ sex = 1;
+ else
+ sex = 0;
+ sprintf(tmpsql,"UPDATE `%s` SET `sex` = '%c' WHERE `%s` = '%d'", login_db, (sex==0?'M':'F'), login_db_account_id, acc);
+ //query
+ if(mysql_query(&mysql_handle, tmpsql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
- return 0;
+ WBUFW(buf,0) = 0x2723;
+ WBUFL(buf,2) = acc;
+ WBUFB(buf,6) = sex;
+ charif_sendallwos(-1, buf, 7);
+ RFIFOSKIP(fd,6);
+ break;
+ }
case 0x2728: // save account_reg2
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
@@ -1589,7 +1589,7 @@ int parse_login(int fd) {
server_num=0;
for(i = 0; i < MAX_SERVERS; i++) {
if (server_fd[i] >= 0) {
- // Andvanced subnet check [LuzZza]
+ // Advanced subnet check [LuzZza]
if((subnet_char_ip = lan_subnetcheck((long *)p)))
WFIFOL(fd,47+server_num*32) = subnet_char_ip;
else
@@ -1635,106 +1635,106 @@ int parse_login(int fd) {
{
sprintf(tmp_sql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%lu', '%s', '%d','login failed : %%s')", loginlog_db, *((ulong *)p), t_uid, result);
switch((result + 1)) {
- case -2: //-3 = Account Banned
- sprintf(tmpsql,tmp_sql,"Account banned.");
- sprintf(error,"Account banned.");
- break;
- case -1: //-2 = Dynamic Ban
- sprintf(tmpsql,tmp_sql,"dynamic ban (ip and account).");
- sprintf(error,"dynamic ban (ip and account).");
- break;
- case 1: // 0 = Unregistered ID
- sprintf(tmpsql,tmp_sql,"Unregisterd ID.");
- sprintf(error,"Unregisterd ID.");
- break;
- case 2: // 1 = Incorrect Password
- sprintf(tmpsql,tmp_sql,"Incorrect Password.");
- sprintf(error,"Incorrect Password.");
- break;
- case 3: // 2 = This ID is expired
- sprintf(tmpsql,tmp_sql,"Account Expired.");
- sprintf(error,"Account Expired.");
- break;
- case 4: // 3 = Rejected from Server
- sprintf(tmpsql,tmp_sql,"Rejected from server.");
- sprintf(error,"Rejected from server.");
- break;
- case 5: // 4 = You have been blocked by the GM Team
- sprintf(tmpsql,tmp_sql,"Blocked by GM.");
- sprintf(error,"Blocked by GM.");
- break;
- case 6: // 5 = Your Game's EXE file is not the latest version
- sprintf(tmpsql,tmp_sql,"Not latest game EXE.");
- sprintf(error,"Not latest game EXE.");
- break;
- case 7: // 6 = Your are Prohibited to log in until %s
- sprintf(tmpsql,tmp_sql,"Banned.");
- sprintf(error,"Banned.");
- break;
- case 8: // 7 = Server is jammed due to over populated
- sprintf(tmpsql,tmp_sql,"Server Over-population.");
- sprintf(error,"Server Over-population.");
- break;
- case 9: // 8 = No more accounts may be connected from this company
- sprintf(tmpsql,tmp_sql,"Account limit from company");
- sprintf(error,"Account limit from company");
- break;
- case 10: // 9 = MSI_REFUSE_BAN_BY_DBA
- sprintf(tmpsql,tmp_sql,"Ban by DBA");
- sprintf(error,"Ban by DBA");
- break;
- case 11: // 10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
- sprintf(tmpsql,tmp_sql,"Email not confirmed");
- sprintf(error,"Email not confirmed");
- break;
- case 12: // 11 = MSI_REFUSE_BAN_BY_GM
- sprintf(tmpsql,tmp_sql,"Ban by GM");
- sprintf(error,"Ban by GM");
- break;
- case 13: // 12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
- sprintf(tmpsql,tmp_sql,"Working in DB");
- sprintf(error,"Working in DB");
- break;
- case 14: // 13 = MSI_REFUSE_SELF_LOCK
- sprintf(tmpsql,tmp_sql,"Self Lock");
- sprintf(error,"Self Lock");
- break;
- case 15: // 14 = MSI_REFUSE_NOT_PERMITTED_GROUP
- sprintf(tmpsql,tmp_sql,"Not Permitted Group");
- sprintf(error,"Not Permitted Group");
- break;
- case 16: // 15 = MSI_REFUSE_NOT_PERMITTED_GROUP
- sprintf(tmpsql,tmp_sql,"Not Permitted Group");
- sprintf(error,"Not Permitted Group");
- break;
- case 100: // 99 = This ID has been totally erased
- sprintf(tmpsql,tmp_sql,"Account gone.");
- sprintf(error,"Account gone.");
- break;
- case 101: // 100 = Login information remains at %s
- sprintf(tmpsql,tmp_sql,"Login info remains.");
- sprintf(error,"Login info remains.");
- break;
- case 102: // 101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
- sprintf(tmpsql,tmp_sql,"Hacking investigation.");
- sprintf(error,"Hacking investigation.");
- break;
- case 103: // 102 = This account has been temporarily prohibited from login due to a bug-related investigation
- sprintf(tmpsql,tmp_sql,"Bug investigation.");
- sprintf(error,"Bug investigation.");
- break;
- case 104: // 103 = This character is being deleted. Login is temporarily unavailable for the time being
- sprintf(tmpsql,tmp_sql,"Deleting char.");
- sprintf(error,"Deleting char.");
- break;
- case 105: // 104 = This character is being deleted. Login is temporarily unavailable for the time being
- sprintf(tmpsql,tmp_sql,"Deleting spouse char.");
- sprintf(error,"Deleting spouse char.");
- break;
- default:
- sprintf(tmpsql,tmp_sql,"Uknown Error.");
- sprintf(error,"Uknown Error.");
- break;
+ case -2: //-3 = Account Banned
+ sprintf(tmpsql,tmp_sql,"Account banned.");
+ sprintf(error,"Account banned.");
+ break;
+ case -1: //-2 = Dynamic Ban
+ sprintf(tmpsql,tmp_sql,"dynamic ban (ip and account).");
+ sprintf(error,"dynamic ban (ip and account).");
+ break;
+ case 1: // 0 = Unregistered ID
+ sprintf(tmpsql,tmp_sql,"Unregisterd ID.");
+ sprintf(error,"Unregisterd ID.");
+ break;
+ case 2: // 1 = Incorrect Password
+ sprintf(tmpsql,tmp_sql,"Incorrect Password.");
+ sprintf(error,"Incorrect Password.");
+ break;
+ case 3: // 2 = This ID is expired
+ sprintf(tmpsql,tmp_sql,"Account Expired.");
+ sprintf(error,"Account Expired.");
+ break;
+ case 4: // 3 = Rejected from Server
+ sprintf(tmpsql,tmp_sql,"Rejected from server.");
+ sprintf(error,"Rejected from server.");
+ break;
+ case 5: // 4 = You have been blocked by the GM Team
+ sprintf(tmpsql,tmp_sql,"Blocked by GM.");
+ sprintf(error,"Blocked by GM.");
+ break;
+ case 6: // 5 = Your Game's EXE file is not the latest version
+ sprintf(tmpsql,tmp_sql,"Not latest game EXE.");
+ sprintf(error,"Not latest game EXE.");
+ break;
+ case 7: // 6 = Your are Prohibited to log in until %s
+ sprintf(tmpsql,tmp_sql,"Banned.");
+ sprintf(error,"Banned.");
+ break;
+ case 8: // 7 = Server is jammed due to over populated
+ sprintf(tmpsql,tmp_sql,"Server Over-population.");
+ sprintf(error,"Server Over-population.");
+ break;
+ case 9: // 8 = No more accounts may be connected from this company
+ sprintf(tmpsql,tmp_sql,"Account limit from company");
+ sprintf(error,"Account limit from company");
+ break;
+ case 10: // 9 = MSI_REFUSE_BAN_BY_DBA
+ sprintf(tmpsql,tmp_sql,"Ban by DBA");
+ sprintf(error,"Ban by DBA");
+ break;
+ case 11: // 10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
+ sprintf(tmpsql,tmp_sql,"Email not confirmed");
+ sprintf(error,"Email not confirmed");
+ break;
+ case 12: // 11 = MSI_REFUSE_BAN_BY_GM
+ sprintf(tmpsql,tmp_sql,"Ban by GM");
+ sprintf(error,"Ban by GM");
+ break;
+ case 13: // 12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
+ sprintf(tmpsql,tmp_sql,"Working in DB");
+ sprintf(error,"Working in DB");
+ break;
+ case 14: // 13 = MSI_REFUSE_SELF_LOCK
+ sprintf(tmpsql,tmp_sql,"Self Lock");
+ sprintf(error,"Self Lock");
+ break;
+ case 15: // 14 = MSI_REFUSE_NOT_PERMITTED_GROUP
+ sprintf(tmpsql,tmp_sql,"Not Permitted Group");
+ sprintf(error,"Not Permitted Group");
+ break;
+ case 16: // 15 = MSI_REFUSE_NOT_PERMITTED_GROUP
+ sprintf(tmpsql,tmp_sql,"Not Permitted Group");
+ sprintf(error,"Not Permitted Group");
+ break;
+ case 100: // 99 = This ID has been totally erased
+ sprintf(tmpsql,tmp_sql,"Account gone.");
+ sprintf(error,"Account gone.");
+ break;
+ case 101: // 100 = Login information remains at %s
+ sprintf(tmpsql,tmp_sql,"Login info remains.");
+ sprintf(error,"Login info remains.");
+ break;
+ case 102: // 101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
+ sprintf(tmpsql,tmp_sql,"Hacking investigation.");
+ sprintf(error,"Hacking investigation.");
+ break;
+ case 103: // 102 = This account has been temporarily prohibited from login due to a bug-related investigation
+ sprintf(tmpsql,tmp_sql,"Bug investigation.");
+ sprintf(error,"Bug investigation.");
+ break;
+ case 104: // 103 = This character is being deleted. Login is temporarily unavailable for the time being
+ sprintf(tmpsql,tmp_sql,"Deleting char.");
+ sprintf(error,"Deleting char.");
+ break;
+ case 105: // 104 = This character is being deleted. Login is temporarily unavailable for the time being
+ sprintf(tmpsql,tmp_sql,"Deleting spouse char.");
+ sprintf(error,"Deleting spouse char.");
+ break;
+ default:
+ sprintf(tmpsql,tmp_sql,"Unknown Error.");
+ sprintf(error,"Unknown Error.");
+ break;
}
//query
if(mysql_query(&mysql_handle, tmpsql)) {
diff --git a/src/map/skill.c b/src/map/skill.c
index 6bd7e0d4a..f6cb70c48 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1075,21 +1075,15 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
sc_start(bl,type,100,skilllv,skill_get_time2(skillid, skilllv));
break;
}
- case MG_FROSTDIVER: /* t?Xg_Co? */
- case WZ_FROSTNOVA: /* t?Xgm@ */
- {
- rate = (skilllv*3+35)-(tstatus->int_ + tstatus->luk)/15;
- if (rate <= 5)
- rate = 5;
- sc_start(bl,SC_FREEZE,rate,skilllv,skill_get_time2(skillid,skilllv));
- }
+ case MG_FROSTDIVER:
+ case WZ_FROSTNOVA:
+ sc_start(bl,SC_FREEZE,skilllv*3+35,skilllv,skill_get_time2(skillid,skilllv));
break;
- case WZ_STORMGUST: /* Xg?KXg */
+ case WZ_STORMGUST:
tsc->data[SC_FREEZE].val3++;
- if(tsc->data[SC_FREEZE].val3 >= 3)
- status_change_start(bl,SC_FREEZE,10000,
- skilllv,0,0,0,skill_get_time2(skillid,skilllv),8);
+ if(tsc->data[SC_FREEZE].val3 >= 3) //Tharis pointed out that this is normal freeze chance with a base of 300%
+ sc_start(bl,SC_FREEZE,300,skilllv,skill_get_time2(skillid,skilllv));
break;
case WZ_METEOR:
diff --git a/src/map/status.c b/src/map/status.c
index 8a83455f0..7b93785e7 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3793,6 +3793,7 @@ void status_change_init(struct block_list *bl)
int status_get_sc_def(struct block_list *bl, int type)
{
int sc_def;
+ struct status_data* status;
struct status_change* sc;
nullpo_retr(0, bl);
@@ -3824,6 +3825,7 @@ int status_get_sc_def(struct block_list *bl, int type)
return 10000;
}
+ status = status_get_status_data(bl);
switch (type)
{
//Note that stats that are *100/3 were simplified to *33
@@ -3831,29 +3833,24 @@ int status_get_sc_def(struct block_list *bl, int type)
case SC_FREEZE:
case SC_DECREASEAGI:
case SC_COMA:
- sc_def = 300 +100*status_get_mdef(bl) +33*status_get_luk(bl);
+ sc_def = 300 +100*status->mdef +33*status->luk;
break;
case SC_SLEEP:
case SC_CONFUSION:
- sc_def = 300 +100*status_get_int(bl) +33*status_get_luk(bl);
+ sc_def = 300 +100*status->int_ +33*status->luk;
break;
-// Removed since it collides with normal sc.
-// case SP_DEF1: // def
-// sc_def = 300 +100*status_get_def(bl) +33*status_get_luk(bl);
-// break;
case SC_STUN:
case SC_POISON:
case SC_DPOISON:
case SC_SILENCE:
case SC_BLEEDING:
- case SC_STOP:
- sc_def = 300 +100*status_get_vit(bl) +33*status_get_luk(bl);
+ sc_def = 300 +100*status->vit +33*status->luk;
break;
case SC_BLIND:
- sc_def = 300 +100*status_get_int(bl) +33*status_get_vit(bl);
+ sc_def = 300 +100*status->int_ +33*status->vit;
break;
case SC_CURSE:
- sc_def = 300 +100*status_get_luk(bl) +33*status_get_vit(bl);
+ sc_def = 300 +100*status->luk +33*status->vit;
break;
default:
return 0; //Effect that cannot be reduced? Likely a buff.
@@ -3888,56 +3885,58 @@ int status_get_sc_def(struct block_list *bl, int type)
int status_get_sc_tick(struct block_list *bl, int type, int tick)
{
struct map_session_data *sd;
+ struct status_data* status;
int rate=0, min=0;
//If rate is positive, it is a % reduction (10000 -> 100%)
//if it is negative, it is an absolute reduction in ms.
- sd = bl->type == BL_PC?(struct map_session_data *)bl:NULL;
+ BL_CAST(BL_PC,bl,sd);
+ status = status_get_status_data(bl);
switch (type) {
case SC_DECREASEAGI: /* x */
if (sd) // Celest
tick>>=1;
break;
- case SC_ADRENALINE: /* AhibV */
+ case SC_ADRENALINE:
case SC_ADRENALINE2:
- case SC_WEAPONPERFECTION: /* EF|p?tFNV */
- case SC_OVERTHRUST: /* I?o?XXg */
+ case SC_WEAPONPERFECTION:
+ case SC_OVERTHRUST:
if(sd && pc_checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
break;
- case SC_STONE: /* Ή */
- rate = -200*status_get_mdef(bl);
+ case SC_STONE:
+ rate = -200*status->mdef;
break;
- case SC_FREEZE: /* */
- rate = 100*status_get_mdef(bl);
+ case SC_FREEZE:
+ rate = 100*status->mdef;
break;
case SC_STUN: //Reduction in duration is the same as reduction in rate.
- rate = 300 +100*status_get_vit(bl) +33*status_get_luk(bl);
+ rate = 300 +100*status->vit;
break;
- case SC_DPOISON: /* ғ */
- case SC_POISON: /* */
- rate = 100*status_get_vit(bl) + 20*status_get_luk(bl);
+ case SC_DPOISON:
+ case SC_POISON:
+ rate = 100*status->vit + 20*status->luk;
break;
- case SC_SILENCE: /* ?ibNXfr?ij */
+ case SC_SILENCE:
case SC_CONFUSION:
case SC_CURSE:
- rate = 100*status_get_vit(bl);
+ rate = 100*status->vit;
break;
- case SC_BLIND: /* ? */
- rate = 10*status_get_lv(bl) + 7*status_get_int(bl);
+ case SC_BLIND:
+ rate = 10*status_get_lv(bl) + 7*status->int_;
min = 5000; //Minimum 5 secs?
break;
case SC_BLEEDING:
- rate = 20*status_get_lv(bl) +100*status_get_vit(bl);
+ rate = 20*status_get_lv(bl) +100*status->vit;
min = 10000; //Need a min of 10 secs for it to hurt at least once.
break;
case SC_SWOO:
- if (status_get_mode(bl)&MD_BOSS)
+ if (status->mode&MD_BOSS)
tick /= 5; //TODO: Reduce skill's duration. But for how long?
break;
case SC_ANKLE:
- if(status_get_mode(bl)&MD_BOSS) // Lasts 5 times less on bosses
+ if(status->mode&MD_BOSS) // Lasts 5 times less on bosses
tick /= 5;
- rate = -100*status_get_agi(bl);
+ rate = -100*status->agi;
// Minimum trap time of 3+0.03*skilllv seconds [celest]
// Changed to 3 secs and moved from skill.c [Skotlex]
min = 3000;
@@ -3946,11 +3945,6 @@ int status_get_sc_tick(struct block_list *bl, int type, int tick)
if (map[bl->m].flag.pvp)
tick /=2;
break;
- case SC_STOP:
- // Unsure of this... but I get a feeling that agi reduces this
- // (it was on Tiger Fist Code, but at -1 ms per 10 agi....
- rate = -100*status_get_agi(bl);
- break;
}
if (rate) {
if (bl->type == BL_PC) {