From c5e2e189de78c419ba1063ba025e5efe69aabd06 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 11 Feb 2012 10:49:28 -0500 Subject: Core/Conditions: Allow to set SAI conditions to both the invoker and the object using ConditionTarget column. ConditionTarget 0 = invoker ConditionTarget 1 = object Signed-off-by: Subv --- src/server/game/AI/SmartScripts/SmartScript.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/server/game/AI/SmartScripts') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 4b15805c2c9..0794179d158 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -85,14 +85,9 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 if (eventType == e/* && (!(*i).event.event_phase_mask || IsInPhase((*i).event.event_phase_mask)) && !((*i).event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE && (*i).runOnce)*/) { bool meets = true; - if (unit) - { - if (Player* player = unit->ToPlayer()) - { - ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); - meets = sConditionMgr->IsObjectMeetToConditions(player, conds); - } - } + ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); + ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject()); + meets = sConditionMgr->IsObjectMeetToConditionList(info, conds); if (meets) ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); -- cgit v1.2.3