diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b5286f67e4f..c496cbabe43 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -10749,7 +10749,16 @@ JumpChargeParams const* ObjectMgr::GetJumpChargeParams(int32 id) const CreatureStaticFlagsOverride const* ObjectMgr::GetCreatureStaticFlagsOverride(ObjectGuid::LowType spawnId, Difficulty difficultyId) const { - return Trinity::Containers::MapGetValuePtr(_creatureStaticFlagsOverrideStore, std::make_pair(spawnId, difficultyId)); + CreatureStaticFlagsOverride const* staticFlagsOverride = Trinity::Containers::MapGetValuePtr(_creatureStaticFlagsOverrideStore, std::make_pair(spawnId, difficultyId)); + if (staticFlagsOverride) + return staticFlagsOverride; + + // If there is no data for the difficulty, try to get data for the fallback difficulty + DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficultyId); + if (difficultyEntry) + return GetCreatureStaticFlagsOverride(spawnId, Difficulty(difficultyEntry->FallbackDifficultyID)); + + return nullptr; } void ObjectMgr::LoadGameObjectQuestItems() @@ -10916,10 +10925,14 @@ void ObjectMgr::LoadCreatureStaticFlagsOverride() continue; } - if (std::find(creatureData->spawnDifficulties.begin(), creatureData->spawnDifficulties.end(), difficultyId) == creatureData->spawnDifficulties.end()) + // DIFFICULTY_NONE is always a valid fallback + if (difficultyId != DIFFICULTY_NONE) { - TC_LOG_ERROR("sql.sql", "Table `creature_static_flags_override` has data for a creature that is not available for the specified DifficultyId (SpawnId: {}, DifficultyId: {}), skipped", spawnId, difficultyId); - continue; + if (std::find(creatureData->spawnDifficulties.begin(), creatureData->spawnDifficulties.end(), difficultyId) == creatureData->spawnDifficulties.end()) + { + TC_LOG_ERROR("sql.sql", "Table `creature_static_flags_override` has data for a creature that is not available for the specified DifficultyId (SpawnId: {}, DifficultyId: {}), skipped", spawnId, difficultyId); + continue; + } } CreatureStaticFlagsOverride& staticFlagsOverride = _creatureStaticFlagsOverrideStore[std::make_pair(spawnId, difficultyId)]; |