diff options
author | SnapperRy <snapperryen@gmail.com> | 2016-10-04 11:29:02 +0200 |
---|---|---|
committer | SnapperRy <snapperryen@gmail.com> | 2016-10-04 11:29:02 +0200 |
commit | 723c253f8f09d773cd0fd47615c9f424b5c51d9d (patch) | |
tree | 668decdd3d33a7132bc83b0368afbc55921c2d14 /src/server/game/Conditions/ConditionMgr.cpp | |
parent | 0c24e4ee0e1f0bbb37f740aa6f0d45c384ee955d (diff) |
Core/Conditions: implement CONDITION_WINTERGRASP_HORDE to check if Wintergrasp is held by Horde.
Use negative condition to check if it is held by Alliance instead.
Use this condition to fix availability of the Wintergrasp item-gathering weekly quests.
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index c859031b573..b4d9d097f14 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -18,6 +18,7 @@ #include "ConditionMgr.h" #include "AchievementMgr.h" +#include "BattlefieldMgr.h" #include "GameEventMgr.h" #include "InstanceScript.h" #include "ObjectMgr.h" @@ -109,7 +110,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Charmed", false, false, false }, { "Pet type", true, false, false }, { "On Taxi", false, false, false }, - { "Quest state mask", true, true, false } + { "Quest state mask", true, true, false }, + { "Wintergrasp is horde",false, false, false } }; // Checks if object meets the condition @@ -494,6 +496,18 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const } break; } + case CONDITION_WINTERGRASP_HORDE: + { + condMeets = false; + if (Player* player = object->ToPlayer()) + { + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1); + if (wintergrasp->IsEnabled()) + if (wintergrasp->GetDefenderTeam() == TEAM_HORDE) + condMeets = true; + } + break; + } default: condMeets = false; break; @@ -682,6 +696,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_QUESTSTATE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_WINTERGRASP_HORDE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2222,6 +2239,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const case CONDITION_IN_WATER: case CONDITION_CHARMED: case CONDITION_TAXI: + case CONDITION_WINTERGRASP_HORDE: default: break; } |