Using IsGMAccount instead of direct check

This commit is contained in:
Yehonal
2016-09-01 14:53:40 +02:00
parent b86f955f8d
commit cd2417eb2f
7 changed files with 19 additions and 15 deletions
+2 -1
View File
@@ -23,6 +23,7 @@
#include "UpdateFieldFlags.h" #include "UpdateFieldFlags.h"
#include "World.h" #include "World.h"
#include "Transport.h" #include "Transport.h"
#include "AccountMgr.h"
GameObject::GameObject() : WorldObject(false), MovableMapObject(), GameObject::GameObject() : WorldObject(false), MovableMapObject(),
m_model(NULL), m_goValue(), m_AI(NULL) m_model(NULL), m_goValue(), m_AI(NULL)
@@ -2253,7 +2254,7 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
return; return;
bool forcedFlags = GetGoType() == GAMEOBJECT_TYPE_CHEST && GetGOInfo()->chest.groupLootRules && HasLootRecipient(); 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; ByteBuffer fieldBuffer;
+3 -3
View File
@@ -2988,14 +2988,14 @@ void Player::SetGameMaster(bool on)
if (on) if (on)
{ {
m_ExtraFlags |= PLAYER_EXTRA_GM_ON; m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
setFaction(35); setFaction(35);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS); SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
{ {
if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
pet->setFaction(35); pet->setFaction(35);
pet->getHostileRefManager().setOnlineOfflineState(false); pet->getHostileRefManager().setOnlineOfflineState(false);
} }
@@ -3007,7 +3007,7 @@ void Player::SetGameMaster(bool on)
CombatStopWithPets(); CombatStopWithPets();
SetPhaseMask(uint32(PHASEMASK_ANYWHERE), false); // see and visible in all phases 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 else
{ {
+4 -3
View File
@@ -51,6 +51,7 @@
#include "WorldSession.h" #include "WorldSession.h"
#include "ArenaSpectator.h" #include "ArenaSpectator.h"
#include "DynamicVisibility.h" #include "DynamicVisibility.h"
#include "AccountMgr.h"
#include <math.h> #include <math.h>
@@ -19146,7 +19147,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
else if (index == UNIT_FIELD_FLAGS) else if (index == UNIT_FIELD_FLAGS)
{ {
uint32 appendValue = m_uint32Values[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; appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
fieldBuffer << uint32(appendValue); 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 (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) if (cinfo->Modelid1)
displayId = cinfo->Modelid1; // Modelid1 is a visible model for gms displayId = cinfo->Modelid1; // Modelid1 is a visible model for gms
@@ -19294,4 +19295,4 @@ void Unit::setRace(uint8 race)
{ {
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
m_race = race; m_race = race;
} }
+1 -1
View File
@@ -1034,7 +1034,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
} }
// friend status // 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); sSocialMgr->SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true);
// Place character in world (and load zone) before some object loading // Place character in world (and load zone) before some object loading
+2 -1
View File
@@ -34,6 +34,7 @@
#include "WardenWin.h" #include "WardenWin.h"
#include "WardenMac.h" #include "WardenMac.h"
#include "SavingSystem.h" #include "SavingSystem.h"
#include "AccountMgr.h"
namespace { namespace {
@@ -516,7 +517,7 @@ void WorldSession::LogoutPlayer(bool save)
} }
//! Broadcast a logout message to the player's friends //! 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->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow()); sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow());
+1 -1
View File
@@ -83,7 +83,7 @@ public:
return false; return false;
Player* target = handler->getSelectedPlayer(); Player* target = handler->getSelectedPlayer();
if (!target || handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (!target || AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
WorldPacket data(12); WorldPacket data(12);
+6 -5
View File
@@ -18,6 +18,7 @@ EndScriptData */
#include "Player.h" #include "Player.h"
#include "ReputationMgr.h" #include "ReputationMgr.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "AccountMgr.h"
class modify_commandscript : public CommandScript class modify_commandscript : public CommandScript
{ {
@@ -473,7 +474,7 @@ public:
} }
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
if (!target) if (!target)
{ {
@@ -523,7 +524,7 @@ public:
} }
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
if (!target) if (!target)
{ {
@@ -570,7 +571,7 @@ public:
} }
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
if (!target) if (!target)
{ {
@@ -617,7 +618,7 @@ public:
} }
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
if (!target) if (!target)
{ {
@@ -664,7 +665,7 @@ public:
} }
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) if (AccountMgr::IsGMAccount(handler->GetSession()->GetSecurity()))
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
if (!target) if (!target)
{ {