diff options
author | Ric101 <colsupport25s@hotmail.com> | 2013-05-25 07:51:23 +0100 |
---|---|---|
committer | Ric101 <colsupport25s@hotmail.com> | 2013-05-25 07:51:23 +0100 |
commit | 6820ca8bdae4fabcc09b1df6fc75852c9c6ba1d3 (patch) | |
tree | 3ed58a3b0bac130df1fb16f88ec392e795944bd6 | |
parent | b8d75db4f160c3044e9b9602962067b9d59ab78b (diff) |
Core/Conditions: Implement CONDITION_CREATURE_TYPE - 24
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 18 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 67c81b35065..d89b885af42 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; @@ -1988,9 +1994,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; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index b49626747a6..8ef085d2d3c 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -57,7 +57,7 @@ enum ConditionTypes CONDITION_UNIT_STATE = 21, // unitState 0 0 true if unit has unitState CONDITION_MAPID = 22, // map_id 0 0 true if in map_id CONDITION_AREAID = 23, // area_id 0 0 true if in area_id - CONDITION_UNUSED_24 = 24, // + CONDITION_CREATURE_TYPE = 24, // cinfo.type 0 0 true if creature_template.type = value1 CONDITION_SPELL = 25, // spell_id 0 0 true if player has learned spell CONDITION_PHASEMASK = 26, // phasemask 0 0 true if object is in phasemask CONDITION_LEVEL = 27, // level ComparisonType 0 true if unit's level is equal to param1 (param2 can modify the statement) |