Core/Handlers: fix ".whisper on" with opposite faction/low level

Port From (https://github.com/TrinityCore/TrinityCore/commit/0b556d8a9183a8109a8559473c32a55405bd30df)
This commit is contained in:
hondacrx
2021-11-18 17:21:47 -05:00
parent a31eb8647b
commit 2ce3cc84f8
2 changed files with 15 additions and 9 deletions
+2 -1
View File
@@ -2156,7 +2156,8 @@ namespace Game.Entities
else else
m_ExtraFlags &= ~PlayerExtraFlags.AcceptWhispers; m_ExtraFlags &= ~PlayerExtraFlags.AcceptWhispers;
} }
public bool IsGameMaster() { return Convert.ToBoolean(m_ExtraFlags & PlayerExtraFlags.GMOn); } public bool IsGameMaster() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMOn); }
public bool IsGameMasterAcceptingWhispers() { return IsGameMaster() && IsAcceptWhispers(); }
public bool CanBeGameMaster() { return GetSession().HasPermission(RBACPermissions.CommandGm); } public bool CanBeGameMaster() { return GetSession().HasPermission(RBACPermissions.CommandGm); }
public void SetGameMaster(bool on) public void SetGameMaster(bool on)
{ {
+6 -1
View File
@@ -233,7 +233,11 @@ namespace Game
SendChatPlayerNotfoundNotice(target); SendChatPlayerNotfoundNotice(target);
return; return;
} }
if (!sender.IsGameMaster() && sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq) && !receiver.IsInWhisperWhiteList(sender.GetGUID()))
// Apply checks only if receiver is not already in whitelist and if receiver is not a GM with ".whisper on"
if (!receiver.IsInWhisperWhiteList(sender.GetGUID()) && !receiver.IsGameMasterAcceptingWhispers())
{
if (!sender.IsGameMaster() && sender.GetLevel() < WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq))
{ {
SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.WhisperReq), WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq)); SendNotification(Global.ObjectMgr.GetCypherString(CypherStrings.WhisperReq), WorldConfig.GetIntValue(WorldCfg.ChatWhisperLevelReq));
return; return;
@@ -244,6 +248,7 @@ namespace Game
SendChatPlayerNotfoundNotice(target); SendChatPlayerNotfoundNotice(target);
return; return;
} }
}
if (GetPlayer().HasAura(1852) && !receiver.IsGameMaster()) if (GetPlayer().HasAura(1852) && !receiver.IsGameMaster())
{ {