diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-16 17:27:19 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-16 17:27:19 +0000 |
commit | 5498ec6c4370546569603281b5357782e74c65d1 (patch) | |
tree | 61b58b097fd8cd6d0a51e9f9cffde3d754581f1f /src | |
parent | c3fd8c0ad3bcb93b558ce642769c6e6833e29b27 (diff) | |
download | hercules-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')
-rw-r--r-- | src/char_sql/char.c | 23 | ||||
-rw-r--r-- | src/map/chrif.c | 39 |
2 files changed, 54 insertions, 8 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); diff --git a/src/map/chrif.c b/src/map/chrif.c index 7a7c9873a..96abe107c 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -33,9 +33,9 @@ static const int packet_len_table[0x3d] = { // U - used, F - free 60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff 6,-1,18, 7,-1,35,30,10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07 6,30,-1,10,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, U->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f - 11, 9,10, 6,11,-1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17 + 11, 9,10, 6,11,-1,266,10, // 2b10-2b17: U->2b10, F->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17 2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f - -1,10, 8, 2, 2,-1,-1,-1, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, F->2b25, F->2b26, F->2b27 + -1,10, 8, 2, 2,14,-1,-1, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, F->2b26, F->2b27 }; //Used Packets: @@ -84,7 +84,8 @@ static const int packet_len_table[0x3d] = { // U - used, F - free //2b22: Incoming, chrif_updatefamelist_ack. Updated one position in the fame list. //2b23: Outgoing, chrif_keepalive. charserver ping. //2b24: Incoming, chrif_keepalive_ack. charserver ping reply. -//2b25-2b27: FREE +//2b25: Incoming, chrif_deadopt -> 'Removes baby from Father ID and Mother ID' +//2b26-2b27: FREE int chrif_connected = 0; int char_fd = 0; //Using 0 instead of -1 is safer against crashes. [Skotlex] @@ -876,7 +877,7 @@ int chrif_changedsex(int fd) } /*========================================== - * 離婚情報同期要求 + * Divorce players *------------------------------------------*/ int chrif_divorce(int char_id, int partner_id) { @@ -886,17 +887,42 @@ int chrif_divorce(int char_id, int partner_id) if (!char_id || !partner_id || (sd = map_charid2sd(partner_id)) == NULL || sd->status.partner_id != char_id) return 0; - //離婚(相方は既にキャラが消えている筈なので) + // Update Partner info sd->status.partner_id = 0; - //相方の結婚指輪を剥奪 + // Remove Wedding Rings from inventory for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc_delitem(sd, i, 1, 0); return 0; } +/*========================================== + * Removes Baby from parents + *------------------------------------------*/ +int chrif_deadopt(int father_id, int mother_id, int child_id) +{ + struct map_session_data* sd; + int i; + if( father_id && (sd = map_charid2sd(father_id)) != NULL && sd->status.child == child_id ) + { + sd->status.child = 0; + sd->status.skill[WE_CALLBABY].lv = 0; + sd->status.skill[WE_CALLBABY].flag = 0; + clif_skillinfoblock(sd); + } + + if( mother_id && (sd = map_charid2sd(mother_id)) != NULL && sd->status.child == child_id ) + { + sd->status.child = 0; + sd->status.skill[WE_CALLBABY].lv = 0; + sd->status.skill[WE_CALLBABY].flag = 0; + clif_skillinfoblock(sd); + } + + return 0; +} /*========================================== * Disconnection of a player (account has been deleted in login-server) by [Yor] *------------------------------------------*/ @@ -1420,6 +1446,7 @@ int chrif_parse(int fd) case 0x2b21: chrif_save_ack(fd); break; case 0x2b22: chrif_updatefamelist_ack(fd); break; case 0x2b24: chrif_keepalive_ack(fd); break; + case 0x2b25: chrif_deadopt(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; default: ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd); set_eof(fd); |