Core/Db/Conditions: Add ContidionTarget column which allows selection of objects which will be checked by condition, depending on SourceTypeOrReferenceId.

So far usable only with CONDITION_SOURCE_TYPE_SPELL:
ContidionTarget = 0 - check caster
ContidionTarget = 1 - check explicit target
This commit is contained in:
QAston
2012-02-10 23:40:38 +01:00
parent 8c2526e7d0
commit ce4a4ffe50
11 changed files with 198 additions and 65 deletions

View File

@@ -2783,6 +2783,18 @@ void SmartScript::InstallEvents()
}
}
bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3)
{
if (c == 0) return true;
if (!u || !u->ToPlayer()) return false;
Condition cond;
cond.mConditionType = ConditionType(uint32(c));
cond.mConditionValue1 = uint32(v1);
cond.mConditionValue1 = uint32(v2);
cond.mConditionValue1 = uint32(v3);
return cond.Meets(ConditionSourceInfo(u->ToPlayer()));
}
void SmartScript::OnUpdate(uint32 const diff)
{
if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject())