From 4d2527e05c40e7700c0e92376a92317aa79f608d Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sun, 7 Aug 2016 21:46:41 +0200 Subject: [PATCH] Core/Conditions: Add new CONDITION_CHARMED (44). Does what it says on the tin. --- src/server/game/Conditions/ConditionMgr.cpp | 16 +++++++++++++--- src/server/game/Conditions/ConditionMgr.h | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index c4eaad2947..f3258d0e23 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -104,7 +104,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "In Water", false, false, false }, { "Terrain Swap", true, false, false }, { "Sit/stand state", true, true, false }, - { "Daily Quest Completed",true, false, false } + { "Daily Quest Completed",true, false, false }, + { "Charmed", false, false, false } }; // Checks if object meets the condition @@ -460,6 +461,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = player->IsDailyQuestDone(ConditionValue1); break; } + case CONDITION_CHARMED: + { + if (Unit* unit = object->ToUnit()) + condMeets = unit->IsCharmed(); + break; + } default: condMeets = false; break; @@ -644,6 +651,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_DAILY_QUEST_DONE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_CHARMED: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2222,8 +2232,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } - case CONDITION_IN_WATER: - break; case CONDITION_STAND_STATE: { bool valid = false; @@ -2246,6 +2254,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } + case CONDITION_IN_WATER: + case CONDITION_CHARMED: default: break; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 4992c44259..879363bf59 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -74,7 +74,8 @@ enum ConditionTypes CONDITION_TERRAIN_SWAP = 41, // terrainSwap 0 0 true if object is in terrainswap CONDITION_STAND_STATE = 42, // stateType state 0 true if unit matches specified sitstate (0,x: has exactly state x; 1,0: any standing state; 1,1: any sitting state;) CONDITION_DAILY_QUEST_DONE = 43, // quest id 0 0 true if daily quest has been completed for the day - CONDITION_MAX = 44 // MAX + CONDITION_CHARMED = 44, // 0 0 0 true if unit is currently charmed + CONDITION_MAX = 45 // MAX }; /*! Documentation on implementing a new ConditionSourceType: