Core/Conditions: Added "player knows spell" condition type

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-09-10 20:49:29 +02:00
parent 61075d5101
commit 320929ff40
2 changed files with 18 additions and 2 deletions

View File

@@ -166,6 +166,9 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
refId = 0;//cant have references for now
break;
}
case CONDITION_SPELL:
condMeets = player->HasSpell(mConditionValue1);
break;
default:
condMeets = false;
refId = 0;
@@ -1217,6 +1220,18 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog.outErrorDb("ItemTarget condition has useless data in value3 (%u)!", cond->mConditionValue3);
break;
}
case CONDITION_SPELL:
{
if (!sSpellStore.LookupEntry(cond->mConditionValue1))
{
sLog.outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
}
if (cond->mConditionValue2)
sLog.outErrorDb("Spell condition has useless data in value2 (%u)!", cond->mConditionValue2);
break;
}
case CONDITION_AREAID:
case CONDITION_INSTANCE_DATA:
break;

View File

@@ -52,8 +52,9 @@ enum ConditionType
CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 +referenceID true if target's health is below value1 percent, false if over or no target
CONDITION_TARGET_RANGE = 21, // minDistance maxDist +referenceID true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit
CONDITION_MAPID = 22, // map_id 0 +referenceID true if in map_id
CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id
CONDITION_ITEM_TARGET = 24 // ItemRequiredTargetType, TargetEntry, 0
CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id
CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0
CONDITION_SPELL = 25 // spell_id 0 +referenceID true if knows spell
};
#define MAX_CONDITION 25 // maximum value in ConditionType enum