feat(Core/Conditions): CONDITION_DIFFICULTY_ID (#10332)

This commit is contained in:
IntelligentQuantum
2022-02-04 20:13:31 +03:30
committed by GitHub
parent 01c0d046ff
commit e85e556d19
2 changed files with 19 additions and 5 deletions

View File

@@ -420,6 +420,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = unit->HasAuraType(AuraType(ConditionValue1));
break;
}
case CONDITION_DIFFICULTY_ID:
{
condMeets = object->GetMap()->GetDifficulty() == ConditionValue1;
break;
}
case CONDITION_PET_TYPE:
{
if (Player* player = object->ToPlayer())
@@ -624,6 +629,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_HAS_AURA_TYPE:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_DIFFICULTY_ID:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_PET_TYPE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
@@ -1687,7 +1695,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
switch (cond->ConditionType)
{
case CONDITION_TERRAIN_SWAP:
case CONDITION_DIFFICULTY_ID:
LOG_ERROR("sql.sql", "SourceEntry {} in `condition` table has a ConditionType that is not supported on 3.3.5a ({}), ignoring.", cond->SourceEntry, uint32(cond->ConditionType));
return false;
case CONDITION_STAND_STATE:
@@ -2274,6 +2281,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
break;
}
case CONDITION_DIFFICULTY_ID:
if (cond->ConditionValue1 >= MAX_DIFFICULTY)
{
LOG_ERROR("sql.sql", "CONDITION_DIFFICULTY_ID has non existing difficulty in value1 ({}), skipped.", cond->ConditionValue1);
return false;
}
break;
case CONDITION_PET_TYPE:
if (cond->ConditionValue1 >= (1 << MAX_PET_TYPE))
{

View File

@@ -81,13 +81,13 @@ enum ConditionTypes
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_QUEST_OBJECTIVE_PROGRESS = 48, // quest_id objectiveIndex objectiveCount true if player has reached the specified objectiveCount quest progress for the objectiveIndex for the specified quest
CONDITION_DIFFICULTY_ID = 49, // don't use on 3.3.5a
CONDITION_DIFFICULTY_ID = 49, // Difficulty 0 0 true is map has difficulty id
CONDITION_TC_END = 50, // placeholder
CONDITION_AC_START = 100,
CONDITION_QUEST_SATISFY_EXCLUSIVE = 101, // quest_id 0 0 true if satisfied exclusive group
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
CONDITION_AC_END = 103 // placeholder
CONDITION_QUEST_SATISFY_EXCLUSIVE = 101, // quest_id 0 0 true if satisfied exclusive group
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
CONDITION_AC_END = 103 // placeholder
};
/*! Documentation on implementing a new ConditionSourceType: