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>
This commit is contained in:
Subv2112
2012-01-29 13:49:19 -05:00
parent 5ceae46302
commit 74b64150bb
3 changed files with 152 additions and 83 deletions

View File

@@ -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);
}
}
}