* Made SQL char-server options 'chars_per_account' and 'char_del_level' work on TXT as well (follow up to r1063 and r8420).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14621 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ai4rei
2010-12-25 15:48:26 +00:00
parent 9aa76bdd13
commit 78f2401ea0
3 changed files with 29 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
Date Added
2010/12/25
* Made SQL char-server options 'chars_per_account' and 'char_del_level' work on TXT as well (follow up to r1063 and r8420). [Ai4rei]
2010/12/24
* Added support for new /remove and /recall packets for 2010-08-03aRagexeRE and newer. [Ai4rei]
* Synchronized TXT/SQL char-server code a bit. [Ai4rei]

View File

@@ -156,7 +156,7 @@ char_name_option: 1
// Note: Don't add spaces unless you mean to add 'space' to the list.
char_name_letters: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
// How many Characters are allowed per Account ? (0 = disabled) [SQL Only!]
// How many Characters are allowed per Account ? (0 = disabled)
chars_per_account: 0
// Restrict character deletion by BaseLevel

View File

@@ -85,6 +85,9 @@ char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the request
#define TRIM_CHARS "\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 charas per account (default unlimited) [Sirius]
int char_del_level = 0; //From which level u can delete character [Lupus]
int log_char = 1; // loggin char or not [devil]
int log_inter = 1; // loggin inter or not [devil]
@@ -1216,6 +1219,14 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i
|| (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs
return -2; // invalid input
// check the number of already existing chars in this account
if( char_per_account != 0 ) {
ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == -1 );
if( i >= char_per_account )
return -2; // character account limit exceeded
}
// check char slot
ARR_FIND( 0, char_num, i, char_dat[i].status.account_id == sd->account_id && char_dat[i].status.slot == slot );
if( i < char_num )
@@ -3607,6 +3618,17 @@ int parse_char(int fd)
// deletion process
cs = &char_dat[sd->found_char[i]].status;
//check for config char del condition [Lupus]
if( ( char_del_level > 0 && cs->base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && cs->base_level <= (unsigned int)(-char_del_level) ) )
{
WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x70;
WFIFOB(fd,2) = 1; // This character cannot be deleted.
WFIFOSET(fd,3);
break;
}
char_delete(cs);
if (sd->found_char[i] != char_num - 1) {
int j, k;
@@ -4172,6 +4194,10 @@ 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);
} else if (strcmpi(w1, "char_del_level") == 0) { //disable/enable char deletion by its level condition [Lupus]
char_del_level = atoi(w2);
// online files options
} else if (strcmpi(w1, "online_txt_filename") == 0) {
safestrncpy(online_txt_filename, w2, sizeof(online_txt_filename));