[11446] Reimplement corpse enter to instance.

* Resurrect player _before_ enter to instance with corpse
* In case corpse in more deep instance teleport to corpse instance inner entrance.
* If by some reason player can't enter to corpse instance it will just resurrected before entrance.

Original patch and research done by Den.
This commit is contained in:
VladimirMangos 2011-05-09 00:53:21 +04:00
parent 6d28c7dfd0
commit 605fb79847
4 changed files with 65 additions and 69 deletions

View file

@ -194,38 +194,6 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
return false;
}
if (!player->isAlive())
{
if(Corpse *corpse = player->GetCorpse())
{
// let enter in ghost mode in instance that connected to inner instance with corpse
uint32 instance_map = corpse->GetMapId();
do
{
if(instance_map==mapid)
break;
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(instance_map);
instance_map = instance ? instance->parent : 0;
}
while (instance_map);
if (!instance_map)
{
WorldPacket data(SMSG_AREA_TRIGGER_NO_CORPSE);
player->GetSession()->SendPacket(&data);
DEBUG_LOG("MAP: Player '%s' doesn't has a corpse in instance '%s' and can't enter", player->GetName(), mapName);
return false;
}
DEBUG_LOG("MAP: Player '%s' has corpse in instance '%s' and can enter", player->GetName(), mapName);
}
else
{
DEBUG_LOG("Map::CanEnter - player '%s' is dead but doesn't have a corpse!", player->GetName());
}
}
// TODO: move this to a map dependent location
/*if(i_data && i_data->IsEncounterInProgress())
{