CONDITION_QUEST_OBJECTIVE_DONE
This commit is contained in:
@@ -680,6 +680,15 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
|
||||
condMeets = go->HasLabel(ConditionValue1);
|
||||
break;
|
||||
}
|
||||
case CONDITION_QUEST_OBJECTIVE_DONE:
|
||||
{
|
||||
if (Player const* player = object->ToPlayer())
|
||||
{
|
||||
uint32 count = player->GetQuestObjectiveData(ConditionValue1, ConditionValue2);
|
||||
condMeets = ConditionValue3 ? count >= ConditionValue3 : count;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -890,6 +899,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const
|
||||
mask |= GRID_MAP_TYPE_MASK_PLAYER;
|
||||
break;
|
||||
case CONDITION_PLAYER_CONDITION:
|
||||
case CONDITION_QUEST_OBJECTIVE_DONE:
|
||||
mask |= GRID_MAP_TYPE_MASK_PLAYER;
|
||||
break;
|
||||
case CONDITION_PRIVATE_OBJECT:
|
||||
@@ -2679,6 +2689,28 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
|
||||
case CONDITION_STRING_ID:
|
||||
case CONDITION_LABEL:
|
||||
break;
|
||||
case CONDITION_QUEST_OBJECTIVE_DONE:
|
||||
{
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(cond->ConditionValue1);
|
||||
if (!quest)
|
||||
{
|
||||
TC_LOG_ERROR("LOG_FILTER_SQL", "Quest condition specifies non-existing quest (%u), skipped (objective_done)", cond->ConditionValue1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cond->ConditionValue2 > 0)
|
||||
{
|
||||
bool found = false;
|
||||
for (QuestObjective const& obj : quest->GetObjectives())
|
||||
{
|
||||
if (obj.ObjectID == cond->ConditionValue2)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
TC_LOG_ERROR("LOG_FILTER_SQL", "Quest condition specifies non-existing quest (%d) non existen objective %d, skipped", cond->ConditionValue1, cond->ConditionValue2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONDITION_DIFFICULTY_ID:
|
||||
if (!sDifficultyStore.LookupEntry(cond->ConditionValue1))
|
||||
{
|
||||
|
||||
@@ -119,6 +119,7 @@ enum ConditionTypes
|
||||
CONDITION_PRIVATE_OBJECT = 57, // 0 0 0 true if entity is private object
|
||||
CONDITION_STRING_ID = 58,
|
||||
CONDITION_LABEL = 59, // Label 0 0 true if creature/gameobject has specified Label in CreatureLabel.db2/GameObjectLabel.db2
|
||||
CONDITION_QUEST_OBJECTIVE_DONE = 60, // QuestID ObjectiveID Count true if player has ID objective complete, but quest not yet rewarded
|
||||
CONDITION_MAX
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user