diff options
| author | Nay <dnpd.dd@gmail.com> | 2013-07-30 06:25:04 -0700 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2013-07-30 06:25:04 -0700 |
| commit | 7165fd769edcbb1e8828c87f8cbaa58468673c8e (patch) | |
| tree | 282adc75810ef50f2e1dc41cddc31b6f69e3fa23 /src/server/game/Conditions/ConditionMgr.cpp | |
| parent | 1b0c6048484871b7ec6985783d3f29812f862f92 (diff) | |
| parent | 6fe47e7fccbb7e0cd0eee5ec721b06afe2201524 (diff) | |
Merge pull request #9862 from Ric101/condition_creature_type
Core/Conditions: Implement CONDITION_CREATURE_TYPE - 24
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 8007590cd37..ada7909e9ff 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -317,6 +317,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = unit->HasUnitState(ConditionValue1); break; } + case CONDITION_CREATURE_TYPE: + { + if (Creature* creature = object->ToCreature()) + condMeets = creature->GetCreatureTemplate()->type == ConditionValue1; + break; + } default: condMeets = false; break; @@ -478,6 +484,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_UNIT_STATE: mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_CREATURE_TYPE: + mask |= GRID_MAP_TYPE_MASK_CREATURE; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -1989,9 +1998,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } - case CONDITION_UNUSED_24: - TC_LOG_ERROR(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring"); - return false; + case CONDITION_CREATURE_TYPE: + { + if (!cond->ConditionValue1 || cond->ConditionValue1 > CREATURE_TYPE_GAS_CLOUD) + { + TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureType condition has non existing CreatureType in value1 (%u), skipped", cond->ConditionValue1); + return false; + } + break; + } default: break; } |
