diff options
Diffstat (limited to 'src/server/game/Conditions')
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 23 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 1ef035d8f87..06c7cd17492 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -311,6 +311,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = ((1 << object->GetMap()->GetSpawnMode()) & ConditionValue1); break; } + case CONDITION_UNIT_STATE: + { + if (Unit* unit = object->ToUnit()) + condMeets = unit->HasUnitState(ConditionValue1); + break; + } default: condMeets = false; break; @@ -468,6 +474,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_GENDER: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_UNIT_STATE: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -1379,7 +1388,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup) { - sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); + sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set, ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1988,9 +1997,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } - case CONDITION_UNUSED_21: - sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring"); - return false; + case CONDITION_UNIT_STATE: + { + if (cond->ConditionValue1 > uint32(UNIT_STATE_ALL_STATE)) + { + sLog->outError(LOG_FILTER_SQL, "UnitState condition has non existing UnitState in value1 (%u), skipped", cond->ConditionValue1); + return false; + } + break; + } case CONDITION_UNUSED_24: sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring"); return false; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index cd3cf7bbbd8..4db03d8f7df 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -54,7 +54,7 @@ enum ConditionTypes CONDITION_TITLE = 18, // title id 0 0 true if player has title CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask CONDITION_GENDER = 20, // gender 0 0 true if player's gender is equal to gender - CONDITION_UNUSED_21 = 21, // + 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, // |
