diff options
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r-- | src/server/game/Maps/Map.cpp | 84 |
1 files changed, 73 insertions, 11 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 2e98dc59016..0a7138616e0 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -239,7 +239,7 @@ m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_VisibilityNotifyPeriod(DEFAULT_VISIBILITY_NOTIFY_PERIOD), m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()), i_gridExpiry(expiry), -i_scriptLock(false), _defaultLight(GetDefaultMapLight(id)) +i_scriptLock(false), _defaultLight(DB2Manager::GetDefaultMapLight(id)) { m_parentMap = (_parent ? _parent : this); for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) @@ -2405,7 +2405,7 @@ bool Map::IsOutdoors(float x, float y, float z) const return true; AreaTableEntry const* atEntry = nullptr; - WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); + WMOAreaTableEntry const* wmoEntry= sDB2Manager.GetWMOAreaTable(rootId, adtId, groupId); if (wmoEntry) { TC_LOG_DEBUG("maps", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->AreaTableID); @@ -2440,20 +2440,20 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const WMOAreaTableEntry const* wmoEntry = nullptr; AreaTableEntry const* atEntry = nullptr; bool haveAreaInfo = false; + uint32 areaId = 0; if (GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId)) { haveAreaInfo = true; - wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); + wmoEntry = sDB2Manager.GetWMOAreaTable(rootId, adtId, groupId); if (wmoEntry) + { + areaId = wmoEntry->AreaTableID; atEntry = sAreaTableStore.LookupEntry(wmoEntry->AreaTableID); + } } - uint32 areaId = 0; - - if (atEntry) - areaId = atEntry->ID; - else + if (!areaId) { if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) areaId = gmap->getArea(x, y); @@ -2653,7 +2653,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const char const* Map::GetMapName() const { - return i_mapEntry ? i_mapEntry->MapName_lang : "UNNAMEDMAP\x0"; + return i_mapEntry ? i_mapEntry->MapName->Str[sWorld->GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; } void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair) @@ -3415,7 +3415,7 @@ void InstanceMap::SetResetSchedule(bool on) MapDifficultyEntry const* Map::GetMapDifficulty() const { - return GetMapDifficultyData(GetId(), GetDifficultyID()); + return sDB2Manager.GetMapDifficultyData(GetId(), GetDifficultyID()); } uint32 Map::GetDifficultyLootBonusTreeMod() const @@ -3430,6 +3430,36 @@ uint32 Map::GetDifficultyLootBonusTreeMod() const return 0; } +uint32 Map::GetId() const +{ + return i_mapEntry->ID; +} + +bool Map::Instanceable() const +{ + return i_mapEntry && i_mapEntry->Instanceable(); +} + +bool Map::IsDungeon() const +{ + return i_mapEntry && i_mapEntry->IsDungeon(); +} + +bool Map::IsNonRaidDungeon() const +{ + return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); +} + +bool Map::IsRaid() const +{ + return i_mapEntry && i_mapEntry->IsRaid(); +} + +bool Map::IsRaidOrHeroicDungeon() const +{ + return IsRaid() || IsHeroic(); +} + bool Map::IsHeroic() const { if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(i_spawnMode)) @@ -3437,6 +3467,38 @@ bool Map::IsHeroic() const return false; } +bool Map::Is25ManRaid() const +{ + return IsRaid() && (i_spawnMode == DIFFICULTY_25_N || i_spawnMode == DIFFICULTY_25_HC); +} + +bool Map::IsBattleground() const +{ + return i_mapEntry && i_mapEntry->IsBattleground(); +} + +bool Map::IsBattleArena() const +{ + return i_mapEntry && i_mapEntry->IsBattleArena(); +} + +bool Map::IsBattlegroundOrArena() const +{ + return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); +} + +bool Map::IsGarrison() const +{ + return i_mapEntry && i_mapEntry->IsGarrison(); +} + +bool Map::GetEntrancePos(int32 &mapid, float &x, float &y) +{ + if (!i_mapEntry) + return false; + return i_mapEntry->GetEntrancePos(mapid, x, y); +} + bool InstanceMap::HasPermBoundPlayers() const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE); @@ -3456,7 +3518,7 @@ uint32 InstanceMap::GetMaxPlayers() const uint32 InstanceMap::GetMaxResetDelay() const { MapDifficultyEntry const* mapDiff = GetMapDifficulty(); - return mapDiff ? mapDiff->RaidDuration : 0; + return mapDiff ? mapDiff->GetRaidDuration() : 0; } /* ******* Battleground Instance Maps ******* */ |