diff options
author | Teleqraph <nyrdeveloper@gmail.com> | 2023-10-22 11:24:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-22 11:24:48 +0200 |
commit | 9eceff2bc243946998c006418229dbb639e898d6 (patch) | |
tree | f800e44d9d2d7bb7caf388cb690194ed3bfac3e2 /src/server/game/Maps/Map.cpp | |
parent | 3d3979f1cabf59321fbafcde1f0d1e600d29e974 (diff) |
Core/Map: Implement several difficulty getters (#29370)
Co-authored-by: ModoX <moardox@gmail.com>
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r-- | src/server/game/Maps/Map.cpp | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 57af9eb75c0..c778396dd88 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3193,18 +3193,83 @@ bool Map::IsRaid() const return i_mapEntry && i_mapEntry->IsRaid(); } +bool Map::IsLFR() const +{ + switch (i_spawnMode) + { + case DIFFICULTY_LFR: + case DIFFICULTY_LFR_NEW: + case DIFFICULTY_LFR_15TH_ANNIVERSARY: + return true; + default: + return false; + } +} + +bool Map::IsNormal() const +{ + switch (i_spawnMode) + { + case DIFFICULTY_NORMAL: + case DIFFICULTY_10_N: + case DIFFICULTY_25_N: + case DIFFICULTY_NORMAL_RAID: + case DIFFICULTY_NORMAL_ISLAND: + case DIFFICULTY_NORMAL_WARFRONT: + return true; + default: + return false; + } +} + bool Map::IsHeroic() const { if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(i_spawnMode)) - return difficulty->Flags & DIFFICULTY_FLAG_HEROIC; + { + if (difficulty->Flags & DIFFICULTY_FLAG_DISPLAY_HEROIC) + return true; + } + + // compatibility purposes of old difficulties + switch (i_spawnMode) + { + case DIFFICULTY_10_HC: + case DIFFICULTY_25_HC: + case DIFFICULTY_HEROIC: + case DIFFICULTY_3_MAN_SCENARIO_HC: + return true; + default: + return false; + } +} + +bool Map::IsMythic() const +{ + if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(i_spawnMode)) + return difficulty->Flags & DIFFICULTY_FLAG_DISPLAY_MYTHIC; return false; } +bool Map::IsMythicPlus() const +{ + return IsDungeon() && i_spawnMode == DIFFICULTY_MYTHIC_KEYSTONE; +} + +bool Map::IsHeroicOrHigher() const +{ + return IsHeroic() || IsMythic() || IsMythicPlus(); +} + bool Map::Is25ManRaid() const { return IsRaid() && (i_spawnMode == DIFFICULTY_25_N || i_spawnMode == DIFFICULTY_25_HC); } +bool Map::IsTimewalking() const +{ + return (IsDungeon() && i_spawnMode == DIFFICULTY_TIMEWALKING) || (IsRaid() && i_spawnMode == DIFFICULTY_TIMEWALKING_RAID); +} + bool Map::IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); |