summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c12
-rw-r--r--src/char_sql/int_storage.c48
-rw-r--r--src/char_sql/int_storage.h1
3 files changed, 13 insertions, 48 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 50a1a7ba9..0ce2aecf6 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -17,6 +17,7 @@
#include "int_guild.h"
#include "int_homun.h"
#include "int_party.h"
+#include "int_storage.h"
#include "char.h"
#include <sys/types.h>
@@ -483,6 +484,13 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
strcat(save_status, " cart");
}
+ //map storage data
+ if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) )
+ {
+ memitemdata_to_sql(p->storage.items, MAX_STORAGE, p->account_id, TABLE_STORAGE);
+ strcat(save_status, " storage");
+ }
+
#ifdef TXT_SQL_CONVERT
{ //Insert the barebones to then update the rest.
char esc_name[NAME_LENGTH*2+1];
@@ -1102,6 +1110,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item));
strcat(t_msg, " cart");
+ //read storage
+ storage_fromsql(p->account_id, &p->storage);
+ strcat(t_msg, " storage");
+
//read skill
//`skill` (`char_id`, `id`, `lv`)
if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `id`, `lv` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL)
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index cce358d76..f0118047d 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -21,7 +21,6 @@
int storage_tosql(int account_id, struct storage_data* p)
{
memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE);
- //ShowInfo ("storage save to DB - account: %d\n", account_id);
return 0;
}
@@ -159,29 +158,6 @@ int inter_guild_storage_delete(int guild_id)
//---------------------------------------------------------
// packet from map server
-// recive packet about storage data
-int mapif_load_storage(int fd,int account_id)
-{
- //load from DB
- WFIFOHEAD(fd, sizeof(struct storage_data)+8);
- WFIFOW(fd,0)=0x3810;
- WFIFOW(fd,2)=sizeof(struct storage_data)+8;
- WFIFOL(fd,4)=account_id;
- storage_fromsql(account_id, (struct storage_data*)WFIFOP(fd,8));
- WFIFOSET(fd,WFIFOW(fd,2));
- return 0;
-}
-// send ack to map server which is "storage data save ok."
-int mapif_save_storage_ack(int fd,int account_id)
-{
- WFIFOHEAD(fd, 7);
- WFIFOW(fd,0)=0x3811;
- WFIFOL(fd,2)=account_id;
- WFIFOB(fd,6)=0;
- WFIFOSET(fd,7);
- return 0;
-}
-
int mapif_load_guild_storage(int fd,int account_id,int guild_id)
{
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id) )
@@ -221,28 +197,6 @@ int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail)
//---------------------------------------------------------
// packet from map server
-// recive request about storage data
-int mapif_parse_LoadStorage(int fd)
-{
- RFIFOHEAD(fd);
- mapif_load_storage(fd,RFIFOL(fd,2));
- return 0;
-}
-// storage data recive and save
-int mapif_parse_SaveStorage(int fd)
-{
- int len = RFIFOW(fd,2);
- int account_id = RFIFOL(fd,4);
-
- if(sizeof(struct storage_data)!=len-8){
- ShowError("inter storage: data size error %d %d\n",sizeof(struct storage_data),len-8);
- }else{
- storage_tosql(account_id, (struct storage_data*)RFIFOP(fd,8));
- mapif_save_storage_ack(fd,account_id);
- }
- return 0;
-}
-
int mapif_parse_LoadGuildStorage(int fd)
{
RFIFOHEAD(fd);
@@ -285,8 +239,6 @@ int inter_storage_parse_frommap(int fd)
{
RFIFOHEAD(fd);
switch(RFIFOW(fd,0)){
- case 0x3010: mapif_parse_LoadStorage(fd); break;
- case 0x3011: mapif_parse_SaveStorage(fd); break;
case 0x3018: mapif_parse_LoadGuildStorage(fd); break;
case 0x3019: mapif_parse_SaveGuildStorage(fd); break;
default:
diff --git a/src/char_sql/int_storage.h b/src/char_sql/int_storage.h
index 4a17a0442..811608f82 100644
--- a/src/char_sql/int_storage.h
+++ b/src/char_sql/int_storage.h
@@ -15,6 +15,7 @@ int inter_guild_storage_delete(int guild_id);
int inter_storage_parse_frommap(int fd);
//Exported for use in the TXT-SQL converter.
+int storage_fromsql(int account_id, struct storage_data* p);
int storage_tosql(int account_id,struct storage_data *p);
int guild_storage_tosql(int guild_id, struct guild_storage *p);