mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/SAI: Using the action_type SMART_ACTION_SET_REACT_STATE now sets the react state of the target_type. Won't break any scripts as all current cases of this action_type have target_type 1 (SMART_TARGET_SELF).
This commit is contained in:
@@ -367,12 +367,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
if (IsPlayer(*itr))
|
||||
{
|
||||
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
|
||||
{
|
||||
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
@@ -380,12 +382,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_SET_REACT_STATE:
|
||||
{
|
||||
if (!me)
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
break;
|
||||
|
||||
me->SetReactState(ReactStates(e.action.react.state));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_REACT_STATE: Creature guidLow %u set reactstate %u",
|
||||
me->GetGUIDLow(), e.action.react.state);
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
if (!IsUnit(*itr))
|
||||
continue;
|
||||
|
||||
(*itr)->ToUnit()->SetReactState(ReactStates(e.action.react.state));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_RANDOM_EMOTE:
|
||||
|
||||
Reference in New Issue
Block a user