mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Player: cleanup function CheckInstanceLoginValid
This commit is contained in:
3
sql/updates/world/2015_11_27_00_world_355.sql
Normal file
3
sql/updates/world/2015_11_27_00_world_355.sql
Normal 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');
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user