diff options
Diffstat (limited to 'src/server/scripts')
22 files changed, 654 insertions, 393 deletions
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 86fe984e197..867d54a3cc6 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -18,6 +18,7 @@ set(scripts_STAT_SRCS Commands/cs_go.cpp Commands/cs_gobject.cpp Commands/cs_honor.cpp + Commands/cs_instance.cpp Commands/cs_learn.cpp Commands/cs_misc.cpp Commands/cs_modify.cpp @@ -34,7 +35,6 @@ set(scripts_STAT_SRCS # Commands/cs_guild.cpp # Commands/cs_cast.cpp # Commands/cs_reset.cpp -# Commands/cs_instance.cpp # Commands/cs_server.cpp # Commands/cs_channel.cpp # Commands/cs_pet.cpp diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp new file mode 100644 index 00000000000..127a3848ebc --- /dev/null +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * 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 + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +Name: instance_commandscript +%Complete: 100 +Comment: All instance related commands +Category: commandscripts +EndScriptData */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "Group.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "MapManager.h" + +class instance_commandscript : public CommandScript +{ +public: + instance_commandscript() : CommandScript("instance_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand instanceCommandTable[] = + { + { "listbinds", SEC_ADMINISTRATOR, false, &HandleInstanceListBindsCommand, "", NULL }, + { "unbind", SEC_ADMINISTRATOR, false, &HandleInstanceUnbindCommand, "", NULL }, + { "stats", SEC_ADMINISTRATOR, true, &HandleInstanceStatsCommand, "", NULL }, + { "savedata", SEC_ADMINISTRATOR, false, &HandleInstanceSaveDataCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + + return commandTable; + } + + static std::string GetTimeString(uint64 time) + { + uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE; + std::ostringstream ss; + if (days) + ss << days << "d "; + if (hours) + ss << hours << "h "; + ss << minute << 'm'; + return ss.str(); + } + + static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* args) + { + Player* player = handler->getSelectedPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); + + uint32 counter = 0; + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave* save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + counter++; + } + } + handler->PSendSysMessage("player binds: %d", counter); + + counter = 0; + if (Group* group = player->GetGroup()) + { + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); + for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave* save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + counter++; + } + } + } + handler->PSendSysMessage("group binds: %d", counter); + + return true; + } + + static bool HandleInstanceUnbindCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); + + char* map = strtok((char*)args, " "); + char* pDiff = strtok(NULL, " "); + int8 diff = -1; + if (pDiff) + diff = atoi(pDiff); + uint16 counter = 0; + uint16 MapId = 0; + + if (strcmp(map, "all")) + { + MapId = uint16(atoi(map)); + if (!MapId) + return false; + } + + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) + { + InstanceSave* save = itr->second.save; + if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) + { + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + player->UnbindInstance(itr, Difficulty(i)); + counter++; + } + else + ++itr; + } + } + handler->PSendSysMessage("instances unbound: %d", counter); + + return true; + } + + static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/) + { + handler->PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances()); + handler->PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances()); + handler->PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves()); + handler->PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal()); + handler->PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal()); + + return true; + } + + static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/) + { + Player* player = handler->GetSession()->GetPlayer(); + Map* map = player->GetMap(); + if (!map->IsDungeon()) + { + handler->PSendSysMessage("Map is not a dungeon."); + handler->SetSentErrorMessage(true); + return false; + } + + if (!((InstanceMap*)map)->GetInstanceScript()) + { + handler->PSendSysMessage("Map has no instance data."); + handler->SetSentErrorMessage(true); + return false; + } + + ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); + + return true; + } +}; + +void AddSC_instance_commandscript() +{ + new instance_commandscript(); +} diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index ca7c3af7fde..8f390d17cd4 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -97,15 +97,16 @@ public: if (!*args) return false; - std::string name = args; - - if (!sObjectMgr->DeleteGameTele(name)) + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + GameTele const* tele = handler->extractGameTeleFromLink((char*)args); + if (!tele) { handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); handler->SetSentErrorMessage(true); return false; } - + std::string name = tele->name; + sObjectMgr->DeleteGameTele(name); handler->SendSysMessage(LANG_COMMAND_TP_DELETED); return true; } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index a86b2b8b17a..a70d05fa0ef 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -15,11 +15,13 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" #include "blackfathom_deeps.h" #include "ScriptedEscortAI.h" -enum eSpells +enum Spells { SPELL_BLESSING_OF_BLACKFATHOM = 8733, SPELL_RAVAGE = 8391, @@ -94,11 +96,11 @@ public: uint32 frostNovaTimer; uint32 frostBoltVolleyTimer; - bool bFlee; + bool Flee; void Reset() { - bFlee = false; + Flee = false; ravageTimer = urand(5000, 8000); frostNovaTimer = urand(9000, 12000); @@ -140,7 +142,7 @@ public: { if (ravageTimer <= diff) { - DoCast(me->getVictim(), SPELL_RAVAGE); + DoCastVictim(SPELL_RAVAGE); ravageTimer = urand(9000, 14000); } else ravageTimer -= diff; break; @@ -148,9 +150,9 @@ public: case NPC_MURKSHALLOW_SOFTSHELL: case NPC_BARBED_CRUSTACEAN: { - if (!bFlee && HealthBelowPct(15)) + if (!Flee && HealthBelowPct(15)) { - bFlee = true; + Flee = true; me->DoFleeToGetAssistance(); } break; @@ -160,10 +162,7 @@ public: if (frostBoltVolleyTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target) - DoCast(target, SPELL_FROST_BOLT_VOLLEY); - } + DoCast(target, SPELL_FROST_BOLT_VOLLEY); frostBoltVolleyTimer = urand(5000, 8000); } else frostBoltVolleyTimer -= diff; @@ -190,7 +189,7 @@ public: }; }; -enum eMorridune +enum Morridune { SAY_MORRIDUNE_1 = -1048003, SAY_MORRIDUNE_2 = -1048004 diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 32a6bcbde77..7071395812e 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -15,7 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells @@ -42,14 +43,14 @@ public: } uint32 poisonCloudTimer; - bool bIsEnraged; + bool IsEnraged; InstanceScript* instance; void Reset() { poisonCloudTimer = urand(5000, 9000); - bIsEnraged = false; + IsEnraged = false; if (instance) instance->SetData(TYPE_AKU_MAI, NOT_STARTED); } @@ -77,10 +78,10 @@ public: poisonCloudTimer = urand(25000, 50000); } else poisonCloudTimer -= diff; - if (!bIsEnraged && HealthBelowPct(30)) + if (!IsEnraged && HealthBelowPct(30)) { DoCast(me, SPELL_FRENZIED_RAGE); - bIsEnraged = true; + IsEnraged = true; } DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 5a60a849b75..1488772dc8a 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -15,7 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 7ee17172102..1c754b78672 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -15,7 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "blackfathom_deeps.h" enum Spells diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index ea33499a960..236c7b1ba69 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Blackfathom Deeps EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" #include "blackfathom_deeps.h" #define MAX_ENCOUNTER 4 diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index d7043965271..b23d15cd1b5 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -46,15 +47,15 @@ public: { celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) {} - uint32 Wrath_Timer; - uint32 EntanglingRoots_Timer; - uint32 CorruptForces_Timer; + uint32 WrathTimer; + uint32 EntanglingRootsTimer; + uint32 CorruptForcesTimer; void Reset() { - Wrath_Timer = 8000; - EntanglingRoots_Timer = 2000; - CorruptForces_Timer = 30000; + WrathTimer = 8000; + EntanglingRootsTimer = 2000; + CorruptForcesTimer = 30000; } void EnterCombat(Unit* /*who*/) { } @@ -70,32 +71,30 @@ public: return; //Wrath - if (Wrath_Timer <= diff) + if (WrathTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_WRATH); - Wrath_Timer = 8000; + WrathTimer = 8000; } - else Wrath_Timer -= diff; + else WrathTimer -= diff; //EntanglingRoots - if (EntanglingRoots_Timer <= diff) + if (EntanglingRootsTimer <= diff) { - DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); - EntanglingRoots_Timer = 20000; + DoCastVictim(SPELL_ENTANGLINGROOTS); + EntanglingRootsTimer = 20000; } - else EntanglingRoots_Timer -= diff; + else EntanglingRootsTimer -= diff; //CorruptForces - if (CorruptForces_Timer <= diff) + if (CorruptForcesTimer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_CORRUPT_FORCES); - CorruptForces_Timer = 20000; + CorruptForcesTimer = 20000; } - else CorruptForces_Timer -= diff; + else CorruptForcesTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index ea419793ae8..b4128ea80ee 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -46,15 +47,15 @@ public: { boss_landslideAI(Creature* creature) : ScriptedAI(creature) {} - uint32 KnockAway_Timer; - uint32 Trample_Timer; - uint32 Landslide_Timer; + uint32 KnockAwayTimer; + uint32 TrampleTimer; + uint32 LandslideTimer; void Reset() { - KnockAway_Timer = 8000; - Trample_Timer = 2000; - Landslide_Timer = 0; + KnockAwayTimer = 8000; + TrampleTimer = 2000; + LandslideTimer = 0; } void EnterCombat(Unit* /*who*/) @@ -66,32 +67,32 @@ public: if (!UpdateVictim()) return; - //KnockAway_Timer - if (KnockAway_Timer <= diff) + //KnockAwayTimer + if (KnockAwayTimer <= diff) { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 15000; + DoCastVictim(SPELL_KNOCKAWAY); + KnockAwayTimer = 15000; } - else KnockAway_Timer -= diff; + else KnockAwayTimer -= diff; - //Trample_Timer - if (Trample_Timer <= diff) + //TrampleTimer + if (TrampleTimer <= diff) { DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 8000; + TrampleTimer = 8000; } - else Trample_Timer -= diff; + else TrampleTimer -= diff; //Landslide if (HealthBelowPct(50)) { - if (Landslide_Timer <= diff) + if (LandslideTimer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_LANDSLIDE); - Landslide_Timer = 60000; + LandslideTimer = 60000; } - else Landslide_Timer -= diff; + else LandslideTimer -= diff; } DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index 18ce7be0f0a..ece3ff83776 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -23,7 +23,9 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" + enum Spells { SPELL_TOXICVOLLEY = 21687, @@ -44,24 +46,22 @@ public: { boss_noxxionAI(Creature* creature) : ScriptedAI(creature) {} - uint32 ToxicVolley_Timer; - uint32 Uppercut_Timer; - uint32 Adds_Timer; - uint32 Invisible_Timer; + uint32 ToxicVolleyTimer; + uint32 UppercutTimer; + uint32 AddsTimer; + uint32 InvisibleTimer; bool Invisible; void Reset() { - ToxicVolley_Timer = 7000; - Uppercut_Timer = 16000; - Adds_Timer = 19000; - Invisible_Timer = 15000; //Too much too low? + ToxicVolleyTimer = 7000; + UppercutTimer = 16000; + AddsTimer = 19000; + InvisibleTimer = 15000; //Too much too low? Invisible = false; } - void EnterCombat(Unit* /*who*/) - { - } + void EnterCombat(Unit* /*who*/) {} void SummonAdds(Unit* victim) { @@ -71,7 +71,7 @@ public: void UpdateAI(const uint32 diff) { - if (Invisible && Invisible_Timer <= diff) + if (Invisible && InvisibleTimer <= diff) { //Become visible again me->setFaction(14); @@ -83,7 +83,7 @@ public: } else if (Invisible) { - Invisible_Timer -= diff; + InvisibleTimer -= diff; //Do nothing while invisible return; } @@ -92,24 +92,24 @@ public: if (!UpdateVictim()) return; - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) + //ToxicVolleyTimer + if (ToxicVolleyTimer <= diff) { - DoCast(me->getVictim(), SPELL_TOXICVOLLEY); - ToxicVolley_Timer = 9000; + DoCastVictim(SPELL_TOXICVOLLEY); + ToxicVolleyTimer = 9000; } - else ToxicVolley_Timer -= diff; + else ToxicVolleyTimer -= diff; - //Uppercut_Timer - if (Uppercut_Timer <= diff) + //UppercutTimer + if (UppercutTimer <= diff) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 12000; + DoCastVictim(SPELL_UPPERCUT); + UppercutTimer = 12000; } - else Uppercut_Timer -= diff; + else UppercutTimer -= diff; - //Adds_Timer - if (!Invisible && Adds_Timer <= diff) + //AddsTimer + if (!Invisible && AddsTimer <= diff) { //Interrupt any spell casting //me->m_canMove = true; @@ -124,11 +124,11 @@ public: SummonAdds(me->getVictim()); SummonAdds(me->getVictim()); Invisible = true; - Invisible_Timer = 15000; + InvisibleTimer = 15000; - Adds_Timer = 40000; + AddsTimer = 40000; } - else Adds_Timer -= diff; + else AddsTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 039d30071d2..1f887d7ce64 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -23,7 +23,8 @@ SDComment: SDCategory: Maraudon EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" enum Spells { @@ -47,17 +48,17 @@ public: { boss_ptheradrasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 Dustfield_Timer; - uint32 Boulder_Timer; - uint32 Thrash_Timer; - uint32 RepulsiveGaze_Timer; + uint32 DustfieldTimer; + uint32 BoulderTimer; + uint32 ThrashTimer; + uint32 RepulsiveGazeTimer; void Reset() { - Dustfield_Timer = 8000; - Boulder_Timer = 2000; - Thrash_Timer = 5000; - RepulsiveGaze_Timer = 23000; + DustfieldTimer = 8000; + BoulderTimer = 2000; + ThrashTimer = 5000; + RepulsiveGazeTimer = 23000; } void EnterCombat(Unit* /*who*/) {} @@ -72,40 +73,38 @@ public: if (!UpdateVictim()) return; - //Dustfield_Timer - if (Dustfield_Timer <= diff) + //DustfieldTimer + if (DustfieldTimer <= diff) { DoCast(me, SPELL_DUSTFIELD); - Dustfield_Timer = 14000; + DustfieldTimer = 14000; } - else Dustfield_Timer -= diff; + else DustfieldTimer -= diff; - //Boulder_Timer - if (Boulder_Timer <= diff) + //BoulderTimer + if (BoulderTimer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_BOULDER); - Boulder_Timer = 10000; + BoulderTimer = 10000; } - else Boulder_Timer -= diff; + else BoulderTimer -= diff; - //RepulsiveGaze_Timer - if (RepulsiveGaze_Timer <= diff) + //RepulsiveGazeTimer + if (RepulsiveGazeTimer <= diff) { - DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); - RepulsiveGaze_Timer = 20000; + DoCastVictim(SPELL_REPULSIVEGAZE); + RepulsiveGazeTimer = 20000; } - else RepulsiveGaze_Timer -= diff; + else RepulsiveGazeTimer -= diff; - //Thrash_Timer - if (Thrash_Timer <= diff) + //ThrashTimer + if (ThrashTimer <= diff) { DoCast(me, SPELL_THRASH); - Thrash_Timer = 18000; + ThrashTimer = 18000; } - else Thrash_Timer -= diff; + else ThrashTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 6e6e089ba02..1fdf941d75c 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -25,10 +25,15 @@ SDComment: <Known bugs> SDCategory: Onyxia's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "onyxias_lair.h" -enum eYells +enum Yells { SAY_AGGRO = -1249000, SAY_KILL = -1249001, @@ -37,7 +42,7 @@ enum eYells EMOTE_BREATH = -1249004, }; -enum eSpells +enum Spells { // Phase 1 spells SPELL_WING_BUFFET = 18500, @@ -67,15 +72,15 @@ enum eSpells SPELL_BELLOWING_ROAR = 18431, }; -struct sOnyxMove +struct OnyxMove { - uint32 uiLocId; - uint32 uiLocIdEnd; - uint32 uiSpellId; + uint8 LocId; + uint8 LocIdEnd; + uint32 SpellId; float fX, fY, fZ; }; -static sOnyxMove aMoveData[]= +static OnyxMove MoveData[8]= { {0, 1, SPELL_BREATH_WEST_TO_EAST, -33.5561f, -182.682f, -56.9457f}, //west {1, 0, SPELL_BREATH_EAST_TO_WEST, -31.4963f, -250.123f, -55.1278f}, //east @@ -87,11 +92,11 @@ static sOnyxMove aMoveData[]= {7, 6, SPELL_BREATH_NORTH_TO_SOUTH, 22.8763f, -217.152f, -55.0548f}, //north }; -const Position MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f}; +Position const MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f}; -const Position Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f}; +Position const Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f}; -static Position aSpawnLocations[3]= +Position const SpawnLocations[3]= { //Whelps {-30.127f, -254.463f, -89.440f, 0.0f}, @@ -121,58 +126,58 @@ public: InstanceScript* instance; SummonList Summons; - uint32 m_uiPhase; + uint32 Phase; - uint32 m_uiFlameBreathTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiWingBuffetTimer; + uint32 FlameBreathTimer; + uint32 CleaveTimer; + uint32 TailSweepTimer; + uint32 WingBuffetTimer; - uint32 m_uiMovePoint; - uint32 m_uiMovementTimer; - sOnyxMove* m_pPointData; + uint8 MovePoint; + uint32 MovementTimer; + OnyxMove* PointData; - uint32 m_uiFireballTimer; - uint32 m_uiWhelpTimer; - uint32 m_uiLairGuardTimer; - uint32 m_uiDeepBreathTimer; + uint32 FireballTimer; + uint32 WhelpTimer; + uint32 LairGuardTimer; + uint32 DeepBreathTimer; - uint32 m_uiBellowingRoarTimer; + uint32 BellowingRoarTimer; - uint8 m_uiSummonWhelpCount; - bool m_bIsMoving; + uint8 SummonWhelpCount; + bool IsMoving; void Reset() { if (!IsCombatMovementAllowed()) SetCombatMovement(true); - m_uiPhase = PHASE_START; + Phase = PHASE_START; - m_uiFlameBreathTimer = urand(10000, 20000); - m_uiTailSweepTimer = urand(15000, 20000); - m_uiCleaveTimer = urand(2000, 5000); - m_uiWingBuffetTimer = urand(10000, 20000); + FlameBreathTimer = urand(10000, 20000); + TailSweepTimer = urand(15000, 20000); + CleaveTimer = urand(2000, 5000); + WingBuffetTimer = urand(10000, 20000); - m_uiMovePoint = urand(0, 5); - m_uiMovementTimer = 14000; - m_pPointData = GetMoveData(); + MovePoint = urand(0, 5); + MovementTimer = 14000; + PointData = GetMoveData(); - m_uiFireballTimer = 15000; - m_uiWhelpTimer = 60000; - m_uiLairGuardTimer = 60000; - m_uiDeepBreathTimer = 85000; + FireballTimer = 15000; + WhelpTimer = 60000; + LairGuardTimer = 60000; + DeepBreathTimer = 85000; - m_uiBellowingRoarTimer = 30000; + BellowingRoarTimer = 30000; Summons.DespawnAll(); - m_uiSummonWhelpCount = 0; - m_bIsMoving = false; + SummonWhelpCount = 0; + IsMoving = false; if (instance) { instance->SetData(DATA_ONYXIA, NOT_STARTED); - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + instance->SetData(DATA_ONYXIA_PHASE, Phase); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } @@ -206,7 +211,7 @@ public: switch (summoned->GetEntry()) { case NPC_WHELP: - ++m_uiSummonWhelpCount; + ++SummonWhelpCount; break; case NPC_LAIRGUARD: summoned->setActive(true); @@ -225,17 +230,17 @@ public: DoScriptText(SAY_KILL, me); } - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) + void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell) { - if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || - pSpell->Id == SPELL_BREATH_WEST_TO_EAST || - pSpell->Id == SPELL_BREATH_SE_TO_NW || - pSpell->Id == SPELL_BREATH_NW_TO_SE || - pSpell->Id == SPELL_BREATH_SW_TO_NE || - pSpell->Id == SPELL_BREATH_NE_TO_SW) + if (Spell->Id == SPELL_BREATH_EAST_TO_WEST || + Spell->Id == SPELL_BREATH_WEST_TO_EAST || + Spell->Id == SPELL_BREATH_SE_TO_NW || + Spell->Id == SPELL_BREATH_NW_TO_SE || + Spell->Id == SPELL_BREATH_SW_TO_NE || + Spell->Id == SPELL_BREATH_NE_TO_SW) { - m_pPointData = GetMoveData(); - m_uiMovePoint = m_pPointData->uiLocIdEnd; + PointData = GetMoveData(); + MovePoint = PointData->LocIdEnd; me->SetSpeed(MOVE_FLIGHT, 1.5f); me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); @@ -249,16 +254,16 @@ public: switch (id) { case 8: - m_pPointData = GetMoveData(); - if (m_pPointData) + PointData = GetMoveData(); + if (PointData) { me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); } break; case 9: me->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiBellowingRoarTimer = 1000; + BellowingRoarTimer = 1000; break; case 10: me->SetCanFly(true); @@ -266,39 +271,39 @@ public: me->SetSpeed(MOVE_FLIGHT, 1.0f); DoScriptText(SAY_PHASE_2_TRANS, me); if (instance) - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - m_uiWhelpTimer = 5000; - m_uiLairGuardTimer = 15000; + instance->SetData(DATA_ONYXIA_PHASE, Phase); + WhelpTimer = 5000; + LairGuardTimer = 15000; break; case 11: - if (m_pPointData) - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + if (PointData) + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); break; default: - m_bIsMoving = false; + IsMoving = false; break; } } } - void SpellHitTarget(Unit* target, const SpellInfo* pSpell) + void SpellHitTarget(Unit* target, const SpellInfo* Spell) { //Workaround - Couldn't find a way to group this spells (All Eruption) - if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || - (pSpell->Id == 17097) || - (pSpell->Id >= 18351 && pSpell->Id <= 18361) || - (pSpell->Id >= 18564 && pSpell->Id <= 18576) || - (pSpell->Id >= 18578 && pSpell->Id <= 18607) || - (pSpell->Id == 18609) || - (pSpell->Id >= 18611 && pSpell->Id <= 18628) || - (pSpell->Id >= 21132 && pSpell->Id <= 21133) || - (pSpell->Id >= 21135 && pSpell->Id <= 21139) || - (pSpell->Id >= 22191 && pSpell->Id <= 22202) || - (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && + if (((Spell->Id >= 17086 && Spell->Id <= 17095) || + (Spell->Id == 17097) || + (Spell->Id >= 18351 && Spell->Id <= 18361) || + (Spell->Id >= 18564 && Spell->Id <= 18576) || + (Spell->Id >= 18578 && Spell->Id <= 18607) || + (Spell->Id == 18609) || + (Spell->Id >= 18611 && Spell->Id <= 18628) || + (Spell->Id >= 21132 && Spell->Id <= 21133) || + (Spell->Id >= 21135 && Spell->Id <= 21139) || + (Spell->Id >= 22191 && Spell->Id <= 22202) || + (Spell->Id >= 22267 && Spell->Id <= 22268)) && (target->GetTypeId() == TYPEID_PLAYER)) { if (instance) @@ -308,14 +313,14 @@ public: } } - sOnyxMove* GetMoveData() + OnyxMove* GetMoveData() { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove); - for (uint32 i = 0; i < uiMaxCount; ++i) + for (uint8 i = 0; i < MaxCount; ++i) { - if (aMoveData[i].uiLocId == m_uiMovePoint) - return &aMoveData[i]; + if (MoveData[i].LocId == MovePoint) + return &MoveData[i]; } return NULL; @@ -323,84 +328,84 @@ public: void SetNextRandomPoint() { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove); - uint32 iTemp = rand()%(uiMaxCount-1); + uint8 iTemp = urand(0, MaxCount-1); - if (iTemp >= m_uiMovePoint) + if (iTemp >= MovePoint) ++iTemp; - m_uiMovePoint = iTemp; + MovePoint = iTemp; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 Diff) { if (!UpdateVictim()) return; //Common to PHASE_START && PHASE_END - if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) + if (Phase == PHASE_START || Phase == PHASE_END) { //Specific to PHASE_START || PHASE_END - if (m_uiPhase == PHASE_START) + if (Phase == PHASE_START) { if (HealthBelowPct(60)) { SetCombatMovement(false); - m_uiPhase = PHASE_BREATH; + Phase = PHASE_BREATH; me->GetMotionMaster()->MovePoint(10, Phase2Location); return; } } else { - if (m_uiBellowingRoarTimer <= uiDiff) + if (BellowingRoarTimer <= Diff) { DoCastVictim(SPELL_BELLOWING_ROAR); // Eruption - GameObject* pFloor = NULL; + GameObject* Floor = NULL; Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); - Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check); + Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check); me->VisitNearbyGridObject(30, searcher); - if (instance && pFloor) - instance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); - m_uiBellowingRoarTimer = 30000; + if (instance && Floor) + instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID()); + BellowingRoarTimer = 30000; } else - m_uiBellowingRoarTimer -= uiDiff; + BellowingRoarTimer -= Diff; } - if (m_uiFlameBreathTimer <= uiDiff) + if (FlameBreathTimer <= Diff) { DoCastVictim(SPELL_FLAME_BREATH); - m_uiFlameBreathTimer = urand(10000, 20000); + FlameBreathTimer = urand(10000, 20000); } else - m_uiFlameBreathTimer -= uiDiff; + FlameBreathTimer -= Diff; - if (m_uiTailSweepTimer <= uiDiff) + if (TailSweepTimer <= Diff) { DoCastAOE(SPELL_TAIL_SWEEP); - m_uiTailSweepTimer = urand(15000, 20000); + TailSweepTimer = urand(15000, 20000); } else - m_uiTailSweepTimer -= uiDiff; + TailSweepTimer -= Diff; - if (m_uiCleaveTimer <= uiDiff) + if (CleaveTimer <= Diff) { DoCastVictim(SPELL_CLEAVE); - m_uiCleaveTimer = urand(2000, 5000); + CleaveTimer = urand(2000, 5000); } else - m_uiCleaveTimer -= uiDiff; + CleaveTimer -= Diff; - if (m_uiWingBuffetTimer <= uiDiff) + if (WingBuffetTimer <= Diff) { DoCastVictim(SPELL_WING_BUFFET); - m_uiWingBuffetTimer = urand(15000, 30000); + WingBuffetTimer = urand(15000, 30000); } else - m_uiWingBuffetTimer -= uiDiff; + WingBuffetTimer -= Diff; DoMeleeAttackIfReady(); } @@ -408,86 +413,86 @@ public: { if (HealthBelowPct(40)) { - m_uiPhase = PHASE_END; + Phase = PHASE_END; if (instance) - instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + instance->SetData(DATA_ONYXIA_PHASE, Phase); DoScriptText(SAY_PHASE_3_TRANS, me); SetCombatMovement(true); me->SetCanFly(false); - m_bIsMoving = false; + IsMoving = false; me->GetMotionMaster()->MovePoint(9, me->GetHomePosition()); return; } - if (m_uiDeepBreathTimer <= uiDiff) + if (DeepBreathTimer <= Diff) { - if (!m_bIsMoving) + if (!IsMoving) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); DoScriptText(EMOTE_BREATH, me); - DoCast(me, m_pPointData->uiSpellId); - m_uiDeepBreathTimer = 70000; + DoCast(me, PointData->SpellId); + DeepBreathTimer = 70000; } } else - m_uiDeepBreathTimer -= uiDiff; + DeepBreathTimer -= Diff; - if (m_uiMovementTimer <= uiDiff) + if (MovementTimer <= Diff) { - if (!m_bIsMoving) + if (!IsMoving) { SetNextRandomPoint(); - m_pPointData = GetMoveData(); + PointData = GetMoveData(); - if (!m_pPointData) + if (!PointData) return; - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - m_bIsMoving = true; - m_uiMovementTimer = 25000; + me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); + IsMoving = true; + MovementTimer = 25000; } } else - m_uiMovementTimer -= uiDiff; + MovementTimer -= Diff; - if (m_uiFireballTimer <= uiDiff) + if (FireballTimer <= Diff) { if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_FIREBALL); - m_uiFireballTimer = 8000; + FireballTimer = 8000; } } else - m_uiFireballTimer -= uiDiff; + FireballTimer -= Diff; - if (m_uiLairGuardTimer <= uiDiff) + if (LairGuardTimer <= Diff) { - me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - m_uiLairGuardTimer = 30000; + me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN); + LairGuardTimer = 30000; } else - m_uiLairGuardTimer -= uiDiff; + LairGuardTimer -= Diff; - if (m_uiWhelpTimer <= uiDiff) + if (WhelpTimer <= Diff) { - me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonWhelpCount >= RAID_MODE(20, 40)) + me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN); + if (SummonWhelpCount >= RAID_MODE(20, 40)) { - m_uiSummonWhelpCount = 0; - m_uiWhelpTimer = 90000; + SummonWhelpCount = 0; + WhelpTimer = 90000; } else - m_uiWhelpTimer = 500; + WhelpTimer = 500; } else - m_uiWhelpTimer -= uiDiff; + WhelpTimer -= Diff; } } }; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 1c599ce7c6f..0689a8872bb 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -22,7 +22,12 @@ SDComment: SDCategory: Onyxia's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "onyxias_lair.h" class instance_onyxias_lair : public InstanceMapScript @@ -44,27 +49,27 @@ public: std::map<uint64, uint32> FloorEruptionGUID[2]; std::queue<uint64> FloorEruptionGUIDQueue; - uint64 m_uiOnyxiasGUID; - uint32 m_uiOnyxiaLiftoffTimer; - uint32 m_uiManyWhelpsCounter; - uint32 m_uiEruptTimer; + uint64 OnyxiasGUID; + uint32 OnyxiaLiftoffTimer; + uint32 ManyWhelpsCounter; + uint32 EruptTimer; - uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 Encounter[MAX_ENCOUNTER]; - bool m_bAchievManyWhelpsHandleIt; - bool m_bAchievSheDeepBreathMore; + bool AchievManyWhelpsHandleIt; + bool AchievSheDeepBreathMore; void Initialize() { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + memset(&Encounter, 0, sizeof(Encounter)); - m_uiOnyxiasGUID = 0; - m_uiOnyxiaLiftoffTimer = 0; - m_uiManyWhelpsCounter = 0; - m_bAchievManyWhelpsHandleIt = false; - m_bAchievSheDeepBreathMore = true; + OnyxiasGUID = 0; + OnyxiaLiftoffTimer = 0; + ManyWhelpsCounter = 0; + AchievManyWhelpsHandleIt = false; + AchievSheDeepBreathMore = true; - m_uiEruptTimer = 0; + EruptTimer = 0; } void OnCreatureCreate(Creature* creature) @@ -72,7 +77,7 @@ public: switch (creature->GetEntry()) { case NPC_ONYXIA: - m_uiOnyxiasGUID = creature->GetGUID(); + OnyxiasGUID = creature->GetGUID(); break; } } @@ -93,7 +98,7 @@ public: if (Creature* temp = go->SummonCreature(NPC_WHELP, goPos, TEMPSUMMON_CORPSE_DESPAWN)) { temp->SetInCombatWithZone(); - ++m_uiManyWhelpsCounter; + ++ManyWhelpsCounter; } break; } @@ -139,88 +144,88 @@ public: FloorEruptionGUID[1].erase(floorEruptedGUID); } - void SetData(uint32 uiType, uint32 uiData) + void SetData(uint32 Type, uint32 Data) { - switch (uiType) + switch (Type) { case DATA_ONYXIA: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) + Encounter[0] = Data; + if (Data == IN_PROGRESS) SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); break; case DATA_ONYXIA_PHASE: - if (uiData == PHASE_BREATH) //Used to mark the liftoff phase + if (Data == PHASE_BREATH) //Used to mark the liftoff phase { - m_bAchievManyWhelpsHandleIt = false; - m_uiManyWhelpsCounter = 0; - m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; + AchievManyWhelpsHandleIt = false; + ManyWhelpsCounter = 0; + OnyxiaLiftoffTimer = 10*IN_MILLISECONDS; } break; case DATA_SHE_DEEP_BREATH_MORE: - if (uiData == IN_PROGRESS) + if (Data == IN_PROGRESS) { - m_bAchievSheDeepBreathMore = true; + AchievSheDeepBreathMore = true; } - else if (uiData == FAIL) + else if (Data == FAIL) { - m_bAchievSheDeepBreathMore = false; + AchievSheDeepBreathMore = false; } break; } - if (uiType < MAX_ENCOUNTER && uiData == DONE) + if (Type < MAX_ENCOUNTER && Data == DONE) SaveToDB(); } - void SetData64(uint32 uiType, uint64 uiData) + void SetData64(uint32 Type, uint64 Data) { - switch (uiType) + switch (Type) { case DATA_FLOOR_ERUPTION_GUID: FloorEruptionGUID[1] = FloorEruptionGUID[0]; - FloorEruptionGUIDQueue.push(uiData); - m_uiEruptTimer = 2500; + FloorEruptionGUIDQueue.push(Data); + EruptTimer = 2500; break; } } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 Type) { - switch (uiType) + switch (Type) { case DATA_ONYXIA: - return m_auiEncounter[0]; + return Encounter[0]; } return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 Data) { - switch (uiData) + switch (Data) { case DATA_ONYXIA_GUID: - return m_uiOnyxiasGUID; + return OnyxiasGUID; } return 0; } - void Update(uint32 uiDiff) + void Update(uint32 Diff) { if (GetData(DATA_ONYXIA) == IN_PROGRESS) { - if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) + if (OnyxiaLiftoffTimer && OnyxiaLiftoffTimer <= Diff) { - m_uiOnyxiaLiftoffTimer = 0; - if (m_uiManyWhelpsCounter >= 50) - m_bAchievManyWhelpsHandleIt = true; - } else m_uiOnyxiaLiftoffTimer -= uiDiff; + OnyxiaLiftoffTimer = 0; + if (ManyWhelpsCounter >= 50) + AchievManyWhelpsHandleIt = true; + } else OnyxiaLiftoffTimer -= Diff; } if (!FloorEruptionGUIDQueue.empty()) { - if (m_uiEruptTimer <= uiDiff) + if (EruptTimer <= Diff) { uint32 treeHeight = 0; do @@ -229,10 +234,10 @@ public: FloorEruption(FloorEruptionGUIDQueue.front()); FloorEruptionGUIDQueue.pop(); } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); - m_uiEruptTimer = 1000; + EruptTimer = 1000; } else - m_uiEruptTimer -= uiDiff; + EruptTimer -= Diff; } } @@ -242,10 +247,10 @@ public: { case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s - return m_bAchievManyWhelpsHandleIt; + return AchievManyWhelpsHandleIt; case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath - return m_bAchievSheDeepBreathMore; + return AchievSheDeepBreathMore; } return false; } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h index eaf6cac43af..26fd9284ea2 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h +++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h @@ -18,13 +18,13 @@ #ifndef DEF_ONYXIAS_LAIR_H #define DEF_ONYXIAS_LAIR_H -enum eData64 +enum Data64 { DATA_ONYXIA_GUID, DATA_FLOOR_ERUPTION_GUID }; -enum eInstanceData +enum InstanceData { DATA_ONYXIA, MAX_ENCOUNTER, @@ -34,7 +34,7 @@ enum eInstanceData DATA_MANY_WHELPS_COUNT }; -enum eCreatures +enum Creatures { NPC_WHELP = 11262, NPC_LAIRGUARD = 36561, @@ -42,20 +42,20 @@ enum eCreatures NPC_ONYXIA = 10184 }; -enum eOnyxiaPhases +enum OnyxiaPhases { PHASE_START = 1, PHASE_BREATH = 2, PHASE_END = 3 }; -enum eGameObjects +enum GameObjects { GO_WHELP_SPAWNER = 176510, GO_WHELP_EGG = 176511 }; -enum eAchievementData +enum AchievementData { ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER = 12565, // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER = 12568, // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index a0fca522f61..b2662b644a7 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -296,6 +296,7 @@ class boss_professor_putricide : public CreatureScript summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true); summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false); + summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); return; case NPC_VOLATILE_OOZE: @@ -303,6 +304,7 @@ class boss_professor_putricide : public CreatureScript summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true); summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true); summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false); + summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); return; case NPC_CHOKING_GAS_BOMB: diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 4dab215d1da..d2eaab361a1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -138,7 +138,7 @@ enum Spells SPELL_IN_FROSTMOURNE_ROOM = 74276, SPELL_KILL_FROSTMOURNE_PLAYERS = 75127, SPELL_HARVESTED_SOUL = 72679, - SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, + SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, // TODO: Cast every 3 seconds during Frostmourne phase, targets a Wicked Spirit amd activates it // Frostmourne SPELL_LIGHTS_FAVOR = 69382, @@ -152,6 +152,7 @@ enum Spells SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, // (Heroic) SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, // (Heroic) SPELL_EXPLOSION = 73576, // Spirit Bomb (Heroic) + SPELL_HARVEST_SOUL_DAMAGE_AURA = 73655, // Outro SPELL_FURY_OF_FROSTMOURNE = 72350, @@ -221,7 +222,7 @@ enum Events EVENT_QUAKE_2 = 27, EVENT_VILE_SPIRITS = 28, EVENT_HARVEST_SOULS = 29, // heroic only - EVENT_WICKED_SPIRITS = 30, + EVENT_BERSERK = 30, EVENT_SOUL_RIP = 31, EVENT_DESTROY_SOUL = 32, EVENT_FROSTMOURNE_TALK_1 = 33, @@ -249,19 +250,18 @@ enum Events EVENT_OUTRO_TERENAS_TALK_2 = 55, EVENT_OUTRO_TALK_7 = 56, EVENT_OUTRO_TALK_8 = 57, - EVENT_BERSERK = 58, // Shambling Horror - EVENT_SHOCKWAVE = 59, - EVENT_ENRAGE = 60, + EVENT_SHOCKWAVE = 58, + EVENT_ENRAGE = 59, // Raging Spirit - EVENT_SOUL_SHRIEK = 61, + EVENT_SOUL_SHRIEK = 60, // Strangulate Vehicle (Harvest Soul) - EVENT_TELEPORT = 62, - EVENT_MOVE_TO_LICH_KING = 63, - EVENT_DESPAWN_SELF = 64, + EVENT_TELEPORT = 61, + EVENT_MOVE_TO_LICH_KING = 62, + EVENT_DESPAWN_SELF = 63, }; enum EventGroups @@ -475,6 +475,32 @@ class VileSpiritActivateEvent : public BasicEvent Creature* _owner; }; +class TriggerWickedSpirit : public BasicEvent +{ + public: + explicit TriggerWickedSpirit(Creature* owner) + : _owner(owner), _counter(13) + { + } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true); + + if (--_counter) + { + _owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000)); + return false; + } + + return true; + } + + private: + Creature* _owner; + uint32 _counter; +}; + class boss_the_lich_king : public CreatureScript { public: @@ -503,6 +529,8 @@ class boss_the_lich_king : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->GetMotionMaster()->MoveFall(); + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->DespawnOrUnsummon(); } void EnterCombat(Unit* target) @@ -601,8 +629,6 @@ class boss_the_lich_king : public CreatureScript summons.DoAction(ACTION_TELEPORT_BACK, pred); if (!IsHeroic()) Talk(SAY_LK_FROSTMOURNE_ESCAPE); - else - DoCastAOE(SPELL_TRIGGER_VILE_SPIRIT_HEROIC); break; } default: @@ -645,6 +671,8 @@ class boss_the_lich_king : public CreatureScript if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70)) { events.SetPhase(PHASE_TRANSITION); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition); return; } @@ -652,6 +680,8 @@ class boss_the_lich_king : public CreatureScript if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40)) { events.SetPhase(PHASE_TRANSITION); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition); return; } @@ -664,7 +694,8 @@ class boss_the_lich_king : public CreatureScript events.SetPhase(PHASE_OUTRO); summons.DespawnAll(); SendMusicToPlayers(MUSIC_FURY_OF_FROSTMOURNE); - DoCastAOE(SPELL_FURY_OF_FROSTMOURNE); + me->InterruptNonMeleeSpells(true); + me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, TRIGGERED_NONE); me->SetWalk(true); events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO); events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO); @@ -712,7 +743,6 @@ class boss_the_lich_king : public CreatureScript break; case NPC_FROSTMOURNE_TRIGGER: { - summons.Summon(summon); summon->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true); SendLightOverride(LIGHT_SOULSTORM, 10000); @@ -724,16 +754,11 @@ class boss_the_lich_king : public CreatureScript case NPC_VILE_SPIRIT: { summons.Summon(summon); - if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE) - { - TeleportSpirit(summon); - return; - } - summon->SetReactState(REACT_PASSIVE); summon->SetSpeed(MOVE_FLIGHT, 0.5f); summon->GetMotionMaster()->MoveRandom(10.0f); - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); + if (!(events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE)) + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); return; } case NPC_STRANGULATE_VEHICLE: @@ -756,7 +781,6 @@ class boss_the_lich_king : public CreatureScript case NPC_VALKYR_SHADOWGUARD: case NPC_RAGING_SPIRIT: case NPC_VILE_SPIRIT: - case NPC_WICKED_SPIRIT: summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); break; default: @@ -802,8 +826,6 @@ class boss_the_lich_king : public CreatureScript me->SetFacingTo(0.0f); Talk(SAY_LK_REMORSELESS_WINTER); SendMusicToPlayers(MUSIC_SPECIAL); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); DoCast(me, SPELL_REMORSELESS_WINTER_1); events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions events.ScheduleEvent(EVENT_QUAKE, 62500, 0, PHASE_TRANSITION); @@ -819,8 +841,6 @@ class boss_the_lich_king : public CreatureScript me->SetFacingTo(0.0f); Talk(SAY_LK_REMORSELESS_WINTER); SendMusicToPlayers(MUSIC_SPECIAL); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); DoCast(me, SPELL_REMORSELESS_WINTER_2); summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD); events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions @@ -992,10 +1012,6 @@ class boss_the_lich_king : public CreatureScript DoCastAOE(SPELL_VILE_SPIRITS); events.ScheduleEvent(EVENT_VILE_SPIRITS, urand(35000, 40000), EVENT_GROUP_VILE_SPIRITS, PHASE_THREE); break; - case EVENT_WICKED_SPIRITS: - DoCastAOE(SPELL_VILE_SPIRITS); - events.ScheduleEvent(EVENT_WICKED_SPIRITS, urand(35000, 40000), 0, PHASE_FROSTMOURNE); - break; case EVENT_HARVEST_SOULS: Talk(SAY_LK_HARVEST_SOUL); DoCastAOE(SPELL_HARVEST_SOULS); @@ -1003,7 +1019,6 @@ class boss_the_lich_king : public CreatureScript events.SetPhase(PHASE_FROSTMOURNE); // will stop running UpdateVictim (no evading) me->SetReactState(REACT_PASSIVE); me->AttackStop(); - events.ScheduleEvent(EVENT_WICKED_SPIRITS, events.GetNextEventTime(EVENT_VILE_SPIRITS) - events.GetTimer(), 0, PHASE_FROSTMOURNE); events.DelayEvents(50000, EVENT_GROUP_VILE_SPIRITS); events.RescheduleEvent(EVENT_DEFILE, 50000, 0, PHASE_THREE); events.RescheduleEvent(EVENT_SOUL_REAPER, urand(57000, 62000), 0, PHASE_THREE); @@ -1019,16 +1034,22 @@ class boss_the_lich_king : public CreatureScript if (!triggers.empty()) { triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, true)); - Unit* spawner = triggers.front(); + Creature* spawner = triggers.front(); spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players + spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000)); } for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) { Creature* summon = ObjectAccessor::GetCreature(*me, *i); if (summon && summon->GetEntry() == NPC_VILE_SPIRIT) - TeleportSpirit(summon); + { + summon->m_Events.KillAllEvents(true); + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(50000)); + summon->GetMotionMaster()->MoveRandom(10.0f); + summon->SetReactState(REACT_PASSIVE); + } } } break; @@ -1099,22 +1120,6 @@ class boss_the_lich_king : public CreatureScript } private: - - void TeleportSpirit(Creature* summon) - { - float dist = me->GetObjectSize() + (15.0f - me->GetObjectSize()) * float(rand_norm()); - float angle = float(rand_norm()) * float(2.0f * M_PI); - Position dest = TerenasSpawnHeroic; - me->MovePosition(dest, dist, angle); - dest.m_positionZ += 15.0f; - summon->UpdateEntry(NPC_WICKED_SPIRIT); - summon->SetReactState(REACT_PASSIVE); - summon->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); - summon->SetSpeed(MOVE_FLIGHT, 0.5f); - summon->m_Events.KillAllEvents(true); - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(1000)); - } - void SendMusicToPlayers(uint32 musicId) const { WorldPacket data(SMSG_PLAY_MUSIC, 4); @@ -1635,8 +1640,13 @@ class npc_strangulate_vehicle : public CreatureScript return; if (TempSummon* summ = me->ToTempSummon()) + { if (Unit* summoner = summ->GetSummoner()) + { DoCast(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK); + summoner->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL_DAMAGE_AURA); + } + } if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) lichKing->AI()->SummonedCreatureDespawn(me); @@ -1993,6 +2003,10 @@ class npc_broken_frostmourne : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000, 0, PHASE_OUTRO); } + void EnterEvadeMode() + { + } + void UpdateAI(uint32 const diff) { UpdateVictim(); @@ -2472,14 +2486,18 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); // spirit bombs get higher if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) + { dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } } void Register() { - OnEffectLaunch += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectHit += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); } }; @@ -2954,6 +2972,15 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f)) spawner->RemoveAllAuras(); + + std::list<Creature*> spirits; + GetCaster()->GetCreatureListWithEntryInGrid(spirits, NPC_WICKED_SPIRIT, 200.0f); + for (std::list<Creature*>::iterator itr = spirits.begin(); itr != spirits.end(); ++itr) + { + (*itr)->m_Events.KillAllEvents(true); + (*itr)->SetReactState(REACT_PASSIVE); + (*itr)->AI()->EnterEvadeMode(); + } } void RemoveAura() @@ -3046,23 +3073,18 @@ class spell_the_lich_king_trigger_vile_spirit : public SpellScriptLoader { PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript); - void TeleportOutside() + void ActivateSpirit() { Creature* target = GetHitCreature(); if (!target) return; - Position dest; - Position offset; - TerenasSpawnHeroic.GetPositionOffsetTo(*target, offset); - GetCaster()->GetPosition(&dest); - dest.RelocateOffset(offset); - target->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); + VileSpiritActivateEvent(target).Execute(0, 0); } void Register() { - OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::TeleportOutside); + OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index c40a521c794..31ed1eedf10 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1013,11 +1013,8 @@ class npc_dream_portal : public CreatureScript { } - void DoAction(int32 const action) + void OnSpellClick(Unit* /*clicker*/) { - if (action != EVENT_SPELLCLICK) - return; - _used = true; me->DespawnOrUnsummon(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 704c3c2b0c2..270f56674eb 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -290,6 +290,11 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_TERENAS_MENETHIL_FROSTMOURNE_H: TerenasMenethilGUID = creature->GetGUID(); break; + case NPC_WICKED_SPIRIT: + // Remove corpse as soon as it dies (and respawn 10 seconds later) + creature->SetCorpseDelay(0); + creature->SetReactState(REACT_PASSIVE); + break; default: break; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 0e453eceaa1..8ff6c2e1a3a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -720,20 +720,18 @@ class boss_flame_leviathan_overload_device : public CreatureScript { } - void DoAction(const int32 param) + void OnSpellClick(Unit* /*clicker*/) { - if (param == EVENT_SPELLCLICK) + if (me->GetVehicle()) { - if (me->GetVehicle()) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) - { - me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true); - player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); - player->ExitVehicle(); - } + me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true); + player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); + player->ExitVehicle(); } } } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e7cc7360aab..9cbf81b39af 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2996,11 +2996,14 @@ class spell_gen_mount : public SpellScriptLoader // Triggered spell id dependent on riding skill and zone bool canFly = false; - uint32 map = target->GetMapId(); + uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId()); if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING))) canFly = true; - AreaTableEntry const* area = sAreaStore.LookupEntry(target->GetAreaId()); + float x, y, z; + target->GetPosition(x, y, z); + uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z); + AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag); if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 0ba5c866d63..f1276c24a75 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -184,9 +184,9 @@ class spell_warr_deep_wounds : public SpellScriptLoader damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); - + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; @@ -405,7 +405,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + OnEffectHit += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } }; @@ -415,6 +415,33 @@ class spell_warr_bloodthirst : public SpellScriptLoader } }; +class spell_warr_bloodthirst_heal : public SpellScriptLoader +{ +public: + spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { } + + class spell_warr_bloodthirst_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript); + + void HandleHeal(SpellEffIndex /* effIndex */) + { + if (GetTriggeringSpell()) + SetHitHeal(CalculatePctN(GetCaster()->GetMaxHealth(),GetTriggeringSpell()->Effects[EFFECT_1].CalcValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_bloodthirst_heal_SpellScript(); + } +}; + enum Overpower { SPELL_UNRELENTING_ASSAULT_RANK_1 = 46859, @@ -472,4 +499,5 @@ void AddSC_warrior_spell_scripts() new spell_warr_concussion_blow(); new spell_warr_bloodthirst(); new spell_warr_overpower(); + new spell_warr_bloodthirst_heal(); } |
