Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # User Rat
- # Date 1290262879 -3600
- # Branch trunk
- # Node ID bef8c38ab59bc790de5c482e05e66473bbf33f38
- # Parent faf34d0f163aeefcb63a8485451295f64d37c164
- Core/SmartAI: all actions regarding to TIMED_ACTIONLIST will now use targeting:
- you can now 'send' a list of timed actions to any targeted creature if it has SmartAI
- note: already made script with timed actions should be remade to use self as target
- diff -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartAI.cpp
- --- a/src/server/game/AI/SmartScripts/SmartAI.cpp Sat Nov 20 13:54:45 2010 +0100
- +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp Sat Nov 20 15:21:19 2010 +0100
- @@ -788,6 +788,11 @@
- 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 -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartAI.h
- --- a/src/server/game/AI/SmartScripts/SmartAI.h Sat Nov 20 13:54:45 2010 +0100
- +++ b/src/server/game/AI/SmartScripts/SmartAI.h Sat Nov 20 15:21:19 2010 +0100
- @@ -65,6 +65,7 @@
- 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 -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartScript.cpp
- --- a/src/server/game/AI/SmartScripts/SmartScript.cpp Sat Nov 20 13:54:45 2010 +0100
- +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp Sat Nov 20 15:21:19 2010 +0100
- @@ -1060,7 +1060,18 @@
- }
- 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:
- @@ -1132,12 +1143,36 @@
- 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 -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartScript.h
- --- a/src/server/game/AI/SmartScripts/SmartScript.h Sat Nov 20 13:54:45 2010 +0100
- +++ b/src/server/game/AI/SmartScripts/SmartScript.h Sat Nov 20 15:21:19 2010 +0100
- @@ -180,6 +180,9 @@
- 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 @@
- SmartScriptHolder s;
- return s;
- }
- - //TIMED_ACTIONLIST (script type 9 aka script9)
- - void SetScript9(SmartScriptHolder &e, uint32 entry);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement