From 723c253f8f09d773cd0fd47615c9f424b5c51d9d Mon Sep 17 00:00:00 2001 From: SnapperRy Date: Tue, 4 Oct 2016 11:29:02 +0200 Subject: 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. --- src/server/game/Conditions/ConditionMgr.cpp | 20 +++++++++++++++++++- src/server/game/Conditions/ConditionMgr.h | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') 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; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 7bda1376a0d..1c4bf737e18 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -78,7 +78,8 @@ enum ConditionTypes CONDITION_PET_TYPE = 45, // mask 0 0 true if player has a pet of given type(s) CONDITION_TAXI = 46, // 0 0 0 true if player is on taxi CONDITION_QUESTSTATE = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded) - CONDITION_MAX = 48 // MAX + CONDITION_WINTERGRASP_HORDE = 48, // 0 0 0 true if Wintergrasp is enabled and held by horde + CONDITION_MAX = 49 // MAX }; /*! Documentation on implementing a new ConditionSourceType: -- cgit v1.2.3