diff options
author | markzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2013-01-07 05:13:54 +0000 |
---|---|---|
committer | markzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2013-01-07 05:13:54 +0000 |
commit | 24987d8513307094064f59d3c9f9c35d0f6a6e87 (patch) | |
tree | c535cefbdf72d7de8ec676f4d9d89fcaebbd8668 /src/char/int_mail.c | |
parent | 92880a66754afb8b3b4285276c70c0fc6aa75c1f (diff) | |
download | hercules-24987d8513307094064f59d3c9f9c35d0f6a6e87.tar.gz hercules-24987d8513307094064f59d3c9f9c35d0f6a6e87.tar.bz2 hercules-24987d8513307094064f59d3c9f9c35d0f6a6e87.tar.xz hercules-24987d8513307094064f59d3c9f9c35d0f6a6e87.zip |
* Implemented Unique identifier for Non stackable items. (tid:69380)
* Set as off by default, it can be changed in /src/config/core.h.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17080 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/int_mail.c')
-rw-r--r-- | src/char/int_mail.c | 20 |
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); } } |