summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-16 20:33:01 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-16 20:33:01 +0000
commitbdd45e85b62b80d552190b95e74dafd0e6a19a77 (patch)
tree5b5ba1876a3c3e0f7bf307019d90ca4ad810f883 /src/char_sql
parent7b694adc3afbc616c41d447be20adb3412a9a42d (diff)
downloadhercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.gz
hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.bz2
hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.xz
hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.zip
- Added support for offline divorce.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12379 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index d5b837d33..73907cf22 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1277,6 +1277,26 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
}
/*----------------------------------------------------------------------------------------------------------*/
+/* Divorce Players */
+/*----------------------------------------------------------------------------------------------------------*/
+int divorce_char_sql(int partner_id1, int partner_id2)
+{
+ unsigned char buf[64];
+
+ if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, partner_id1, partner_id2) )
+ Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d')", inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
+ Sql_ShowDebug(sql_handle);
+
+ WBUFW(buf,0) = 0x2b12;
+ WBUFL(buf,2) = partner_id1;
+ WBUFL(buf,6) = partner_id2;
+ mapif_sendall(buf,10);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------------------*/
/* Delete char - davidsiaw */
/*----------------------------------------------------------------------------------------------------------*/
/* Returns 0 if successful
@@ -1323,19 +1343,7 @@ int delete_char_sql(int char_id)
/* Divorce [Wizputer] */
if( partner_id )
- {
- unsigned char buf[64];
-
- if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d'", char_db, partner_id) )
- Sql_ShowDebug(sql_handle);
- if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND `char_id`='%d'", inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id) )
- Sql_ShowDebug(sql_handle);
-
- WBUFW(buf,0) = 0x2b12;
- WBUFL(buf,2) = char_id;
- WBUFL(buf,6) = partner_id;
- mapif_sendall(buf,10);
- }
+ divorce_char_sql(char_id, partner_id);
/* De-addopt [Zephyrus] */
if( father_id || mother_id )
@@ -1857,7 +1865,6 @@ int parse_fromlogin(int fd)
{ //Receive account_reg2 registry, forward to map servers.
unsigned char buf[ACCOUNT_REG2_NUM*(256+32+2)+16];
memcpy(buf,RFIFOP(fd,0), RFIFOW(fd,2));
-// WBUFW(buf,0) = 0x2b11;
WBUFW(buf,0) = 0x3804; //Map server can now receive all kinds of reg values with the same packet. [Skotlex]
mapif_sendall(buf, WBUFW(buf,2));
}
@@ -2659,6 +2666,15 @@ int parse_frommap(int fd)
}
break;
+ // Divorce chars
+ case 0x2b11:
+ if( RFIFOREST(fd) < 10 )
+ return 0;
+
+ divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6));
+ RFIFOSKIP(fd,10);
+ break;
+
case 0x2b16: // Receive rates [Wizputer]
if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,8))
return 0;