diff options
author | hemagx <hemagx2@gmail.com> | 2015-12-12 12:52:28 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-12-17 04:15:53 +0100 |
commit | bb407e4e657c80115af8a8f5717e1f6f6dc61043 (patch) | |
tree | 63ae925756971fb7a6a840d40788c682714b48a4 /src | |
parent | 478776d998e0fb48d87cd4c49229a1cf1b8cc203 (diff) | |
download | hercules-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')
-rw-r--r-- | src/map/atcommand.c | 18 | ||||
-rw-r--r-- | src/map/buyingstore.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 14 | ||||
-rw-r--r-- | src/map/pc.c | 4 | ||||
-rw-r--r-- | src/map/pc.h | 1 | ||||
-rw-r--r-- | src/map/status.c | 2 |
6 files changed, 18 insertions, 25 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 diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 38b8da91d..3828a3c14 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -51,7 +51,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots) return false; } - if( sd->sc.data[SC_NOCHAT] && (sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) ) + if(pc_ismuted(&sd->sc, MANNER_NOROOM)) {// custom: mute limitation return false; } @@ -105,7 +105,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha return; } - if( sd->sc.data[SC_NOCHAT] && (sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) ) + if(pc_ismuted(&sd->sc, MANNER_NOROOM)) {// custom: mute limitation return; } diff --git a/src/map/clif.c b/src/map/clif.c index 5030442f1..6fb7dd04e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10235,7 +10235,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) { sd->sc.data[SC_TRICKDEAD] || sd->sc.data[SC_BLADESTOP] || sd->sc.data[SC_CLOAKINGEXCEED] || - (sd->sc.data[SC_NOCHAT] &&sd->sc.data[SC_NOCHAT]->val1&MANNER_NOITEM) + pc_ismuted(&sd->sc, MANNER_NOITEM) ) ) break; @@ -10271,7 +10271,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) if (sd->sc.count && ( sd->sc.data[SC_AUTOCOUNTER] || sd->sc.data[SC_BLADESTOP] || - (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOITEM) + pc_ismuted(&sd->sc, MANNER_NOITEM) )) break; @@ -10530,7 +10530,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) char s_password[CHATROOM_PASS_SIZE]; char s_title[CHATROOM_TITLE_SIZE]; - if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) + if (pc_ismuted(&sd->sc, MANNER_NOROOM)) return; if(battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 4) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3); @@ -11816,7 +11816,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) if( atcommand->exec(fd, sd, message, true) ) return; - if( 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; if (battle_config.min_chat_delay) { @@ -12528,7 +12528,7 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) { if( !flag ) sd->state.prevend = sd->state.workinprogress = 0; - if( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM ) + if(pc_ismuted(&sd->sc, MANNER_NOROOM)) return; if( map->list[sd->bl.m].flag.novending ) { clif->message (sd->fd, msg_sd(sd,276)); // "You can't open a shop on this map" @@ -12920,7 +12920,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) if( atcommand->exec(fd, sd, message, true) ) return; - if( 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; if (battle_config.min_chat_delay) { @@ -16016,7 +16016,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) if( atcommand->exec(fd, sd, message, true) ) return; - if( 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; if( battle_config.min_chat_delay ) { diff --git a/src/map/pc.c b/src/map/pc.c index d5d68d299..567348d20 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4884,7 +4884,7 @@ int pc_useitem(struct map_session_data *sd,int n) { sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC_SATURDAY_NIGHT_FEVER] || sd->sc.data[SC_COLD] || - (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOITEM) + pc_ismuted(&sd->sc, MANNER_NOITEM) )) return 0; @@ -8875,7 +8875,7 @@ bool pc_can_talk( struct map_session_data *sd ) { if( 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) ) + pc_ismuted(&sd->sc, MANNER_NOCHAT) ) return false; return true; diff --git a/src/map/pc.h b/src/map/pc.h index 2a6f8643a..93173f6c8 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -620,6 +620,7 @@ END_ZEROED_BLOCK; #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) ) #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) ) #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK ) +#define pc_ismuted(sc,type) ( (sc)->data[SC_NOCHAT] && (sc)->data[SC_NOCHAT]->val1&(type) ) #ifdef NEW_CARTS #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] ) diff --git a/src/map/status.c b/src/map/status.c index 926ebaf21..f4fd04467 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1815,7 +1815,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin (sc->data[SC_VOLCANO] && skill_id == WZ_ICEWALL) || (sc->data[SC_ROKISWEIL] && skill_id != BD_ADAPTATION) || (sc->data[SC_HERMODE] && skill->get_inf(skill_id) & INF_SUPPORT_SKILL) || - (sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOSKILL) + pc_ismuted(sc, MANNER_NOSKILL) ) return 0; |