summaryrefslogtreecommitdiff
path: root/src/map/mail.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-12 08:55:36 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-12 08:55:36 +0000
commit2f6e6453f6296a6335cf6fccbfe0567584ebdbde (patch)
treec1239f5528ea9254381e78aae0f5d520283151f8 /src/map/mail.c
parent164c37ba01a9a727a2134ec606f875d6aa770413 (diff)
downloadhercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.gz
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.bz2
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.xz
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.zip
- Important fix to Mail System allowing (by a low change) items duple.
- Added picklog to mail. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11721 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mail.c')
-rw-r--r--src/map/mail.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index e7cd6b2d6..9d2f4375e 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -9,6 +9,7 @@
#include "itemdb.h"
#include "clif.h"
#include "pc.h"
+#include "log.h"
#include <time.h>
#include <string.h>
@@ -26,7 +27,12 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if( sd->mail.amount )
{
if (flag)
+ { // Item send
+ if(log_config.enable_logs&0x2000)
+ log_pick_pc(sd, "E", sd->mail.nameid, -sd->mail.amount, &sd->status.inventory[sd->mail.index]);
+
pc_delitem(sd, sd->mail.index, sd->mail.amount, 1);
+ }
else
clif_additem(sd, sd->mail.index, sd->mail.amount, 0);
}
@@ -72,7 +78,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
- if( !itemdb_isdropable(&sd->status.inventory[idx], pc_isGM(sd)) )
+ if( !pc_candrop(sd, &sd->status.inventory[idx]) )
return 1;
sd->mail.index = idx;
@@ -83,12 +89,12 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
}
}
-bool mail_getattach(struct map_session_data *sd, struct mail_message *msg)
+bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
{
int n;
- nullpo_retr(0,sd);
- nullpo_retr(0,msg);
+ nullpo_retr(false,sd);
+ nullpo_retr(false,msg);
if( sd->mail.zeny < 0 || sd->mail.zeny > sd->status.zeny )
return false;
@@ -110,29 +116,30 @@ bool mail_getattach(struct map_session_data *sd, struct mail_message *msg)
msg->zeny = sd->mail.zeny;
+ // Removes the attachment from sender
+ mail_removeitem(sd,1);
+ mail_removezeny(sd,1);
+
return true;
}
-bool mail_checkattach(struct map_session_data *sd)
+void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item)
{
- nullpo_retr(false,sd);
-
- if( sd->mail.zeny > 0 && sd->status.zeny < sd->status.zeny )
- return false;
-
- if( sd->mail.amount > 0 )
+ if( zeny > 0 )
{
- if( sd->status.inventory[sd->mail.index].nameid != sd->mail.nameid )
- return false;
-
- if( sd->status.inventory[sd->mail.index].amount < sd->mail.amount )
- return false;
+ sd->status.zeny += zeny;
+ clif_updatestatus(sd, SP_ZENY);
}
- mail_removeitem(sd,1);
- mail_removezeny(sd,1);
+ if( item->nameid > 0 && item->amount > 0 )
+ {
+ pc_additem(sd, item, item->amount);
- return true;
+ if(log_config.enable_logs&0x2000)
+ log_pick_pc(sd, "E", item->nameid, item->amount, item);
+
+ clif_Mail_getattachment(sd->fd, 0);
+ }
}
int mail_openmail(struct map_session_data *sd)