Core/Map: Implement several difficulty getters (#29370)

Co-authored-by: ModoX <moardox@gmail.com>
This commit is contained in:
Teleqraph
2023-10-22 11:24:48 +02:00
committed by GitHub
parent 3d3979f1ca
commit 9eceff2bc2
10 changed files with 130 additions and 25 deletions

View File

@@ -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();