diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-07 17:16:53 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-07 17:16:53 +0000 |
commit | 7496915ff909733618b011ca06ee27ae7a098f2b (patch) | |
tree | 4291f623b63f1d03fbb14d4cb7dc67dab70798af /src/map | |
parent | a78edf2b3c8b22ff202ee43261f89c42e2313657 (diff) | |
download | hercules-7496915ff909733618b011ca06ee27ae7a098f2b.tar.gz hercules-7496915ff909733618b011ca06ee27ae7a098f2b.tar.bz2 hercules-7496915ff909733618b011ca06ee27ae7a098f2b.tar.xz hercules-7496915ff909733618b011ca06ee27ae7a098f2b.zip |
- 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
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 16 | ||||
-rw-r--r-- | src/map/intif.c | 20 | ||||
-rw-r--r-- | src/map/mail.c | 2 |
3 files changed, 19 insertions, 19 deletions
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; } } |