summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2016-09-01 14:53:40 +0200
committerYehonal <yehonal.azeroth@gmail.com>2016-09-02 00:21:12 +0200
commitcd2417eb2f5d8864ec6cb47f57e9720e2909204b (patch)
tree985c2302de389b53d06539fb8b2e425617e06663
parentb86f955f8d45058b96db5cd9a704ec7f9c85a340 (diff)
Using IsGMAccount instead of direct check
-rw-r--r--src/game/Entities/GameObject/GameObject.cpp3
-rw-r--r--src/game/Entities/Player/Player.cpp6
-rw-r--r--src/game/Entities/Unit/Unit.cpp7
-rw-r--r--src/game/Handlers/CharacterHandler.cpp2
-rw-r--r--src/game/Server/WorldSession.cpp3
-rw-r--r--src/scripts/Commands/cs_gm.cpp2
-rw-r--r--src/scripts/Commands/cs_modify.cpp11
7 files changed, 19 insertions, 15 deletions
diff --git a/src/game/Entities/GameObject/GameObject.cpp b/src/game/Entities/GameObject/GameObject.cpp
index 6e9f293ffc..b6931c5f70 100644
--- a/src/game/Entities/GameObject/GameObject.cpp
+++ b/src/game/Entities/GameObject/GameObject.cpp
@@ -23,6 +23,7 @@
#include "UpdateFieldFlags.h"
#include "World.h"
#include "Transport.h"
+#include "AccountMgr.h"
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
m_model(NULL), m_goValue(), m_AI(NULL)
@@ -2253,7 +2254,7 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
return;
bool forcedFlags = GetGoType() == GAMEOBJECT_TYPE_CHEST && GetGOInfo()->chest.groupLootRules && HasLootRecipient();
- bool targetIsGM = target->IsGameMaster() && target->GetSession()->GetSecurity() >= SEC_GAMEMASTER;
+ bool targetIsGM = target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity());
ByteBuffer fieldBuffer;
diff --git a/src/game/Entities/Player/Player.cpp b/src/game/Entities/Player/Player.cpp
index cf68d8354e..b94dd3d245 100644
--- a/src/game/Entities/Player/Player.cpp
+++ b/src/game/Entities/Player/Player.cpp
@@ -2988,14 +2988,14 @@ void Player::SetGameMaster(bool on)
if (on)
{
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
- if (GetSession()->GetSecurity() >= SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
setFaction(35);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet())
{
- if (GetSession()->GetSecurity() >= SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
pet->setFaction(35);
pet->getHostileRefManager().setOnlineOfflineState(false);
}
@@ -3007,7 +3007,7 @@ void Player::SetGameMaster(bool on)
CombatStopWithPets();
SetPhaseMask(uint32(PHASEMASK_ANYWHERE), false); // see and visible in all phases
- m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, GetSession()->GetSecurity() == SEC_MODERATOR ? SEC_PLAYER : GetSession()->GetSecurity());
+ m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, GetSession()->GetSecurity());
}
else
{
diff --git a/src/game/Entities/Unit/Unit.cpp b/src/game/Entities/Unit/Unit.cpp
index 1f8117dadf..73298fb36d 100644
--- a/src/game/Entities/Unit/Unit.cpp
+++ b/src/game/Entities/Unit/Unit.cpp
@@ -51,6 +51,7 @@
#include "WorldSession.h"
#include "ArenaSpectator.h"
#include "DynamicVisibility.h"
+#include "AccountMgr.h"
#include <math.h>
@@ -19146,7 +19147,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
else if (index == UNIT_FIELD_FLAGS)
{
uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
- if (target->IsGameMaster() && target->GetSession()->GetSecurity() >= SEC_GAMEMASTER)
+ if (target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity()))
appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
fieldBuffer << uint32(appendValue);
@@ -19171,7 +19172,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
{
- if (target->IsGameMaster() && target->GetSession()->GetSecurity() >= SEC_GAMEMASTER)
+ if (target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity()))
{
if (cinfo->Modelid1)
displayId = cinfo->Modelid1; // Modelid1 is a visible model for gms
@@ -19294,4 +19295,4 @@ void Unit::setRace(uint8 race)
{
if (GetTypeId() == TYPEID_PLAYER)
m_race = race;
-} \ No newline at end of file
+}
diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp
index 94f4199267..0f4ee76ff6 100644
--- a/src/game/Handlers/CharacterHandler.cpp
+++ b/src/game/Handlers/CharacterHandler.cpp
@@ -1034,7 +1034,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
}
// friend status
- if (GetSecurity() < SEC_GAMEMASTER) // pussywizard: only for non-gms
+ if (AccountMgr::IsGMAccount(GetSecurity())) // pussywizard: only for non-gms
sSocialMgr->SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true);
// Place character in world (and load zone) before some object loading
diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp
index fac6ac4bfb..01af0e49ac 100644
--- a/src/game/Server/WorldSession.cpp
+++ b/src/game/Server/WorldSession.cpp
@@ -34,6 +34,7 @@
#include "WardenWin.h"
#include "WardenMac.h"
#include "SavingSystem.h"
+#include "AccountMgr.h"
namespace {
@@ -516,7 +517,7 @@ void WorldSession::LogoutPlayer(bool save)
}
//! Broadcast a logout message to the player's friends
- if (GetSecurity() < SEC_GAMEMASTER) // pussywizard: only for non-gms
+ if (AccountMgr::IsGMAccount(GetSecurity())) // pussywizard: only for non-gms
sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow());
diff --git a/src/scripts/Commands/cs_gm.cpp b/src/scripts/Commands/cs_gm.cpp
index d88c6138aa..9268272d2d 100644
--- a/src/scripts/Commands/cs_gm.cpp
+++ b/src/scripts/Commands/cs_gm.cpp
@@ -83,7 +83,7 @@ public:
return false;
Player* target = handler->getSelectedPlayer();
- if (!target || handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (!target || AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
WorldPacket data(12);
diff --git a/src/scripts/Commands/cs_modify.cpp b/src/scripts/Commands/cs_modify.cpp
index 7dc571f5bb..d05078869d 100644
--- a/src/scripts/Commands/cs_modify.cpp
+++ b/src/scripts/Commands/cs_modify.cpp
@@ -18,6 +18,7 @@ EndScriptData */
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
+#include "AccountMgr.h"
class modify_commandscript : public CommandScript
{
@@ -473,7 +474,7 @@ public:
}
Player* target = handler->getSelectedPlayerOrSelf();
- if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
if (!target)
{
@@ -523,7 +524,7 @@ public:
}
Player* target = handler->getSelectedPlayerOrSelf();
- if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
if (!target)
{
@@ -570,7 +571,7 @@ public:
}
Player* target = handler->getSelectedPlayerOrSelf();
- if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
if (!target)
{
@@ -617,7 +618,7 @@ public:
}
Player* target = handler->getSelectedPlayerOrSelf();
- if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
if (!target)
{
@@ -664,7 +665,7 @@ public:
}
Player* target = handler->getSelectedPlayerOrSelf();
- if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
+ if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer();
if (!target)
{