summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/mail.c36
-rw-r--r--src/map/mail.h9
3 files changed, 47 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 7eb1035..5327532 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -40,6 +40,7 @@
#include "map/clif.h"
#include "map/itemdb.h"
#include "map/lang.h"
+#include "map/mail.h"
#include "map/map.h"
#include "map/mob.h"
#include "map/npc.h"
@@ -149,6 +150,7 @@ HPExport void plugin_init (void)
addHookPre("itemdb->readdb_additional_fields", eitemdb_readdb_additional_fields);
addHookPre("unit->can_move", eunit_can_move);
addHookPre("unit->walktoxy", eunit_walktoxy);
+ addHookPre("mail->invalid_operation", email_invalid_operation);
addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post);
addHookPost("clif->authok", eclif_authok_post);
diff --git a/src/map/mail.c b/src/map/mail.c
new file mode 100644
index 0000000..d136192
--- /dev/null
+++ b/src/map/mail.c
@@ -0,0 +1,36 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/db.h"
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+#include "../../../common/timer.h"
+#include "../../../map/battle.h"
+#include "../../../map/itemdb.h"
+#include "../../../map/map.h"
+#include "../../../map/pc.h"
+
+bool email_invalid_operation(struct map_session_data *sd)
+{
+ if (!sd)
+ {
+ hookStop();
+ return true;
+ }
+
+ if (!map->list[sd->bl.m].flag.town)
+ {
+ ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
+ hookStop();
+ return true;
+ }
+ hookStop();
+ return false;
+}
diff --git a/src/map/mail.h b/src/map/mail.h
new file mode 100644
index 0000000..2c3aca2
--- /dev/null
+++ b/src/map/mail.h
@@ -0,0 +1,9 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_MAIL
+#define EVOL_MAP_MAIL
+
+bool email_invalid_operation(struct map_session_data *sd);
+
+#endif // EVOL_MAP_MAIL