diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-10-18 11:29:30 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-10-18 11:29:30 +0000 |
commit | 64ffd93566bb6dc40dbc338aac969adfc1615ed7 (patch) | |
tree | d1162e2272714f88bcf974ba2c3c75b53da92571 | |
parent | 76a15224480ae093a7bf1ff456acbbde45a8c153 (diff) | |
download | hercules-64ffd93566bb6dc40dbc338aac969adfc1615ed7.tar.gz hercules-64ffd93566bb6dc40dbc338aac969adfc1615ed7.tar.bz2 hercules-64ffd93566bb6dc40dbc338aac969adfc1615ed7.tar.xz hercules-64ffd93566bb6dc40dbc338aac969adfc1615ed7.zip |
Removed the char_rename setting in favor of a PACKETVER define.
Inverted the way renames are counted: '0' now means 'no renames left' (the default).
Please make sure your database matches this new behavior before starting the server.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14093 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 4 | ||||
-rw-r--r-- | conf/Changelog.txt | 2 | ||||
-rw-r--r-- | conf/char_athena.conf | 10 | ||||
-rw-r--r-- | src/char/char.c | 17 | ||||
-rw-r--r-- | src/char/char.h | 6 | ||||
-rw-r--r-- | src/char_sql/char.c | 24 | ||||
-rw-r--r-- | src/char_sql/char.h | 6 |
7 files changed, 36 insertions, 33 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index e4d4beddc..8c24bd90f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,10 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +09/10/18 + * Removed the char_rename setting in favor of a PACKETVER define [ultramage] + * Inverted the way renames are counted: '0' now means 'no renames left' (the default) + * Please make sure your database matches this new behavior before starting the server. 09/10/10 * Added character rename function. [Inkfish] * NPCs' names should only be 24 characters long including EOS. [Inkfish] diff --git a/conf/Changelog.txt b/conf/Changelog.txt index 2843100d2..cfffd303e 100644 --- a/conf/Changelog.txt +++ b/conf/Changelog.txt @@ -1,5 +1,7 @@ Date Added +2009/10/18 + * Removed char_rename config setting, now hardcoded [ultramage] 2009/10/15 * Rev. 14092 Added several 13.x and 12.1 map mapflags, might have missed some. [L0ne_w0lf] 2009/08/18 diff --git a/conf/char_athena.conf b/conf/char_athena.conf index 87516b3dc..d92f2a47a 100644 --- a/conf/char_athena.conf +++ b/conf/char_athena.conf @@ -156,16 +156,6 @@ char_name_option: 1 // Note: Don't add spaces unless you mean to add 'space' to the list. char_name_letters: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -// Character rename option. -// When set to yes, the server will send an extended char-info packet, -// informing whether the character can be renamed or not. -// NOTE: This option is for compatibility with kRO sakray 2006-10-23 and newer. -// !Do not disable it for these clients since it will crash them! -// !Do not use it for any other type of client since it will crash them too! -// !If you really wanna disable it for newer clients, change the default value to the setting value in `rename` column of `char` table! -// 0: off, 1+: the maximun number of times you can change each character's name -char_rename: 1 - // How many Characters are allowed per Account ? (0 = disabled) [SQL Only!] chars_per_account: 0 diff --git a/src/char/char.c b/src/char/char.c index 1311147ae..200257584 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -88,7 +88,6 @@ int char_name_option = 0; // Option to know which letters/symbols are authorised char unknown_char_name[1024] = "Unknown"; // Name to use when the requested name cannot be determined #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 authorised (or not) in a character name. by [Yor] -bool char_rename = true; int log_char = 1; // loggin char or not [devil] int log_inter = 1; // loggin inter or not [devil] @@ -1681,6 +1680,8 @@ int count_users(void) /// Returns the size (106 or 108) int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p) { + int size = 106; + if( buf == NULL || p == NULL ) return 0; @@ -1719,12 +1720,12 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p) WBUFB(buf,102) = min(p->dex, UCHAR_MAX); WBUFB(buf,103) = min(p->luk, UCHAR_MAX); WBUFW(buf,104) = p->slot; - if (char_rename) { - WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename) - return 108; - } else { - return 106; - } +#if PACKETVER >= 20061023 + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + size += 2; +#endif + + return size; } //---------------------------------------- @@ -4096,8 +4097,6 @@ int char_config_read(const char *cfgName) char_name_option = atoi(w2); } else if (strcmpi(w1, "char_name_letters") == 0) { strcpy(char_name_letters, w2); - } else if (strcmpi(w1, "char_rename") == 0) { - char_rename = config_switch(w2); // online files options } else if (strcmpi(w1, "online_txt_filename") == 0) { strcpy(online_txt_filename, w2); diff --git a/src/char/char.h b/src/char/char.h index 8c8d7c554..b53f66ffa 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -16,6 +16,12 @@ struct character_data { struct global_reg global[GLOBAL_REG_NUM]; }; +// server->client protocol version +// 20061023 - 2006-10-23aSakexe+ - 0x6b, 0x6d +#ifndef PACKETVER + #define PACKETVER 20061023 +#endif + struct mmo_charstatus* search_character(int aid, int cid); struct mmo_charstatus* search_character_byname(char* character_name); int search_character_index(char* character_name); diff --git a/src/char_sql/char.c b/src/char_sql/char.c index ed6566f7c..85e7d83c0 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -99,7 +99,6 @@ int char_name_option = 0; // Option to know which letters/symbols are authorised char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the requested name cannot be determined #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 used to authorise or not a name of a character. by [Yor] -short char_rename = 1; 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] @@ -1192,7 +1191,7 @@ int rename_char_sql(struct char_session_data *sd, int char_id) if( !mmo_char_fromsql(char_id, &char_dat, false) ) // Only the short data is needed. return 2; - if( char_dat.rename >= char_rename ) + if( char_dat.rename == 0 ) return 1; Sql_EscapeStringLen(sql_handle, esc_name, sd->new_name, strnlen(sd->new_name, NAME_LENGTH)); @@ -1204,7 +1203,7 @@ int rename_char_sql(struct char_session_data *sd, int char_id) return 4; } - if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, ++char_dat.rename, char_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) { Sql_ShowDebug(sql_handle); return 3; @@ -1542,6 +1541,8 @@ int count_users(void) /// Returns the size (106 or 108) int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p) { + int size = 106; + if( buf == NULL || p == NULL ) return 0; @@ -1580,15 +1581,12 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p) WBUFB(buf,102) = min(p->dex, UCHAR_MAX); WBUFB(buf,103) = min(p->luk, UCHAR_MAX); WBUFW(buf,104) = p->slot; - if( char_rename ) - { - if( p->rename < char_rename ) - WBUFW(buf,106) = 0; - else - WBUFW(buf,106) = 1; - return 108; - } - return 106; +#if PACKETVER >= 20061023 + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + size += 2; +#endif + + return size; } int mmo_char_send006b(int fd, struct char_session_data* sd) @@ -3893,8 +3891,6 @@ int char_config_read(const char* cfgName) char_name_option = atoi(w2); } else if (strcmpi(w1, "char_name_letters") == 0) { strcpy(char_name_letters, w2); - } else if (strcmpi(w1, "char_rename") == 0) { - char_rename = atoi(w2); } 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] diff --git a/src/char_sql/char.h b/src/char_sql/char.h index a40340cfb..bd9f06d3e 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -17,6 +17,12 @@ enum { TABLE_GUILD_STORAGE, }; +// server->client protocol version +// 20061023 - 2006-10-23aSakexe+ - 0x6b, 0x6d +#ifndef PACKETVER + #define PACKETVER 20061023 +#endif + int memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch); int mapif_sendall(unsigned char *buf,unsigned int len); |