summaryrefslogtreecommitdiff
path: root/src/char/int_mail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/int_mail.c')
-rw-r--r--src/char/int_mail.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/char/int_mail.c b/src/char/int_mail.c
index 98da43aeb..f327bb8a3 100644
--- a/src/char/int_mail.c
+++ b/src/char/int_mail.c
@@ -29,7 +29,7 @@ static int mail_fromsql(int char_id, struct mail_data* md)
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`,"
- "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`");
+ "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`nsiuid`");
for (i = 0; i < MAX_SLOTS; i++)
StringBuf_Printf(&buf, ",`card%d`", i);
@@ -61,11 +61,12 @@ static int mail_fromsql(int char_id, struct mail_data* md)
Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data);
Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data);
Sql_GetData(sql_handle,14, &data, NULL); item->identify = atoi(data);
+ Sql_GetData(sql_handle,15, &data, NULL); item->nsiuid = strtoull(data, NULL, 10);
item->expire_time = 0;
for (j = 0; j < MAX_SLOTS; j++)
{
- Sql_GetData(sql_handle, 15 + j, &data, NULL);
+ Sql_GetData(sql_handle, 16 + j, &data, NULL);
item->card[j] = atoi(data);
}
}
@@ -106,14 +107,18 @@ int mail_savemessage(struct mail_message* msg)
// build message save query
StringBuf_Init(&buf);
- StringBuf_Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `status`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`", mail_db);
+ StringBuf_Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `status`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`, `nsiuid`", mail_db);
for (j = 0; j < MAX_SLOTS; j++)
StringBuf_Printf(&buf, ", `card%d`", j);
- StringBuf_Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
- msg->send_id, msg->dest_id, (unsigned long)msg->timestamp, msg->status, msg->zeny, msg->item.amount, msg->item.nameid, msg->item.refine, msg->item.attribute, msg->item.identify);
+ StringBuf_Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
+ msg->send_id, msg->dest_id, (unsigned long)msg->timestamp, msg->status, msg->zeny, msg->item.amount, msg->item.nameid, msg->item.refine, msg->item.attribute, msg->item.identify, msg->item.nsiuid);
for (j = 0; j < MAX_SLOTS; j++)
StringBuf_Printf(&buf, ", '%d'", msg->item.card[j]);
StringBuf_AppendStr(&buf, ")");
+
+ //Unique Non Stackable Item ID
+ updateLastUid(msg->item.nsiuid);
+ dbUpdateUid(sql_handle);
// prepare and execute query
stmt = SqlStmt_Malloc(sql_handle);
@@ -144,7 +149,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg)
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`,"
- "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`");
+ "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`nsiuid`");
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ",`card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `id` = '%d'", mail_db, mail_id);
@@ -176,11 +181,12 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg)
Sql_GetData(sql_handle,12, &data, NULL); msg->item.refine = atoi(data);
Sql_GetData(sql_handle,13, &data, NULL); msg->item.attribute = atoi(data);
Sql_GetData(sql_handle,14, &data, NULL); msg->item.identify = atoi(data);
+ Sql_GetData(sql_handle,15, &data, NULL); msg->item.nsiuid = strtoull(data, NULL, 10);
msg->item.expire_time = 0;
for( j = 0; j < MAX_SLOTS; j++ )
{
- Sql_GetData(sql_handle,15 + j, &data, NULL);
+ Sql_GetData(sql_handle,16 + j, &data, NULL);
msg->item.card[j] = atoi(data);
}
}