summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-11-13 15:26:42 +0100
committerGitHub <noreply@github.com>2018-11-13 15:26:42 +0100
commitbeacddf2e4b9393f85d92508f4639a4118350ac9 (patch)
tree7bc0eae59312d50c3eaf19b53d4c65776676956d
parentbb2858fda55ca4ca3144232da9b837d9551aafc0 (diff)
parent71378dd896ac0ff839091a0c3ccca5abab20cda5 (diff)
downloadhercules-beacddf2e4b9393f85d92508f4639a4118350ac9.tar.gz
hercules-beacddf2e4b9393f85d92508f4639a4118350ac9.tar.bz2
hercules-beacddf2e4b9393f85d92508f4639a4118350ac9.tar.xz
hercules-beacddf2e4b9393f85d92508f4639a4118350ac9.zip
Merge pull request #1866 from Helianthella/rename2
patch for #1805 (char rename)
-rw-r--r--conf/char/char-server.conf7
-rw-r--r--src/char/char.c10
2 files changed, 16 insertions, 1 deletions
diff --git a/conf/char/char-server.conf b/conf/char/char-server.conf
index 76bd5e359..0f07731fb 100644
--- a/conf/char/char-server.conf
+++ b/conf/char/char-server.conf
@@ -50,7 +50,7 @@ char_configuration: {
// Server Communication username and password.
userid: "s1"
passwd: "p1"
-
+
// Login Server IP
// The character server connects to the login server using this IP address.
// NOTE: This is useful when you are running behind a firewall or are on
@@ -162,6 +162,11 @@ char_configuration: {
// Set the letters/symbols that you want use with the 'char_name_option' option.
// Note: Don't add spaces unless you mean to add 'space' to the list.
name_letters: "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
+
+ // Block renaming if character is in a guild or a party? (BOOL)
+ // Athena: false Aegis: true
+ // This check is imposed by Aegis to avoid dead entries in databases and is not needed on Hercules, as we clear data properly
+ use_aegis_rename: false
}
deletion: {
diff --git a/src/char/char.c b/src/char/char.c
index 54f6ca7d1..4ce4c55fe 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -139,6 +139,7 @@ char char_name_letters[1024] = ""; // list of letters/symbols allowed (or not) i
static int char_del_level = 0; ///< From which level you can delete character [Lupus]
static int char_del_delay = 86400;
static bool char_aegis_delete = false; ///< Verify if char is in guild/party or char and reacts as Aegis does (disallow deletion), @see chr->delete2_req.
+static bool char_aegis_rename = false; // whether or not the player can be renamed while in party/guild
static int max_connect_user = -1;
static int gm_allow_group = -1;
@@ -1514,6 +1515,14 @@ static int char_rename_char_sql(struct char_session_data *sd, int char_id)
if( char_dat.rename == 0 )
return 1;
+ if (char_aegis_rename) {
+ if (char_dat.guild_id > 0) {
+ return 5; // MSG_FAILED_RENAME_BELONGS_TO_GUILD
+ } else if (char_dat.party_id > 0) {
+ return 6; // MSG_FAILED_RENAME_BELONGS_TO_PARTY
+ }
+ }
+
SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, strnlen(sd->new_name, NAME_LENGTH));
// check if the char exist
@@ -5848,6 +5857,7 @@ static bool char_config_read_player_name(const char *filename, const struct conf
libconfig->setting_lookup_mutable_string(setting, "name_letters", char_name_letters, sizeof(char_name_letters));
libconfig->setting_lookup_int(setting, "name_option", &char_name_option);
libconfig->setting_lookup_bool_real(setting, "name_ignoring_case", &name_ignoring_case);
+ libconfig->setting_lookup_bool_real(setting, "use_aegis_rename", &char_aegis_rename);
return true;
}