aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp5
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp41
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h5
4 files changed, 47 insertions, 5 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 7509fa4e329..edb81d6f176 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -789,6 +789,11 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
me->GetMotionMaster()->MoveFollow(target, dist, angle);
mFollowCreditType = creditType;
}
+
+void SmartAI::SetScript9(SmartScriptHolder &e, uint32 entry)
+{
+ GetScript()->SetScript9(e, entry);
+}
/*
SMART_EVENT_UPDATE_OOC
SMART_EVENT_SPELLHIT
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index b664ded1ddd..ac67704b120 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -65,6 +65,7 @@ class SmartAI : public CreatureAI
void SetCombatMove(bool on);
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
+ void SetScript9(SmartScriptHolder &e, uint32 entry);
SmartScript* GetScript() { return &mScript; }
bool IsEscortInvokerInRange();
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index c9e7955f0ad..11f38ed40c8 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1063,7 +1063,18 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
- SetScript9(e, e.action.timedActionList.id);
+ ObjectList* targets = GetTargets(e, unit);
+ if (targets)
+ {
+ for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
+ {
+ if (Creature* target = (*itr)->ToCreature())
+ {
+ if (IsSmart(target))
+ CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id);
+ }
+ }
+ }
break;
}
case SMART_ACTION_SET_NPC_FLAG:
@@ -1135,12 +1146,36 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
count++;
}
}
- SetScript9(e, temp[urand(0, count)]);
+ uint32 id = temp[urand(0, count)];
+ ObjectList* targets = GetTargets(e, unit);
+ if (targets)
+ {
+ for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
+ {
+ if (Creature* target = (*itr)->ToCreature())
+ {
+ if (IsSmart(target))
+ CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
+ }
+ }
+ }
break;
}
case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
{
- SetScript9(e, urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2));
+ uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
+ ObjectList* targets = GetTargets(e, unit);
+ if (targets)
+ {
+ for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
+ {
+ if (Creature* target = (*itr)->ToCreature())
+ {
+ if (IsSmart(target))
+ CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
+ }
+ }
+ }
break;
}
case SMART_ACTION_ACTIVATE_TAXI:
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index fdb819ab530..16064d6591d 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -180,6 +180,9 @@ class SmartScript
meOrigGUID = 0;
}
+ //TIMED_ACTIONLIST (script type 9 aka script9)
+ void SetScript9(SmartScriptHolder &e, uint32 entry);
+
private:
void IncPhase(int32 p = 1) {
if(p >= 0)
@@ -250,8 +253,6 @@ class SmartScript
SmartScriptHolder s;
return s;
}
- //TIMED_ACTIONLIST (script type 9 aka script9)
- void SetScript9(SmartScriptHolder &e, uint32 entry);
};
#endif