diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 52ed4a26e..65c1913d0 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -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) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index cfdd9003b..9b69675c0 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -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(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6f3e21ff6..bdacfe71a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -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; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 02d7e7f3e..93ca39e86 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11014" + #define REVISION_NR "11015" #endif // __REVISION_NR_H__