Added a configuration for deletion restriction
Additionally added the checks to char_delete_char_sql so it is triggered on deletion itself and from older packets(chclif_parse_delchar) too.
This commit is contained in:
parent
5ea873b8b2
commit
ce9e623e47
@ -182,6 +182,13 @@ char_del_delay: 86400
|
||||
// - Clients that are not using 0x0068 or 0x01fb, only use birthdate (YYMMDD) as default.
|
||||
char_del_option: 2
|
||||
|
||||
// Restrict character deletion as long as he is still in a party or guild
|
||||
// 0: No restriction is applied
|
||||
// 1: Character cannot be deleted as long as he remains in a party
|
||||
// 2: Character cannot be deleted as long as he remains in a guild
|
||||
// 3: Character cannot be deleted as long as he remains in a party or guild(default)
|
||||
char_del_restriction: 3
|
||||
|
||||
// What folder the DB files are in (item_db.txt, etc.)
|
||||
db_path: db
|
||||
|
||||
|
@ -1678,6 +1678,18 @@ int char_delete_char_sql(uint32 char_id){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (charserv_config.char_config.char_del_restriction&CHAR_DEL_RESTRICT_GUILD && guild_id) // character is in guild
|
||||
{
|
||||
ShowInfo("Char deletion aborted: %s, Guild ID: %i\n", name, guild_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (charserv_config.char_config.char_del_restriction&CHAR_DEL_RESTRICT_PARTY && party_id) // character is in party
|
||||
{
|
||||
ShowInfo("Char deletion aborted: %s, Party ID: %i\n", name, party_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Divorce [Wizputer] */
|
||||
if( partner_id )
|
||||
char_divorce_char_sql(char_id, partner_id);
|
||||
@ -2720,6 +2732,7 @@ void char_set_defaults(){
|
||||
#else
|
||||
charserv_config.char_config.char_del_option = CHAR_DEL_EMAIL;
|
||||
#endif
|
||||
charserv_config.char_config.char_del_restriction = CHAR_DEL_RESTRICT_ALL;
|
||||
|
||||
// charserv_config.userid[24];
|
||||
// charserv_config.passwd[24];
|
||||
@ -2998,6 +3011,8 @@ bool char_config_read(const char* cfgName, bool normal){
|
||||
charserv_config.char_config.char_del_delay = atoi(w2);
|
||||
} else if (strcmpi(w1, "char_del_option") == 0) {
|
||||
charserv_config.char_config.char_del_option = atoi(w2);
|
||||
} else if (strcmpi(w1, "char_del_restriction") == 0) {
|
||||
charserv_config.char_config.char_del_restriction = atoi(w2);
|
||||
} else if(strcmpi(w1,"db_path")==0) {
|
||||
safestrncpy(schema_config.db_path, w2, sizeof(schema_config.db_path));
|
||||
} else if (strcmpi(w1, "fame_list_alchemist") == 0) {
|
||||
|
@ -37,6 +37,12 @@ enum e_char_delete {
|
||||
CHAR_DEL_BIRTHDATE
|
||||
};
|
||||
|
||||
enum e_char_delete_restriction {
|
||||
CHAR_DEL_RESTRICT_PARTY = 1,
|
||||
CHAR_DEL_RESTRICT_GUILD,
|
||||
CHAR_DEL_RESTRICT_ALL
|
||||
};
|
||||
|
||||
struct Schema_Config {
|
||||
int db_use_sqldbs;
|
||||
char db_path[1024];
|
||||
@ -119,6 +125,7 @@ struct Char_Config {
|
||||
char char_name_letters[1024]; // list of letters/symbols allowed (or not) in a character name. by [Yor]
|
||||
int char_name_option; // Option to know which letters/symbols are authorised in the name of a character (0: all, 1: only those in char_name_letters, 2: all EXCEPT those in char_name_letters) by [Yor]
|
||||
int char_del_option; // Character deletion type, email = 1, birthdate = 2 (default)
|
||||
int char_del_restriction; // Character deletion restriction (0: none, 1: if the character is in a party, 2: if the character is in a guild, 3: if the character is in a party or a guild)
|
||||
};
|
||||
|
||||
#define TRIM_CHARS "\255\xA0\032\t\x0A\x0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]
|
||||
|
@ -498,13 +498,13 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (guild_id) // character is in guild
|
||||
if (charserv_config.char_config.char_del_restriction&CHAR_DEL_RESTRICT_GUILD && guild_id) // character is in guild
|
||||
{
|
||||
chclif_char_delete2_ack(fd, char_id, 4, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (party_id) // character is in party
|
||||
if (charserv_config.char_config.char_del_restriction&CHAR_DEL_RESTRICT_PARTY && party_id) // character is in party
|
||||
{
|
||||
chclif_char_delete2_ack(fd, char_id, 5, 0);
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user