diff options
Diffstat (limited to 'src/char/char.c')
-rw-r--r-- | src/char/char.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/char/char.c b/src/char/char.c index e088e416c..edb7c0140 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -107,7 +107,6 @@ char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the request #define TRIM_CHARS "\255\xA0\032\t\x0A\x0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex] char char_name_letters[1024] = ""; // list of letters/symbols allowed (or not) in a character name. by [Yor] -int char_per_account = 0; //Maximum chars per account (default unlimited) [Sirius] int char_del_level = 0; //From which level u can delete character [Lupus] int char_del_delay = 86400; @@ -1334,8 +1333,6 @@ int mmo_char_sql_init(void) { char_db_= idb_alloc(DB_OPT_RELEASE_DATA); - ShowStatus("Characters per Account: '%d'.\n", char_per_account); - //the 'set offline' part is now in check_login_conn ... //if the server connects to loginserver //it will dc all off players @@ -1522,9 +1519,9 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag //check other inputs #if PACKETVER >= 20120307 - if(slot >= sd->char_slots) + if(slot < 0 || slot >= sd->char_slots) #else - if((slot >= sd->char_slots) // slots + if((slot < 0 || slot >= sd->char_slots) // slots || (str + agi + vit + int_ + dex + luk != 6*5 ) // stats || (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values || (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs @@ -1535,20 +1532,9 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag return -2; // invalid input #endif - - // check the number of already existing chars in this account - if( char_per_account != 0 ) { - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `account_id` = '%d'", char_db, sd->account_id) ) - Sql_ShowDebug(sql_handle); - if( Sql_NumRows(sql_handle) >= char_per_account ) - return -2; // character account limit exceeded - } - // check char slot - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `account_id` = '%d' AND `char_num` = '%d' LIMIT 1", char_db, sd->account_id, slot) ) - Sql_ShowDebug(sql_handle); - if( Sql_NumRows(sql_handle) > 0 ) - return -2; // slot already in use + if( sd->found_char[slot] ) + return -2; /* character account limit exceeded */ // validation success, log result if (log_char) { @@ -4775,13 +4761,6 @@ int char_config_read(const char* cfgName) char_name_option = atoi(w2); } else if (strcmpi(w1, "char_name_letters") == 0) { safestrncpy(char_name_letters, w2, sizeof(char_name_letters)); - } else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius] - char_per_account = atoi(w2); - if( char_per_account == 0 || char_per_account > MAX_CHARS ) { - if( char_per_account > MAX_CHARS ) - ShowWarning("Max chars per account '%d' exceeded limit. Defaulting to '%d'.\n", char_per_account, MAX_CHARS); - char_per_account = MAX_CHARS; - } } else if (strcmpi(w1, "char_del_level") == 0) { //disable/enable char deletion by its level condition [Lupus] char_del_level = atoi(w2); } else if (strcmpi(w1, "char_del_delay") == 0) { |