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:42:08 +01:00
parent 8c2526e7d0
commit ce4a4ffe50
11 changed files with 198 additions and 65 deletions
@@ -1338,7 +1338,7 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote)
cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
if (cond.Meets(player))
if (cond.Meets(ConditionSourceInfo(player)))
{
sLog->outDebug(LOG_FILTER_DATABASE_AI, "CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
ProcessEvent(*itr, player);
@@ -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())
+1 -11
View File
@@ -84,17 +84,7 @@ class SmartScript
return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
}
bool 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(u->ToPlayer());
}
bool ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3);
void OnUpdate(const uint32 diff);
void OnMoveInLineOfSight(Unit* who);