From 7496915ff909733618b011ca06ee27ae7a098f2b Mon Sep 17 00:00:00 2001 From: zephyrus Date: Wed, 7 Nov 2007 17:16:53 +0000 Subject: - Some updates on the mail system packets [Zephyrus] - Corrected the mail database structure on main.sql - TODO: find what happens when you cannot receive an emailed item due to weight problems. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11692 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 3 +++ sql-files/main.sql | 2 +- src/map/clif.c | 16 ++++++++-------- src/map/intif.c | 20 ++++++++++---------- src/map/mail.c | 2 +- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 2d29bf352..06fa7f509 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2007/11/07 + * Some updates on the mail system packets [Zephyrus] + - Corrected the mail database structure on main.sql 2007/11/06 * Fixed a crash caused by a mistake in the previous change 2007/11/05 diff --git a/sql-files/main.sql b/sql-files/main.sql index 90c989443..22cbab24b 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -479,7 +479,7 @@ CREATE TABLE `mail` ( `title` varchar(45) NOT NULL default '', `message` varchar(255) NOT NULL default '', `time` int(11) unsigned NOT NULL default '0', - `status` tinyint(2) unsigned NOT NULL default '0', + `status` tinyint(2) NOT NULL default '0', `zeny` int(11) unsigned NOT NULL default '0', `nameid` int(11) unsigned NOT NULL default '0', `amount` int(11) unsigned NOT NULL default '0', diff --git a/src/map/clif.c b/src/map/clif.c index 3bdaa3396..068ace525 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11301,14 +11301,14 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) * Reply to an Attachment operation * 0 : Successfully attached item to mail * 1 : Fail to set the attachment - * 2 : Weight problems (when getting the attachment) *------------------------------------------*/ -static void clif_Mail_attachment(int fd, uint8 flag) +static void clif_Mail_attachment(int fd, int index, uint8 flag) { - WFIFOHEAD(fd,packet_len(0x245)); - WFIFOW(fd,0) = 0x245; - WFIFOB(fd,2) = flag; - WFIFOSET(fd,packet_len(0x245)); + WFIFOHEAD(fd,packet_len(0x255)); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_len(0x255)); } /*------------------------------------------ @@ -11519,7 +11519,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) weight = data->weight * sd->mail.inbox.msg[i].item.amount; if (weight > sd->max_weight - sd->weight) { - clif_Mail_attachment(fd, 2); + // clif_Mail_attachment(fd, 2); return; } } @@ -11582,7 +11582,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) flag = mail_setitem(sd, idx, amount); if (idx > 0) - clif_Mail_attachment(fd,flag); + clif_Mail_attachment(fd,idx,flag); } /*------------------------------------------ diff --git a/src/map/intif.c b/src/map/intif.c index 629f1f5d1..d54441f4e 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1700,17 +1700,9 @@ static void intif_parse_Mail_send(int fd) fail = true; else { - if( sd == NULL ) - fail = true; + fail = !mail_checkattach(sd); - if( !mail_checkattach(sd) ) - { - mail_removeitem(sd, 0); - mail_removezeny(sd, 0); - fail = true; - } - - // confirmation message + // Confirmation to CharServer WFIFOHEAD(inter_fd,7); WFIFOW(inter_fd,0) = 0x304e; WFIFOL(inter_fd,2) = mail_id; @@ -1718,6 +1710,14 @@ static void intif_parse_Mail_send(int fd) WFIFOSET(inter_fd,7); } + nullpo_retv(sd); + + if( fail ) + { // Return items and zeny to owner + mail_removeitem(sd, 0); + mail_removezeny(sd, 0); + } + clif_Mail_send(sd->fd, fail); } diff --git a/src/map/mail.c b/src/map/mail.c index e1c006a0a..e7cd6b2d6 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -78,7 +78,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) sd->mail.index = idx; sd->mail.nameid = sd->status.inventory[idx].nameid; sd->mail.amount = amount; - clif_delitem(sd, idx, amount); + return 0; } } -- cgit v1.2.3-70-g09d2