summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/pc.c36
-rw-r--r--src/emap/pc.h3
3 files changed, 40 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 4e63623..c92f503 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -188,6 +188,7 @@ HPExport void plugin_init (void)
addHookPre("pc->dropitem", epc_dropitem_pre);
addHookPre("pc->takeitem", epc_takeitem_pre);
addHookPre("pc->insert_card", epc_insert_card_pre);
+ addHookPre("pc->process_chat_message", epc_process_chat_message_pre);
addHookPre("mob->deleteslave_sub", emob_deleteslave_sub);
addHookPre("mob->read_db_additional_fields", emob_read_db_additional_fields);
addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag);
diff --git a/src/emap/pc.c b/src/emap/pc.c
index c7203d0..42669ae 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -660,3 +660,39 @@ bool epc_adoption_pre(struct map_session_data *p1_sd,
hookStop();
return true;
}
+
+// copy from pc_process_chat_message
+// exception only prevent call gm command if string start with ##
+bool epc_process_chat_message_pre(struct map_session_data *sd, const char *message)
+{
+ if (message && strlen(message) > 2 && message[0] == '#' && message[1] == '#')
+ {
+ // do nothing
+ }
+ else if (atcommand->exec(sd->fd, sd, message, true))
+ {
+ hookStop();
+ return false;
+ }
+
+ if (!pc->can_talk(sd))
+ {
+ hookStop();
+ return false;
+ }
+
+ if (battle->bc->min_chat_delay != 0)
+ {
+ if (DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0)
+ {
+ hookStop();
+ return false;
+ }
+ sd->cantalk_tick = timer->gettick() + battle->bc->min_chat_delay;
+ }
+
+ pc->update_idle_time(sd, BCIDLE_CHAT);
+
+ hookStop();
+ return true;
+}
diff --git a/src/emap/pc.h b/src/emap/pc.h
index 951c91e..058561f 100644
--- a/src/emap/pc.h
+++ b/src/emap/pc.h
@@ -74,4 +74,7 @@ bool epc_adoption_pre(struct map_session_data *p1_sd,
struct map_session_data *p2_sd,
struct map_session_data *b_sd);
+bool epc_process_chat_message_pre(struct map_session_data *sd,
+ const char *message);
+
#endif // EVOL_MAP_PC