diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index dc96eea42..8c51fc020 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -923,7 +923,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; //FIXME: work only for instances where max==min for players - if(((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit) + if (map->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit) continue; SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); break; diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index 8b0833859..2e28ff0e6 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -234,7 +234,7 @@ enum AreaFlags enum Difficulty { - DIFFICULTY_DEFAULT = 0, + REGULAR_DEFAULT = 0, DUNGEON_DIFFICULTY_NORMAL = 0, DUNGEON_DIFFICULTY_HEROIC = 1, @@ -251,7 +251,7 @@ enum Difficulty enum SpawnMask { - SPAWNMASK_CONTINENT = (1 << DIFFICULTY_DEFAULT),// any any maps without spawn modes + SPAWNMASK_REGULAR = (1 << REGULAR_DEFAULT), // any any maps without spawn modes (continents/subway) or in minimal spawnmode SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL), SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC), diff --git a/src/game/Map.cpp b/src/game/Map.cpp index bbec9b77e..59ed9dd11 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1127,6 +1127,23 @@ void Map::UnloadAll(bool pForce) } } +MapDifficulty const* Map::GetMapDifficulty() const +{ + return GetMapDifficultyData(GetId(),GetDifficulty()); +} + +uint32 Map::GetMaxPlayers() const +{ + MapDifficulty const* mapDiff = GetMapDifficulty(); + return mapDiff ? mapDiff->maxPlayers : 0; +} + +uint32 Map::GetMaxResetDelay() const +{ + MapDifficulty const* mapDiff = GetMapDifficulty(); + return mapDiff ? mapDiff->resetTime : 0; +} + //***************************** // Grid function //***************************** @@ -2618,24 +2635,6 @@ void InstanceMap::SetResetSchedule(bool on) } } -MapDifficulty const* InstanceMap::GetMapDifficulty() const -{ - return GetMapDifficultyData(GetId(),GetDifficulty()); -} - -uint32 InstanceMap::GetMaxPlayers() const -{ - MapDifficulty const* mapDiff = GetMapDifficulty(); - return mapDiff ? mapDiff->maxPlayers : 0; -} - -uint32 InstanceMap::GetMaxResetDelay() const -{ - MapDifficulty const* mapDiff = GetMapDifficulty(); - return mapDiff ? mapDiff->resetTime : 0; -} - - /* ******* Battleground Instance Maps ******* */ BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode) diff --git a/src/game/Map.h b/src/game/Map.h index 428d182c9..d824d22d7 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -362,10 +362,20 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj bool CheckGridIntegrity(Creature* c, bool moved) const; uint32 GetInstanceId() const { return i_InstanceId; } - uint8 GetSpawnMode() const { return (i_spawnMode); } virtual bool CanEnter(Player* /*player*/) { return true; } const char* GetMapName() const; + // have meaning only for instanced map (that have set real difficulty), NOT USE its for BaseMap + // _currently_ spawnmode == difficulty, but this can be changes later, so use appropriate spawmmode/difficult functions + // for simplify later code support + // regular difficulty = continent/dungeon normal/first raid normal difficulty + uint8 GetSpawnMode() const { return (i_spawnMode); } + Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); } + bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DEFAULT; } + uint32 GetMaxPlayers() const; // dependent from map difficulty + uint32 GetMaxResetDelay() const; // dependent from map difficulty + MapDifficulty const* GetMapDifficulty() const; // dependent from map difficulty + bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); } // NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); } @@ -597,12 +607,6 @@ class MANGOS_DLL_SPEC InstanceMap : public Map void SendResetWarnings(uint32 timeLeft) const; void SetResetSchedule(bool on); - // have meaning only for instanced map (that have set real difficulty) - Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); } - uint32 GetMaxPlayers() const; - uint32 GetMaxResetDelay() const; - MapDifficulty const* GetMapDifficulty() const; - virtual void InitVisibilityDistance(); private: bool m_resetAfterUnload; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4294cb87e..3065fcd18 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2319,7 +2319,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { if (m_target->GetMap()->IsDungeon()) { - uint32 spellId = ((InstanceMap*)m_target->GetMap())->GetDifficulty() == DIFFICULTY_DEFAULT ? 44190 : 46163; + uint32 spellId = m_target->GetMap()->IsRegularDifficulty() ? 44190 : 46163; m_target->CastSpell(m_target, spellId, true, NULL, this); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ffaa521b8..21931b450 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 "8830" + #define REVISION_NR "8831" #endif // __REVISION_NR_H__