aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorSubv2112 <s.v.h21@hotmail.com>2012-01-29 13:49:19 -0500
committerSubv2112 <s.v.h21@hotmail.com>2012-01-29 13:49:19 -0500
commit74b64150bba50fb43b29d0fc837fdd4bff6d8d52 (patch)
tree2a55d674cac2f47c16ad5c84e1b3b389e047763b /src/server/game/AI/SmartScripts
parent5ceae46302b1b601927b50f3ea973941cd8938d0 (diff)
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 <s.v.h21@hotmail.com>
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp15
1 files changed, 14 insertions, 1 deletions
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);
+ }
}
}