From 0aa8d501408119e45d3b08eaf9160f99b749b341 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sat, 25 Dec 2010 15:48:26 +0000 Subject: * 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14621 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ conf/char_athena.conf | 2 +- src/char/char.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c8c737c0c..49b72e0f5 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -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] diff --git a/conf/char_athena.conf b/conf/char_athena.conf index d92f2a47a..af0da9976 100644 --- a/conf/char_athena.conf +++ b/conf/char_athena.conf @@ -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 diff --git a/src/char/char.c b/src/char/char.c index 8e23fff39..1459d1ef2 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -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)); -- cgit v1.2.3-60-g2f50