aboutsummaryrefslogtreecommitdiff
path: root/src/game/Chat.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-29 17:27:50 -0600
committermegamage <none@none>2008-12-29 17:27:50 -0600
commitf70d5a22c7efdef6caab5d9ddf433d689e5f0dbc (patch)
tree1d600a20630e92f7fe848abdc87b9f48c6dd15b6 /src/game/Chat.cpp
parent35ce5ca6ba2ac8f0a70049cca652a541f2e10bec (diff)
*Update to Mangos 6982.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Chat.cpp')
-rw-r--r--src/game/Chat.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index fe7949fc700..283cd8b9582 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -33,6 +33,7 @@
#include "MapManager.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
+#include "AccountMgr.h"
bool ChatHandler::load_command_table = true;
@@ -668,6 +669,38 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const
return m_session->GetSecurity() >= cmd.SecurityLevel;
}
+bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid)
+{
+ uint32 target_sec;
+
+ if (!sWorld.getConfig(CONFIG_GM_LOWER_SECURITY))
+ return false;
+
+ // allow everything from RA console
+ if (!m_session)
+ return false;
+
+ if (target)
+ target_sec = target->GetSession()->GetSecurity();
+ else if (guid)
+ target_sec = accmgr.GetSecurity(objmgr.GetPlayerAccountIdByGUID(guid));
+ else
+ {
+ SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ SetSentErrorMessage(true);
+ return true;
+ }
+
+ if (m_session->GetSecurity() < target_sec)
+ {
+ SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
+ SetSentErrorMessage(true);
+ return true;
+ }
+
+ return false;
+}
+
bool ChatHandler::hasStringAbbr(const char* name, const char* part)
{
// non "" command