summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2015-12-12 12:52:28 +0200
committerHaru <haru@dotalux.com>2015-12-17 04:15:53 +0100
commitbb407e4e657c80115af8a8f5717e1f6f6dc61043 (patch)
tree63ae925756971fb7a6a840d40788c682714b48a4 /src/map/atcommand.c
parent478776d998e0fb48d87cd4c49229a1cf1b8cc203 (diff)
downloadhercules-bb407e4e657c80115af8a8f5717e1f6f6dc61043.tar.gz
hercules-bb407e4e657c80115af8a8f5717e1f6f6dc61043.tar.bz2
hercules-bb407e4e657c80115af8a8f5717e1f6f6dc61043.tar.xz
hercules-bb407e4e657c80115af8a8f5717e1f6f6dc61043.zip
Change all chat mute checks to use pc->can_talk instead of direct check.
Put new macro pc_ismuted and change all other kind of mutes to use it Closes #937 as merged Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 97d8ad9db..889deac49 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6127,9 +6127,7 @@ ACMD(npctalk)
bool ifcolor=(*(info->command + 7) != 'c' && *(info->command + 7) != 'C')?0:1;
unsigned int color = 0;
- if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
- (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
+ if (!pc->can_talk(sd))
return false;
if(!ifcolor) {
@@ -6176,9 +6174,7 @@ ACMD(pettalk)
return false;
}
- if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
- (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
+ if (!pc->can_talk(sd))
return false;
if (!*message || sscanf(message, "%99[^\n]", mes) < 1) {
@@ -6983,9 +6979,7 @@ ACMD(homtalk)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
- if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
- (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
+ if (!pc->can_talk(sd))
return false;
if (!homun_alive(sd->hd)) {
@@ -7350,9 +7344,7 @@ ACMD(me)
memset(tempmes, '\0', sizeof(tempmes));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
- (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
+ if (!pc->can_talk(sd))
return false;
if (!*message || sscanf(message, "%199[^\n]", tempmes) < 0) {
@@ -9812,7 +9804,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
return false;
//Block NOCHAT but do not display it as a normal message
- if ( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCOMMAND )
+ if (pc_ismuted(&sd->sc, MANNER_NOCOMMAND))
return true;
// skip 10/11-langtype's codepage indicator, if detected