casucristy

gqweqasd

Jul 12th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.30 KB | None | 0 0
  1. From d5aa34fa32b785c01a1e40848668ba6ff760a577 Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Fri, 13 Jul 2012 05:21:38 +0300
  4. Subject: [PATCH] Fix Shade of Akama
  5.  
  6. ---
  7.  .../Outland/BlackTemple/boss_shade_of_akama.cpp    |  142 +++++++++-----------
  8.  1 file changed, 63 insertions(+), 79 deletions(-)
  9.  
  10. diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
  11. index 630e444..adb728f 100644
  12. --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
  13. +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
  14. @@ -40,17 +40,17 @@ struct Location
  15.      float x, y, o, z;
  16.  };
  17.  
  18. -/* Not used
  19. +
  20.  static Location ChannelerLocations[]=
  21.  {
  22. -    {463.161285f, 401.219757f, 3.141592f, 0.0f},
  23. -    {457.377625f, 391.227661f, 2.106461f, 0.0f},
  24. -    {446.012421f, 391.227661f, 1.071904f, 0.0f},
  25. -    {439.533783f, 401.219757f, 0.000000f, 0.0f},
  26. -    {446.012421f, 411.211853f, 5.210546f, 0.0f},
  27. -    {457.377625f, 411.211853f, 4.177494f, 0.0f}
  28. +    {461.158600f, 403.238877f, 3.215190f, 118.537796f},
  29. +    {456.694000f, 414.117004f, 4.258600f, 118.621002f},
  30. +    {443.494995f, 413.972992f, 5.131270f, 118.621002f},
  31. +    {438.278992f, 401.257996f, 0.017453f, 118.621002f},
  32. +    {444.153015f, 389.213989f, 1.082100f, 118.621002f},
  33. +    {458.346008f, 393.503998f, 2.283940f, 118.538002f}
  34.  };
  35. -*/
  36. +
  37.  
  38.  static Location SpawnLocations[]=
  39.  {
  40. @@ -261,7 +261,6 @@ public:
  41.              DeathCount = 0;
  42.  
  43.              SummonTimer = 10000;
  44. -            ReduceHealthTimer = 0;
  45.              ResetTimer = 60000;
  46.              DefenderTimer = 15000;
  47.  
  48. @@ -279,6 +278,8 @@ public:
  49.                  instance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED);
  50.  
  51.              reseting = false;
  52. +          
  53. +           SummonChannelers();
  54.          }
  55.          void JustDied(Unit* /*killer*/)
  56.          {
  57. @@ -295,35 +296,6 @@ public:
  58.                  summons.Despawn(summon);
  59.          }
  60.  
  61. -        void MoveInLineOfSight(Unit* /*who*/)
  62. -        {
  63. -            if (!GridSearcherSucceeded)
  64. -            {
  65. -                FindChannelers();
  66. -
  67. -                if (!Channelers.empty())
  68. -                {
  69. -                    for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
  70. -                    {
  71. -                        Creature* Channeler = (Unit::GetCreature(*me, *itr));
  72. -                        if (Channeler)
  73. -                        {
  74. -                            if (Channeler->isDead())
  75. -                            {
  76. -                                Channeler->RemoveCorpse();
  77. -                                Channeler->Respawn();
  78. -                            }
  79. -
  80. -                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
  81. -                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true);
  82. -                            Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  83. -                            GridSearcherSucceeded = true;
  84. -                        }
  85. -                    }
  86. -                } else sLog->outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
  87. -            }
  88. -        }
  89. -
  90.          void AttackStart(Unit* who)
  91.          {
  92.              if (!who || IsBanished)
  93. @@ -385,23 +357,6 @@ public:
  94.              }
  95.          }
  96.  
  97. -        void FindChannelers()
  98. -        {
  99. -            std::list<Creature*> ChannelerList;
  100. -            me->GetCreatureListWithEntryInGrid(ChannelerList, CREATURE_CHANNELER, 50.0f);
  101. -
  102. -            if (!ChannelerList.empty())
  103. -            {
  104. -                for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
  105. -                {
  106. -                    CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID();
  107. -                    Channelers.push_back((*itr)->GetGUID());
  108. -                    sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
  109. -                }
  110. -            }
  111. -            else sLog->outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
  112. -        }
  113. -
  114.          void SetSelectableChannelers()
  115.          {
  116.              if (Channelers.empty())
  117. @@ -415,6 +370,45 @@ public:
  118.                      Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  119.          }
  120.  
  121. +       void SummonChannelers()
  122. +       {
  123. +           if(Channelers.empty())
  124. +           {
  125. +               for(int i = 0 ; i < 6; i++)
  126. +               {
  127. +                   if(Creature* channeler = me->SummonCreature(CREATURE_CHANNELER,ChannelerLocations[i].x,ChannelerLocations[i].y,ChannelerLocations[i].z,ChannelerLocations[i].o))
  128. +                   {
  129. +                       CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, channeler->AI())->ShadeGUID = me->GetGUID();
  130. +                       Channelers.push_back(channeler->GetGUID());
  131. +                       ChannelersInit(channeler);
  132. +                   }
  133. +               }
  134. +           }
  135. +           else
  136. +           {
  137. +               for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
  138. +               {
  139. +                   if(Creature* Channeler = (Unit::GetCreature(*me,*itr)))
  140. +                   {  
  141. +                       if (Channeler->isDead())
  142. +                       {
  143. +                           CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, Channeler->AI())->ShadeGUID = me->GetGUID();
  144. +                           Channeler->RemoveCorpse();
  145. +                           Channeler->Respawn();
  146. +                       }
  147. +                       ChannelersInit(Channeler);
  148. +                   }
  149. +               }
  150. +           }
  151. +       }
  152. +
  153. +       void ChannelersInit(Creature* Channeler)
  154. +       {
  155. +            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
  156. +            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true);
  157. +            Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                
  158. +       }
  159. +
  160.          void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; }
  161.  
  162.          void UpdateAI(const uint32 diff)
  163. @@ -424,8 +418,8 @@ public:
  164.  
  165.              if (IsBanished)
  166.              {
  167. -                // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check
  168. -                if (me->getThreatManager().getThreatList().size() < 2)
  169. +                // Akama and channelers are set in the threatlist so when we reset, we make sure that he is not included in our check
  170. +                if (me->getThreatManager().getThreatList().size() < 8)
  171.                  {
  172.                      EnterEvadeMode();
  173.                      return;
  174. @@ -487,20 +481,6 @@ public:
  175.              }
  176.              else                                                // No longer banished, let's fight Akama now
  177.              {
  178. -                if (ReduceHealthTimer <= diff)
  179. -                {
  180. -                    if (AkamaGUID)
  181. -                    {
  182. -                        Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
  183. -                        if (Akama && Akama->isAlive())
  184. -                        {
  185. -                            //10 % less health every few seconds.
  186. -                            me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  187. -                            ReduceHealthTimer = 12000;
  188. -                        }
  189. -                    }
  190. -                } else ReduceHealthTimer -= diff;
  191. -
  192.                  if (HasKilledAkama)
  193.                  {
  194.                      if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug
  195. @@ -511,15 +491,18 @@ public:
  196.                          me->CombatStop();
  197.                          //me->SetFullHealth();
  198.                          me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  199. -                        me->GetMotionMaster()->MoveTargetedHome();
  200. +                       EnterEvadeMode();
  201.                      }
  202. -                    if (ResetTimer <= diff)
  203. -                    {
  204. -                        EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama
  205. -                        return;
  206. -                    } else ResetTimer -= diff;
  207.                  }
  208.  
  209. +               if (ResetTimer <= diff)
  210. +                {
  211. +                   Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
  212. +                   me->Kill(Akama);
  213. +                    EnterEvadeMode(); //After 60 sec kill akama and reset event
  214. +                    return;
  215. +                } else ResetTimer -= diff;
  216. +
  217.                  DoMeleeAttackIfReady();
  218.              }
  219.          }
  220. @@ -555,6 +538,7 @@ public:
  221.          {
  222.              player->CLOSE_GOSSIP_MENU();
  223.              CAST_AI(npc_akama_shade::npc_akamaAI, creature->AI())->BeginEvent(player);
  224. +          
  225.          }
  226.  
  227.          return true;
  228. @@ -623,7 +607,7 @@ public:
  229.  
  230.          void Reset()
  231.          {
  232. -            DestructivePoisonTimer = 15000;
  233. +            DestructivePoisonTimer = 5000;
  234.              LightningBoltTimer = 10000;
  235.              CheckTimer = 2000;
  236.  
  237. @@ -876,7 +860,7 @@ public:
  238.                  Creature* Shade = Unit::GetCreature((*me), ShadeGUID);
  239.                  if (Shade && Shade->isAlive())
  240.                      DoCast(Shade, SPELL_DESTRUCTIVE_POISON);
  241. -                DestructivePoisonTimer = 15000;
  242. +                DestructivePoisonTimer = 5000;
  243.              } else DestructivePoisonTimer -= diff;
  244.  
  245.              if (LightningBoltTimer <= diff)
  246. --
  247. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment