- 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://svn.code.sf.net/p/rathena/svn/trunk@11692 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2007-11-07 17:16:53 +00:00
parent ed0f069c10
commit 009ce06822
5 changed files with 23 additions and 20 deletions

View File

@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. 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. 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 2007/11/06
* Fixed a crash caused by a mistake in the previous change * Fixed a crash caused by a mistake in the previous change
2007/11/05 2007/11/05

View File

@ -479,7 +479,7 @@ CREATE TABLE `mail` (
`title` varchar(45) NOT NULL default '', `title` varchar(45) NOT NULL default '',
`message` varchar(255) NOT NULL default '', `message` varchar(255) NOT NULL default '',
`time` int(11) unsigned NOT NULL default '0', `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', `zeny` int(11) unsigned NOT NULL default '0',
`nameid` int(11) unsigned NOT NULL default '0', `nameid` int(11) unsigned NOT NULL default '0',
`amount` int(11) unsigned NOT NULL default '0', `amount` int(11) unsigned NOT NULL default '0',

View File

@ -11301,14 +11301,14 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
* Reply to an Attachment operation * Reply to an Attachment operation
* 0 : Successfully attached item to mail * 0 : Successfully attached item to mail
* 1 : Fail to set the attachment * 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)); WFIFOHEAD(fd,packet_len(0x255));
WFIFOW(fd,0) = 0x245; WFIFOW(fd,0) = 0x255;
WFIFOB(fd,2) = flag; WFIFOW(fd,2) = index;
WFIFOSET(fd,packet_len(0x245)); 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; weight = data->weight * sd->mail.inbox.msg[i].item.amount;
if (weight > sd->max_weight - sd->weight) if (weight > sd->max_weight - sd->weight)
{ {
clif_Mail_attachment(fd, 2); // clif_Mail_attachment(fd, 2);
return; return;
} }
} }
@ -11582,7 +11582,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd)
flag = mail_setitem(sd, idx, amount); flag = mail_setitem(sd, idx, amount);
if (idx > 0) if (idx > 0)
clif_Mail_attachment(fd,flag); clif_Mail_attachment(fd,idx,flag);
} }
/*------------------------------------------ /*------------------------------------------

View File

@ -1700,17 +1700,9 @@ static void intif_parse_Mail_send(int fd)
fail = true; fail = true;
else else
{ {
if( sd == NULL ) fail = !mail_checkattach(sd);
fail = true;
if( !mail_checkattach(sd) ) // Confirmation to CharServer
{
mail_removeitem(sd, 0);
mail_removezeny(sd, 0);
fail = true;
}
// confirmation message
WFIFOHEAD(inter_fd,7); WFIFOHEAD(inter_fd,7);
WFIFOW(inter_fd,0) = 0x304e; WFIFOW(inter_fd,0) = 0x304e;
WFIFOL(inter_fd,2) = mail_id; WFIFOL(inter_fd,2) = mail_id;
@ -1718,6 +1710,14 @@ static void intif_parse_Mail_send(int fd)
WFIFOSET(inter_fd,7); 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); clif_Mail_send(sd->fd, fail);
} }

View File

@ -78,7 +78,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
sd->mail.index = idx; sd->mail.index = idx;
sd->mail.nameid = sd->status.inventory[idx].nameid; sd->mail.nameid = sd->status.inventory[idx].nameid;
sd->mail.amount = amount; sd->mail.amount = amount;
clif_delitem(sd, idx, amount);
return 0; return 0;
} }
} }