summaryrefslogtreecommitdiff
path: root/src/char_sql/char.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-16 17:27:19 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-16 17:27:19 +0000
commit5498ec6c4370546569603281b5357782e74c65d1 (patch)
tree61b58b097fd8cd6d0a51e9f9cffde3d754581f1f /src/char_sql/char.c
parentc3fd8c0ad3bcb93b558ce642769c6e6833e29b27 (diff)
downloadhercules-5498ec6c4370546569603281b5357782e74c65d1.tar.gz
hercules-5498ec6c4370546569603281b5357782e74c65d1.tar.bz2
hercules-5498ec6c4370546569603281b5357782e74c65d1.tar.xz
hercules-5498ec6c4370546569603281b5357782e74c65d1.zip
- Added De-adopt support when deleting a baby.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12377 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r--src/char_sql/char.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 90bbb3e1f..d5b837d33 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1286,11 +1286,11 @@ int delete_char_sql(int char_id)
{
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
- int account_id, party_id, guild_id, hom_id, base_level, partner_id;
+ int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id;
char* data;
size_t len;
- if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) )
+ if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) )
Sql_ShowDebug(sql_handle);
if( SQL_SUCCESS != Sql_NextRow(sql_handle) )
@@ -1307,6 +1307,8 @@ int delete_char_sql(int char_id)
Sql_GetData(sql_handle, 4, &data, NULL); base_level = atoi(data);
Sql_GetData(sql_handle, 5, &data, NULL); hom_id = atoi(data);
Sql_GetData(sql_handle, 6, &data, NULL); partner_id = atoi(data);
+ Sql_GetData(sql_handle, 7, &data, NULL); father_id = atoi(data);
+ Sql_GetData(sql_handle, 8, &data, NULL); mother_id = atoi(data);
Sql_EscapeStringLen(sql_handle, esc_name, name, min(len, NAME_LENGTH));
Sql_FreeResult(sql_handle);
@@ -1335,6 +1337,23 @@ int delete_char_sql(int char_id)
mapif_sendall(buf,10);
}
+ /* De-addopt [Zephyrus] */
+ if( father_id || mother_id )
+ { // Char is Baby
+ unsigned char buf[64];
+
+ if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) )
+ Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) )
+ Sql_ShowDebug(sql_handle);
+
+ WBUFW(buf,0) = 0x2b25;
+ WBUFL(buf,2) = father_id;
+ WBUFL(buf,6) = mother_id;
+ WBUFL(buf,10) = char_id; // Baby
+ mapif_sendall(buf,14);
+ }
+
//Make the character leave the party [Skotlex]
if (party_id)
inter_party_leave(party_id, account_id, char_id);