From 9eceff2bc243946998c006418229dbb639e898d6 Mon Sep 17 00:00:00 2001 From: Teleqraph Date: Sun, 22 Oct 2023 11:24:48 +0200 Subject: Core/Map: Implement several difficulty getters (#29370) Co-authored-by: ModoX --- src/server/game/Maps/Map.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'src/server/game/Maps/Map.cpp') 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(); -- cgit v1.2.3