summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.cpp24
-rw-r--r--src/map/map.hpp8
-rw-r--r--src/map/pc.cpp34
-rw-r--r--src/mmo/clif.t.hpp4
4 files changed, 70 insertions, 0 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 81ae02f..bd7f4ef 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -3844,6 +3844,12 @@ RecvResult clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd)
if (is_atcommand(s, sd, mbuf, GmLevel()))
return rv;
+ if (sd->mute.global)
+ {
+ clif_displaymessage(s, "Your message could not be sent: you are muted."_s);
+ return rv;
+ }
+
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
@@ -4188,11 +4194,20 @@ RecvResult clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd)
return rv;
}
+ if (magic_message(sd, mbuf))
+ return rv;
+
if (is_atcommand(s, sd, mbuf, GmLevel()))
{
return rv;
}
+ if (sd->mute.whisper)
+ {
+ clif_displaymessage(s, "Your message could not be sent: you are muted."_s);
+ return rv;
+ }
+
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
@@ -4974,9 +4989,18 @@ RecvResult clif_parse_PartyMessage(Session *s, dumb_ptr<map_session_data> sd)
return rv;
}
+ if (magic_message(sd, mbuf))
+ return rv;
+
if (is_atcommand(s, sd, mbuf, GmLevel()))
return rv;
+ if (sd->mute.party)
+ {
+ clif_displaymessage(s, "Your message could not be sent: you are muted."_s);
+ return rv;
+ }
+
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 7732af9..897787e 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -290,6 +290,14 @@ struct map_session_data : block_list, SessionData
int chat_total_repeats;
RString chat_lastmsg;
+ struct
+ {
+ unsigned global:1;
+ unsigned party:1;
+ unsigned whisper:1;
+ unsigned guild:1;
+ } mute;
+
tick_t flood_rates[0x220];
tick_t packet_flood_reset_due;
int packet_flood_in;
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 05f61ea..f854ccd 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -827,6 +827,12 @@ int pc_authok(AccountId id, int login_id2, ClientVersion client_version,
sd->chat_repeat_reset_due = tick_t();
sd->chat_lastmsg = RString();
+ // Initialize mute vars
+ sd->mute.global = 0;
+ sd->mute.party = 0;
+ sd->mute.whisper = 0;
+ sd->mute.guild = 0;
+
for (tick_t& t : sd->flood_rates)
t = tick_t();
sd->packet_flood_reset_due = tick_t();
@@ -3547,6 +3553,18 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type)
if (sd)
val = bool(sd->status.option & Opt0::HIDE);
break;
+ case SP::MUTE_GLOBAL:
+ val = sd ? sd->mute.global : 0;
+ break;
+ case SP::MUTE_PARTY:
+ val = sd ? sd->mute.party : 0;
+ break;
+ case SP::MUTE_WHISPER:
+ val = sd ? sd->mute.whisper : 0;
+ break;
+ case SP::MUTE_GUILD:
+ val = sd ? sd->mute.guild : 0;
+ break;
}
return val;
@@ -3770,6 +3788,22 @@ int pc_setparam(dumb_ptr<block_list> bl, SP type, int val)
sd->status.option &= ~Opt0::HIDE;
clif_changeoption(sd);
break;
+ case SP::MUTE_GLOBAL:
+ nullpo_retz(sd);
+ sd->mute.global = (val == 1);
+ break;
+ case SP::MUTE_PARTY:
+ nullpo_retz(sd);
+ sd->mute.party = (val == 1);
+ break;
+ case SP::MUTE_WHISPER:
+ nullpo_retz(sd);
+ sd->mute.whisper = (val == 1);
+ break;
+ case SP::MUTE_GUILD:
+ nullpo_retz(sd);
+ sd->mute.guild = (val == 1);
+ break;
}
return 0;
diff --git a/src/mmo/clif.t.hpp b/src/mmo/clif.t.hpp
index c23842e..5f07ebd 100644
--- a/src/mmo/clif.t.hpp
+++ b/src/mmo/clif.t.hpp
@@ -476,6 +476,10 @@ enum class SP : uint16_t
CHAR_ID = 1079,
INVISIBLE = 1080,
HIDDEN = 1081,
+ MUTE_GLOBAL = 1082,
+ MUTE_WHISPER = 1083,
+ MUTE_PARTY = 1084,
+ MUTE_GUILD = 1085,
};
constexpr