casucristy

jwerw

Jul 13th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.01 KB | None | 0 0
  1. From 85bd9d239d796d8964b50c2e051bc4c67dcc36db Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Fri, 13 Jul 2012 14:52:14 +0300
  4. Subject: [PATCH] Shade of Akama fix.
  5.  
  6. ---
  7.  .../Outland/BlackTemple/boss_shade_of_akama.cpp    |  147 +++++++++-----------
  8.  1 file changed, 68 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..942eaf3 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. @@ -364,6 +336,9 @@ public:
  94.                      Sorcerer->SetWalk(false);
  95.                      Sorcerer->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
  96.                      Sorcerer->SetTarget(me->GetGUID());
  97. +                   //make sure that sorcerer will be on akama threat list.
  98. +                   Sorcerer->AddThreat(me,1000000.0f);
  99. +                   me->AddThreat(Sorcerer,1000000.f);
  100.                      Sorcerers.push_back(Sorcerer->GetGUID());
  101.                      --DeathCount;
  102.                      ++SorcererCount;
  103. @@ -385,23 +360,6 @@ public:
  104.              }
  105.          }
  106.  
  107. -        void FindChannelers()
  108. -        {
  109. -            std::list<Creature*> ChannelerList;
  110. -            me->GetCreatureListWithEntryInGrid(ChannelerList, CREATURE_CHANNELER, 50.0f);
  111. -
  112. -            if (!ChannelerList.empty())
  113. -            {
  114. -                for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
  115. -                {
  116. -                    CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID();
  117. -                    Channelers.push_back((*itr)->GetGUID());
  118. -                    sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
  119. -                }
  120. -            }
  121. -            else sLog->outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
  122. -        }
  123. -
  124.          void SetSelectableChannelers()
  125.          {
  126.              if (Channelers.empty())
  127. @@ -415,6 +373,45 @@ public:
  128.                      Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  129.          }
  130.  
  131. +       void SummonChannelers()
  132. +       {
  133. +           if(Channelers.empty())
  134. +           {
  135. +               for(int i = 0 ; i < 6; i++)
  136. +               {
  137. +                   if(Creature* channeler = me->SummonCreature(CREATURE_CHANNELER,ChannelerLocations[i].x,ChannelerLocations[i].y,ChannelerLocations[i].z,ChannelerLocations[i].o))
  138. +                   {
  139. +                       CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, channeler->AI())->ShadeGUID = me->GetGUID();
  140. +                       Channelers.push_back(channeler->GetGUID());
  141. +                       ChannelersInit(channeler);
  142. +                   }
  143. +               }
  144. +           }
  145. +           else
  146. +           {
  147. +               for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
  148. +               {
  149. +                   if(Creature* Channeler = (Unit::GetCreature(*me,*itr)))
  150. +                   {  
  151. +                       if (Channeler->isDead())
  152. +                       {
  153. +                           CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, Channeler->AI())->ShadeGUID = me->GetGUID();
  154. +                           Channeler->RemoveCorpse();
  155. +                           Channeler->Respawn();
  156. +                       }
  157. +                       ChannelersInit(Channeler);
  158. +                   }
  159. +               }
  160. +           }
  161. +       }
  162. +
  163. +       void ChannelersInit(Creature* Channeler)
  164. +       {
  165. +            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
  166. +            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true);
  167. +            Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                
  168. +       }
  169. +
  170.          void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; }
  171.  
  172.          void UpdateAI(const uint32 diff)
  173. @@ -424,8 +421,8 @@ public:
  174.  
  175.              if (IsBanished)
  176.              {
  177. -                // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check
  178. -                if (me->getThreatManager().getThreatList().size() < 2)
  179. +                // Akama, channelers and sorceres are set in the threatlist so when we reset, we make sure that he is not included in our check
  180. +               if (me->getThreatManager().getThreatList().size() + DeathCount - Channelers.size() < 2)
  181.                  {
  182.                      EnterEvadeMode();
  183.                      return;
  184. @@ -487,20 +484,6 @@ public:
  185.              }
  186.              else                                                // No longer banished, let's fight Akama now
  187.              {
  188. -                if (ReduceHealthTimer <= diff)
  189. -                {
  190. -                    if (AkamaGUID)
  191. -                    {
  192. -                        Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
  193. -                        if (Akama && Akama->isAlive())
  194. -                        {
  195. -                            //10 % less health every few seconds.
  196. -                            me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  197. -                            ReduceHealthTimer = 12000;
  198. -                        }
  199. -                    }
  200. -                } else ReduceHealthTimer -= diff;
  201. -
  202.                  if (HasKilledAkama)
  203.                  {
  204.                      if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug
  205. @@ -511,15 +494,19 @@ public:
  206.                          me->CombatStop();
  207.                          //me->SetFullHealth();
  208.                          me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  209. -                        me->GetMotionMaster()->MoveTargetedHome();
  210. +                       EnterEvadeMode();
  211.                      }
  212. -                    if (ResetTimer <= diff)
  213. -                    {
  214. -                        EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama
  215. -                        return;
  216. -                    } else ResetTimer -= diff;
  217.                  }
  218.  
  219. +               if (ResetTimer <= diff)
  220. +                {
  221. +                   Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
  222. +                   if(Akama)
  223. +                       me->Kill(Akama);
  224. +                    EnterEvadeMode(); //After 60 sec kill akama and reset event
  225. +                    return;
  226. +                } else ResetTimer -= diff;
  227. +
  228.                  DoMeleeAttackIfReady();
  229.              }
  230.          }
  231. @@ -555,6 +542,7 @@ public:
  232.          {
  233.              player->CLOSE_GOSSIP_MENU();
  234.              CAST_AI(npc_akama_shade::npc_akamaAI, creature->AI())->BeginEvent(player);
  235. +          
  236.          }
  237.  
  238.          return true;
  239. @@ -623,7 +611,7 @@ public:
  240.  
  241.          void Reset()
  242.          {
  243. -            DestructivePoisonTimer = 15000;
  244. +            DestructivePoisonTimer = 5000;
  245.              LightningBoltTimer = 10000;
  246.              CheckTimer = 2000;
  247.  
  248. @@ -876,7 +864,7 @@ public:
  249.                  Creature* Shade = Unit::GetCreature((*me), ShadeGUID);
  250.                  if (Shade && Shade->isAlive())
  251.                      DoCast(Shade, SPELL_DESTRUCTIVE_POISON);
  252. -                DestructivePoisonTimer = 15000;
  253. +                DestructivePoisonTimer = 5000;
  254.              } else DestructivePoisonTimer -= diff;
  255.  
  256.              if (LightningBoltTimer <= diff)
  257. @@ -897,3 +885,4 @@ void AddSC_boss_shade_of_akama()
  258.      new mob_ashtongue_sorcerer();
  259.      new npc_akama_shade();
  260.  }
  261. +
  262. --
  263. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment