*Do not create new instance when player is logging in. (Try to fix "Instance Relog & Reset Exploit")

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-03 17:06:31 -06:00
parent 08d259e0cc
commit b36929bc79
2 changed files with 15 additions and 7 deletions
+4 -1
View File
@@ -610,7 +610,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
}
}
if (!pCurrChar->GetMap()->Add(pCurrChar))
{
Map *map = pCurrChar->GetMap();
if (!map || !map->Add(pCurrChar))
{
AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId());
if(at)
@@ -618,6 +620,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
else
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
}
}
ObjectAccessor::Instance().AddObject(pCurrChar);
//sLog.outDebug("Player %s added to Map.",pCurrChar->GetName());
+6 -1
View File
@@ -179,13 +179,18 @@ Map* MapInstanced::GetInstance(const WorldObject* obj)
map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty());
return map;
}
else
else if(!player->GetSession()->PlayerLoading())
{
// if no instanceId via group members or instance saves is found
// the instance will be created for the first time
NewInstanceId = MapManager::Instance().GenerateInstanceId();
return CreateInstance(NewInstanceId, NULL, player->GetDifficulty());
}
else
{
sLog.outError("MAPINSTANCED: Player %s is trying to create instance (MapId %u) when login.", player->GetName(), player->GetMapId());
return NULL;
}
}
}
}