Permalink
Browse files

Merge branch 'master' of git://github.com/TrinityCore/TrinityCore

  • Loading branch information...
2 parents 551fbcb + 91a6bee commit ae910d3f8116c109ecfafd0585f0df484a735725 @MacWarrior MacWarrior committed Dec 30, 2011
@@ -1321,9 +1321,27 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsSmart())
return;
+ Object* target = NULL;
+
+ if (e.GetTargetType() == SMART_TARGET_CREATURE_RANGE || e.GetTargetType() == SMART_TARGET_CREATURE_GUID ||
+ e.GetTargetType() == SMART_TARGET_CREATURE_DISTANCE || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_RANGE ||
+ e.GetTargetType() == SMART_TARGET_GAMEOBJECT_GUID || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_DISTANCE ||
+ e.GetTargetType() == SMART_TARGET_CLOSEST_CREATURE || e.GetTargetType() == SMART_TARGET_CLOSEST_GAMEOBJECT ||
+ e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER)
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ return;
+
+ target = *targets->front();
+ }
+
bool run = e.action.setRun.run ? true : false;
CAST_AI(SmartAI, me->AI())->SetRun(run);
- me->GetMotionMaster()->MovePoint(0, e.target.x, e.target.y, e.target.z);
+ if(!target)
+ me->GetMotionMaster()->MovePoint(0, e.target.x, e.target.y, e.target.z);
+ else
+ me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
break;
}
case SMART_ACTION_RESPAWN_TARGET:
@@ -254,12 +254,14 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
}
case SMART_TARGET_CREATURE_GUID:
{
- if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry)) return false;
+ if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry))
+ return false;
break;
}
case SMART_TARGET_GAMEOBJECT_GUID:
{
- if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) return false;
+ if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry))
+ return false;
break;
}
case SMART_TARGET_PLAYER_DISTANCE:
@@ -287,6 +289,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_THREAT_LIST:
case SMART_TARGET_CLOSEST_GAMEOBJECT:
case SMART_TARGET_CLOSEST_CREATURE:
+ case SMART_TARGET_STORED:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());

0 comments on commit ae910d3

Please sign in to comment.