summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/char-server.conf5
-rw-r--r--sql-files/upgrades/rAthena-logs-upgrade.sql (renamed from sql-files/upgrades/rathena-logs-database-upgrade)2
-rw-r--r--sql-files/upgrades/rAthena-main-upgrade.sql2
-rw-r--r--src/char/char.c47
-rw-r--r--src/common/db.c2
5 files changed, 41 insertions, 17 deletions
diff --git a/conf/char-server.conf b/conf/char-server.conf
index b1172e654..7ebb7ed00 100644
--- a/conf/char-server.conf
+++ b/conf/char-server.conf
@@ -150,6 +150,11 @@ char_del_level: 0
// NOTE: Requires client 2010-08-03aragexeRE or newer.
char_del_delay: 86400
+// Block deletion if character is inside a guild or a party? (BOOL)
+// default: 0 official: 1
+// !!This check is imposed by Aegis to avoid dead entries in databases and _is_not_needed_ as we clear data properly!!
+char_aegis_delete: 0
+
// What folder the DB files are in (item_db.txt, etc.)
db_path: db
diff --git a/sql-files/upgrades/rathena-logs-database-upgrade b/sql-files/upgrades/rAthena-logs-upgrade.sql
index 7cdf58992..b523f8444 100644
--- a/sql-files/upgrades/rathena-logs-database-upgrade
+++ b/sql-files/upgrades/rAthena-logs-upgrade.sql
@@ -4,7 +4,7 @@
-- Remember to make a backup before applying.
-- We are not liable for any data loss this may cause.
-- Apply in the same database you applied your logs.sql
--- Last revision: November 10, 2013, 19:00
+-- Last revised: March 21, 2014 20:30 GMT
-- Upgrades to table `picklog`
ALTER TABLE `picklog` MODIFY `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U') NOT NULL default 'P';
diff --git a/sql-files/upgrades/rAthena-main-upgrade.sql b/sql-files/upgrades/rAthena-main-upgrade.sql
index 165584795..9982322e5 100644
--- a/sql-files/upgrades/rAthena-main-upgrade.sql
+++ b/sql-files/upgrades/rAthena-main-upgrade.sql
@@ -4,7 +4,7 @@
-- Remember to make a backup before applying.
-- We are not liable for any data loss this may cause.
-- Apply in the same database you applied your main.sql
--- Last revised: March 21, 2014 20:30
+-- Last revised: March 21, 2014 20:30 GMT
-- Drop table contents from ´sc_data´ since we use a different status order than rAthena
-- /!\ WARNING /!\ This will remove _ALL_ of the status effects active on the server
diff --git a/src/char/char.c b/src/char/char.c
index bf19a0012..0769067fd 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -125,6 +125,8 @@ int char_del_delay = 86400;
int log_char = 1; // loggin char or not [devil]
int log_inter = 1; // loggin inter or not [devil]
+int char_aegis_delete = 0; // Verify if char is in guild/party or char and reacts as Aegis does (doesn't allow deletion), see char_delete2_req for more information
+
// Advanced subnet check [LuzZza]
struct s_subnet {
uint32 mask;
@@ -3854,6 +3856,7 @@ int lan_subnetcheck(uint32 ip)
}
+/// Answers to deletion request (HC_DELETE_CHAR3_RESERVED)
/// @param result
/// 0 (0x718): An unknown error has occurred.
/// 1: none/success
@@ -3919,7 +3922,7 @@ void char_delete2_cancel_ack(int fd, int char_id, uint32 result)
static void char_delete2_req(int fd, struct char_session_data* sd)
{// CH: <0827>.W <char id>.L
- int char_id, i;
+ int char_id, party_id, guild_id, i;
char* data;
time_t delete_date;
@@ -3946,22 +3949,34 @@ static void char_delete2_req(int fd, struct char_session_data* sd)
return;
}
-/*
- // Aegis imposes these checks probably to avoid dead member
- // entries in guilds/parties, otherwise they are not required.
- // TODO: Figure out how these are enforced during waiting.
- if( guild_id )
- {// character in guild
- char_delete2_ack(fd, char_id, 4, 0);
- return;
- }
+ // This check is imposed by Aegis to avoid dead entries in databases
+ // _it is not needed_ as we clear data properly
+ // see issue: 7338
+ if( char_aegis_delete )
+ {
+ if( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)
+ || SQL_SUCCESS != SQL->NextRow(sql_handle)
+ )
+ {
+ Sql_ShowDebug(sql_handle);
+ char_delete2_ack(fd, char_id, 3, 0);
+ return;
+ }
+ SQL->GetData(sql_handle, 0, &data, NULL); party_id = atoi(data);
+ SQL->GetData(sql_handle, 1, &data, NULL); guild_id = atoi(data);
- if( party_id )
- {// character in party
- char_delete2_ack(fd, char_id, 5, 0);
- return;
+ if( guild_id )
+ {
+ char_delete2_ack(fd, char_id, 4, 0);
+ return;
+ }
+
+ if( party_id )
+ {
+ char_delete2_ack(fd, char_id, 5, 0);
+ return;
+ }
}
-*/
// success
delete_date = time(NULL)+char_del_delay;
@@ -5258,6 +5273,8 @@ int char_config_read(const char* cfgName)
char_del_level = atoi(w2);
} else if (strcmpi(w1, "char_del_delay") == 0) {
char_del_delay = atoi(w2);
+ } else if (strcmpi(w1, "char_aegis_delete") == 0) {
+ char_aegis_delete = atoi(w2);
} else if(strcmpi(w1,"db_path")==0) {
safestrncpy(db_path, w2, sizeof(db_path));
} else if (strcmpi(w1, "fame_list_alchemist") == 0) {
diff --git a/src/common/db.c b/src/common/db.c
index 8c15c0feb..8d6b08815 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -1846,6 +1846,8 @@ static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...)
* @protected
* @see #db_malloc_dbn(void)
* @see DBMap#put
+ * FIXME: If this method fails shouldn't it return another value?
+ * Other functions rely on this to know if they were able to put something [Panikon]
*/
static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
{