mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Merge pull request #14370 from Kittnz/realm_achievement
Core/Condition: Realm Achievement condition
(cherry picked from commit 769acfbd02)
This commit is contained in:
@@ -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;
|
||||
@@ -585,6 +593,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;
|
||||
@@ -2116,6 +2127,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
||||
case CONDITION_AREAID:
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ enum ConditionTypes
|
||||
CONDITION_ALIVE = 36, // 0 0 0 true if unit is alive
|
||||
CONDITION_HP_VAL = 37, // hpVal ComparisonType 0 true if unit's hp matches given value
|
||||
CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct
|
||||
CONDITION_MAX = 39 // MAX
|
||||
CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete
|
||||
CONDITION_MAX = 40 // MAX
|
||||
};
|
||||
|
||||
/*! Documentation on implementing a new ConditionSourceType:
|
||||
|
||||
Reference in New Issue
Block a user