summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-25 15:48:26 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-25 15:48:26 +0000
commit0aa8d501408119e45d3b08eaf9160f99b749b341 (patch)
treefcba408438aa657e8dfc00b83ac80dafd2083a5f /src
parentc8ff72c09f9c763912d7c1d953638b5f32cb40aa (diff)
downloadhercules-0aa8d501408119e45d3b08eaf9160f99b749b341.tar.gz
hercules-0aa8d501408119e45d3b08eaf9160f99b749b341.tar.bz2
hercules-0aa8d501408119e45d3b08eaf9160f99b749b341.tar.xz
hercules-0aa8d501408119e45d3b08eaf9160f99b749b341.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c26
1 files changed, 26 insertions, 0 deletions
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));