diff options
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index c0be07a60d9..6516c7422a1 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -151,6 +151,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "BattlePet Species Learned", true, true, true }, { "On Scenario Step", true, false, false }, { "Scene In Progress", true, false, false }, + { "Player Condition", true, false, false }, }; ConditionSourceInfo::ConditionSourceInfo(WorldObject* target0, WorldObject* target1, WorldObject* target2) @@ -621,6 +622,13 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = player->GetSceneMgr().GetActiveSceneCount(ConditionValue1) > 0; break; } + case CONDITION_PLAYER_CONDITION: + { + if (Player* player = object->ToPlayer()) + if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(ConditionValue1)) + condMeets = ConditionMgr::IsPlayerMeetingCondition(player, playerCondition); + break; + } default: break; } @@ -830,6 +838,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_SCENE_IN_PROGRESS: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_PLAYER_CONDITION: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ABORT_MSG("Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2719,6 +2730,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } + case CONDITION_PLAYER_CONDITION: + { + if (!sPlayerConditionStore.LookupEntry(cond->ConditionValue1)) + { + TC_LOG_ERROR("sql.sql", "%s has non existing PlayerConditionId in value1 (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); + return false; + } + break; + } default: TC_LOG_ERROR("sql.sql", "%s Invalid ConditionType in `condition` table, ignoring.", cond->ToString().c_str()); return false; |