summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-13 17:55:32 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-13 17:55:32 +0000
commit3c8b17a9300d36cf6241edb6751f26af3b262c1e (patch)
tree7c3abb9e7bc239b367a9baf5876c133754b4faf4 /src/map/clif.c
parent71d75dcb2b25a8df05fdf04eadecca560960fd90 (diff)
downloadhercules-3c8b17a9300d36cf6241edb6751f26af3b262c1e.tar.gz
hercules-3c8b17a9300d36cf6241edb6751f26af3b262c1e.tar.bz2
hercules-3c8b17a9300d36cf6241edb6751f26af3b262c1e.tar.xz
hercules-3c8b17a9300d36cf6241edb6751f26af3b262c1e.zip
- Some fixes to mail system.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12199 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 3a1afb5cb..8600d520a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11295,13 +11295,14 @@ void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title)
}
/*------------------------------------------
- * Opens Mail Window on Client
+ * Handles Mail Window on Client
+ * flag : 0 open | 1 close
*------------------------------------------*/
-void clif_Mail_openmail(int fd)
+void clif_Mail_window(int fd, int flag)
{
WFIFOHEAD(fd,packet_len(0x260));
WFIFOW(fd,0) = 0x260;
- WFIFOL(fd,2) = 0;
+ WFIFOL(fd,2) = flag;
WFIFOSET(fd,packet_len(0x260));
}
@@ -11429,6 +11430,7 @@ void clif_parse_Mail_read(int fd, struct map_session_data *sd)
void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
{
int i, mail_id = RFIFOL(fd,2);
+ bool fail = false;
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
if( i == MAIL_MAX_INBOX )
@@ -11445,8 +11447,23 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
if ((data = itemdb_search(sd->mail.inbox.msg[i].item.nameid)) == NULL)
return;
+ switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) )
+ {
+ case ADDITEM_NEW:
+ fail = ( pc_inventoryblank(sd) == 0 );
+ break;
+ case ADDITEM_OVERAMOUNT:
+ fail = true;
+ }
+
+ if( fail )
+ {
+ clif_Mail_getattachment(fd, 1);
+ return;
+ }
+
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_getattachment(fd, 2);
return;