From 74b64150bba50fb43b29d0fc837fdd4bff6d8d52 Mon Sep 17 00:00:00 2001 From: Subv2112 Date: Sun, 29 Jan 2012 13:49:19 -0500 Subject: Core/Conditions: Implemented SAI conditions, only usable with events in which the invoker is a player. sourceType = 22 sourceEntry = entryorguid sourceGroup = eventId + 1 sourceId = SAI sourceType (0 = creature, 1 = gameobject, etc) Also refactored some code Signed-off-by: Subv2112 --- src/server/game/AI/SmartScripts/SmartScript.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (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 84ce57b7a13..3c0bdfcade7 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -84,7 +84,20 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 continue; 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)*/) - ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); + { + bool meets = true; + if (unit) + { + if (Player* player = unit->ToPlayer()) + { + ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); + meets = sConditionMgr->IsPlayerMeetToConditions(player, conds); + } + } + + if (meets) + ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); + } } } -- cgit v1.2.3