Core/Conditions: Implement CONDITION_UNIT_STATE = 21

This commit is contained in:
Vincent_Michael
2013-01-11 23:37:53 +01:00
parent 84553f168c
commit b13e5694b6
2 changed files with 19 additions and 4 deletions
+18 -3
View File
@@ -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;
@@ -1957,9 +1966,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;
+1 -1
View File
@@ -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, //