diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index d43a96f5b..62751edba 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -289,8 +289,22 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_NEAR_GAMEOBJECT: { - condMeets = static_cast(GetClosestGameObjectWithEntry(object, ConditionValue1, static_cast(ConditionValue2))); - break; + if (!ConditionValue3) + { + condMeets = static_cast(GetClosestGameObjectWithEntry(object, ConditionValue1, static_cast(ConditionValue2))); + break; + } + else + { + if (GameObject* go = GetClosestGameObjectWithEntry(object, ConditionValue1, static_cast(ConditionValue2))) + { + if ((go->GetGoState() == GO_STATE_READY && ConditionValue3 == 1) || (go->GetGoState() != GO_STATE_READY && ConditionValue3 == 2)) + condMeets = true; + else + condMeets = false; + } + break; + } } case CONDITION_OBJECT_ENTRY_GUID: { @@ -2124,8 +2138,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) LOG_ERROR("sql.sql", "NearGameObject condition has non existing gameobject template entry ({}), skipped", cond->ConditionValue1); return false; } - if (cond->ConditionValue3) - LOG_ERROR("sql.sql", "NearGameObject condition has useless data in value3 ({})!", cond->ConditionValue3); + if (cond->ConditionValue3 > 2) + LOG_ERROR("sql.sql", "NearGameObject condition for gameobject ID ({}) has data over 2 for value3 ({})!", cond->ConditionValue1, cond->ConditionValue3); break; } case CONDITION_OBJECT_ENTRY_GUID: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 185a5e1bd..9f963a96f 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -62,7 +62,7 @@ enum ConditionTypes CONDITION_LEVEL = 27, // level ComparisonType 0 true if unit's level is equal to param1 (param2 can modify the statement) CONDITION_QUEST_COMPLETE = 28, // quest_id 0 0 true if player has quest_id with all objectives complete, but not yet rewarded CONDITION_NEAR_CREATURE = 29, // creature entry distance dead true if there is a creature of entry in range - CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance 0 true if there is a gameobject of entry in range + CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance GoState true if there is a gameobject of entry in range (param3 can check for GoState, 0 = dont't check, 1 = Ready , 2 = Not Ready) CONDITION_OBJECT_ENTRY_GUID = 31, // TypeID entry guid/Attackable true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object CONDITION_TYPE_MASK = 32, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask CONDITION_RELATION_TO = 33, // ConditionTarget RelationType 0 true if object is in given relation with object specified by ConditionTarget