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 <s.v.h21@hotmail.com>
This commit is contained in:
Subv
2012-02-11 10:49:28 -05:00
parent 784d58c023
commit c5e2e189de
2 changed files with 6 additions and 9 deletions

View File

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

View File

@@ -36,7 +36,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
// object not present, return false
if (!object)
{
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found");
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", mSourceEntry, mSourceType, mSourceGroup);
return false;
}
bool condMeets = false;
@@ -334,6 +334,8 @@ uint32 Condition::GetMaxAvailableConditionTargets()
{
case CONDITION_SOURCE_TYPE_SPELL:
return 2;
case CONDITION_SOURCE_TYPE_SMART_EVENT:
return 2;
default:
return 1;
}