summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-08-23 19:08:54 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-08-23 19:08:54 +0000
commitac96c8dbde939dc367afe734f3452590e154475c (patch)
treead6b2ec838d199f6875ec331727b4a25249e0f9b /src/char_sql
parentc45d93d9d873996f99829dfc506c7875ea13d24c (diff)
downloadhercules-ac96c8dbde939dc367afe734f3452590e154475c.tar.gz
hercules-ac96c8dbde939dc367afe734f3452590e154475c.tar.bz2
hercules-ac96c8dbde939dc367afe734f3452590e154475c.tar.xz
hercules-ac96c8dbde939dc367afe734f3452590e154475c.zip
- Completed Mercenary Create, Delete, Save. Tests OK.
- Incremented MAX_SKILL required for a proper load of Mercenary Skills. - Some fixes. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13118 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/int_homun.c36
-rw-r--r--src/char_sql/int_homun.h3
-rw-r--r--src/char_sql/inter.c2
3 files changed, 37 insertions, 4 deletions
diff --git a/src/char_sql/int_homun.c b/src/char_sql/int_homun.c
index f949ac4f9..9fedfe978 100644
--- a/src/char_sql/int_homun.c
+++ b/src/char_sql/int_homun.c
@@ -330,7 +330,7 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
merc->mercenary_id = merc_id;
merc->char_id = char_id;
- if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `mercenary` WHERE `merc_id` = '%d' AND `char_id` = '%d'", merc_id, char_id) )
+ if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `mercenary` WHERE `mer_id` = '%d' AND `char_id` = '%d'", merc_id, char_id) )
{
Sql_ShowDebug(sql_handle);
return false;
@@ -356,7 +356,7 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
bool mapif_mercenary_delete(int merc_id)
{
- if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `mercenary` WHERE `merc_id` = '%d'", merc_id) )
+ if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `mercenary` WHERE `mer_id` = '%d'", merc_id) )
{
Sql_ShowDebug(sql_handle);
return false;
@@ -390,6 +390,34 @@ static void mapif_parse_mercenary_load(int fd, int merc_id, int char_id)
mapif_mercenary_send(fd, &merc, result);
}
+static void mapif_mercenary_deleted(int fd, unsigned char flag)
+{
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x3871;
+ WFIFOB(fd,2) = flag;
+ WFIFOSET(fd,3);
+}
+
+static void mapif_parse_mercenary_delete(int fd, int merc_id)
+{
+ bool result = mapif_mercenary_delete(merc_id);
+ mapif_mercenary_deleted(fd, result);
+}
+
+static void mapif_mercenary_saved(int fd, unsigned char flag)
+{
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x3872;
+ WFIFOB(fd,2) = flag;
+ WFIFOSET(fd,3);
+}
+
+static void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc)
+{
+ bool result = mapif_mercenary_save(merc);
+ mapif_mercenary_saved(fd, result);
+}
+
/*==========================================
* Inter Packets
*------------------------------------------*/
@@ -406,8 +434,10 @@ int inter_homunculus_parse_frommap(int fd)
case 0x3093: mapif_parse_homunculus_delete(fd, (int)RFIFOL(fd,2)); break;
case 0x3094: mapif_parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break;
// Mercenary Packets
- case 0x3070: mapif_parse_mercenary_create(fd, (struct s_mercenary*)RFIFOP(fd,8)); break;
+ case 0x3070: mapif_parse_mercenary_create(fd, (struct s_mercenary*)RFIFOP(fd,4)); break;
case 0x3071: mapif_parse_mercenary_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break;
+ case 0x3072: mapif_parse_mercenary_delete(fd, (int)RFIFOL(fd,2)); break;
+ case 0x3073: mapif_parse_mercenary_save(fd, (struct s_mercenary*)RFIFOP(fd,4)); break;
default:
return 0;
}
diff --git a/src/char_sql/int_homun.h b/src/char_sql/int_homun.h
index 1c0d76269..8ff30f976 100644
--- a/src/char_sql/int_homun.h
+++ b/src/char_sql/int_homun.h
@@ -5,6 +5,7 @@
#define _INT_HOMUN_SQL_H_
struct s_homunculus;
+struct s_mercenary;
int inter_homunculus_sql_init(void);
void inter_homunculus_sql_final(void);
@@ -15,4 +16,6 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd);
bool mapif_homunculus_delete(int homun_id);
bool mapif_homunculus_rename(char *name);
+bool mapif_mercenary_delete(int merc_id);
+
#endif /* _INT_HOMUN_SQL_H_ */
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index f29d44ea9..372ce400f 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -51,7 +51,7 @@ int inter_recv_packet_length[] = {
5, 9, 0, 0, 0, 0, 0, 0, 7, 6,10,10, 10,-1, 0, 0, // 3040-
-1,-1,10,10, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus]
6,-1,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3060- Quest system [Kevin]
- -1,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3070- Mercenary packets [Zephyrus]
+ -1,10, 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3070- Mercenary packets [Zephyrus]
48,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080-
-1,10,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3090- Homunculus packets [albator]
};