summaryrefslogtreecommitdiff
path: root/src/map/mail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mail.c')
-rw-r--r--src/map/mail.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index fa842b70f..9a8d4e521 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -31,7 +32,7 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if( sd->mail.amount )
{
if (flag) // Item send
- pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
+ pc->delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
else
clif->additem(sd, sd->mail.index, sd->mail.amount, 0);
}
@@ -48,7 +49,7 @@ int mail_removezeny(struct map_session_data *sd, short flag)
if (flag && sd->mail.zeny > 0)
{ //Zeny send
- pc_payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
+ pc->payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
}
sd->mail.zeny = 0;
@@ -61,7 +62,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 1;
if( idx == 0 ) { // Zeny Transfer
- if( amount < 0 || !pc_can_give_items(sd) )
+ if( amount < 0 || !pc->can_give_items(sd) )
return 1;
if( amount > sd->status.zeny )
@@ -72,14 +73,14 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 0;
} else { // Item Transfer
idx -= 2;
- mail_removeitem(sd, 0);
+ mail->removeitem(sd, 0);
if( idx < 0 || idx >= MAX_INVENTORY )
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
- if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time ||
- !itemdb_canmail(&sd->status.inventory[idx],pc_get_group_level(sd)) )
+ if( !pc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+ !itemdb_canmail(&sd->status.inventory[idx],pc->get_group_level(sd)) )
return 1;
sd->mail.index = idx;
@@ -121,8 +122,8 @@ bool mail_setattachment(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);
+ mail->removeitem(sd,1);
+ mail->removezeny(sd,1);
return true;
}
@@ -131,13 +132,13 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item
{
if( item->nameid > 0 && item->amount > 0 )
{
- pc_additem(sd, item, item->amount, LOG_TYPE_MAIL);
+ pc->additem(sd, item, item->amount, LOG_TYPE_MAIL);
clif->mail_getattachment(sd->fd, 0);
}
if( zeny > 0 )
{ //Zeny receive
- pc_getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
+ pc->getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
}
}
@@ -161,12 +162,12 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->item.amount > 0 )
{
// Item receive (due to failure)
- pc_additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
+ pc->additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
}
if( msg->zeny > 0 )
{
- pc_getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
+ pc->getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
}
clif->mail_send(sd->fd, true);
@@ -175,7 +176,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
// This function only check if the mail operations are valid
bool mail_invalid_operation(struct map_session_data *sd)
{
- if( !map[sd->bl.m].flag.town && !pc_can_use_command(sd, "@mail") )
+ if( !map[sd->bl.m].flag.town && !pc->can_use_command(sd, "@mail") )
{
ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;
@@ -183,3 +184,18 @@ bool mail_invalid_operation(struct map_session_data *sd)
return false;
}
+
+void mail_defaults(void)
+{
+ mail = &mail_s;
+
+ mail->clear = mail_clear;
+ mail->removeitem = mail_removeitem;
+ mail->removezeny = mail_removezeny;
+ mail->setitem = mail_setitem;
+ mail->setattachment = mail_setattachment;
+ mail->getattachment = mail_getattachment;
+ mail->openmail = mail_openmail;
+ mail->deliveryfail = mail_deliveryfail;
+ mail->invalid_operation = mail_invalid_operation;
+} \ No newline at end of file