Core/Player: Always allow accounts with RBAC_PERM_COMMAND_GM to enter instances on login

Always allow accounts with RBAC_PERM_COMMAND_GM to enter instances on login even if player had .gm off .
Send an ingame message to notify the user about the avoided kick.

(cherry picked from commit 5f917e2286809d7aafa8871be38042ae7966c26b)
This commit is contained in:
jackpoz
2015-12-12 03:08:45 +01:00
committed by Carbenium
parent baa52438e6
commit 5077363f51
2 changed files with 22 additions and 3 deletions
+19 -3
View File
@@ -2267,6 +2267,11 @@ void Player::SetGameMaster(bool on)
UpdateObjectVisibility();
}
bool Player::CanBeGameMaster() const
{
return m_session && m_session->HasPermission(rbac::RBAC_PERM_COMMAND_GM);
}
void Player::SetGMVisible(bool on)
{
if (on)
@@ -18326,17 +18331,28 @@ bool Player::CheckInstanceLoginValid(Map* map)
{
// cannot be in raid instance without a group
if (!GetGroup())
return false;
return IsInstanceLoginGameMasterException();
}
else
{
// cannot be in normal instance without a group and more players than 1 in instance
if (!GetGroup() && map->GetPlayersCountExceptGMs() > 1)
return false;
return IsInstanceLoginGameMasterException();
}
// do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
return sMapMgr->CanPlayerEnter(map->GetId(), this, true);
return sMapMgr->CanPlayerEnter(map->GetId(), this, true) || IsInstanceLoginGameMasterException();
}
bool Player::IsInstanceLoginGameMasterException() const
{
if (CanBeGameMaster())
{
ChatHandler(GetSession()).PSendSysMessage("You didn't get kicked out of the instance even if Player::CheckInstanceLoginValid() returned false and without .gm on flag");
return true;
}
else
return false;
}
bool Player::CheckInstanceCount(uint32 instanceId) const
+3
View File
@@ -1244,6 +1244,7 @@ class Player : public Unit, public GridObject<Player>
bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
bool IsGameMaster() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_ON) != 0; }
bool CanBeGameMaster() const;
void SetGameMaster(bool on);
bool isGMChat() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT) != 0; }
void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
@@ -2771,6 +2772,8 @@ class Player : public Unit, public GridObject<Player>
bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; }
void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; }
void ScheduleDelayedOperation(uint32 operation) { if (operation < DELAYED_END) m_DelayedOperations |= operation; }
bool IsInstanceLoginGameMasterException() const;
MapReference m_mapRef;