Skip to content

Commit

Permalink
Added guild/party checks for character deletion process #1480
Browse files Browse the repository at this point in the history
  • Loading branch information
cyilcode authored and Lemongrass3110 committed Oct 11, 2016
1 parent 3e4d2b8 commit 5ea873b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/char/char_clif.c
Expand Up @@ -468,7 +468,7 @@ void chclif_char_delete2_cancel_ack(int fd, uint32 char_id, uint32 result) {
int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
FIFOSD_CHECK(6)
{
uint32 char_id, i;
uint32 char_id, i, guild_id, party_id;
char* data;
time_t delete_date;

Expand All @@ -482,36 +482,34 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
return 1;
}

if( SQL_SUCCESS != Sql_Query(sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", schema_config.char_db, char_id) || SQL_SUCCESS != Sql_NextRow(sql_handle) )
if( SQL_SUCCESS != Sql_Query(sql_handle, "SELECT `delete_date`,`party_id`,`guild_id` FROM `%s` WHERE `char_id`='%d'", schema_config.char_db, char_id) || SQL_SUCCESS != Sql_NextRow(sql_handle) )
{
Sql_ShowDebug(sql_handle);
chclif_char_delete2_ack(fd, char_id, 3, 0);
return 1;
}

Sql_GetData(sql_handle, 0, &data, NULL); delete_date = strtoul(data, NULL, 10);
Sql_GetData(sql_handle, 1, &data, NULL); party_id = strtoul(data, NULL, 10);
Sql_GetData(sql_handle, 2, &data, NULL); guild_id = strtoul(data, NULL, 10);

if( delete_date ) {// character already queued for deletion
chclif_char_delete2_ack(fd, char_id, 0, 0);
return 1;
}

/*
// 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
if (guild_id) // character is in guild
{
chclif_char_delete2_ack(fd, char_id, 4, 0);
return 1;
}

if( party_id )
{// character in party
if (party_id) // character is in party
{
chclif_char_delete2_ack(fd, char_id, 5, 0);
return 1;
}
*/
// success
delete_date = time(NULL)+(charserv_config.char_config.char_del_delay);

Expand Down

0 comments on commit 5ea873b

Please sign in to comment.