This commit is contained in:
Aokromes
2015-10-16 00:02:55 +02:00
3 changed files with 9 additions and 11 deletions
+7 -9
View File
@@ -16847,7 +16847,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
}
else if (map->IsDungeon()) // if map is dungeon...
{
if (!((InstanceMap*)map)->CanEnter(this)) // ... and can't enter map, then look for entry point.
if (!((InstanceMap*)map)->CanEnter(this) || !CheckInstanceLoginValid(map)) // ... and can't enter map, then look for entry point.
{
areaTrigger = sObjectMgr->GetGoBackTrigger(mapId);
check = true;
@@ -16874,6 +16874,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
{
TC_LOG_ERROR("entities.player", "Player %s %s Map: %u, X: %f, Y: %f, Z: %f, O: %f. Areatrigger not found.",
m_name.c_str(), guid.ToString().c_str(), mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
map = NULL;
}
}
@@ -18556,15 +18557,12 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
return true;
}
bool Player::CheckInstanceLoginValid()
bool Player::CheckInstanceLoginValid(Map* map)
{
if (!FindMap())
return false;
if (!GetMap()->IsDungeon() || IsGameMaster())
if (!map->IsDungeon() || IsGameMaster())
return true;
if (GetMap()->IsRaid())
if (map->IsRaid())
{
// cannot be in raid instance without a group
if (!GetGroup())
@@ -18573,12 +18571,12 @@ bool Player::CheckInstanceLoginValid()
else
{
// cannot be in normal instance without a group and more players than 1 in instance
if (!GetGroup() && GetMap()->GetPlayersCountExceptGMs() > 1)
if (!GetGroup() && map->GetPlayersCountExceptGMs() > 1)
return false;
}
// do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
return sMapMgr->CanPlayerEnter(GetMap()->GetId(), this, true);
return sMapMgr->CanPlayerEnter(map->GetId(), this, true);
}
bool Player::CheckInstanceCount(uint32 instanceId) const
+1 -1
View File
@@ -2441,7 +2441,7 @@ class Player : public Unit, public GridObject<Player>
void SendRaidInfo();
static void ConvertInstancesToGroup(Player* player, Group* group, bool switchLeader);
bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false);
bool CheckInstanceLoginValid();
bool CheckInstanceLoginValid(Map* map);
bool CheckInstanceCount(uint32 instanceId) const;
void AddInstanceEnterTime(uint32 instanceId, time_t enterTime);
@@ -1011,7 +1011,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
}
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar))
{
AreaTriggerStruct const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
if (at)