Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.02 KB | None | 0 0
  1. # HG changeset patch
  2. # User Rat
  3. # Date 1290262879 -3600
  4. # Branch trunk
  5. # Node ID bef8c38ab59bc790de5c482e05e66473bbf33f38
  6. # Parent  faf34d0f163aeefcb63a8485451295f64d37c164
  7. Core/SmartAI: all actions regarding to TIMED_ACTIONLIST will now use targeting:
  8. you can now 'send' a list of timed actions to any targeted creature if it has SmartAI
  9. note: already made script with timed actions should be remade to use self as target
  10.  
  11. diff -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartAI.cpp
  12. --- a/src/server/game/AI/SmartScripts/SmartAI.cpp   Sat Nov 20 13:54:45 2010 +0100
  13. +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp   Sat Nov 20 15:21:19 2010 +0100
  14. @@ -788,6 +788,11 @@
  15.      me->GetMotionMaster()->MoveFollow(target, dist, angle);
  16.      mFollowCreditType = creditType;
  17.  }
  18. +
  19. +void SmartAI::SetScript9(SmartScriptHolder &e, uint32 entry)
  20. +{
  21. +    GetScript()->SetScript9(e, entry);
  22. +}
  23.  /*
  24.  SMART_EVENT_UPDATE_OOC
  25.  SMART_EVENT_SPELLHIT
  26. diff -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartAI.h
  27. --- a/src/server/game/AI/SmartScripts/SmartAI.h Sat Nov 20 13:54:45 2010 +0100
  28. +++ b/src/server/game/AI/SmartScripts/SmartAI.h Sat Nov 20 15:21:19 2010 +0100
  29. @@ -65,6 +65,7 @@
  30.          void SetCombatMove(bool on);
  31.          void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
  32.  
  33. +        void SetScript9(SmartScriptHolder &e, uint32 entry);
  34.          SmartScript* GetScript() { return &mScript; }
  35.          bool IsEscortInvokerInRange();
  36.  
  37. diff -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartScript.cpp
  38. --- a/src/server/game/AI/SmartScripts/SmartScript.cpp   Sat Nov 20 13:54:45 2010 +0100
  39. +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp   Sat Nov 20 15:21:19 2010 +0100
  40. @@ -1060,7 +1060,18 @@
  41.              }
  42.          case SMART_ACTION_CALL_TIMED_ACTIONLIST:
  43.              {
  44. -                SetScript9(e, e.action.timedActionList.id);
  45. +                ObjectList* targets = GetTargets(e, unit);
  46. +                if (targets)
  47. +                {
  48. +                    for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
  49. +                    {
  50. +                        if (Creature* target = (*itr)->ToCreature())
  51. +                        {
  52. +                            if (IsSmart(target))
  53. +                                CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id);
  54. +                        }
  55. +                    }
  56. +                }
  57.                  break;
  58.              }
  59.          case SMART_ACTION_SET_NPC_FLAG:
  60. @@ -1132,12 +1143,36 @@
  61.                          count++;
  62.                      }
  63.                  }
  64. -                SetScript9(e, temp[urand(0, count)]);
  65. +                uint32 id = temp[urand(0, count)];
  66. +                ObjectList* targets = GetTargets(e, unit);
  67. +                if (targets)
  68. +                {
  69. +                    for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
  70. +                    {
  71. +                        if (Creature* target = (*itr)->ToCreature())
  72. +                        {
  73. +                            if (IsSmart(target))
  74. +                                CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
  75. +                        }
  76. +                    }
  77. +                }
  78.                  break;
  79.              }
  80.          case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
  81.              {
  82. -                SetScript9(e, urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2));
  83. +                uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
  84. +                ObjectList* targets = GetTargets(e, unit);
  85. +                if (targets)
  86. +                {
  87. +                    for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
  88. +                    {
  89. +                        if (Creature* target = (*itr)->ToCreature())
  90. +                        {
  91. +                            if (IsSmart(target))
  92. +                                CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
  93. +                        }
  94. +                    }
  95. +                }
  96.                  break;
  97.              }
  98.          case SMART_ACTION_ACTIVATE_TAXI:
  99. diff -r faf34d0f163a -r bef8c38ab59b src/server/game/AI/SmartScripts/SmartScript.h
  100. --- a/src/server/game/AI/SmartScripts/SmartScript.h Sat Nov 20 13:54:45 2010 +0100
  101. +++ b/src/server/game/AI/SmartScripts/SmartScript.h Sat Nov 20 15:21:19 2010 +0100
  102. @@ -180,6 +180,9 @@
  103.              meOrigGUID = 0;
  104.          }
  105.  
  106. +        //TIMED_ACTIONLIST (script type 9 aka script9)
  107. +        void SetScript9(SmartScriptHolder &e, uint32 entry);
  108. +
  109.      private:
  110.          void IncPhase(int32 p = 1) {
  111.              if(p >= 0)
  112. @@ -250,8 +253,6 @@
  113.              SmartScriptHolder s;
  114.              return s;
  115.          }
  116. -        //TIMED_ACTIONLIST (script type 9 aka script9)
  117. -        void SetScript9(SmartScriptHolder &e, uint32 entry);
  118.  };
  119.  
  120.  #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement