diff options
19 files changed, 874 insertions, 320 deletions
diff --git a/sql/updates/5997_world_scripts.sql b/sql/updates/5997_world_scripts.sql new file mode 100644 index 00000000000..39078a5ba7a --- /dev/null +++ b/sql/updates/5997_world_scripts.sql @@ -0,0 +1,5 @@ + +UPDATE `creature_template` SET `ScriptName`='boss_jedoga_shadowseeker' WHERE `entry`='29310' LIMIT 1; +UPDATE `creature_template` SET `ScriptName`='mob_jedoga_initiand' WHERE `entry`='30114' LIMIT 1; +UPDATE `creature_template` SET `ScriptName`='npc_jedogas_aufseher_trigger' WHERE `entry`='30181' LIMIT 1; + diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp index 94f40eee090..faa05e147ed 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp @@ -561,7 +561,7 @@ struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI          }      } -    void EnterCombat(Unit* who) { } +    void EnterCombat(Unit* who) {}      void Reset() {}      void JustDied(Unit* killer) @@ -1006,7 +1006,7 @@ struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI  {      npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} -    void EnterCombat(Unit* who) { } +    void EnterCombat(Unit* who) {}      void Reset() {}      void JustDied(Unit* killer) diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp index 61a92ebfe40..622f666c2f6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_spire/boss_mother_smolderweb.cpp @@ -40,7 +40,7 @@ struct TRINITY_DLL_DECL boss_mothersmolderwebAI : public ScriptedAI          MothersMilk_Timer = 10000;      } -    void EnterCombat(Unit *who) { } +    void EnterCombat(Unit *who) {}      void DamageTaken(Unit *done_by, uint32 &damage)      { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp index c801398b830..a53a23d9dbd 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp @@ -38,9 +38,9 @@ struct TRINITY_DLL_DECL mobs_ghoul_flayerAI : public ScriptedAI  {      mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} -    void Reset() { } +    void Reset() {} -    void EnterCombat(Unit* who) { } +    void EnterCombat(Unit* who) {}      void JustDied(Unit* Killer)      { @@ -93,7 +93,7 @@ struct TRINITY_DLL_DECL npc_darrowshire_spiritAI : public ScriptedAI          m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);      } -    void EnterCombat(Unit *who) { } +    void EnterCombat(Unit *who) {}  };  CreatureAI* GetAI_npc_darrowshire_spirit(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp index 7914c87fe1a..41608b6c7d5 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp @@ -158,7 +158,7 @@ static Locations SpawnPosition[]=      {-11.9, -18, 0.361, 5.87}  }; -static uint32 PaladinEntry[]= {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPION_SWIFTBLADE, CHAMPION_SUNSTRIKER}; +static uint32 PaladinEntry[] = {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPION_SWIFTBLADE, CHAMPION_SUNSTRIKER};  /*######  ## npc_second_trial_paladin @@ -182,7 +182,8 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI      uint32 timerJudLight;      uint32 timerCommand; -    void Reset() { +    void Reset() +    {        timer = 2000;        questPhase = 0; @@ -196,95 +197,93 @@ struct TRINITY_DLL_DECL npc_secondTrialAI : public ScriptedAI        spellJudLight   = false;        spellCommand    = false; -      switch(m_creature->GetEntry()) { -        case CHAMPION_BLOODWRATH : -          spellFlashLight = true; -          timerFlashLight = TIMER_FLASH_OF_LIGHT; -        break; -        case CHAMPION_LIGHTREND : -          spellJustice    = true; -          timerJustice    = 500; -        break; -        case CHAMPION_SWIFTBLADE : -          spellJudLight   = false;  // Misses Script Effect // http://www.wowhead.com/?spell=20271 -          timerJudLight   = 500; -        break; -        case CHAMPION_SUNSTRIKER : -          spellFlashLight = true; -          spellJudLight   = false;  // Misses Script Effect // http://www.wowhead.com/?spell=20271 -          spellCommand    = false;  // Misses Dummy // http://www.wowhead.com/?spell=20375 -          timerFlashLight = TIMER_FLASH_OF_LIGHT; -          timerJudLight   = 500; -          timerCommand    = 1500; -        break; +      switch(m_creature->GetEntry()) +      { +          case CHAMPION_BLOODWRATH: +              spellFlashLight = true; +              timerFlashLight = TIMER_FLASH_OF_LIGHT; +          break; +          case CHAMPION_LIGHTREND: +              spellJustice    = true; +              timerJustice    = 500; +          break; +          case CHAMPION_SWIFTBLADE: +              spellJudLight   = false;  // Misses Script Effect // http://www.wowhead.com/?spell=20271 +              timerJudLight   = 500; +          break; +          case CHAMPION_SUNSTRIKER: +              spellFlashLight = true; +              spellJudLight   = false;  // Misses Script Effect // http://www.wowhead.com/?spell=20271 +              spellCommand    = false;  // Misses Dummy // http://www.wowhead.com/?spell=20375 +              timerFlashLight = TIMER_FLASH_OF_LIGHT; +              timerJudLight   = 500; +              timerCommand    = 1500; +          break;        }      } -    void EnterCombat(Unit *who) { } +    void EnterCombat(Unit *who) {}      void UpdateAI(const uint32 diff)      { -      if (questPhase == 1) { - -        if (timer < diff) { -              m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); -              m_creature->setFaction(FACTION_HOSTILE); -              questPhase = 0; - -              Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); -              if (target && target->GetTypeId() == TYPEID_PLAYER) // only on players. -              { -                m_creature->AddThreat(target, 5000000.0f); -                AttackStart(target); -              } -         } -         else timer -= diff; -      } +        if (questPhase == 1) +            if (timer < diff) +            { +                m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); +                m_creature->setFaction(FACTION_HOSTILE); +                questPhase = 0; + +                if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) +                { +                    m_creature->AddThreat(target, 5000000.0f); +                    AttackStart(target); +                } +            } +            else +                timer -= diff; -      if (!UpdateVictim()) +        if (!UpdateVictim())            return; -      // healer -      if (spellFlashLight) { -        if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 70){ -          if (timerFlashLight < diff) { -            DoCast(m_creature, SPELL_FLASH_OF_LIGHT); -            timerFlashLight = TIMER_FLASH_OF_LIGHT +  rand()%(TIMER_FLASH_OF_LIGHT); -          } -          else -            timerFlashLight -= diff; -        } -      } +        // healer +        if (spellFlashLight) +            if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 70) +                if (timerFlashLight < diff) +                { +                    DoCast(m_creature, SPELL_FLASH_OF_LIGHT); +                    timerFlashLight = TIMER_FLASH_OF_LIGHT +  rand()%TIMER_FLASH_OF_LIGHT; +                } +                else +                    timerFlashLight -= diff; -      if (spellJustice) { -          if (timerJustice < diff) +        if (spellJustice) +            if (timerJustice < diff)              { -            DoCast(m_creature, SPELL_SEAL_OF_JUSTICE); -            timerJustice = TIMER_SEAL_OF_JUSTICE +  rand()%(TIMER_SEAL_OF_JUSTICE); -          } -          else -            timerJustice -= diff; -      } +                DoCast(m_creature, SPELL_SEAL_OF_JUSTICE); +                timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE; +            } +            else +                timerJustice -= diff; -      if (spellJudLight) { -          if (timerJudLight < diff) { -            DoCast(m_creature,  SPELL_JUDGEMENT_OF_LIGHT); -            timerJudLight = TIMER_JUDGEMENT_OF_LIGHT +  rand()%(TIMER_JUDGEMENT_OF_LIGHT); -          } -          else -            timerJudLight -= diff; -      } +        if (spellJudLight) +            if (timerJudLight < diff) +            { +                DoCast(m_creature,  SPELL_JUDGEMENT_OF_LIGHT); +                timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT; +            } +            else +                timerJudLight -= diff; -      if (spellCommand) { -          if (timerCommand < diff) { -            DoCast(m_creature,  TIMER_SEAL_OF_COMMAND); -            timerCommand = TIMER_SEAL_OF_COMMAND +  rand()%(TIMER_SEAL_OF_COMMAND); -          } -          else -            timerCommand -= diff; -      } +          if (spellCommand) +              if (timerCommand < diff) +              { +                  DoCast(m_creature,  TIMER_SEAL_OF_COMMAND); +                  timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND; +              } +              else +                  timerCommand -= diff; -      DoMeleeAttackIfReady(); +          DoMeleeAttackIfReady();      }      void Activate(uint64 summonerguid); @@ -307,79 +306,79 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI      uint64 paladinGuid[4]; -    void Reset() { - -      questPhase = 0; -      timer = 60000; -      paladinPhase = 0; -      uint64 paladinGuid[] = {0,0,0,0}; - +    void Reset() +    { +        questPhase = 0; +        timer = 60000; +        paladinPhase = 0; +        uint64 paladinGuid[] = {0,0,0,0};      }      void EnterCombat(Unit *who) {}      void UpdateAI(const uint32 diff)      { -      // Quest accepted but object not activated, object despawned (if in sync 1 minute!) -      if (questPhase == 1) { -         if (timer < diff) Reset(); -         else timer -= diff; -      } -      // fight the 4 paladin mobs phase -      else if (questPhase == 2) { - -        if (timer < diff) { - -          Creature* paladinSpawn; -          paladinSpawn = (Unit::GetCreature((*m_creature), paladinGuid[paladinPhase])); -            if (paladinSpawn) { -               CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(m_creature->GetGUID()); - -               switch(paladinPhase) { -                 case 0: -                  DoScriptText(TEXT_SECOND_TRIAL_1,m_creature); -                 break; -                 case 1: -                   DoScriptText(TEXT_SECOND_TRIAL_2,m_creature); -                 break; -                 case 2: -                  DoScriptText(TEXT_SECOND_TRIAL_3,m_creature); -                 break; -                 case 3: -                  DoScriptText(TEXT_SECOND_TRIAL_4,m_creature); -                 break; -               } -            } +        // Quest accepted but object not activated, object despawned (if in sync 1 minute!) +        if (questPhase == 1) +        { +            if (timer < diff) +            Reset();              else -              Reset(); +            timer -= diff; +        } +        // fight the 4 paladin mobs phase +        else if (questPhase == 2) +        { +            if (timer < diff) +            { +                if (Creature* paladinSpawn = Unit::GetCreature((*m_creature), paladinGuid[paladinPhase])) +                { +                    CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(m_creature->GetGUID()); + +                    switch(paladinPhase) +                    { +                    case 0: +                        DoScriptText(TEXT_SECOND_TRIAL_1,m_creature); +                        break; +                    case 1: +                        DoScriptText(TEXT_SECOND_TRIAL_2,m_creature); +                        break; +                    case 2: +                        DoScriptText(TEXT_SECOND_TRIAL_3,m_creature); +                        break; +                    case 3: +                        DoScriptText(TEXT_SECOND_TRIAL_4,m_creature); +                        break; +                    } +                } +                else +                Reset(); -            questPhase=4; -            timer = OFFSET_NEXT_ATTACK; +                questPhase = 4; +                timer = OFFSET_NEXT_ATTACK; +            } +            else +            timer -= diff;          } -         else timer -= diff; -      } -      if (!UpdateVictim()) -          return; +        if (!UpdateVictim()) +        return; -      DoMeleeAttackIfReady(); +        DoMeleeAttackIfReady();      }      void StartEvent()      { -      if (questPhase == 1) { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code +        if (questPhase == 1) +        { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code -        for (int i = 0; i<4; ++i) { -          Creature* Summoned; -          Summoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000); +            for (uint8 i = 0; i < 4; ++i) +            if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) +            paladinGuid[i] = pSummoned->GetGUID(); -          if (Summoned) -            paladinGuid[i] = Summoned->GetGUID(); -        } - -        timer = OFFSET_NEXT_ATTACK; -        questPhase = 2; +            timer = OFFSET_NEXT_ATTACK; +            questPhase = 2;          }      } @@ -394,7 +393,8 @@ bool GossipHello_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature)      // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest.      // !not sure if this really works! -    if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) { +    if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) +    {          pPlayer->PrepareQuestMenu(pCreature->GetGUID());          pPlayer->SendPreparedQuest(pCreature->GetGUID());      } @@ -412,65 +412,58 @@ bool QuestAccept_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature,      return true;  } -void master_kelerun_bloodmournAI::SecondTrialKill() { - -      if (questPhase > 0) { - -        ++paladinPhase; +void master_kelerun_bloodmournAI::SecondTrialKill() +{ +    if (questPhase > 0) +    { +      ++paladinPhase; -        if (paladinPhase < 4) -          questPhase=2; -        else +      if (paladinPhase < 4) +          questPhase = 2; +      else            Reset();  // Quest Complete, QuestComplete handler is in npc_secondTrialAI::JustDied -      } -  } - -void npc_secondTrialAI::JustDied(Unit* Killer) { - -      if (Killer->GetTypeId() == TYPEID_PLAYER) -      { -          Creature* Summoner; -          Summoner = (Unit::GetCreature((*m_creature), summonerGuid)); +    } +} -          if (Summoner) +void npc_secondTrialAI::JustDied(Unit* Killer) +{ +    if (Killer->GetTypeId() == TYPEID_PLAYER) +    { +        if (Creature *pSummoner = Unit::GetCreature((*m_creature), summonerGuid))              CAST_AI(master_kelerun_bloodmournAI, Summoner->AI())->SecondTrialKill(); -          // last kill quest complete for group -          if (m_creature->GetEntry() == CHAMPION_SUNSTRIKER) { - +        // last kill quest complete for group +        if (m_creature->GetEntry() == CHAMPION_SUNSTRIKER) +        {              if (Group *pGroup = CAST_PLR(Killer)->GetGroup())              { -               for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) -               { -                 Player *pGroupGuy = itr->getSource(); +                for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) +                { +                    Player *pGroupGuy = itr->getSource(); -                 // for any leave or dead (with not released body) group member at appropriate distance -                 if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(m_creature) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) -                   pGroupGuy->CompleteQuest(QUEST_SECOND_TRIAL); +                    // for any leave or dead (with not released body) group member at appropriate distance +                    if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(m_creature) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) +                        pGroupGuy->CompleteQuest(QUEST_SECOND_TRIAL);                  }              } -            else { -               if (CAST_PLR(Killer)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) -                   CAST_PLR(Killer)->CompleteQuest(QUEST_SECOND_TRIAL); -            } -          } -      } -  } - -void npc_secondTrialAI::KilledUnit(Unit* Killed) { - -  if (Killed->GetTypeId() == TYPEID_PLAYER) { - -      if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) -        CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); -  } +            else if (CAST_PLR(Killer)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) +                CAST_PLR(Killer)->CompleteQuest(QUEST_SECOND_TRIAL); +        } +    }  } -void npc_secondTrialAI::Activate(uint64 summonerguid) { +void npc_secondTrialAI::KilledUnit(Unit* Killed) +{ +    if (Killed->GetTypeId() == TYPEID_PLAYER) +        if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) +            CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); +} -      questPhase=1; +void npc_secondTrialAI::Activate(uint64 summonerguid) +{ +      questPhase = 1;        summonerGuid = summonerguid; -    } +}  CreatureAI* GetAI_master_kelerun_bloodmourn(Creature* pCreature)  { @@ -489,7 +482,7 @@ CreatureAI* GetAI_npc_secondTrial(Creature* pCreature)  bool GOHello_go_second_trial(Player* pPlayer, GameObject* pGO)  {      // find spawn :: master_kelerun_bloodmourn -    if (Creature* pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) +    if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f))         CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->StartEvent();      return true; @@ -537,24 +530,15 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI      void JustDied(Unit* killer)      {          if (PlayerGUID) -        { -            Player* pPlayer = Unit::GetPlayer(PlayerGUID); -            if (pPlayer) +            if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))                  CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); -        }      }      void UpdateAI(const uint32 diff)      { -        if (KillCount >= 3) -        { -            if (PlayerGUID) -            { -                Player* pPlayer = Unit::GetPlayer(PlayerGUID); -                if (pPlayer) -                    CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); -            } -        } +        if (KillCount >= 3 && PlayerGUID) +            if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) +                CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT);          if (Summon)          { @@ -594,7 +578,7 @@ struct Location      float x, y, z;  }; -static Location SpawnLocations[]= +static Location SpawnLocations[] =  {      {8270.68, -7188.53, 139.619},      {8284.27, -7187.78, 139.603}, @@ -647,11 +631,8 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI      void JustDied(Unit* killer)      {          if (PlayerGUID && !Completed) -        { -            Player* pPlayer = Unit::GetPlayer(PlayerGUID); -            if (pPlayer) +            if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))                  CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); -        }      }      void UpdateAI(const uint32 diff) @@ -661,14 +642,12 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI              DoScriptText(EMOTE, m_creature);              Completed = true;              if (PlayerGUID) -            { -                Player* pPlayer = Unit::GetPlayer(PlayerGUID); -                if (pPlayer) +                if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))                      CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); -            } +              m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);              m_creature->RemoveCorpse(); -        }else EndTimer -= diff; +        } else EndTimer -= diff;          if (WaveTimer < diff && !Completed && Progress)          { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp index 82b5980ca44..c4e7a33a77c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_vexallus.cpp @@ -191,7 +191,7 @@ struct  TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI  {      mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} -    void Reset() { } +    void Reset() {}      void JustDied(Unit* slayer)      { @@ -202,9 +202,9 @@ struct  TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI          }      } -    void EnterCombat(Unit *who) { } -    void MoveInLineOfSight(Unit *who) { } -    void AttackStart(Unit *who) { } +    void EnterCombat(Unit *who) {} +    void MoveInLineOfSight(Unit *who) {} +    void AttackStart(Unit *who) {}  };  CreatureAI* GetAI_mob_pure_energy(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp index cd96acd80a8..4baaefd7504 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/magisters_terrace.cpp @@ -51,7 +51,7 @@ const float afKaelLandPoint[] = {225.045, -276.236, -5.434};  // If we assume DB handle summon, summon appear somewhere outside the platform where Orb is  struct TRINITY_DLL_DECL npc_kalecgosAI : public ScriptedAI  { -    npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) { } +    npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) {}      uint32 m_uiTransformTimer; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp index d33e9a92ba3..7a1810c6b60 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/molten_core/boss_gehennas.cpp @@ -42,7 +42,7 @@ struct TRINITY_DLL_DECL boss_gehennasAI : public ScriptedAI          GehennasCurse_Timer = 12000;      } -    void EnterCombat(Unit *who) { } +    void EnterCombat(Unit *who) {}      void UpdateAI(const uint32 diff)      { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp index ecbd3695045..f810ded603b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_monastery/boss_herod.cpp @@ -118,9 +118,9 @@ struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI      uint32 Start_Timer; -    void Reset() { } -    void WaypointReached(uint32 uiPoint) { } -    void EnterCombat(Unit* who) { } +    void Reset() {} +    void WaypointReached(uint32 uiPoint) {} +    void EnterCombat(Unit* who) {}      void UpdateAI(const uint32 diff)      { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp index 4f8d19a305e..1d8db17d501 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp @@ -86,7 +86,7 @@ struct TRINITY_DLL_DECL mob_freed_soulAI : public ScriptedAI          DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), m_creature);      } -    void EnterCombat(Unit* who) { } +    void EnterCombat(Unit* who) {}  };  CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp index ff475597b88..83237e13d54 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp @@ -45,9 +45,9 @@ struct TRINITY_DLL_DECL npc_forest_frogAI : public ScriptedAI      ScriptedInstance *pInstance; -    void Reset() { } +    void Reset() {} -    void EnterCombat(Unit *who) { } +    void EnterCombat(Unit *who) {}      void DoSpawnRandom()      { diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp index a239c961bfa..b543f9c5c19 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -18,88 +18,572 @@  /* ScriptData  SDName: boss_jedoga_shadowseeker -SDAuthor: LordVanMartin -SD%Complete: 0 -SDComment: +SDAuthor: WarHead +SD%Complete: 100% +SDComment: Complete - BUT THE TRIGGER NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE !  SDCategory: Ahn'kahet  EndScriptData */ -/*** SQL START *** -update creature_template set scriptname = 'boss_jedoga' where entry = ''; -*** SQL END ***/ -  #include "precompiled.h"  #include "def_ahnkahet.h" -#define SPELL_CYCLONE_STRIKE                    56855 -#define H_SPELL_CYCLONE_STRIKE                  60030//kein unterschied zu 56855 außer das 60030 1,5sec cast ist -#define SPELL_LIGHTNING_BOLT                    56891 -#define H_SPELL_LIGHTNING_BOLT                  60032 -#define SPELL_THUNDERSHOCK                      56926//AOE works -#define H_SPELL_THUNDERSHOCK                    60029//AOE works -#define SPELL_GIFT_OF_THE_HERALD                56219//triggert if sucessfull sacreficed - -//not in db -#define SAY_AGGRO                                 -1619000 -#define SAY_C_SACRIFICE_1                         -1619001 -#define SAY_C_SACRIFICE_2                         -1619002 -#define SAY_SACRIFICE_1                           -1619003 -#define SAY_SACRIFICE_2                           -1619004 -#define SAY_SLAY_1                                -1619005 -#define SAY_SLAY_2                                -1619006 -#define SAY_SLAY_3                                -1619007 -#define SAY_DEATH                                 -1619008 -#define SAY_PREACHING_1                           -1619009 -#define SAY_PREACHING_2                           -1619010 -#define SAY_PREACHING_3                           -1619011 -#define SAY_PREACHING_4                           -1619012 -#define SAY_PREACHING_5                           -1619013 - -struct TRINITY_DLL_DECL boss_jedogaAI : public ScriptedAI +#define TEXT_AGGRO          -1619000 +#define TEXT_SACRIFICE_1_1  -1619001 +#define TEXT_SACRIFICE_1_2  -1619002 +#define TEXT_SACRIFICE_2_1  -1619003 +#define TEXT_SACRIFICE_2_2  -1619004 +#define TEXT_SLAY_1         -1619005 +#define TEXT_SLAY_2         -1619006 +#define TEXT_SLAY_3         -1619007 +#define TEXT_DEATH          -1619008 +#define TEXT_PREACHING_1    -1619009 +#define TEXT_PREACHING_2    -1619010 +#define TEXT_PREACHING_3    -1619011 +#define TEXT_PREACHING_4    -1619012 +#define TEXT_PREACHING_5    -1619013 + +#define SPELL_SPHERE_VISUAL         56075 +#define SPELL_GIFT_OF_THE_HERALD    56219 + +#define SPELL_CYCLONE_STRIKE        56855 // Self +#define SPELL_CYCLONE_STRIKE_H      60030 +#define SPELL_LIGHTNING_BOLT        56891 // 40Y +#define SPELL_LIGHTNING_BOLT_H      60032 // 40Y +#define SPELL_THUNDERSHOCK          56926 // 30Y +#define SPELL_THUNDERSHOCK_H        60029 // 30Y + +float JEDOGA_POS[2][4] = +{ +    {372.330994f, -705.278015f, -0.624178f, 5.427970f}, +    {372.330994f, -705.278015f, -16.179716f, 5.427970f} +}; + +struct MANGOS_DLL_DECL boss_jedoga_shadowseekerAI : public ScriptedAI  { -    boss_jedogaAI(Creature *c) : ScriptedAI(c) {} +    boss_jedoga_shadowseekerAI(Creature* c) : ScriptedAI(c) +    { +        pInstance = c->GetInstanceData(); +        HeroicMode = c->GetMap()->IsHeroic(); +        MaxDistance = 45.0f; +        FirstTime = true; +        predone = false; +    } + +    ScriptedInstance* pInstance; + +    uint32 uiOpFerTimer, +        uiCycloneTimer, +        uiBoltTimer, +        uiThunderTimer; + +    bool predone, +        bOpFerok, +        bOnGround, +        bOpFerokFail, +        bCanDown; + +    bool FirstTime; + +    void Reset() +    { +        uiOpFerTimer = urand(15000,20000); + +        uiCycloneTimer = 3000; +        uiBoltTimer = 7000; +        uiThunderTimer = 12000; + +        bOpFerok = false; +        bOpFerokFail = false; +        bOnGround = false; +        bCanDown = false; + +        if (pInstance) +        { +            if (!FirstTime) +                pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, FAIL); + +            pInstance->SetData64(DATA_PL_JEDOGA_TARGET, 0); +            pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); +            pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); +        } +        MoveUp(); + +        FirstTime = false; +    } -    void Reset() {}      void EnterCombat(Unit* who)      { -        DoScriptText(SAY_AGGRO, m_creature); +        if (!pInstance || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == 30181)) +            return; + +        DoScriptText(TEXT_AGGRO, m_creature); +        m_creature->SetInCombatWithZone(); +        pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS);      } -    void AttackStart(Unit* who) {} -    void MoveInLineOfSight(Unit* who) {} + +    void AttackStart(Unit* who) +    { +        if (!who || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == 30181)) +            return; + +        ScriptedAI::AttackStart(who); +    } + +    void KilledUnit(Unit* Victim) +    { +        if (!Victim || Victim->GetTypeId() != TYPEID_PLAYER) +		    return; + +        DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), m_creature); +    } + +    void JustDied(Unit* Killer) +    { +        DoScriptText(TEXT_DEATH, m_creature); +        if (pInstance) +            pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE); +    } + +    void MoveInLineOfSight(Unit* who) +    { +        if (!pInstance || !who || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == 30181)) +            return; + +        if (!predone && who->GetTypeId() == TYPEID_PLAYER && m_creature->GetDistance(who) < 100.0f) +        { +            DoScriptText(RAND(TEXT_PREACHING_1, TEXT_PREACHING_2, TEXT_PREACHING_3, TEXT_PREACHING_4, TEXT_PREACHING_5), m_creature); +            predone = true; +        } + +        if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS || !bOnGround) +            return; + +        if (!m_creature->getVictim() && who->isTargetableForAttack() && m_creature->IsHostileTo(who) && who->isInAccessiblePlaceFor(m_creature)) +        { +            float attackRadius = m_creature->GetAttackDistance(who); +            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) +            { +                if (!m_creature->getVictim()) +                { +                    who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); +                    AttackStart(who); +                } +                else if (m_creature->GetMap()->IsDungeon()) +                { +                    who->SetInCombatWith(m_creature); +                    m_creature->AddThreat(who, 0.0f); +                } +            } +        } +    } + +    void MoveDown() +    { +        if (!pInstance) +            return; + +        bOpFerokFail = false; + +        pInstance->SetData(DATA_JEDOGA_TRIGGER_SWITCH, 0); +        m_creature->GetMotionMaster()->MovePoint(1, JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2]); + +        m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); +        m_creature->SendMonsterMove(JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2], 0, MOVEFLAG_JUMP, 0); +        m_creature->Relocate(JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2], JEDOGA_POS[1][3]); +        m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); + +        m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); +        m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false); +        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + +        m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); + +        bOnGround = true; + +        if (UpdateVictim()) +        { +            AttackStart(m_creature->getVictim()); +            m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); +        } +        else +        { +            if (Unit* pTarget = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_PL_JEDOGA_TARGET))) +            { +                AttackStart(pTarget); +                pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); +                if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS) +                    EnterCombat(pTarget); +            } +            else if (!m_creature->isInCombat()) +                EnterEvadeMode(); +        } +    } + +    void MoveUp() +    { +        if (!pInstance) +            return; + +        m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); +        m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); +        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + +        m_creature->AttackStop(); +        m_creature->RemoveAllAuras(); +        m_creature->LoadCreaturesAddon(); +        m_creature->GetMotionMaster()->MovePoint(0, JEDOGA_POS[0][0], JEDOGA_POS[0][1], JEDOGA_POS[0][2]); + +        m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); +        m_creature->SendMonsterMove(JEDOGA_POS[0][0], JEDOGA_POS[0][1], JEDOGA_POS[0][2], 0, MOVEFLAG_JUMP, 0); +        m_creature->Relocate(JEDOGA_POS[0][0], JEDOGA_POS[0][1], JEDOGA_POS[0][2], JEDOGA_POS[0][3]); +        m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); +        m_creature->GetMotionMaster()->Clear(); +        m_creature->GetMotionMaster()->MoveIdle(); +        m_creature->StopMoving(); + +        pInstance->SetData(DATA_JEDOGA_TRIGGER_SWITCH, 1); +        if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == IN_PROGRESS) OpferRufen(); + +        bOnGround = false; +        uiOpFerTimer = urand(15000,30000); +    } + +    void OpferRufen() +    { +        if (!pInstance) +            return; + +        uint64 opfer = pInstance->GetData64(DATA_ADD_JEDOGA_INITIAND); + +        if (opfer) +        { +            DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), m_creature); +            pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer); +        } else +            bCanDown = true; +    } + +    void Opfern() +    { +        DoScriptText(RAND(TEXT_SACRIFICE_2_1, TEXT_SACRIFICE_2_2), m_creature); + +        m_creature->InterruptNonMeleeSpells(false); +        m_creature->CastSpell(m_creature, SPELL_GIFT_OF_THE_HERALD, false); + +        bOpFerok = false; +        bCanDown = true; +    } +      void UpdateAI(const uint32 diff)      { +        if (!pInstance) +            return; + +        if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS && pInstance->GetData(DATA_ALL_INITIAND_DEAD)) +            MoveDown(); + +        if (bOpFerok && !bOnGround && !bCanDown) Opfern(); + +        if (bOpFerokFail && !bOnGround && !bCanDown) +            bCanDown = true; + +        if (bCanDown) +        { +            MoveDown(); +            bCanDown = false; +        } + +        if (bOnGround) +        { +            if (!UpdateVictim()) +                return; + +            if (uiCycloneTimer < diff) +            { +                m_creature->CastSpell(m_creature, HEROIC(SPELL_CYCLONE_STRIKE, SPELL_CYCLONE_STRIKE_H), false); +                uiCycloneTimer = urand(15000,30000); +            } else uiCycloneTimer -= diff; + +            if (uiBoltTimer < diff) +            { +                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) +                    m_creature->CastSpell(pTarget, HEROIC(SPELL_LIGHTNING_BOLT, SPELL_LIGHTNING_BOLT_H), false); + +                uiBoltTimer = urand(15000,30000); +            } else uiBoltTimer -= diff; + +            if (uiThunderTimer < diff) +            { +                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) +                    m_creature->CastSpell(pTarget, HEROIC(SPELL_THUNDERSHOCK, SPELL_THUNDERSHOCK_H), false); + +                uiThunderTimer = urand(15000,30000); +            } else uiThunderTimer -= diff; + +            if (uiOpFerTimer < diff) +                MoveUp(); +            else +                uiOpFerTimer -= diff; + +            DoMeleeAttackIfReady(); +        } +    } +}; + +struct MANGOS_DLL_DECL mob_jedoga_initiandAI : public ScriptedAI +{ +    mob_jedoga_initiandAI(Creature* c) : ScriptedAI(c) +    { +        pInstance = c->GetInstanceData(); +    } + +    ScriptedInstance* pInstance; + +    uint32 checktimer; + +    bool walking; + +    void Reset() +    { +        if (!pInstance) +            return; + +        walking = false; +        checktimer = 2000; + +        if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS) +        { +            m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); +            m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); +            m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false); +            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); +        } +        else +        { +            m_creature->CastSpell(m_creature, SPELL_SPHERE_VISUAL, false); +            m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); +            m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); +            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); +        } +    } + +    void JustDied(Unit* Killer) +    { +        if (!Killer || !pInstance) return; + +        if (walking) +        { +            Creature* boss = m_creature->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); +            if (boss && !CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->opferfail = true; + +            if (Killer->GetTypeId() == TYPEID_PLAYER) pInstance->SetData(DATA_INITIAND_KILLED, 1); +            pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); + +            walking = false; +        } +        if (Killer->GetTypeId() == TYPEID_PLAYER) pInstance->SetData64(DATA_PL_JEDOGA_TARGET, Killer->GetGUID()); +    } + +    void EnterCombat(Unit* who) +    { +        if ((pInstance && pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == IN_PROGRESS) || !who) return; +    } + +    void AttackStart(Unit* victim) +    { +        if ((pInstance && pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == IN_PROGRESS) || !victim) return; + +        ScriptedAI::AttackStart(victim); +    } + +    void MoveInLineOfSight(Unit* who) +    { +        if ((pInstance && pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == IN_PROGRESS) || !who) return; + +        ScriptedAI::MoveInLineOfSight(who); +    } + +    void MovementInform(uint32 uiType, uint32 uiPointId) +    { +        if (uiType != POINT_MOTION_TYPE || !pInstance) return; + +        switch(uiPointId) +        { +            case 1: +                { +                    Creature* boss = m_creature->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); +                    if (boss) +                    { +                        CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true; +                        CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = false; +                        m_creature->DealDamage(boss, m_creature->GetHealth()); +                        m_creature->setDeathState(JUST_DIED); +                    } +                } +                break; +        } +    } + +    void UpdateAI(const uint32 diff) +    { +        if (pInstance && checktimer < diff) +        { +            if (m_creature->GetGUID() == pInstance->GetData64(DATA_ADD_JEDOGA_OPFER) && !walking) +            { +                m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); +                m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); +                m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false); +                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + +                float distance = m_creature->GetDistance(JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2]); + +                if (distance < 9.0f) +                    m_creature->SetSpeed(MOVE_WALK, 0.5f, true); +                else if (distance < 15.0f) +                    m_creature->SetSpeed(MOVE_WALK, 0.75f, true); +                else if (distance < 20.0f) +                    m_creature->SetSpeed(MOVE_WALK, 1.0f, true); + +                m_creature->GetMotionMaster()->Clear(false); +                m_creature->GetMotionMaster()->MovePoint(1, JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2]); +                walking = true; +            } +            if (!walking) +            { +                if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS && m_creature->HasAura(SPELL_SPHERE_VISUAL)) +                { +                    m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); +                    m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); +                    m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false); +                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); +                } +                if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == IN_PROGRESS && !m_creature->HasAura(SPELL_SPHERE_VISUAL)) +                { +                    m_creature->CastSpell(m_creature, SPELL_SPHERE_VISUAL, false); +                    m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); +                    m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); +                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); +                } +            } +            checktimer = 2000; +        } else checktimer -= diff; +          //Return since we have no target          if (!UpdateVictim())              return;          DoMeleeAttackIfReady();      } +}; + +// ------------------------------------------------------------------------------------------------------------ +// Jedogas Aufseher - Entry: 30181 +// ------------------------------------------------------------------------------------------------------------ +#define SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_1    60342 +#define SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_2    56312 -    void JustDied(Unit* killer) +struct MANGOS_DLL_DECL npc_jedogas_aufseher_triggerAI : public Scripted_NoMovementAI +{ +    npc_jedogas_aufseher_triggerAI(Creature* c) : Scripted_NoMovementAI(c)      { -        DoScriptText(SAY_DEATH, m_creature); +        pInstance = c->GetInstanceData(); +        c->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); +        c->setFaction(35); +        removed = false; +        removed2 = false; +        casted = false; +        casted2 = false;      } -    void KilledUnit(Unit *victim) +    ScriptedInstance* pInstance; + +    bool removed, +        removed2, +        casted, +        casted2; + +    void Reset() {} +    void EnterCombat(Unit* who) {} +    void AttackStart(Unit* victim) {} +    void MoveInLineOfSight(Unit* who) {} + +    void UpdateAI(const uint32 diff)      { -        if (victim == m_creature) +        if (!pInstance)              return; -        DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); +        if (!removed && m_creature->GetPositionX() > 440.0f) +        {   /* NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE ! +            if (pInstance->GetData(EVENT_VORRICHTUNGEN)) +            { +                m_creature->InterruptNonMeleeSpells(true); +                removed = true; +                return; +            }*/ +            if (pInstance->GetData(DATA_PRINCE_TALDARAM_EVENT) == DONE) +            { +                m_creature->InterruptNonMeleeSpells(true); +                removed = true; +                return; +            } +            if (!casted) +            { +                m_creature->CastSpell(m_creature, SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_1, false); +                casted = true; +            } +        } +        if (!removed2 && m_creature->GetPositionX() < 440.0f) +        { +            if (!casted2 && pInstance->GetData(DATA_JEDOGA_TRIGGER_SWITCH)) +            { +                m_creature->CastSpell(m_creature, SPELL_BEAM_VISUAL_JEDOGAS_AUFSEHER_2, false); +                casted2 = true; +            } +            if (casted2 && !pInstance->GetData(DATA_JEDOGA_TRIGGER_SWITCH)) +            { +                m_creature->InterruptNonMeleeSpells(true); +                casted2 = false; +            } +            if (!removed2 && pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) == DONE) +            { +                m_creature->InterruptNonMeleeSpells(true); +                removed2 = true; +            } +        }      }  }; -CreatureAI* GetAI_boss_jedoga(Creature* pCreature) +CreatureAI* GetAI_boss_jedoga_shadowseeker(Creature* pCreature) +{ +    return new boss_jedoga_shadowseekerAI (pCreature); +} + +CreatureAI* GetAI_mob_jedoga_initiand(Creature* pCreature)  { -    return new boss_jedogaAI (pCreature); +    return new mob_jedoga_initiandAI (pCreature);  } -void AddSC_boss_jedoga() +CreatureAI* GetAI_npc_jedogas_aufseher_trigger(Creature* pCreature)  { -    Script *newscript; +    return new npc_jedogas_aufseher_triggerAI (pCreature); +} + +void AddSC_boss_jedoga_shadowseeker() +{ +    Script* newscript; + +    newscript = new Script; +    newscript->Name = "boss_jedoga_shadowseeker"; +    newscript->GetAI = &GetAI_boss_jedoga_shadowseeker; +    newscript->RegisterSelf(); + +    newscript = new Script; +    newscript->Name = "mob_jedoga_initiand"; +    newscript->GetAI = &GetAI_mob_jedoga_initiand; +    newscript->RegisterSelf();      newscript = new Script; -    newscript->Name = "boss_jedoga"; -    newscript->GetAI = &GetAI_boss_jedoga; +    newscript->Name = "npc_jedogas_aufseher_trigger"; +    newscript->GetAI = &GetAI_npc_jedogas_aufseher_trigger;      newscript->RegisterSelf();  } diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h index 9c17171d019..e6d3bd387ae 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/def_ahnkahet.h @@ -37,4 +37,12 @@  #define DATA_SPHERE2_EVENT              14  #define DATA_PRINCE_TALDARAM_PLATFORM   15 +#define DATA_PL_JEDOGA_TARGET       16 +#define DATA_ADD_JEDOGA_OPFER       17 +#define DATA_JEDOGA_RESET_INITIANDS 18 +#define DATA_JEDOGA_TRIGGER_SWITCH  19 +#define DATA_ADD_JEDOGA_INITIAND    20 +#define DATA_ALL_INITIAND_DEAD      21 +#define DATA_INITIAND_KILLED        22 +  #endif diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp index f682368c4f8..247dc765ccd 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/instance_ahnkahet.cpp @@ -26,7 +26,10 @@ EndScriptData */  #include "precompiled.h"  #include "def_ahnkahet.h" -#define MAX_ENCOUNTER     5 +#define MAX_ENCOUNTER           5 +#define MAX_JEDOGA_INITIANDS    15 + +#define AchievementVolunteerWork    2056  /* Ahn'kahet encounters:  0 - Elder Nadox @@ -50,21 +53,39 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance      uint64 Prince_TaldaramPlatform;      uint64 Prince_TaldaramGate; +    uint64 InitiandGUIDs[MAX_JEDOGA_INITIANDS]; +    uint64 JedogaSacrifices; +    uint64 JedogaTarget; +      uint32 m_auiEncounter[MAX_ENCOUNTER];      uint32 spheres[2]; +    uint8 InitiandCnt, +        switchtrigger, +        initiandkilled; +      void Initialize()      { -         Elder_Nadox =0; -         Prince_Taldaram =0; -         Jedoga_Shadowseeker =0; -         Herald_Volazj =0; -         Amanitar =0; - -         for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) -             m_auiEncounter[i] = NOT_STARTED; +        Elder_Nadox =0; +        Prince_Taldaram =0; +        Jedoga_Shadowseeker =0; +        Herald_Volazj =0; +        Amanitar =0; + +        for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) +            m_auiEncounter[i] = NOT_STARTED; +          spheres[0] = NOT_STARTED;          spheres[1] = NOT_STARTED; + +        InitiandCnt = 0; +        switchtrigger = 0; +        initiandkilled = 0; +        JedogaSacrifices = 0; +        JedogaTarget = 0; + +        for (uint8 i=0; i<MAX_JEDOGA_INITIANDS; ++i) +            InitiandGUIDs[i] = 0;      }      bool IsEncounterInProgress() const @@ -79,11 +100,12 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance      {          switch(pCreature->GetEntry())          { -            case 29309:    Elder_Nadox = pCreature->GetGUID();                   break; -            case 29308:    Prince_Taldaram = pCreature->GetGUID();               break; -            case 29310:    Jedoga_Shadowseeker = pCreature->GetGUID();           break; -            case 29311:    Herald_Volazj = pCreature->GetGUID();                 break; -            case 30258:    Amanitar = pCreature->GetGUID();                      break; +            case 29309: Elder_Nadox = pCreature->GetGUID();                     break; +            case 29308: Prince_Taldaram = pCreature->GetGUID();                 break; +            case 29310: Jedoga_Shadowseeker = pCreature->GetGUID();             break; +            case 29311: Herald_Volazj = pCreature->GetGUID();                   break; +            case 30258: Amanitar = pCreature->GetGUID();                        break; +            case 30114: InitiandGUIDs[InitiandCnt++] = pCreature->GetGUID();    break;          }      } @@ -114,6 +136,15 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance          }      } +    void SetData64(uint32 idx, uint64 guid) +    { +        switch(idx) +        { +            case DATA_ADD_JEDOGA_OPFER: JedogaSacrifices = guid; break; +            case DATA_PL_JEDOGA_TARGET: JedogaTarget = guid; break; +        } +    } +      uint64 GetData64(uint32 identifier)      {          switch(identifier) @@ -126,6 +157,26 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance              case DATA_SPHERE1:                    return Prince_TaldaramSpheres[0];              case DATA_SPHERE2:                    return Prince_TaldaramSpheres[1];              case DATA_PRINCE_TALDARAM_PLATFORM:   return Prince_TaldaramPlatform; +            case DATA_ADD_JEDOGA_INITIAND: +                { +                    uint8 i = 0; +                    uint32 rnd = urand(0,MAX_JEDOGA_INITIANDS-1); +                    do +                    { +                        if (i == rnd) +                        { +                            Creature* cr = instance->GetCreature(InitiandGUIDs[i]); +                            if (cr && cr->isAlive()) return InitiandGUIDs[i]; +                            else +                            { +                                i = 0; +                                rnd = urand(0,MAX_JEDOGA_INITIANDS-1); +                            } +                        } else ++i; +                    } while (i < MAX_JEDOGA_INITIANDS); +                } +            case DATA_ADD_JEDOGA_OPFER: return JedogaSacrifices; +            case DATA_PL_JEDOGA_TARGET: return JedogaTarget;          }          return 0;      } @@ -134,30 +185,50 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance      {          switch(type)          { -        case DATA_ELDER_NADOX_EVENT: -            m_auiEncounter[0] = data;break; -        case DATA_PRINCE_TALDARAM_EVENT: -	    if (data == DONE) -	    { -	        HandleGameObject(Prince_TaldaramGate,true); -	    } -            m_auiEncounter[1] = data; break; -        case DATA_JEDOGA_SHADOWSEEKER_EVENT: -            m_auiEncounter[2] = data; break; -        case DATA_HERALD_VOLAZJ: -            m_auiEncounter[3] = data; break; -        case DATA_AMANITAR: -            m_auiEncounter[4] = data; break; -        case DATA_SPHERE1_EVENT: -            spheres[0] = data; break; -        case DATA_SPHERE2_EVENT: -            spheres[1] = data; break; -	} - +            case DATA_ELDER_NADOX_EVENT: m_auiEncounter[0] = data; break; +            case DATA_PRINCE_TALDARAM_EVENT: +                if (data == DONE) +                    HandleGameObject(Prince_TaldaramGate,true); +                m_auiEncounter[1] = data; +                break; +            case DATA_JEDOGA_SHADOWSEEKER_EVENT: +                m_auiEncounter[2] = data; +                if (data == DONE) +                { +                    for (uint8 i = 0; i < MAX_JEDOGA_INITIANDS; ++i) +                    { +                        Creature* cr = instance->GetCreature(InitiandGUIDs[i]); +                        if (cr && cr->isAlive()) +                        { +                            cr->SetVisibility(VISIBILITY_OFF); +                            cr->setDeathState(JUST_DIED); +                            cr->RemoveCorpse(); +                        } +                    } +                    if (!initiandkilled && instance->IsHeroic()) +                        DoCompleteAchievement(AchievementVolunteerWork); +                } +                break; +            case DATA_HERALD_VOLAZJ: m_auiEncounter[3] = data; break; +            case DATA_AMANITAR: m_auiEncounter[4] = data; break; +            case DATA_SPHERE1_EVENT: spheres[0] = data; break; +            case DATA_SPHERE2_EVENT: spheres[1] = data; break; +            case DATA_JEDOGA_TRIGGER_SWITCH: switchtrigger = data; break; +            case DATA_INITIAND_KILLED: initiandkilled = data; break; +            case DATA_JEDOGA_RESET_INITIANDS: +                for (uint8 i=0; i < MAX_JEDOGA_INITIANDS; ++i) +                { +                    Creature* cr = instance->GetCreature(InitiandGUIDs[i]); +                    if (cr) +                    { +                        cr->Respawn(); +                        if (!cr->IsInEvadeMode()) cr->AI()->EnterEvadeMode(); +                    } +                } +                break; +        }          if (data == DONE) -        {              SaveToDB(); -        }      }      uint32 GetData(uint32 type) @@ -171,25 +242,30 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance              case DATA_AMANITAR:                     return m_auiEncounter[4];              case DATA_SPHERE1_EVENT:                return spheres[0];              case DATA_SPHERE2_EVENT:                return spheres[1]; +            case DATA_ALL_INITIAND_DEAD: +                for (uint8 i=0; i<MAX_JEDOGA_INITIANDS; ++i) +                { +                    Creature* cr = instance->GetCreature(InitiandGUIDs[i]); +                    if (!cr || (cr && cr->isAlive())) return 0; +                } +                return 1; +            case DATA_JEDOGA_TRIGGER_SWITCH: return switchtrigger; +            case DATA_INITIAND_KILLED: return initiandkilled;          }          return 0;      } -   std::string GetSaveData() +    std::string GetSaveData()      {          OUT_SAVE_INST_DATA; -        std::string str_data; -          std::ostringstream saveStream;          saveStream << "A K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "              << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " "              << spheres[0] << " " << spheres[1]; -        str_data = saveStream.str(); -          OUT_SAVE_INST_DATA_COMPLETE; -        return str_data; +        return saveStream.str();      }      void Load(const char* in) diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp index 1137abeda3a..cab79fc3bea 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_anubarak.cpp @@ -303,7 +303,7 @@ void AddSC_boss_anub_arak()      Script *newscript;      newscript = new Script; -    newscript->Name="boss_anub_arak"; +    newscript->Name = "boss_anub_arak";      newscript->GetAI = &GetAI_boss_anub_arak;      newscript->RegisterSelf();  } diff --git a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp index d107a63b653..b791b05ddbc 100644 --- a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp +++ b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp @@ -685,7 +685,7 @@ struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI  struct TRINITY_DLL_DECL mob_tenebronAI : public dummy_dragonAI  { -    mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } +    mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {}      uint32 m_uiShadowBreathTimer;      uint32 m_uiShadowFissureTimer; @@ -755,7 +755,7 @@ CreatureAI* GetAI_mob_tenebron(Creature* pCreature)  struct TRINITY_DLL_DECL mob_shadronAI : public dummy_dragonAI  { -    mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } +    mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {}      uint32 m_uiShadowBreathTimer;      uint32 m_uiShadowFissureTimer; @@ -831,7 +831,7 @@ CreatureAI* GetAI_mob_shadron(Creature* pCreature)  struct TRINITY_DLL_DECL mob_vesperonAI : public dummy_dragonAI  { -    mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) { } +    mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) {}      uint32 m_uiShadowBreathTimer;      uint32 m_uiShadowFissureTimer; @@ -1009,7 +1009,7 @@ CreatureAI* GetAI_mob_acolyte_of_vesperon(Creature* pCreature)  struct TRINITY_DLL_DECL mob_twilight_eggsAI : public ScriptedAI  { -    mob_twilight_eggsAI(Creature* pCreature) : ScriptedAI(pCreature) { } +    mob_twilight_eggsAI(Creature* pCreature) : ScriptedAI(pCreature) {}      uint32 m_uiFadeArmorTimer; @@ -1018,8 +1018,8 @@ struct TRINITY_DLL_DECL mob_twilight_eggsAI : public ScriptedAI          m_uiFadeArmorTimer = 1000;      } -    void AttackStart(Unit* pWho) { } -    void MoveInLineOfSight(Unit* pWho) { } +    void AttackStart(Unit* pWho) {} +    void MoveInLineOfSight(Unit* pWho) {}  };  CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature) @@ -1033,7 +1033,7 @@ CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature)  struct TRINITY_DLL_DECL mob_twilight_whelpAI : public ScriptedAI  { -    mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) { } +    mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) {}      uint32 m_uiFadeArmorTimer; diff --git a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp index 19047460303..e16c0b940ad 100644 --- a/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp +++ b/src/bindings/scripts/scripts/northrend/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp @@ -806,7 +806,7 @@ void AddSC_boss_palehoof()      newscript->RegisterSelf();      newscript = new Script; -    newscript->Name="mob_palehoof_orb"; +    newscript->Name = "mob_palehoof_orb";      newscript->GetAI = &GetAI_mob_palehoof_orb;      newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index 176522e3bbd..5ca874c09d3 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -135,7 +135,7 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI      SpawnAssociation* m_pSpawnAssoc;      uint64 m_uiSpawnedGUID; -    void Reset() { } +    void Reset() {}      Creature* SummonGuard()      { diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index 5d026318a9b..dde39ee426f 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -274,6 +274,7 @@ extern void AddSC_instance_azjol_nerub();  extern void AddSC_instance_ahnkahet();          //Azjol-Nerub Ahn'kahet  extern void AddSC_boss_amanitar();  extern void AddSC_boss_taldaram(); +extern void AddSC_boss_jedoga_shadowseeker();  extern void AddSC_boss_elder_nadox();  extern void AddSC_boss_volazj();  extern void AddSC_boss_anubrekhan();            //Naxxramas @@ -704,6 +705,7 @@ void AddScripts()      AddSC_boss_amanitar();      AddSC_boss_taldaram();              //Azjol-Nerub Ahn'kahet      AddSC_boss_elder_nadox(); +    AddSC_boss_jedoga_shadowseeker();      AddSC_boss_volazj();      AddSC_instance_ahnkahet();      AddSC_boss_krik_thir();             //Azjol-Nerub Azjol-Nerub  | 
