diff options
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
20 files changed, 956 insertions, 959 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 97fe57c5434..96293c635d6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -146,7 +146,7 @@ public:                  me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);                  if (Player* starter = Unit::GetPlayer(*me, playerGUID)) -                    Talk(SAY_EVENT_ATTACK); +                    sCreatureTextMgr->SendChat(me, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, starter);                  phase = PHASE_TO_ATTACK;              } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 87301f43745..22c4da74d44 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -399,35 +399,6 @@ class go_altar_of_archaedas : public GameObjectScript          }  }; -/* ScriptData -SDName: go_altar_of_the_keepers -SD%Complete: 100 -SDComment: Need 1 person to activate to open the altar.  One by one the StoneKeepers will activate.  After all four are dead than the door will open. -SDCategory: Uldaman -EndScriptData */ - -class go_altar_of_the_keepers : public GameObjectScript -{ -    public: - -        go_altar_of_the_keepers() -            : GameObjectScript("go_altar_of_the_keepers") -        { -        } - -        bool OnGossipHello(Player* player, GameObject* /*go*/) -        { -            InstanceScript* instance = player->GetInstanceScript(); -            if (!instance) -                return false; - -            player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false); - -            instance->SetData(DATA_STONE_KEEPERS, IN_PROGRESS); // activate the Stone Keepers -            return false; -        } -}; -  //This is the actual function called only once durring InitScripts()  //It must define all handled functions that are to be run in this script  void AddSC_boss_archaedas() @@ -436,6 +407,5 @@ void AddSC_boss_archaedas()      new mob_archaedas_minions();      new mob_stonekeepers();      new go_altar_of_archaedas(); -    new go_altar_of_the_keepers();  } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 138243a9ce2..ac26056c6e6 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -33,38 +33,38 @@ enum eSpells      SPELL_AWAKEN_VAULT_WALKER   = 10258,  }; +enum Events +{ +    EVENT_SUB_BOSS_AGGRO        = 2228 +}; +  class instance_uldaman : public InstanceMapScript  {      public: -        instance_uldaman() -            : InstanceMapScript("instance_uldaman", 70) -        { -        } +        instance_uldaman() : InstanceMapScript("instance_uldaman", 70) {}          struct instance_uldaman_InstanceMapScript : public InstanceScript          { -            instance_uldaman_InstanceMapScript(Map* map) : InstanceScript(map) -            { -            } +            instance_uldaman_InstanceMapScript(Map* map) : InstanceScript(map) {}              void Initialize()              {                  memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); -                uiArchaedasGUID = 0; -                uiIronayaGUID = 0; -                uiWhoWokeuiArchaedasGUID = 0; +                archaedasGUID = 0; +                ironayaGUID = 0; +                whoWokeuiArchaedasGUID = 0; -                uiAltarOfTheKeeperTempleDoor = 0; -                uiArchaedasTempleDoor = 0; -                uiAncientVaultDoor = 0; +                altarOfTheKeeperTempleDoor = 0; +                archaedasTempleDoor = 0; +                ancientVaultDoor = 0; -                uiIronayaSealDoor = 0; +                ironayaSealDoor = 0; -                uiKeystoneGUID = 0; +                keystoneGUID = 0; -                uiIronayaSealDoorTimer = 27000; //animation time -                bKeystoneCheck = false; +                ironayaSealDoorTimer = 27000; //animation time +                keystoneCheck = false;              }              bool IsEncounterInProgress() const @@ -76,25 +76,25 @@ class instance_uldaman : public InstanceMapScript                  return false;              } -            uint64 uiArchaedasGUID; -            uint64 uiIronayaGUID; -            uint64 uiWhoWokeuiArchaedasGUID; +            uint64 archaedasGUID; +            uint64 ironayaGUID; +            uint64 whoWokeuiArchaedasGUID; -            uint64 uiAltarOfTheKeeperTempleDoor; -            uint64 uiArchaedasTempleDoor; -            uint64 uiAncientVaultDoor; -            uint64 uiIronayaSealDoor; +            uint64 altarOfTheKeeperTempleDoor; +            uint64 archaedasTempleDoor; +            uint64 ancientVaultDoor; +            uint64 ironayaSealDoor; -            uint64 uiKeystoneGUID; +            uint64 keystoneGUID; -            uint32 uiIronayaSealDoorTimer; -            bool bKeystoneCheck; +            uint32 ironayaSealDoorTimer; +            bool keystoneCheck; -            std::vector<uint64> vStoneKeeper; -            std::vector<uint64> vAltarOfTheKeeperCount; -            std::vector<uint64> vVaultWalker; -            std::vector<uint64> vEarthenGuardian; -            std::vector<uint64> vArchaedasWallMinions;    // minions lined up around the wall +            std::vector<uint64> stoneKeepers; +            std::vector<uint64> altarOfTheKeeperCounts; +            std::vector<uint64> vaultWalkers; +            std::vector<uint64> earthenGuardians; +            std::vector<uint64> archaedasWallMinions;    // minions lined up around the wall              uint32 m_auiEncounter[MAX_ENCOUNTER];              std::string str_data; @@ -104,14 +104,14 @@ class instance_uldaman : public InstanceMapScript                  switch (go->GetEntry())                  {                      case GO_ALTAR_OF_THE_KEEPER_TEMPLE_DOOR:         // lock the door -                        uiAltarOfTheKeeperTempleDoor = go->GetGUID(); +                        altarOfTheKeeperTempleDoor = go->GetGUID();                          if (m_auiEncounter[0] == DONE)                             HandleGameObject(0, true, go);                          break;                      case GO_ARCHAEDAS_TEMPLE_DOOR: -                        uiArchaedasTempleDoor = go->GetGUID(); +                        archaedasTempleDoor = go->GetGUID();                          if (m_auiEncounter[0] == DONE)                              HandleGameObject(0, true, go); @@ -120,21 +120,21 @@ class instance_uldaman : public InstanceMapScript                      case GO_ANCIENT_VAULT_DOOR:                          go->SetGoState(GO_STATE_READY);                          go->SetUInt32Value(GAMEOBJECT_FLAGS, 33); -                        uiAncientVaultDoor = go->GetGUID(); +                        ancientVaultDoor = go->GetGUID();                          if (m_auiEncounter[1] == DONE)                              HandleGameObject(0, true, go);                          break;                      case GO_IRONAYA_SEAL_DOOR: -                        uiIronayaSealDoor = go->GetGUID(); +                        ironayaSealDoor = go->GetGUID();                          if (m_auiEncounter[2] == DONE)                              HandleGameObject(0, true, go);                          break;                      case GO_KEYSTONE: -                        uiKeystoneGUID = go->GetGUID(); +                        keystoneGUID = go->GetGUID();                          if (m_auiEncounter[2] == DONE)                          { @@ -174,28 +174,31 @@ class instance_uldaman : public InstanceMapScript              void ActivateStoneKeepers()              { -                for (std::vector<uint64>::const_iterator i = vStoneKeeper.begin(); i != vStoneKeeper.end(); ++i) +                if (GetData(DATA_ALTAR_DOORS) != DONE)                  { -                    Creature* target = instance->GetCreature(*i); -                    if (!target || !target->isAlive() || target->getFaction() == 14) -                        continue; -                    target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); -                    target->setFaction(14); -                    target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -                    return;        // only want the first one we find +                    for (std::vector<uint64>::const_iterator i = stoneKeepers.begin(); i != stoneKeepers.end(); ++i) +                    { +                        Creature* target = instance->GetCreature(*i); +                        if (!target || !target->isAlive()) +                            continue; +                        target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); +                        target->setFaction(14); +                        target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +                        return;        // only want the first one we find +                    } +                    // if we get this far than all four are dead so open the door +                    SetData(DATA_ALTAR_DOORS, DONE); +                    SetDoor(archaedasTempleDoor, true); //open next the door too                  } -                // if we get this far than all four are dead so open the door -                SetData(DATA_ALTAR_DOORS, DONE); -                SetDoor(uiArchaedasTempleDoor, true); //open next the door too              }              void ActivateWallMinions()              { -                Creature* archaedas = instance->GetCreature(uiArchaedasGUID); +                Creature* archaedas = instance->GetCreature(archaedasGUID);                  if (!archaedas)                      return; -                for (std::vector<uint64>::const_iterator i = vArchaedasWallMinions.begin(); i != vArchaedasWallMinions.end(); ++i) +                for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (!target || !target->isAlive() || target->getFaction() == 14) @@ -213,7 +216,7 @@ class instance_uldaman : public InstanceMapScript              void DeActivateMinions()              {                  // first despawn any aggroed wall minions -                for (std::vector<uint64>::const_iterator i = vArchaedasWallMinions.begin(); i != vArchaedasWallMinions.end(); ++i) +                for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (!target || target->isDead() || target->getFaction() != 14) @@ -223,7 +226,7 @@ class instance_uldaman : public InstanceMapScript                  }                  // Vault Walkers -                for (std::vector<uint64>::const_iterator i = vVaultWalker.begin(); i != vVaultWalker.end(); ++i) +                for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (!target || target->isDead() || target->getFaction() != 14) @@ -233,7 +236,7 @@ class instance_uldaman : public InstanceMapScript                  }                  // Earthen Guardians -                for (std::vector<uint64>::const_iterator i = vEarthenGuardian.begin(); i != vEarthenGuardian.end(); ++i) +                for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (!target || target->isDead() || target->getFaction() != 14) @@ -245,20 +248,20 @@ class instance_uldaman : public InstanceMapScript              void ActivateArchaedas(uint64 target)              { -                Creature* archaedas = instance->GetCreature(uiArchaedasGUID); +                Creature* archaedas = instance->GetCreature(archaedasGUID);                  if (!archaedas)                      return;                  if (Unit::GetUnit(*archaedas, target))                  {                      archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN, false); -                    uiWhoWokeuiArchaedasGUID = target; +                    whoWokeuiArchaedasGUID = target;                  }              }              void ActivateIronaya()              { -                Creature* ironaya = instance->GetCreature(uiIronayaGUID); +                Creature* ironaya = instance->GetCreature(ironayaGUID);                  if (!ironaya)                      return; @@ -270,7 +273,7 @@ class instance_uldaman : public InstanceMapScript              void RespawnMinions()              {                  // first respawn any aggroed wall minions -                for (std::vector<uint64>::const_iterator i = vArchaedasWallMinions.begin(); i != vArchaedasWallMinions.end(); ++i) +                for (std::vector<uint64>::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (target && target->isDead()) @@ -282,7 +285,7 @@ class instance_uldaman : public InstanceMapScript                  }                  // Vault Walkers -                for (std::vector<uint64>::const_iterator i = vVaultWalker.begin(); i != vVaultWalker.end(); ++i) +                for (std::vector<uint64>::const_iterator i = vaultWalkers.begin(); i != vaultWalkers.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (target && target->isDead()) @@ -294,7 +297,7 @@ class instance_uldaman : public InstanceMapScript                  }                  // Earthen Guardians -                for (std::vector<uint64>::const_iterator i = vEarthenGuardian.begin(); i != vEarthenGuardian.end(); ++i) +                for (std::vector<uint64>::const_iterator i = earthenGuardians.begin(); i != earthenGuardians.end(); ++i)                  {                      Creature* target = instance->GetCreature(*i);                      if (target && target->isDead()) @@ -307,21 +310,21 @@ class instance_uldaman : public InstanceMapScript              }              void Update(uint32 diff)              { -                if (!bKeystoneCheck) +                if (!keystoneCheck)                      return; -                if (uiIronayaSealDoorTimer <= diff) +                if (ironayaSealDoorTimer <= diff)                  {                      ActivateIronaya(); -                    SetDoor(uiIronayaSealDoor, true); -                    BlockGO(uiKeystoneGUID); +                    SetDoor(ironayaSealDoor, true); +                    BlockGO(keystoneGUID);                      SetData(DATA_IRONAYA_DOOR, DONE); //save state -                    bKeystoneCheck = false; +                    keystoneCheck = false;                  }                  else -                    uiIronayaSealDoorTimer -= diff; +                    ironayaSealDoorTimer -= diff;              }              void SetData(uint32 type, uint32 data) @@ -331,15 +334,15 @@ class instance_uldaman : public InstanceMapScript                      case DATA_ALTAR_DOORS:                          m_auiEncounter[0] = data;                          if (data == DONE) -                            SetDoor(uiAltarOfTheKeeperTempleDoor, true); +                            SetDoor(altarOfTheKeeperTempleDoor, true);                          break;                      case DATA_ANCIENT_DOOR:                          m_auiEncounter[1] = data;                          if (data == DONE) //archeadas defeat                          { -                            SetDoor(uiArchaedasTempleDoor, true); //re open enter door -                            SetDoor(uiAncientVaultDoor, true); +                            SetDoor(archaedasTempleDoor, true); //re open enter door +                            SetDoor(ancientVaultDoor, true);                          }                          break; @@ -356,7 +359,7 @@ class instance_uldaman : public InstanceMapScript                          {                              case NOT_STARTED:                                  if (m_auiEncounter[0] == DONE) //if players opened the doors -                                    SetDoor(uiArchaedasTempleDoor, true); +                                    SetDoor(archaedasTempleDoor, true);                                  RespawnMinions();                                  break; @@ -372,7 +375,7 @@ class instance_uldaman : public InstanceMapScript                          break;                      case DATA_IRONAYA_SEAL: -                        bKeystoneCheck = true; +                        keystoneCheck = true;                          break;                  } @@ -396,7 +399,7 @@ class instance_uldaman : public InstanceMapScript                  if (type == 0)                  {                      ActivateArchaedas (data); -                    SetDoor(uiArchaedasTempleDoor, false); //close when event is started +                    SetDoor(archaedasTempleDoor, false); //close when event is started                  }              } @@ -433,34 +436,34 @@ class instance_uldaman : public InstanceMapScript                  {                      case 4857:    // Stone Keeper                          SetFrozenState (creature); -                        vStoneKeeper.push_back(creature->GetGUID()); +                        stoneKeepers.push_back(creature->GetGUID());                          break;                      case 7309:    // Earthen Custodian -                        vArchaedasWallMinions.push_back(creature->GetGUID()); +                        archaedasWallMinions.push_back(creature->GetGUID());                          break;                      case 7077:    // Earthen Hallshaper -                        vArchaedasWallMinions.push_back(creature->GetGUID()); +                        archaedasWallMinions.push_back(creature->GetGUID());                          break;                      case 7076:    // Earthen Guardian -                        vEarthenGuardian.push_back(creature->GetGUID()); +                        earthenGuardians.push_back(creature->GetGUID());                          break;                      case 7228:    // Ironaya -                        uiIronayaGUID = creature->GetGUID(); +                        ironayaGUID = creature->GetGUID();                          if (m_auiEncounter[2] != DONE)                              SetFrozenState (creature);                          break;                      case 10120:    // Vault Walker -                        vVaultWalker.push_back(creature->GetGUID()); +                        vaultWalkers.push_back(creature->GetGUID());                          break;                      case 2748:    // Archaedas -                        uiArchaedasGUID = creature->GetGUID(); +                        archaedasGUID = creature->GetGUID();                          break;                  } @@ -471,25 +474,37 @@ class instance_uldaman : public InstanceMapScript                  switch (identifier)                  {                      case 0: -                        return uiWhoWokeuiArchaedasGUID; +                        return whoWokeuiArchaedasGUID;                      case 1:                      case 2:                      case 3:                      case 4: -                        return vVaultWalker.at(identifier - 1); +                        return vaultWalkers.at(identifier - 1);                      case 5:                      case 6:                      case 7:                      case 8:                      case 9:                      case 10: -                        return vEarthenGuardian.at(identifier - 5); +                        return earthenGuardians.at(identifier - 5);                      default:                          break;                  }                  return 0;              } // end GetData64 + +            void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) +            { +                switch (eventId) +                { +                    case EVENT_SUB_BOSS_AGGRO: +                        SetData(DATA_STONE_KEEPERS, IN_PROGRESS); // activate the Stone Keepers +                        break; +                    default: +                        break; +                } +            }          };          InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 935e54eae0c..577423adb39 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -45,32 +45,37 @@ EndScriptData */  #define YELL_BERSERK "Whatch you be doing? Pissin' yourselves..."  #define SOUND_BERSERK                12025 -#define SPELL_DUAL_WIELD                29651 -#define SPELL_SABER_LASH                43267 -#define SPELL_FRENZY                    43139 -#define SPELL_FLAMESHOCK                43303 -#define SPELL_EARTHSHOCK                43305 -#define SPELL_TRANSFORM_SPLIT           43142 -#define SPELL_TRANSFORM_SPLIT2          43573 -#define SPELL_TRANSFORM_MERGE           43271 -#define SPELL_SUMMON_LYNX               43143 -#define SPELL_SUMMON_TOTEM              43302 -#define SPELL_BERSERK                   45078 - -#define MOB_SPIRIT_LYNX                 24143 -#define SPELL_LYNX_FRENZY               43290 -#define SPELL_SHRED_ARMOR               43243 - -#define MOB_TOTEM                       24224 +enum Spells +{ +    SPELL_DUAL_WIELD            = 29651, +    SPELL_SABER_LASH            = 43267, +    SPELL_FRENZY                = 43139, +    SPELL_FLAMESHOCK            = 43303, +    SPELL_EARTHSHOCK            = 43305, +    SPELL_TRANSFORM_SPLIT       = 43142, +    SPELL_TRANSFORM_SPLIT2      = 43573, +    SPELL_TRANSFORM_MERGE       = 43271, +    SPELL_SUMMON_LYNX           = 43143, +    SPELL_SUMMON_TOTEM          = 43302, +    SPELL_BERSERK               = 45078, +    SPELL_LYNX_FRENZY           = 43290, // Used by Spirit Lynx +    SPELL_SHRED_ARMOR           = 43243  // Used by Spirit Lynx +}; + +enum Hal_CreatureIds +{ +    NPC_SPIRIT_LYNX             = 24143, +    NPC_TOTEM                   = 24224 +};  enum PhaseHalazzi  { -    PHASE_NONE = 0, -    PHASE_LYNX = 1, -    PHASE_SPLIT = 2, -    PHASE_HUMAN = 3, -    PHASE_MERGE = 4, -    PHASE_ENRAGE = 5 +    PHASE_NONE                  = 0, +    PHASE_LYNX                  = 1, +    PHASE_SPLIT                 = 2, +    PHASE_HUMAN                 = 3, +    PHASE_MERGE                 = 4, +    PHASE_ENRAGE                = 5  };  class boss_halazzi : public CreatureScript @@ -134,7 +139,7 @@ class boss_halazzi : public CreatureScript              void JustSummoned(Creature* summon)              {                  summon->AI()->AttackStart(me->getVictim()); -                if (summon->GetEntry() == MOB_SPIRIT_LYNX) +                if (summon->GetEntry() == NPC_SPIRIT_LYNX)                      LynxGUID = summon->GetGUID();              } @@ -183,7 +188,7 @@ class boss_halazzi : public CreatureScript                      break;                  case PHASE_HUMAN:                      //DoCast(me, SPELL_SUMMON_LYNX, true); -                    DoSpawnCreature(MOB_SPIRIT_LYNX, 5, 5, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); +                    DoSpawnCreature(NPC_SPIRIT_LYNX, 5, 5, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);                      me->SetMaxHealth(400000);                      me->SetHealth(400000);                      ShockTimer = 10000; @@ -413,3 +418,4 @@ void AddSC_boss_halazzi()      new mob_halazzi_lynx();  } + diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 54a5f5c706c..593ee05d951 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -27,14 +27,14 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum eYells +enum Says  {      SAY_AGGRO                   = 0,      SAY_FEAST_PANTHER           = 1, -    SAY_DEATH                   = 2, +    SAY_DEATH                   = 2  }; -enum eSpells +enum Spells  {      SPELL_SHADOWWORDPAIN        = 23952,      SPELL_GOUGE                 = 24698, @@ -51,21 +51,11 @@ enum eSpells  class boss_arlokk : public CreatureScript  { -    public: - -        boss_arlokk() -            : CreatureScript("boss_arlokk") -        { -        } +    public: boss_arlokk() : CreatureScript("boss_arlokk") {} -        struct boss_arlokkAI : public ScriptedAI +        struct boss_arlokkAI : public BossAI          { -            boss_arlokkAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } - -            InstanceScript* instance; +            boss_arlokkAI(Creature* creature) : BossAI(creature, DATA_ARLOKK) {}              uint32 m_uiShadowWordPain_Timer;              uint32 m_uiGouge_Timer; @@ -104,8 +94,17 @@ class boss_arlokk : public CreatureScript                  me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);              } +            void JustDied(Unit* /*killer*/) +            { +                _JustDied(); +                Talk(SAY_DEATH); +                me->SetDisplayId(MODEL_ID_NORMAL); +                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +            } +              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat();                  Talk(SAY_AGGRO);              } @@ -118,17 +117,6 @@ class boss_arlokk : public CreatureScript                  me->DespawnOrUnsummon();              } -            void JustDied(Unit* /*killer*/) -            { -                Talk(SAY_DEATH); - -                me->SetDisplayId(MODEL_ID_NORMAL); -                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - -                if (instance) -                    instance->SetData(DATA_ARLOKK, DONE); -            } -              void DoSummonPhanters()              {                  if (MarkedTargetGUID) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index e7d54aecb31..7943e51a7cd 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -25,62 +25,73 @@ EndScriptData */  #include "ScriptMgr.h"  #include "ScriptedCreature.h" +#include "zulgurub.h" -#define SPELL_FROSTBREATH            16099 -#define SPELL_MASSIVEGEYSER          22421                  //Not working. Cause its a summon... -#define SPELL_SLAM                   24326 +enum Spells +{ +    SPELL_FROSTBREATH               = 16099, +    SPELL_MASSIVEGEYSER             = 22421, // Not working. (summon) +    SPELL_SLAM                      = 24326 +}; + +enum Events +{ +    EVENT_FROSTBREATH               = 0, +    EVENT_MASSIVEGEYSER             = 1, +    EVENT_SLAM                      = 2 +}; -class boss_gahzranka : public CreatureScript +class boss_gahzranka : public CreatureScript // gahzranka  { -    public: -        boss_gahzranka() : CreatureScript("boss_gahzranka") { } +    public: boss_gahzranka() : CreatureScript("boss_gahzranka") {} -        struct boss_gahzrankaAI : public ScriptedAI +        struct boss_gahzrankaAI : public BossAI          { -            boss_gahzrankaAI(Creature* creature) : ScriptedAI(creature) { } -            uint32 Frostbreath_Timer; -            uint32 MassiveGeyser_Timer; -            uint32 Slam_Timer; +            boss_gahzrankaAI(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) {} -            void Reset() +            void JustDied(Unit* /*killer*/)              { -                Frostbreath_Timer = 8000; -                MassiveGeyser_Timer = 25000; -                Slam_Timer = 17000; +                _JustDied();              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_FROSTBREATH, 8000); +                events.ScheduleEvent(EVENT_MASSIVEGEYSER, 25000); +                events.ScheduleEvent(EVENT_SLAM, 17000);              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              { -                //Return since we have no target                  if (!UpdateVictim())                      return; -                //Frostbreath_Timer -                if (Frostbreath_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_FROSTBREATH); -                    Frostbreath_Timer = urand(7000, 11000); -                } else Frostbreath_Timer -= diff; - -                //MassiveGeyser_Timer -                if (MassiveGeyser_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_MASSIVEGEYSER); -                    DoResetThreat(); +                events.Update(diff); -                    MassiveGeyser_Timer = urand(22000, 32000); -                } else MassiveGeyser_Timer -= diff; +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                //Slam_Timer -                if (Slam_Timer <= diff) +                while (uint32 eventId = events.ExecuteEvent())                  { -                    DoCast(me->getVictim(), SPELL_SLAM); -                    Slam_Timer = urand(12000, 20000); -                } else Slam_Timer -= diff; +                    switch (eventId) +                    { +                        case EVENT_FROSTBREATH: +                            DoCastVictim(SPELL_FROSTBREATH, true); +                            events.ScheduleEvent(EVENT_FROSTBREATH, urand(7000, 11000)); +                            break; +                        case EVENT_MASSIVEGEYSER: +                            DoCastVictim(SPELL_MASSIVEGEYSER, true); +                            events.ScheduleEvent(EVENT_MASSIVEGEYSER, urand(22000, 32000)); +                            break; +                        case EVENT_SLAM: +                            DoCastVictim(SPELL_SLAM, true); +                            events.ScheduleEvent(EVENT_SLAM, urand(12000, 20000)); +                            break; +                        default: +                            break; +                    } +                }                  DoMeleeAttackIfReady();              } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index 4ccdbceb466..4b7bee5abf1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -27,60 +27,68 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -#define SPELL_AVARTAR                24646                  //The Enrage Spell -#define SPELL_GROUNDTREMOR            6524 +enum Spells +{ +    SPELL_AVATAR                    = 24646, // Enrage Spell +    SPELL_GROUND_TREMOR             = 6524 +}; + +enum Events +{ +    EVENT_AVATAR                    = 0, +    EVENT_GROUND_TREMOR             = 1 +}; -class boss_grilek : public CreatureScript +class boss_grilek : public CreatureScript // grilek  { -    public: -        boss_grilek() : CreatureScript("boss_grilek") { } +    public: boss_grilek() : CreatureScript("boss_grilek") {} -        struct boss_grilekAI : public ScriptedAI +        struct boss_grilekAI : public BossAI          { -            boss_grilekAI(Creature* creature) : ScriptedAI(creature) { } - -            uint32 Avartar_Timer; -            uint32 GroundTremor_Timer; +            boss_grilekAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) {} -            void Reset() +            void JustDied(Unit* /*killer*/)              { -                Avartar_Timer = urand(15000, 25000); -                GroundTremor_Timer = urand(8000, 16000); +                _JustDied();              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_AVATAR, urand(15000, 25000)); +                events.ScheduleEvent(EVENT_GROUND_TREMOR, urand(15000, 25000));              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              { -                //Return since we have no target                  if (!UpdateVictim())                      return; -                //Avartar_Timer -                if (Avartar_Timer <= diff) -                { - -                    DoCast(me, SPELL_AVARTAR); -                    Unit* target = NULL; - -                    target = SelectTarget(SELECT_TARGET_RANDOM, 1); +                events.Update(diff); -                    if (DoGetThreat(me->getVictim())) -                        DoModifyThreatPercent(me->getVictim(), -50); -                    if (target) -                        AttackStart(target); - -                    Avartar_Timer = urand(25000, 35000); -                } else Avartar_Timer -= diff; +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                //GroundTremor_Timer -                if (GroundTremor_Timer <= diff) +                while (uint32 eventId = events.ExecuteEvent())                  { -                    DoCast(me->getVictim(), SPELL_GROUNDTREMOR); -                    GroundTremor_Timer = urand(12000, 16000); -                } else GroundTremor_Timer -= diff; +                    switch (eventId) +                    { +                        case EVENT_AVATAR: +                            DoCast(me, SPELL_AVATAR); +                            if (DoGetThreat(me->getVictim())) +                                DoModifyThreatPercent(me->getVictim(), -50); +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) +                                AttackStart(target); +                            events.ScheduleEvent(EVENT_AVATAR, urand(25000, 35000)); +                            break; +                        case EVENT_GROUND_TREMOR: +                            DoCastVictim(SPELL_GROUND_TREMOR, true); +                            events.ScheduleEvent(EVENT_GROUND_TREMOR, urand(12000, 16000)); +                            break; +                        default: +                            break; +                    } +                }                  DoMeleeAttackIfReady();              } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 781b68bfcb0..87a9c02e3ed 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -27,19 +27,21 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Hakkar +enum Says  {      SAY_AGGRO                   = 0,      SAY_FLEEING                 = 1,      SAY_MINION_DESTROY          = 2,                //where does it belong? -    SAY_PROTECT_ALTAR           = 3,                //where does it belong? +    SAY_PROTECT_ALTAR           = 3                 //where does it belong? +}; +enum Spells +{      SPELL_BLOODSIPHON           = 24322,      SPELL_CORRUPTEDBLOOD        = 24328,      SPELL_CAUSEINSANITY         = 24327,                 //Not working disabled.      SPELL_WILLOFHAKKAR          = 24178,      SPELL_ENRAGE                = 24318, -  // The Aspects of all High Priests      SPELL_ASPECT_OF_JEKLIK      = 24687,      SPELL_ASPECT_OF_VENOXIS     = 24688, @@ -48,23 +50,13 @@ enum Hakkar      SPELL_ASPECT_OF_ARLOKK      = 24690  }; -class boss_hakkar : public CreatureScript +class boss_hakkar : public CreatureScript // hakkar  { -    public: - -        boss_hakkar() -            : CreatureScript("boss_hakkar") -        { -        } +    public: boss_hakkar() : CreatureScript("boss_hakkar") {} -        struct boss_hakkarAI : public ScriptedAI +        struct boss_hakkarAI : public BossAI          { -            boss_hakkarAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } - -            InstanceScript* instance; +            boss_hakkarAI(Creature* creature) : BossAI(creature, DATA_HAKKAR) {}              uint32 BloodSiphon_Timer;              uint32 CorruptedBlood_Timer; @@ -109,8 +101,14 @@ class boss_hakkar : public CreatureScript                  Enraged = false;              } +            void JustDied(Unit* /*killer*/) +            { +                _JustDied(); +            } +              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat();                  Talk(SAY_AGGRO);              } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index bbdc2905874..cd55d648196 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -27,75 +27,80 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -#define SPELL_MANABURN         26046 -#define SPELL_SLEEP            24664 +enum Spells +{ +    SPELL_MANABURN              = 26046, +    SPELL_SLEEP                 = 24664 +}; -class boss_hazzarah : public CreatureScript +enum Events  { -    public: +    EVENT_MANABURN              = 0, +    EVENT_SLEEP                 = 1, +    EVENT_ILLUSIONS             = 2 +}; -        boss_hazzarah() -            : CreatureScript("boss_hazzarah") -        { -        } +class boss_hazzarah : public CreatureScript +{ +    public: boss_hazzarah() : CreatureScript("boss_hazzarah") {} -        struct boss_hazzarahAI : public ScriptedAI +        struct boss_hazzarahAI : public BossAI          { -            boss_hazzarahAI(Creature* creature) : ScriptedAI(creature) {} - -            uint32 ManaBurn_Timer; -            uint32 Sleep_Timer; -            uint32 Illusions_Timer; +            boss_hazzarahAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) {} -            void Reset() +            void JustDied(Unit* /*killer*/)              { -                ManaBurn_Timer = urand(4000, 10000); -                Sleep_Timer = urand(10000, 18000); -                Illusions_Timer = urand(10000, 18000); +                _JustDied();              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_MANABURN, urand(4000, 10000)); +                events.ScheduleEvent(EVENT_SLEEP, urand(10000, 18000)); +                events.ScheduleEvent(EVENT_ILLUSIONS, urand(10000, 18000));              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              {                  if (!UpdateVictim())                      return; -                //ManaBurn_Timer -                if (ManaBurn_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_MANABURN); -                    ManaBurn_Timer = urand(8000, 16000); -                } else ManaBurn_Timer -= diff; +                events.Update(diff); -                //Sleep_Timer -                if (Sleep_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_SLEEP); -                    Sleep_Timer = urand(12000, 20000); -                } else Sleep_Timer -= diff; +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                //Illusions_Timer -                if (Illusions_Timer <= diff) +                while (uint32 eventId = events.ExecuteEvent())                  { -                    //We will summon 3 illusions that will spawn on a random gamer and attack this gamer -                    //We will just use one model for the beginning -                    Unit* target = NULL; -                    for (uint8 i = 0; i < 3; ++i) +                    switch (eventId)                      { -                        target = SelectTarget(SELECT_TARGET_RANDOM, 0); -                        if (!target) -                            return; - -                        Creature* Illusion = me->SummonCreature(15163, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); -                        if (Illusion) -                            Illusion->AI()->AttackStart(target); +                        case EVENT_MANABURN: +                            DoCastVictim(SPELL_MANABURN, true); +                            events.ScheduleEvent(EVENT_MANABURN, urand(8000, 16000)); +                            break; +                        case EVENT_SLEEP: +                            DoCastVictim(SPELL_SLEEP, true); +                            events.ScheduleEvent(EVENT_SLEEP, urand(12000, 20000)); +                            break; +                        case EVENT_ILLUSIONS: +                            // We will summon 3 illusions that will spawn on a random gamer and attack this gamer +                            // We will just use one model for the beginning +                            for (uint8 i = 0; i < 3; ++i) +                            { +                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) +                                { +                                    Creature* Illusion = me->SummonCreature(NPC_NIGHTMARE_ILLUSION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); +                                    if (Illusion) +                                        Illusion->AI()->AttackStart(target); +                                } +                            } +                            events.ScheduleEvent(EVENT_ILLUSIONS, urand(15000, 25000)); +                            break; +                        default: +                            break;                      } - -                    Illusions_Timer = urand(15000, 25000); -                } else Illusions_Timer -= diff; +                }                  DoMeleeAttackIfReady();              } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 10431ec84bd..4d27fd99769 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -27,42 +27,34 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Jeklik +enum Says  {      SAY_AGGRO                   = 0,      SAY_RAIN_FIRE               = 1, -    SAY_DEATH                   = 2, +    SAY_DEATH                   = 2 +}; +enum Spells +{      SPELL_CHARGE                = 22911,      SPELL_SONICBURST            = 23918,      SPELL_SCREECH               = 6605,      SPELL_SHADOW_WORD_PAIN      = 23952,      SPELL_MIND_FLAY             = 23953, -    SPELL_CHAIN_MIND_FLAY       = 26044, //Right ID unknown. So disabled +    SPELL_CHAIN_MIND_FLAY       = 26044, // Right ID unknown. So disabled      SPELL_GREATERHEAL           = 23954,      SPELL_BAT_FORM              = 23966, -      // Batriders Spell -    SPELL_BOMB                  = 40332 //Wrong ID but Magmadars bomb is not working... +    SPELL_BOMB                  = 40332 // Wrong ID but Magmadars bomb is not working...  }; -class boss_jeklik : public CreatureScript +class boss_jeklik : public CreatureScript //jeklik  { -    public: - -        boss_jeklik() -            : CreatureScript("boss_jeklik") -        { -        } +    public: boss_jeklik() : CreatureScript("boss_jeklik") {} -        struct boss_jeklikAI : public ScriptedAI +        struct boss_jeklikAI : public BossAI          { -            boss_jeklikAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } - -            InstanceScript* instance; +            boss_jeklikAI(Creature* creature) : BossAI(creature, DATA_JEKLIK) {}              uint32 Charge_Timer;              uint32 SonicBurst_Timer; @@ -91,18 +83,17 @@ class boss_jeklik : public CreatureScript                  PhaseTwo = false;              } -            void EnterCombat(Unit* /*who*/) -            { -                Talk(SAY_AGGRO); -                DoCast(me, SPELL_BAT_FORM); -            } -              void JustDied(Unit* /*killer*/)              { +                _JustDied();                  Talk(SAY_DEATH); +            } -                if (instance) -                    instance->SetData(DATA_JEKLIK, DONE); +            void EnterCombat(Unit* /*who*/) +            { +                _EnterCombat(); +                Talk(SAY_AGGRO); +                DoCast(me, SPELL_BAT_FORM);              }              void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 7c4c9626f9a..dd1edcb3529 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -27,147 +27,148 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Jindo +enum Say  { -    SAY_AGGRO                       = 1, +    SAY_AGGRO                       = 1 +}; +enum Spells +{      SPELL_BRAINWASHTOTEM            = 24262, -    SPELL_POWERFULLHEALINGWARD      = 24309,               //We will not use this spell. We will summon a totem by script cause the spell totems will not cast. +    SPELL_POWERFULLHEALINGWARD      = 24309, // HACKED Totem summoned by script because the spell totems will not cast.      SPELL_HEX                       = 24053,      SPELL_DELUSIONSOFJINDO          = 24306, -    SPELL_SHADEOFJINDO              = 24308,               //We will not use this spell. We will summon a shade by script. - +    SPELL_SHADEOFJINDO              = 24308, // HACKED      //Healing Ward Spell -    SPELL_HEAL                      = 38588,               //Totems are not working right. Right heal spell ID is 24311 but this spell is not casting... - +    SPELL_HEAL                      = 38588, // HACKED Totems are not working right. Right heal spell ID is 24311 but this spell is not casting...      //Shade of Jindo Spell      SPELL_SHADOWSHOCK               = 19460,      SPELL_INVISIBLE                 = 24699  }; -class boss_jindo : public CreatureScript +enum Events  { -    public: +    EVENT_BRAINWASHTOTEM            = 0, +    EVENT_POWERFULLHEALINGWARD      = 1, +    EVENT_HEX                       = 2, +    EVENT_DELUSIONSOFJINDO          = 3, +    EVENT_TELEPORT                  = 4 +}; -        boss_jindo() -            : CreatureScript("boss_jindo") -        { -        } +enum CreatureId +{ +    NPC_SHADE_OF_JINDO              = 14986, +    NPC_SACRIFICED_TROLL            = 14826 +}; -        struct boss_jindoAI : public ScriptedAI -        { -            boss_jindoAI(Creature* creature) : ScriptedAI(creature) {} +Position const TeleportLoc = {-11583.7783f, -1249.4278f, 77.5471f, 4.745f}; -            uint32 BrainWashTotem_Timer; -            uint32 HealingWard_Timer; -            uint32 Hex_Timer; -            uint32 Delusions_Timer; -            uint32 Teleport_Timer; +class boss_jindo : public CreatureScript +{ +    public: boss_jindo() : CreatureScript("boss_jindo") {} -            void Reset() +        struct boss_jindoAI : public BossAI +        { +            boss_jindoAI(Creature* creature) : BossAI(creature, DATA_JINDO) {} + +            void JustDied(Unit* /*killer*/)              { -                BrainWashTotem_Timer = 20000; -                HealingWard_Timer = 16000; -                Hex_Timer = 8000; -                Delusions_Timer = 10000; -                Teleport_Timer = 5000; +                _JustDied();              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_BRAINWASHTOTEM, 20000); +                events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, 16000); +                events.ScheduleEvent(EVENT_HEX, 8000); +                events.ScheduleEvent(EVENT_DELUSIONSOFJINDO, 10000); +                events.ScheduleEvent(EVENT_TELEPORT, 5000);                  Talk(SAY_AGGRO);              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              {                  if (!UpdateVictim())                      return; -                //BrainWashTotem_Timer -                if (BrainWashTotem_Timer <= diff) -                { -                    DoCast(me, SPELL_BRAINWASHTOTEM); -                    BrainWashTotem_Timer = urand(18000, 26000); -                } else BrainWashTotem_Timer -= diff; - -                //HealingWard_Timer -                if (HealingWard_Timer <= diff) -                { -                    //DoCast(me, SPELL_POWERFULLHEALINGWARD); -                    me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); -                    HealingWard_Timer = urand(14000, 20000); -                } else HealingWard_Timer -= diff; - -                //Hex_Timer -                if (Hex_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_HEX); - -                    if (DoGetThreat(me->getVictim())) -                        DoModifyThreatPercent(me->getVictim(), -80); - -                    Hex_Timer = urand(12000, 20000); -                } else Hex_Timer -= diff; +                events.Update(diff); -                //Casting the delusion curse with a shade. So shade will attack the same target with the curse. -                if (Delusions_Timer <= diff) -                { -                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) -                    { -                        DoCast(target, SPELL_DELUSIONSOFJINDO); - -                        Creature* Shade = me->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Shade) -                            Shade->AI()->AttackStart(target); -                    } - -                    Delusions_Timer = urand(4000, 12000); -                } else Delusions_Timer -= diff; +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer -                if (Teleport_Timer <= diff) +                while (uint32 eventId = events.ExecuteEvent())                  { -                    Unit* target = NULL; -                    target = SelectTarget(SELECT_TARGET_RANDOM, 0); -                    if (target && target->GetTypeId() == TYPEID_PLAYER) +                    switch (eventId)                      { -                        DoTeleportPlayer(target, -11583.7783f, -1249.4278f, 77.5471f, 4.745f); - -                        if (DoGetThreat(me->getVictim())) -                            DoModifyThreatPercent(target, -100); - -                        Creature* Skeletons; -                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); -                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Skeletons) -                            Skeletons->AI()->AttackStart(target); +                        case EVENT_BRAINWASHTOTEM: +                            DoCast(me, SPELL_BRAINWASHTOTEM); +                            events.ScheduleEvent(EVENT_BRAINWASHTOTEM, urand(18000, 26000)); +                            break; +                        case EVENT_POWERFULLHEALINGWARD: // HACK +                            //DoCast(me, SPELL_POWERFULLHEALINGWARD); +                            me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); +                            events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, urand(14000, 20000)); +                            break; +                        case EVENT_HEX: +                            DoCastVictim(SPELL_HEX, true); +                            if (DoGetThreat(me->getVictim())) +                                DoModifyThreatPercent(me->getVictim(), -80); +                            events.ScheduleEvent(EVENT_HEX, urand(12000, 20000)); +                            break; +                        case EVENT_DELUSIONSOFJINDO: // HACK +                            // Casting the delusion curse with a shade so shade will attack the same target with the curse. +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) +                            { +                                DoCast(target, SPELL_DELUSIONSOFJINDO); +                                Creature* Shade = me->SummonCreature(NPC_SHADE_OF_JINDO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Shade) +                                    Shade->AI()->AttackStart(target); +                            } +                            events.ScheduleEvent(EVENT_DELUSIONSOFJINDO, urand(4000, 12000)); +                            break; +                        case EVENT_TELEPORT: // Possible HACK +                            // Teleports a random player and spawns 9 Sacrificed Trolls to attack player +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) +                            { +                                DoTeleportPlayer(target, TeleportLoc.m_positionX, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, TeleportLoc.m_orientation); +                                if (DoGetThreat(me->getVictim())) +                                    DoModifyThreatPercent(target, -100); +                                Creature* SacrificedTroll; +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (SacrificedTroll) +                                    SacrificedTroll->AI()->AttackStart(target); +                              } +                            events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000)); +                            break; +                        default: +                            break;                      } - -                    Teleport_Timer = urand(15000, 23000); -                } else Teleport_Timer -= diff; +                }                  DoMeleeAttackIfReady();              } @@ -283,4 +284,3 @@ void AddSC_boss_jindo()      new mob_healing_ward();      new mob_shade_of_jindo();  } - diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index bcc080bb8a5..6b527ba45f3 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -27,44 +27,42 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Mandokir +enum Says  { -    SAY_AGGRO               = 0, -    SAY_DING_KILL           = 1, -    SAY_WATCH               = 2, -    SAY_WATCH_WHISPER       = 3,                    //is this text for real? easter egg? -    SAY_GRATS_JINDO         = 0, - -    SPELL_CHARGE            = 24408, -    SPELL_CLEAVE            = 7160, -    SPELL_FEAR              = 29321, -    SPELL_WHIRLWIND         = 15589, -    SPELL_MORTAL_STRIKE     = 16856, -    SPELL_ENRAGE            = 24318, -    SPELL_WATCH             = 24314, -    SPELL_LEVEL_UP          = 24312, - -//Ohgans Spells -    SPELL_SUNDERARMOR       = 24317, - -    NPC_SPEAKER             = 11391 +    SAY_AGGRO                 = 0, +    SAY_DING_KILL             = 1, +    SAY_WATCH                 = 2, +    SAY_WATCH_WHISPER         = 3, // is this text for real? easter egg? +    SAY_GRATS_JINDO           = 0, +}; + +enum Spells +{ +    SPELL_CHARGE              = 24408, +    SPELL_CLEAVE              = 7160, +    SPELL_FEAR                = 29321, +    SPELL_WHIRLWIND           = 15589, +    SPELL_MORTAL_STRIKE       = 16856, +    SPELL_ENRAGE              = 24318, +    SPELL_WATCH               = 24314, +    SPELL_LEVEL_UP            = 24312, +    SPELL_SWIFT_ORANGE_RAPTOR = 23243, +    // Ohgans Spell +    SPELL_SUNDERARMOR         = 24317 +}; + +enum CreatureId +{ +    NPC_SPEAKER               = 11391  };  class boss_mandokir : public CreatureScript  { -    public: +    public: boss_mandokir() : CreatureScript("boss_mandokir") {} -        boss_mandokir() -            : CreatureScript("boss_mandokir") +        struct boss_mandokirAI : public BossAI          { -        } - -        struct boss_mandokirAI : public ScriptedAI -        { -            boss_mandokirAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } +            boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) {}              uint32 KillCount;              uint32 Watch_Timer; @@ -114,6 +112,11 @@ class boss_mandokir : public CreatureScript                  DoCast(me, 23243);              } +            void JustDied(Unit* /*killer*/) +            { +                _JustDied(); +            } +              void KilledUnit(Unit* victim)              {                  if (victim->GetTypeId() == TYPEID_PLAYER) @@ -144,6 +147,7 @@ class boss_mandokir : public CreatureScript              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat();                  Talk(SAY_AGGRO);              } @@ -302,15 +306,10 @@ class boss_mandokir : public CreatureScript          }  }; -//Ohgan +// Ohgan  class mob_ohgan : public CreatureScript  { -    public: - -        mob_ohgan() -            : CreatureScript("mob_ohgan") -        { -        } +    public: mob_ohgan() : CreatureScript("mob_ohgan") {}          struct mob_ohganAI : public ScriptedAI          { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 56aeee93ee2..4d2a892d305 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -27,192 +27,184 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Marli +enum Says  {      SAY_AGGRO               = 0,      SAY_TRANSFORM           = 1,      SAY_SPIDER_SPAWN        = 2, -    SAY_DEATH               = 3, - -    SPELL_CHARGE            = 22911, -    SPELL_ASPECT_OF_MARLI   = 24686,                     // A stun spell -    SPELL_ENVOLWINGWEB      = 24110, -    SPELL_POISONVOLLEY      = 24099, -    SPELL_SPIDER_FORM       = 24084, - -//The Spider Spells -    SPELL_LEVELUP           = 24312                     //Not right Spell. +    SAY_DEATH               = 3  }; -class boss_marli : public CreatureScript +enum Spells  { -    public: +    SPELL_CHARGE              = 22911, +    SPELL_ASPECT_OF_MARLI     = 24686, // A stun spell +    SPELL_ENVOLWINGWEB        = 24110, +    SPELL_POISON_VOLLEY       = 24099, +    SPELL_SPIDER_FORM         = 24084, +    // The Spider Spell +    SPELL_LEVELUP             = 24312  // Not right Spell. +}; -        boss_marli() -            : CreatureScript("boss_marli") -        { -        } +enum Events +{ +    EVENT_SPAWN_START_SPIDERS = 0, // Phase 1 +    EVENT_POISON_VOLLEY       = 1, // Phase All +    EVENT_SPAWN_SPIDER        = 2, // Phase All +    EVENT_CHARGE_PLAYER       = 3, // Phase 3 +    EVENT_ASPECT_OF_MARLI     = 4, // Phase 2 +    EVENT_TRANSFORM           = 5, // Phase 2 +    EVENT_TRANSFORM_BACK      = 6  // Phase 3 +}; -        struct boss_marliAI : public ScriptedAI -        { -            boss_marliAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } +enum Phases +{ +    PHASE_ONE                 = 1, +    PHASE_TWO                 = 2, +    PHASE_THREE               = 3 +}; -            InstanceScript* instance; +enum ModelId +{ +    MODEL_MARLI               = 15220 +}; -            uint32 SpawnStartSpiders_Timer; -            uint32 PoisonVolley_Timer; -            uint32 SpawnSpider_Timer; -            uint32 Charge_Timer; -            uint32 Aspect_Timer; -            uint32 Transform_Timer; -            uint32 TransformBack_Timer; +class boss_marli : public CreatureScript +{ +    public: boss_marli() : CreatureScript("boss_marli") {} -            bool Spawned; -            bool PhaseTwo; +        struct boss_marliAI : public BossAI +        { +            boss_marliAI(Creature* creature) : BossAI(creature, DATA_MARLI) {} -            void Reset() +            void JustDied(Unit* /*killer*/)              { -                SpawnStartSpiders_Timer = 1000; -                PoisonVolley_Timer = 15000; -                SpawnSpider_Timer = 30000; -                Charge_Timer = 1500; -                Aspect_Timer = 12000; -                Transform_Timer = 45000; -                TransformBack_Timer = 25000; - -                Spawned = false; -                PhaseTwo = false; +                _JustDied(); +                Talk(SAY_DEATH);              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_SPAWN_START_SPIDERS, 1000, 0, PHASE_ONE);                  Talk(SAY_AGGRO);              } -            void JustDied(Unit* /*killer*/) -            { -                Talk(SAY_DEATH); -                if (instance) -                    instance->SetData(DATA_MARLI, DONE); -            } - -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              {                  if (!UpdateVictim())                      return; -                if (me->getVictim() && me->isAlive()) -                { -                    if (PoisonVolley_Timer <= diff) -                    { -                        DoCast(me->getVictim(), SPELL_POISONVOLLEY); -                        PoisonVolley_Timer = urand(10000, 20000); -                    } else PoisonVolley_Timer -= diff; - -                    if (!PhaseTwo && Aspect_Timer <= diff) -                    { -                        DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); -                        Aspect_Timer = urand(13000, 18000); -                    } else Aspect_Timer -= diff; +                events.Update(diff); -                    if (!Spawned && SpawnStartSpiders_Timer <= diff) -                    { -                        Talk(SAY_SPIDER_SPAWN); - -                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); -                        if (!target) -                            return; - -                        Creature* Spider = NULL; - -                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Spider) -                            Spider->AI()->AttackStart(target); -                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Spider) -                            Spider->AI()->AttackStart(target); -                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Spider) -                            Spider->AI()->AttackStart(target); -                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Spider) -                            Spider->AI()->AttackStart(target); - -                        Spawned = true; -                    } else SpawnStartSpiders_Timer -= diff; - -                    if (SpawnSpider_Timer <= diff) -                    { -                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); -                        if (!target) -                            return; - -                        Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); -                        if (Spider) -                            Spider->AI()->AttackStart(target); -                        SpawnSpider_Timer = urand(12000, 17000); -                    } else SpawnSpider_Timer -= diff; +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                    if (!PhaseTwo && Transform_Timer <= diff) +                while (uint32 eventId = events.ExecuteEvent()) +                { +                    switch (eventId)                      { -                        Talk(SAY_TRANSFORM); -                        DoCast(me, SPELL_SPIDER_FORM); -                        const CreatureTemplate* cinfo = me->GetCreatureTemplate(); -                        me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); -                        me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); -                        me->UpdateDamagePhysical(BASE_ATTACK); -                        DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); - -                        if (DoGetThreat(me->getVictim())) -                            DoModifyThreatPercent(me->getVictim(), -100); - -                        PhaseTwo = true; -                        Transform_Timer = urand(35000, 60000); -                    } else Transform_Timer -= diff; +                        case EVENT_SPAWN_START_SPIDERS: -                    if (PhaseTwo) -                    { -                        if (Charge_Timer <= diff) -                        { -                            Unit* target = NULL; -                            int i = 0; -                            while (i < 3)                           // max 3 tries to get a random target with power_mana +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) +                            { +                                Talk(SAY_SPIDER_SPAWN); +                                Creature* Spider = NULL; +                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Spider) +                                    Spider->AI()->AttackStart(target); +                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Spider) +                                    Spider->AI()->AttackStart(target); +                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Spider) +                                    Spider->AI()->AttackStart(target); +                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Spider) +                                    Spider->AI()->AttackStart(target); +                            } +                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO); +                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); +                            events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000); +                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000); +                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); +                            events.SetPhase(PHASE_TWO); +                            break; +                        case EVENT_POISON_VOLLEY: +                            DoCastVictim(SPELL_POISON_VOLLEY, true); +                            events.ScheduleEvent(EVENT_POISON_VOLLEY, urand(10000, 20000)); +                            break; +                        case EVENT_ASPECT_OF_MARLI: +                            DoCastVictim(SPELL_ASPECT_OF_MARLI, true); +                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, urand(13000, 18000), 0, PHASE_TWO); +                            break; +                        case EVENT_SPAWN_SPIDER: +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                              { -                                ++i; -                                target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader -                                if (target && target->getPowerType() == POWER_MANA) +                                Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); +                                if (Spider) +                                    Spider->AI()->AttackStart(target); +                            } +                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, urand(12000, 17000)); +                            break; +                        case EVENT_TRANSFORM: +                            { +                                Talk(SAY_TRANSFORM); +                                DoCast(me, SPELL_SPIDER_FORM); +                                const CreatureTemplate* cinfo = me->GetCreatureTemplate(); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); +                                me->UpdateDamagePhysical(BASE_ATTACK); +                                DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); +                                if (DoGetThreat(me->getVictim())) +                                    DoModifyThreatPercent(me->getVictim(), -100); +                                events.ScheduleEvent(EVENT_CHARGE_PLAYER, 1500, 0, PHASE_THREE); +                                events.ScheduleEvent(EVENT_TRANSFORM_BACK, 25000, 0, PHASE_THREE); +                                events.SetPhase(PHASE_THREE); +                                break; +                            } +                        case EVENT_CHARGE_PLAYER: +                            { +                                Unit* target = NULL; +                                int i = 0; +                                while (i < 3) // max 3 tries to get a random target with power_mana +                                { +                                    ++i; +                                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader +                                    if (target && target->getPowerType() == POWER_MANA)                                          i = 3; +                                } +                                if (target) +                                { +                                    DoCast(target, SPELL_CHARGE); +                                    //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); +                                    //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1); +                                    AttackStart(target); +                                } +                                events.ScheduleEvent(EVENT_CHARGE_PLAYER, 8000, 0, PHASE_THREE); +                                break;                              } -                            if (target) +                        case EVENT_TRANSFORM_BACK:                              { -                                DoCast(target, SPELL_CHARGE); -                                //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); -                                //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1); -                                AttackStart(target); +                                me->SetDisplayId(MODEL_MARLI); +                                const CreatureTemplate* cinfo = me->GetCreatureTemplate(); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); +                                me->UpdateDamagePhysical(BASE_ATTACK); +                                events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO); +                                events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); +                                events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000); +                                events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000); +                                events.ScheduleEvent(EVENT_TRANSFORM, urand(35000, 60000), 0, PHASE_TWO); +                                events.SetPhase(PHASE_TWO); +                                break;                              } - -                            Charge_Timer = 8000; -                        } else Charge_Timer -= diff; - -                        if (TransformBack_Timer <= diff) -                        { -                            me->SetDisplayId(15220); -                            const CreatureTemplate* cinfo = me->GetCreatureTemplate(); -                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); -                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); -                            me->UpdateDamagePhysical(BASE_ATTACK); - -                            PhaseTwo = false; -                            TransformBack_Timer = urand(25000, 40000); -                        } else TransformBack_Timer -= diff; - +                        default: +                            break;                      } - -                    DoMeleeAttackIfReady();                  } + +                DoMeleeAttackIfReady();              }          }; @@ -222,15 +214,10 @@ class boss_marli : public CreatureScript          }  }; -//Spawn of Marli +// Spawn of Marli  class mob_spawn_of_marli : public CreatureScript  { -    public: - -        mob_spawn_of_marli() -            : CreatureScript("mob_spawn_of_marli") -        { -        } +    public: mob_spawn_of_marli() : CreatureScript("mob_spawn_of_marli") {}          struct mob_spawn_of_marliAI : public ScriptedAI          { @@ -275,4 +262,3 @@ void AddSC_boss_marli()      new boss_marli();      new mob_spawn_of_marli();  } - diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index d562b7cdf9b..65730d1baf2 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -40,16 +40,11 @@ enum Misc  class boss_renataki : public CreatureScript  { -    public: +    public: boss_renataki() : CreatureScript("boss_renataki") {} -        boss_renataki() -            : CreatureScript("boss_renataki") +        struct boss_renatakiAI : public BossAI          { -        } - -        struct boss_renatakiAI : public ScriptedAI -        { -            boss_renatakiAI(Creature* creature) : ScriptedAI(creature) {} +            boss_renatakiAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) {}              uint32 Invisible_Timer;              uint32 Ambush_Timer; @@ -72,8 +67,14 @@ class boss_renataki : public CreatureScript                  Ambushed = false;              } +            void JustDied(Unit* /*killer*/) +            { +                _JustDied(); +            } +              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat();              }              void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index d91b8f0b483..6710ca67863 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -27,28 +27,29 @@ EndScriptData */  #include "ScriptedCreature.h"  #include "zulgurub.h" -enum Thekal +enum Says  {      SAY_AGGRO                 = 0, -    SAY_DEATH                 = 1, - -    SPELL_MORTALCLEAVE        = 22859, -    SPELL_SILENCE             = 22666, -    SPELL_FRENZY              = 8269, -    SPELL_FORCEPUNCH          = 24189, -    SPELL_CHARGE              = 24193, -    SPELL_ENRAGE              = 8269, -    SPELL_SUMMONTIGERS        = 24183, -    SPELL_TIGER_FORM          = 24169, -    SPELL_RESURRECT           = 24173,                    //We will not use this spell. - -//Zealot Lor'Khan Spells +    SAY_DEATH                 = 1 +}; + +enum Spells +{ +    SPELL_MORTALCLEAVE        = 22859, // Phase 1 +    SPELL_SILENCE             = 22666, // Phase 1 +    SPELL_TIGER_FORM          = 24169, // Phase 1 +    SPELL_RESURRECT           = 24173, // Phase 1    // Not used in script. +    SPELL_FRENZY              = 8269,  // Phase 2 +    SPELL_FORCEPUNCH          = 24189, // Phase 2 +    SPELL_CHARGE              = 24193, // Phase 2 +    SPELL_ENRAGE              = 8269,  // Phase 2 +    SPELL_SUMMONTIGERS        = 24183, // Phase 2 +    // Zealot Lor'Khan Spells      SPELL_SHIELD              = 20545,      SPELL_BLOODLUST           = 24185,      SPELL_GREATERHEAL         = 24208,      SPELL_DISARM              = 6713, - -//Zealot Zath Spells +    // Zealot Zath Spells      SPELL_SWEEPINGSTRIKES     = 18765,      SPELL_SINISTERSTRIKE      = 15581,      SPELL_GOUGE               = 12540, @@ -56,64 +57,56 @@ enum Thekal      SPELL_BLIND               = 21060  }; -class boss_thekal : public CreatureScript +enum Events  { -    public: +    EVENT_MORTALCLEAVE        = 0, // Phase 1 +    EVENT_SILENCE             = 1, // Phase 1 +    EVENT_CHECK_TIMER         = 2, // Phase 1 +    EVENT_RESURRECT_TIMER     = 3, // Phase 1 +    EVENT_FRENZY              = 4, // Phase 2 +    EVENT_FORCEPUNCH          = 5, // Phase 2 +    EVENT_SPELL_CHARGE        = 6, // Phase 2 +    EVENT_ENRAGE              = 7, // Phase 2 +    EVENT_SUMMONTIGERS        = 8  // Phase 2 +}; -        boss_thekal() -            : CreatureScript("boss_thekal") -        { -        } +enum Phases +{ +    PHASE_ONE                 = 1, +    PHASE_TWO                 = 2 +}; -        struct boss_thekalAI : public ScriptedAI -        { -            boss_thekalAI(Creature* creature) : ScriptedAI(creature) -            { -                instance = creature->GetInstanceScript(); -            } +class boss_thekal : public CreatureScript +{ +    public: boss_thekal() : CreatureScript("boss_thekal") {} -            uint32 MortalCleave_Timer; -            uint32 Silence_Timer; -            uint32 Frenzy_Timer; -            uint32 ForcePunch_Timer; -            uint32 Charge_Timer; -            uint32 Enrage_Timer; -            uint32 SummonTigers_Timer; -            uint32 Check_Timer; -            uint32 Resurrect_Timer; +        struct boss_thekalAI : public BossAI +        { +            boss_thekalAI(Creature* creature) : BossAI(creature, DATA_THEKAL) {} -            InstanceScript* instance;              bool Enraged; -            bool PhaseTwo;              bool WasDead;              void Reset()              { -                MortalCleave_Timer = 4000; -                Silence_Timer = 9000; -                Frenzy_Timer = 30000; -                ForcePunch_Timer = 4000; -                Charge_Timer = 12000; -                Enrage_Timer = 32000; -                SummonTigers_Timer = 25000; -                Check_Timer = 10000; -                Resurrect_Timer = 10000; -                  Enraged = false; -                PhaseTwo = false;                  WasDead = false;              } -            void EnterCombat(Unit* /*who*/) +            void JustDied(Unit* /*killer*/)              { -                Talk(SAY_AGGRO); +                _JustDied(); +                Talk(SAY_DEATH);              } -            void JustDied(Unit* /*killer*/) +            void EnterCombat(Unit* /*who*/)              { -                Talk(SAY_DEATH); -                if (instance) -                    instance->SetData(DATA_THEKAL, DONE); +                _EnterCombat(); +                events.ScheduleEvent(EVENT_MORTALCLEAVE, 4000, 0, PHASE_ONE);     // Phase 1 +                events.ScheduleEvent(EVENT_SILENCE, 9000, 0, PHASE_ONE);          // Phase 1 +                events.ScheduleEvent(EVENT_CHECK_TIMER, 10000, 0, PHASE_ONE);     // Phase 1 +                events.ScheduleEvent(EVENT_RESURRECT_TIMER, 10000, 0, PHASE_ONE); // Phase 1 +                Talk(SAY_AGGRO);              }              void JustReachedHome() @@ -122,62 +115,123 @@ class boss_thekal : public CreatureScript                      instance->SetData(DATA_THEKAL, NOT_STARTED);              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              {                  if (!UpdateVictim())                      return; -                    //Check_Timer for the death of LorKhan and Zath. -                    if (!WasDead && Check_Timer <= diff) +                events.Update(diff); + +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; + +                while (uint32 eventId = events.ExecuteEvent()) +                { +                    switch (eventId)                      { -                        if (instance) -                        { -                            if (instance->GetData(DATA_LORKHAN) == SPECIAL) +                        case EVENT_MORTALCLEAVE: +                            DoCastVictim(SPELL_MORTALCLEAVE, true); +                            events.ScheduleEvent(EVENT_MORTALCLEAVE, urand(15000, 20000), 0, PHASE_ONE); +                            break; +                        case EVENT_SILENCE: +                            DoCastVictim(SPELL_SILENCE, true); +                            events.ScheduleEvent(EVENT_SILENCE, urand(20000, 25000), 0, PHASE_ONE); +                            break; +                        case EVENT_RESURRECT_TIMER: +                            //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. +                            if (WasDead)                              { -                                //Resurrect LorKhan -                                if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) -                                { -                                    pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); -                                    pLorKhan->setFaction(14); -                                    pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -                                    pLorKhan->SetFullHealth(); - -                                    instance->SetData(DATA_LORKHAN, DONE); -                                } +                                DoCast(me, SPELL_TIGER_FORM); +                                me->SetObjectScale(2.00f); +                                me->SetStandState(UNIT_STAND_STATE_STAND); +                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +                                me->SetFullHealth(); +                                const CreatureTemplate* cinfo = me->GetCreatureTemplate(); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); +                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); +                                me->UpdateDamagePhysical(BASE_ATTACK); +                                DoResetThreat(); +                                events.ScheduleEvent(EVENT_FRENZY, 30000, 0, PHASE_TWO);          // Phase 2 +                                events.ScheduleEvent(EVENT_FORCEPUNCH, 4000, 0, PHASE_TWO);       // Phase 2 +                                events.ScheduleEvent(EVENT_SPELL_CHARGE, 12000, 0, PHASE_TWO);    // Phase 2 +                                events.ScheduleEvent(EVENT_ENRAGE, 32000, 0, PHASE_TWO);          // Phase 2 +                                events.ScheduleEvent(EVENT_SUMMONTIGERS, 25000, 0, PHASE_TWO);    // Phase 2 +                                events.SetPhase(PHASE_TWO);                              } - -                            if (instance->GetData(DATA_ZATH) == SPECIAL) +                            events.ScheduleEvent(EVENT_RESURRECT_TIMER, 10000, 0, PHASE_ONE); +                            break; +                        case EVENT_CHECK_TIMER: +                            //Check_Timer for the death of LorKhan and Zath. +                            if (!WasDead)                              { -                                //Resurrect Zath -                                Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH)); -                                if (pZath) +                                if (instance)                                  { -                                    pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); -                                    pZath->setFaction(14); -                                    pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -                                    pZath->SetFullHealth(); - -                                    instance->SetData(DATA_ZATH, DONE); +                                    if (instance->GetData(DATA_LORKHAN) == SPECIAL) +                                    { +                                        //Resurrect LorKhan +                                        if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) +                                        { +                                            pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); +                                            pLorKhan->setFaction(14); +                                            pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +                                            pLorKhan->SetFullHealth(); +                                            instance->SetData(DATA_LORKHAN, DONE); +                                        } +                                    } + +                                    if (instance->GetData(DATA_ZATH) == SPECIAL) +                                    { +                                        //Resurrect Zath +                                        if (Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH))) +                                        { +                                            pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); +                                            pZath->setFaction(14); +                                            pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +                                            pZath->SetFullHealth(); +                                            instance->SetData(DATA_ZATH, DONE); +                                        } +                                    }                                  }                              } -                        } - -                        Check_Timer = 5000; -                    } else Check_Timer -= diff; - -                    if (!PhaseTwo && MortalCleave_Timer <= diff) -                    { -                        DoCast(me->getVictim(), SPELL_MORTALCLEAVE); -                        MortalCleave_Timer = urand(15000, 20000); -                    } else MortalCleave_Timer -= diff; +                            events.ScheduleEvent(EVENT_CHECK_TIMER, 5000, 0, PHASE_ONE); +                            break; +                        case EVENT_FRENZY: +                            DoCast(me, SPELL_FRENZY); +                            events.ScheduleEvent(EVENT_FRENZY, 30000, 0, PHASE_TWO); +                            break; +                        case EVENT_FORCEPUNCH: +                            DoCastVictim(SPELL_FORCEPUNCH, true); +                            events.ScheduleEvent(EVENT_FORCEPUNCH, urand(16000, 21000), 0, PHASE_TWO); +                            break; +                        case EVENT_CHARGE: +                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) +                            { +                                DoCast(target, SPELL_CHARGE); +                                DoResetThreat(); +                                AttackStart(target); +                            } +                            events.ScheduleEvent(EVENT_CHARGE, urand(15000, 22000), 0, PHASE_TWO); +                            break; +                        case EVENT_ENRAGE: +                            if (HealthBelowPct(11) && !Enraged) +                            { +                                DoCast(me, SPELL_ENRAGE); +                                Enraged = true; +                            } +                            events.ScheduleEvent(EVENT_ENRAGE, 30000); +                            break; +                        case EVENT_SUMMONTIGERS: +                            DoCastVictim(SPELL_SUMMONTIGERS, true); +                            events.ScheduleEvent(EVENT_SUMMONTIGERS, urand(10000, 14000), 0, PHASE_TWO); +                            break; +                        default: +                            break; +                    } -                    if (!PhaseTwo && Silence_Timer <= diff) -                    { -                        DoCast(me->getVictim(), SPELL_SILENCE); -                        Silence_Timer = urand(20000, 25000); -                    } else Silence_Timer -= diff; +                    if (me->IsFullHealth() && WasDead) +                        WasDead = false; -                    if (!PhaseTwo && !WasDead && !HealthAbovePct(5)) +                    if ((events.GetPhaseMask() == PHASE_ONE) && !WasDead && !HealthAbovePct(5))                      {                          me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);                          me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE); @@ -185,78 +239,12 @@ class boss_thekal : public CreatureScript                          me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                          me->SetStandState(UNIT_STAND_STATE_SLEEP);                          me->AttackStop(); -                          if (instance)                              instance->SetData(DATA_THEKAL, SPECIAL); -                          WasDead=true;                      } - -                    //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. -                    if (!PhaseTwo && WasDead) -                    { -                        if (Resurrect_Timer <= diff) -                        { -                            DoCast(me, SPELL_TIGER_FORM); -                            me->SetObjectScale(2.00f); -                            me->SetStandState(UNIT_STAND_STATE_STAND); -                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -                            me->SetFullHealth(); -                            const CreatureTemplate* cinfo = me->GetCreatureTemplate(); -                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); -                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); -                            me->UpdateDamagePhysical(BASE_ATTACK); -                            DoResetThreat(); -                            PhaseTwo = true; -                        } else Resurrect_Timer -= diff; -                    } - -                    if (me->IsFullHealth() && WasDead) -                    { -                        WasDead = false; -                    } - -                    if (PhaseTwo) -                    { -                        if (Charge_Timer <= diff) -                        { -                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) -                            { -                                DoCast(target, SPELL_CHARGE); -                                DoResetThreat(); -                                AttackStart(target); -                            } - -                            Charge_Timer = urand(15000, 22000); -                        } else Charge_Timer -= diff; - -                        if (Frenzy_Timer <= diff) -                        { -                            DoCast(me, SPELL_FRENZY); -                            Frenzy_Timer = 30000; -                        } else Frenzy_Timer -= diff; - -                        if (ForcePunch_Timer <= diff) -                        { -                            DoCast(me->getVictim(), SPELL_SILENCE); -                            ForcePunch_Timer = urand(16000, 21000); -                        } else ForcePunch_Timer -= diff; - -                        if (SummonTigers_Timer <= diff) -                        { -                            DoCast(me->getVictim(), SPELL_SUMMONTIGERS); -                            SummonTigers_Timer = urand(10000, 14000); -                        } else SummonTigers_Timer -= diff; - -                        if (HealthBelowPct(11) && !Enraged) -                        { -                            DoCast(me, SPELL_ENRAGE); -                            Enraged = true; -                        } -                    } - -                    DoMeleeAttackIfReady(); - +                } +                DoMeleeAttackIfReady();              }          }; @@ -269,12 +257,7 @@ class boss_thekal : public CreatureScript  //Zealot Lor'Khan  class mob_zealot_lorkhan : public CreatureScript  { -    public: - -        mob_zealot_lorkhan() -            : CreatureScript("mob_zealot_lorkhan") -        { -        } +    public: mob_zealot_lorkhan() : CreatureScript("mob_zealot_lorkhan") {}          struct mob_zealot_lorkhanAI : public ScriptedAI          { @@ -585,4 +568,3 @@ void AddSC_boss_thekal()      new mob_zealot_lorkhan();      new mob_zealot_zath();  } - diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index ff63e4a8adb..f5c10631a9b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -27,10 +27,10 @@   * - Fix timers (research some more)   */ -enum Texts +enum Says  {      SAY_VENOXIS_TRANSFORM           = 1,        // Let the coils of hate unfurl! -    SAY_VENOXIS_DEATH               = 2,        // Ssserenity.. at lassst! +    SAY_VENOXIS_DEATH               = 2         // Ssserenity.. at lassst!  };  enum Spells @@ -42,7 +42,6 @@ enum Spells      SPELL_HOLY_NOVA                 = 23858,      SPELL_HOLY_FIRE                 = 23860,      SPELL_HOLY_WRATH                = 23979, -      // snake form      SPELL_POISON_CLOUD              = 23861,      SPELL_VENOM_SPIT                = 23862, @@ -50,15 +49,14 @@ enum Spells      SPELL_PARASITIC_SERPENT         = 23865,      SPELL_SUMMON_PARASITIC_SERPENT  = 23866,      SPELL_PARASITIC_SERPENT_TRIGGER = 23867, -      // used when swapping event-stages      SPELL_VENOXIS_TRANSFORM         = 23849,    // 50% health - shapechange to cobra -    SPELL_FRENZY                    = 8269,     // 20% health - frenzy +    SPELL_FRENZY                    = 8269      // 20% health - frenzy  };  enum NPCs  { -    NPC_PARASITIC_SERPENT           = 14884, +    NPC_PARASITIC_SERPENT           = 14884  };  enum Events @@ -70,10 +68,8 @@ enum Events      EVENT_HOLY_NOVA                 = 4,      EVENT_HOLY_FIRE                 = 5,      EVENT_HOLY_WRATH                = 6, -      // phase-changing      EVENT_TRANSFORM                 = 7, -      // snake form events      EVENT_POISON_CLOUD              = 8,      EVENT_VENOM_SPIT                = 9, @@ -84,19 +80,16 @@ enum Events  enum Phases  {      PHASE_ONE                       = 1,    // troll form -    PHASE_TWO                       = 2,    // snake form +    PHASE_TWO                       = 2     // snake form  };  class boss_venoxis : public CreatureScript  { -    public: -        boss_venoxis() : CreatureScript("boss_venoxis") {} +    public: boss_venoxis() : CreatureScript("boss_venoxis") {}          struct boss_venoxisAI : public BossAI          { -            boss_venoxisAI(Creature* creature) : BossAI(creature, DATA_VENOXIS) -            { -            } +            boss_venoxisAI(Creature* creature) : BossAI(creature, DATA_VENOXIS) {}              void Reset()              { @@ -118,15 +111,19 @@ class boss_venoxis : public CreatureScript                  events.SetPhase(PHASE_ONE);              } +            void JustDied(Unit* /*killer*/) +            { +                _JustDied(); +                Talk(SAY_VENOXIS_DEATH); +                me->RemoveAllAuras(); +            } +              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat();                  me->SetReactState(REACT_AGGRESSIVE); - -                instance->SetBossState(DATA_VENOXIS, IN_PROGRESS); -                  // Always running events                  events.ScheduleEvent(EVENT_THRASH, 5000); -                  // Phase one events (regular form)                  events.ScheduleEvent(EVENT_HOLY_NOVA, 5000, 0, PHASE_ONE);                  events.ScheduleEvent(EVENT_DISPEL_MAGIC, 35000, 0, PHASE_ONE); @@ -157,14 +154,6 @@ class boss_venoxis : public CreatureScript                  }              } -            void JustDied(Unit* /*killer*/) -            { -                Talk(SAY_VENOXIS_DEATH); -                // venoxis is dead, mark him as such for the instance -                instance->SetBossState(DATA_VENOXIS, DONE); -                me->RemoveAllAuras(); -            } -              void UpdateAI(const uint32 diff)              {                  if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index 810ee5e900e..196df2b98b9 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -33,53 +33,58 @@ enum Spells      SPELL_LIGHTNINGWAVE         = 24819  }; -class boss_wushoolay : public CreatureScript +enum Events  { -    public: +    EVENT_LIGHTNINGCLOUD        = 0, +    EVENT_LIGHTNINGWAVE         = 1 +}; -        boss_wushoolay() -            : CreatureScript("boss_wushoolay") -        { -        } +class boss_wushoolay : public CreatureScript +{ +    public: boss_wushoolay() : CreatureScript("boss_wushoolay") {} -        struct boss_wushoolayAI : public ScriptedAI +        struct boss_wushoolayAI : public BossAI          { -            boss_wushoolayAI(Creature* creature) : ScriptedAI(creature) {} +            boss_wushoolayAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) {} -            uint32 LightningCloud_Timer; -            uint32 LightningWave_Timer; - -            void Reset() +            void JustDied(Unit* /*killer*/)              { -                LightningCloud_Timer = urand(5000, 10000); -                LightningWave_Timer = urand(8000, 16000); +                _JustDied();              }              void EnterCombat(Unit* /*who*/)              { +                _EnterCombat(); +                events.ScheduleEvent(EVENT_LIGHTNINGCLOUD, urand(5000, 10000)); +                events.ScheduleEvent(EVENT_LIGHTNINGWAVE, urand(8000, 16000));              } -            void UpdateAI(const uint32 diff) +            void UpdateAI(uint32 const diff)              {                  if (!UpdateVictim())                      return; -                //LightningCloud_Timer -                if (LightningCloud_Timer <= diff) -                { -                    DoCast(me->getVictim(), SPELL_LIGHTNINGCLOUD); -                    LightningCloud_Timer = urand(15000, 20000); -                } else LightningCloud_Timer -= diff; +                events.Update(diff); -                //LightningWave_Timer -                if (LightningWave_Timer <= diff) -                { -                    Unit* target = NULL; -                    target = SelectTarget(SELECT_TARGET_RANDOM, 0); -                    if (target) DoCast(target, SPELL_LIGHTNINGWAVE); +                if (me->HasUnitState(UNIT_STATE_CASTING)) +                    return; -                    LightningWave_Timer = urand(12000, 16000); -                } else LightningWave_Timer -= diff; +                while (uint32 eventId = events.ExecuteEvent()) +                { +                    switch (eventId) +                    { +                        case EVENT_LIGHTNINGCLOUD: +                            DoCastVictim(SPELL_LIGHTNINGCLOUD, true); +                            events.ScheduleEvent(EVENT_LIGHTNINGCLOUD, urand(15000, 20000)); +                            break; +                        case EVENT_LIGHTNINGWAVE: +                            DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_LIGHTNINGWAVE); +                            events.ScheduleEvent(EVENT_LIGHTNINGWAVE, urand(12000, 16000)); +                            break; +                        default: +                            break; +                    } +                }                  DoMeleeAttackIfReady();              } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index cfaf19642f2..b997d277c95 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -29,33 +29,28 @@ EndScriptData */  class instance_zulgurub : public InstanceMapScript  { -    public: -        instance_zulgurub() -            : InstanceMapScript("instance_zulgurub", 309) -        { -        } +    public: instance_zulgurub(): InstanceMapScript("instance_zulgurub", 309) {}          struct instance_zulgurub_InstanceMapScript : public InstanceScript          { -            instance_zulgurub_InstanceMapScript(Map* map) : InstanceScript(map) {} +            instance_zulgurub_InstanceMapScript(Map* map) : InstanceScript(map) +            { +                SetBossNumber(EncounterCount); +            }              //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. -            uint32 m_auiEncounter[MAX_ENCOUNTERS]; -              //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. -            uint64 m_uiLorKhanGUID; -            uint64 m_uiZathGUID; -            uint64 m_uiThekalGUID; -            uint64 m_uiJindoGUID; +            uint64 LorKhanGUID; +            uint64 ZathGUID; +            uint64 ThekalGUID; +            uint64 JindoGUID;              void Initialize()              { -                memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - -                m_uiLorKhanGUID = 0; -                m_uiZathGUID = 0; -                m_uiThekalGUID = 0; -                m_uiJindoGUID = 0; +                LorKhanGUID = 0; +                ZathGUID = 0; +                ThekalGUID = 0; +                JindoGUID = 0;              }              bool IsEncounterInProgress() const @@ -68,90 +63,124 @@ class instance_zulgurub : public InstanceMapScript              {                  switch (creature->GetEntry())                  { -                    case 11347: m_uiLorKhanGUID = creature->GetGUID(); break; -                    case 11348: m_uiZathGUID = creature->GetGUID(); break; -                    case 14509: m_uiThekalGUID = creature->GetGUID(); break; -                    case 11380: m_uiJindoGUID = creature->GetGUID(); break; +                    case NPC_ZEALOT_LORKHAN: LorKhanGUID = creature->GetGUID(); break; +                    case NPC_ZEALOT_ZATH: ZathGUID = creature->GetGUID(); break; +                    case NPC_HIGH_PRIEST_THEKAL: ThekalGUID = creature->GetGUID(); break; +                    case NPC_JINDO_THE_HEXXER: JindoGUID = creature->GetGUID(); break;                  }              } -            void SetData(uint32 uiType, uint32 uiData) +            bool SetBossState(uint32 type, EncounterState state)              { -                switch (uiType) -                { -                    case DATA_ARLOKK: -                        m_auiEncounter[0] = uiData; -                        break; +                if (!InstanceScript::SetBossState(type, state)) +                    return false; +                switch (type) +                {                      case DATA_JEKLIK: -                        m_auiEncounter[1] = uiData; -                        break; -                      case DATA_VENOXIS: -                        m_auiEncounter[2] = uiData; -                        break; -                      case DATA_MARLI: -                        m_auiEncounter[3] = uiData; -                        break; - +                    case DATA_ARLOKK: +                    case DATA_HAKKAR: +                    case DATA_MANDOKIR: +                    case DATA_JINDO: +                    case DATA_GAHZRANKA: +                    case DATA_EDGE_OF_MADNESS:                      case DATA_THEKAL: -                        m_auiEncounter[4] = uiData; -                        break; -                      case DATA_LORKHAN: -                        m_auiEncounter[5] = uiData; -                        break; -                      case DATA_ZATH: -                        m_auiEncounter[6] = uiData; -                        break; -                      case DATA_OHGAN: -                        m_auiEncounter[7] = uiData; +                        break; +                    default:                          break;                  } + +                return true;              } -            uint32 GetData(uint32 uiType) const +        uint32 GetData(uint32 type) const +        { +            switch (type)              { -                switch (uiType) -                { -                    case DATA_ARLOKK: -                        return m_auiEncounter[0]; -                    case DATA_JEKLIK: -                        return m_auiEncounter[1]; -                    case DATA_VENOXIS: -                        return m_auiEncounter[2]; -                    case DATA_MARLI: -                        return m_auiEncounter[3]; -                    case DATA_THEKAL: -                        return m_auiEncounter[4]; -                    case DATA_LORKHAN: -                        return m_auiEncounter[5]; -                    case DATA_ZATH: -                        return m_auiEncounter[6]; -                    case DATA_OHGAN: -                        return m_auiEncounter[7]; -                } -                return 0; +                    case DATA_JEKLIK:             return GetBossState(DATA_JEKLIK); +                    case DATA_VENOXIS:            return GetBossState(DATA_VENOXIS); +                    case DATA_MARLI:              return GetBossState(DATA_MARLI); +                    case DATA_ARLOKK:             return GetBossState(DATA_ARLOKK); +                    case DATA_HAKKAR:             return GetBossState(DATA_HAKKAR); +                    case DATA_MANDOKIR:           return GetBossState(DATA_MANDOKIR); +                    case DATA_JINDO:              return GetBossState(DATA_JINDO); +                    case DATA_GAHZRANKA:          return GetBossState(DATA_GAHZRANKA); +                    case DATA_EDGE_OF_MADNESS:    return GetBossState(DATA_EDGE_OF_MADNESS); +                    case DATA_THEKAL:             return GetBossState(DATA_THEKAL); +                    case DATA_LORKHAN:            return GetBossState(DATA_LORKHAN); +                    case DATA_ZATH:               return GetBossState(DATA_ZATH); +                    case DATA_OHGAN:              return GetBossState(DATA_OHGAN); +                        break; +                    default: +                        break;              } +            return 0; +        } +              uint64 GetData64(uint32 uiData) const              {                  switch (uiData)                  {                      case DATA_LORKHAN: -                        return m_uiLorKhanGUID; +                        return LorKhanGUID;                      case DATA_ZATH: -                        return m_uiZathGUID; +                        return ZathGUID;                      case DATA_THEKAL: -                        return m_uiThekalGUID; +                        return ThekalGUID;                      case DATA_JINDO: -                        return m_uiJindoGUID; +                        return JindoGUID;                  }                  return 0;              } + +            std::string GetSaveData() +            { +                OUT_SAVE_INST_DATA; + +                std::ostringstream saveStream; +                saveStream << "Z G " << GetBossSaveData(); + +                OUT_SAVE_INST_DATA_COMPLETE; +                return saveStream.str(); +            } + +            void Load(const char* str) +            { +                if (!str) +                { +                    OUT_LOAD_INST_DATA_FAIL; +                    return; +                } + +                OUT_LOAD_INST_DATA(str); + +                char dataHead1, dataHead2; + +                std::istringstream loadStream(str); +                loadStream >> dataHead1 >> dataHead2; + +                if (dataHead1 == 'Z' && dataHead2 == 'G') +                { +                    for (uint32 i = 0; i < EncounterCount; ++i) +                    { +                        uint32 tmpState; +                        loadStream >> tmpState; +                        if (tmpState == IN_PROGRESS || tmpState > SPECIAL) +                            tmpState = NOT_STARTED; +                        SetBossState(i, EncounterState(tmpState)); +                    } +                } +                else +                    OUT_LOAD_INST_DATA_FAIL; + +                OUT_LOAD_INST_DATA_COMPLETE; +            }          };          InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h index 22637315066..55bf0e50e3c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h +++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h @@ -1,6 +1,5 @@  /*   * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>   *   * This program is free software; you can redistribute it and/or modify it   * under the terms of the GNU General Public License as published by the @@ -19,20 +18,32 @@  #ifndef DEF_ZULGURUB_H  #define DEF_ZULGURUB_H +uint32 const EncounterCount = 13; +  enum DataTypes  { -    MAX_ENCOUNTERS          = 8, +    DATA_JEKLIK             = 0,  // Main boss +    DATA_VENOXIS            = 1,  // Main boss +    DATA_MARLI              = 2,  // Main boss +    DATA_ARLOKK             = 3,  // Main boss +    DATA_HAKKAR             = 4,  // Main boss +    DATA_MANDOKIR           = 5,  // Optional boss +    DATA_JINDO              = 6,  // Optional boss +    DATA_GAHZRANKA          = 7,  // Optional boss +    DATA_EDGE_OF_MADNESS    = 8,  // Optional Event Edge of Madness - one of: Gri'lek, Renataki, Hazza'rah, or Wushoolay +    DATA_THEKAL             = 9,  // ?? +    DATA_LORKHAN            = 10, // ?? +    DATA_ZATH               = 11, // ?? +    DATA_OHGAN              = 12  // ?? +}; -    DATA_ARLOKK             = 1, -    DATA_JEKLIK             = 2, -    DATA_VENOXIS            = 3, -    DATA_MARLI              = 4, -    DATA_OHGAN              = 5, -    DATA_THEKAL             = 6, -    DATA_ZATH               = 7, -    DATA_LORKHAN            = 8, -    DATA_JINDO              = 10, +enum CreatureIds +{ +    NPC_ZEALOT_LORKHAN      = 11347, +    NPC_ZEALOT_ZATH         = 11348, +    NPC_HIGH_PRIEST_THEKAL  = 14509, +    NPC_JINDO_THE_HEXXER    = 11380, +    NPC_NIGHTMARE_ILLUSION  = 15163  };  #endif - diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp index 226ff794a9f..158861e90c7 100644 --- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp +++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp @@ -26,13 +26,16 @@ EndScriptData */  #include "ScriptMgr.h"  #include "ScriptedCreature.h" -#define SPELL_SHADOWVOLLEY          21341 -#define SPELL_CLEAVE                20677 -#define SPELL_THUNDERCLAP           23931 -#define SPELL_TWISTEDREFLECTION     21063 -#define SPELL_VOIDBOLT              21066 -#define SPELL_RAGE                  21340 -#define SPELL_CAPTURESOUL           21054 +enum Spells +{ +    SPELL_SHADOWVOLLEY          = 21341, +    SPELL_CLEAVE                = 20677, +    SPELL_THUNDERCLAP           = 23931, +    SPELL_TWISTEDREFLECTION     = 21063, +    SPELL_VOIDBOLT              = 21066, +    SPELL_RAGE                  = 21340, +    SPELL_CAPTURESOUL           = 21054 +};  class boss_kruul : public CreatureScript  {  | 
