Core/Player: cleanup function CheckInstanceLoginValid

This commit is contained in:
ForesterDev
2015-11-27 11:59:13 +04:00
parent 5f917e2286
commit 9573ec52f0
3 changed files with 12 additions and 7 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `trinity_string` WHERE `entry` = 11010;
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
(11010, 'You didn\'t get kicked out of the instance even if Player::CheckInstanceLoginValid() returned false and without .gm on flag');

View File

@@ -2563,7 +2563,7 @@ void Player::SetGameMaster(bool on)
bool Player::CanBeGameMaster() const
{
return m_session && m_session->HasPermission(rbac::RBAC_PERM_COMMAND_GM);
return GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_GM);
}
void Player::SetGMVisible(bool on)
@@ -18672,31 +18672,31 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
bool Player::CheckInstanceLoginValid(Map* map)
{
if (!map->IsDungeon() || IsGameMaster())
if (!map->IsDungeon() || IsInstanceLoginGameMasterException())
return true;
if (map->IsRaid())
{
// cannot be in raid instance without a group
if (!GetGroup())
return IsInstanceLoginGameMasterException();
return false;
}
else
{
// cannot be in normal instance without a group and more players than 1 in instance
if (!GetGroup() && map->GetPlayersCountExceptGMs() > 1)
return IsInstanceLoginGameMasterException();
return false;
}
// do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
return sMapMgr->CanPlayerEnter(map->GetId(), this, true) || IsInstanceLoginGameMasterException();
return sMapMgr->CanPlayerEnter(map->GetId(), this, true);
}
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");
ChatHandler(GetSession()).SendSysMessage(LANG_INSTANCE_LOGIN_GAMEMASTER_EXCEPTION);
return true;
}
else

View File

@@ -1202,7 +1202,9 @@ enum TrinityStrings
LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007,
LANG_NPCINFO_INHABIT_TYPE = 11008,
LANG_NPCINFO_FLAGS_EXTRA = 11009
LANG_NPCINFO_FLAGS_EXTRA = 11009,
LANG_INSTANCE_LOGIN_GAMEMASTER_EXCEPTION = 11010
};
#endif