- 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.
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

View File

@ -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',

View File

@ -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);
}
/*------------------------------------------

View File

@ -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);
}

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.nameid = sd->status.inventory[idx].nameid;
sd->mail.amount = amount;
clif_delitem(sd, idx, amount);
return 0;
}
}