diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.cpp | 29 | ||||
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.h | 4 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 694df032d69..4cd00ae322a 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -27,6 +27,7 @@ #include "InstanceScript.h" #include "ConditionMgr.h" #include "ScriptMgr.h" +#include "ScriptedCreature.h" // Checks if player meets the condition // Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI) @@ -187,6 +188,16 @@ bool Condition::Meets(Player * player, Unit* invoker) condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= mConditionValue1; break; } + case CONDITION_NEAR_CREATURE: + { + condMeets = GetClosestCreatureWithEntry(player, mConditionValue1, (float)mConditionValue2) ? true : false; + break; + } + case CONDITION_NEAR_GAMEOBJECT: + { + condMeets = GetClosestGameObjectWithEntry(player, mConditionValue1, (float)mConditionValue2) ? true : false; + break; + } default: condMeets = false; refId = 0; @@ -1344,6 +1355,24 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } + case CONDITION_NEAR_CREATURE: + { + if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue1)) + { + sLog.outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->mConditionValue1); + return false; + } + break; + } + case CONDITION_NEAR_GAMEOBJECT: + { + if (!sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue1)) + { + sLog.outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->mConditionValue1); + return false; + } + break; + } case CONDITION_AREAID: case CONDITION_INSTANCE_DATA: break; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 5e670f882dd..4f5dcdf07b3 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -56,7 +56,9 @@ enum ConditionType CONDITION_NOITEM = 26, // item_id bank +referenceID true if player does not have any of the item (if 'bank' is set it searches in bank slots too) CONDITION_LEVEL = 27, // level opt +referenceID true if player's level is equal to param1 (param2 can modify the statement) CONDITION_QUEST_COMPLETE = 28, // quest_id 0 +referenceID true if player has quest_id with all objectives complete, but not yet rewarded - CONDITION_MAX = 29 // MAX + CONDITION_NEAR_CREATURE = 29, // creature entry distance +referenceID true if there is a creature of entry in range + CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance +referenceID true if there is a gameobject of entry in range + CONDITION_MAX = 31 // MAX }; enum LevelConditionType |