diff options
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index eb3d1708675..8400e4cee00 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -99,7 +99,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Distance", true, true, true }, { "Alive", false, false, false }, { "Health Value", true, true, false }, - { "Health Pct", true, true, false } + { "Health Pct", true, true, false }, + { "Realm Achievement", true, false, false } }; // Checks if object meets the condition @@ -416,6 +417,13 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = creature->GetCreatureTemplate()->type == ConditionValue1; break; } + case CONDITION_REALM_ACHIEVEMENT: + { + AchievementEntry const* achievement = sAchievementMgr->GetAchievement(ConditionValue1); + if (achievement && sAchievementMgr->IsRealmCompleted(achievement, std::numeric_limits<uint32>::max())) + condMeets = true; + break; + } default: condMeets = false; break; @@ -580,6 +588,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_CREATURE_TYPE: mask |= GRID_MAP_TYPE_MASK_CREATURE; break; + case CONDITION_REALM_ACHIEVEMENT: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2056,6 +2067,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case CONDITION_PHASEMASK: case CONDITION_ALIVE: break; + case CONDITION_REALM_ACHIEVEMENT: + { + AchievementEntry const* achievement = sAchievementMgr->GetAchievement(cond->ConditionValue1); + if (!achievement) + { + TC_LOG_ERROR("sql.sql", "%s has non existing realm first achivement id (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); + return false; + } + break; + } default: break; } |