mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[11015] Prevent crash at player far teleport landing to nonexisten battleground instance.
Teleport back in like case or to homebind in bad case.
This commit is contained in:
parent
3de0f99f59
commit
0c19c2c6a2
4 changed files with 39 additions and 9 deletions
|
|
@ -154,12 +154,14 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
|||
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
{
|
||||
const MapEntry *entry = sMapStore.LookupEntry(mapid);
|
||||
if(!entry) return false;
|
||||
if(!entry)
|
||||
return false;
|
||||
|
||||
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
||||
|
||||
if(entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
|
||||
if(entry->IsDungeon())
|
||||
{
|
||||
if (entry->map_type == MAP_RAID)
|
||||
if (entry->IsRaid())
|
||||
{
|
||||
// GMs can avoid raid limitations
|
||||
if(!player->isGameMaster() && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_RAID))
|
||||
|
|
@ -228,10 +230,9 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||
return(false);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,32 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
|
||||
// get the destination map entry, not the current one, this will fix homebind and reset greeting
|
||||
MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid);
|
||||
|
||||
Map* map = NULL;
|
||||
|
||||
// prevent crash at attempt landing to not existed battleground instance
|
||||
if(mEntry->IsBattleGroundOrArena())
|
||||
{
|
||||
if (GetPlayer()->GetBattleGroundId())
|
||||
map = sMapMgr.FindMap(loc.mapid, GetPlayer()->GetBattleGroundId());
|
||||
|
||||
if (!map)
|
||||
{
|
||||
DETAIL_LOG("WorldSession::HandleMoveWorldportAckOpcode: %s was teleported far to nonexisten battleground instance "
|
||||
" (map:%u, x:%f, y:%f, z:%f) Trying to port him to his previous place..",
|
||||
GetPlayer()->GetGuidStr().c_str(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
|
||||
|
||||
// Teleport to previous place, if cannot be ported back TP to homebind place
|
||||
if (!GetPlayer()->TeleportTo(old_loc))
|
||||
{
|
||||
DETAIL_LOG("WorldSession::HandleMoveWorldportAckOpcode: %s cannot be ported to his previous place, teleporting him to his homebind place...",
|
||||
GetPlayer()->GetGuidStr().c_str());
|
||||
GetPlayer()->TeleportToHomebind();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(loc.mapid);
|
||||
|
||||
// reset instance validity, except if going to an instance inside an instance
|
||||
|
|
@ -75,7 +101,10 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
GetPlayer()->SetSemaphoreTeleportFar(false);
|
||||
|
||||
// relocate the player to the teleport destination
|
||||
GetPlayer()->SetMap(sMapMgr.CreateMap(loc.mapid, GetPlayer()));
|
||||
if (!map)
|
||||
map = sMapMgr.CreateMap(loc.mapid, GetPlayer());
|
||||
|
||||
GetPlayer()->SetMap(map);
|
||||
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
|
||||
|
||||
GetPlayer()->SendInitialPacketsBeforeAddToMap();
|
||||
|
|
|
|||
|
|
@ -2756,7 +2756,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
if (totem && apply)
|
||||
((Player*)target)->GetCamera().SetView(totem);
|
||||
else
|
||||
((Player*)target)->GetCamera().ResetView(totem);
|
||||
((Player*)target)->GetCamera().ResetView();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11014"
|
||||
#define REVISION_NR "11015"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue